diff --git a/spm-headers/include/spm/mario.h b/spm-headers/include/spm/mario.h index a1d5f94..02734e4 100644 --- a/spm-headers/include/spm/mario.h +++ b/spm-headers/include/spm/mario.h @@ -140,87 +140,84 @@ SIZE_ASSERT(MarioPaneBoundary, 0x8) */ typedef bool (MarioPaneChangeFunc)(s32 newPane); -enum MarioMotionId -{ -/* 0x00 */ MOT_STAY, // Standing still -/* 0x01 */ MOT_WALK, // Walking slowly -/* 0x02 */ MOT_DASH, // Walking at full speed -/* 0x03 */ MOT_JUMP, // Jumping normally -/* 0x04 */ MOT_CROUCH, // Crouching -/* 0x05 */ MOT_5, -/* 0x06 */ MOT_SPRING, // Jumping off spring object -/* 0x07 */ MOT_7, -/* 0x08 */ MOT_8, -/* 0x09 */ MOT_BOUNCE, // Jumping off of an NPC -/* 0x0A */ MOT_FALL, // Falling in the air -/* 0x0B */ MOT_11, -/* 0x0C */ MOT_12, -/* 0x0D */ MOT_13, -/* 0x0E */ MOT_THUDLEY_AIR, // In the air while using thudley -/* 0x0F */ MOT_THUDLEY_LAND, // Landing whlie using thudley -/* 0x10 */ MOT_HAMMER, // Using cudge -/* 0x11 */ MOT_JABARA, // Luigi spring jump(?) -/* 0x12 */ MOT_SLIT, // Thin with slim -/* 0x13 */ MOT_TALK, // Talking to an NPC -/* 0x14 */ MOT_20, -/* 0x15 */ MOT_21, -/* 0x16 */ MOT_22, -/* 0x17 */ MOT_FORCE_RESET, // ? TTYD name -/* 0x18 */ MOT_24, -/* 0x19 */ MOT_BOTTOMLESS, // Respawning from falling -/* 0x1A */ MOT_FLIP_AIR, // Flip into midair -/* 0x1B */ MOT_DAMAGE, // Taking damage -/* 0x1C */ MOT_28, -/* 0x1D */ MOT_29, -/* 0x1E */ MOT_30, -/* 0x1F */ MOT_31, -/* 0x20 */ MOT_32, -/* 0x21 */ MOT_33, -/* 0x22 */ MOT_34, -/* 0x23 */ MOT_35, -/* 0x24 */ MOT_GRAB, // Throwing thoreau -/* 0x25 */ MOT_BOMB, // Placing boomer -/* 0x26 */ MOT_FLEEP, // Using fleep -/* 0x27 */ MOT_SHRINK, // Shrinking with dottie -/* 0x28 */ MOT_GROW, // Growing with dottie -/* 0x29 */ MOT_PICCOLO, // Using piccolo -/* 0x2A */ MOT_BARRY, // Using barry -/* 0x2B */ MOT_43, -/* 0x2C */ MOT_CARRIE_MOUNT, // Mounting carrie -/* 0x2D */ MOT_CARRIE_DISMOUNT, // Dismounting carrie -/* 0x2E */ MOT_46, -/* 0x2F */ MOT_47, -/* 0x30 */ MOT_48, -/* 0x31 */ MOT_49, -/* 0x32 */ MOT_50, -/* 0x33 */ MOT_51, -/* 0x34 */ MOT_52, -/* 0x35 */ MOT_53, -/* 0x36 */ MOT_54, -/* 0x37 */ MOT_55, -/* 0x38 */ MOT_56, -/* 0x39 */ MOT_57, -/* 0x3A */ MOT_58, -/* 0x3B */ MOT_59, -/* 0x3C */ MOT_60, -/* 0x3D */ MOT_61, -/* 0x3E */ MOT_62, -/* 0x3F */ MOT_63, -/* 0x40 */ MOT_64, -/* 0x41 */ MOT_65, -/* 0x42 */ MOT_66, -/* 0x43 */ MOT_67, -/* 0x44 */ MOT_68, -/* 0x45 */ MOT_SWIM, // Off-ground underwater -/* 0x46 */ MOT_70, -/* 0x47 */ MOT_CHAR_CHANGE, // Changing character -/* 0x48 */ MOT_FAIRY_CHANGE, // Changing pixl -/* 0x49 */ MOT_FLIP, // Flipping to 2d/3d -/* 0x4A */ MOT_GLIDE, // Peach parasol glide -/* 0x4B */ MOT_GUARD, // Peach parasol guard -/* 0x4C */ MOT_FIRE, // Bowser fire -/* 0x4D */ MOT_77 -}; +#define MOT_STAY 0x00 // Standing still +#define MOT_WALK 0x01 // Walking slowly +#define MOT_DASH 0x02 // Walking at full speed +#define MOT_JUMP 0x03 // Jumping normally +#define MOT_CROUCH 0x04 // Crouching +#define MOT_5 0x05 +#define MOT_SPRING 0x06 // Jumping off spring object +#define MOT_7 0x07 +#define MOT_8 0x08 +#define MOT_BOUNCE 0x09 // Jumping off of an NPC +#define MOT_FALL 0x0A // Falling in the air +#define MOT_11 0x0B +#define MOT_12 0x0C +#define MOT_13 0x0D +#define MOT_THUDLEY_AIR 0x0E // In the air while using thudley +#define MOT_THUDLEY_LAND 0x0F // Landing whlie using thudley +#define MOT_HAMMER 0x10 // Using cudge +#define MOT_JABARA 0x11 // Luigi spring jump(?) +#define MOT_SLIT 0x12 // Thin with slim +#define MOT_TALK 0x13 // Talking to an NPC +#define MOT_20 0x14 +#define MOT_21 0x15 +#define MOT_22 0x16 +#define MOT_FORCE_RESET 0x17 // ? TTYD name +#define MOT_24 0x18 +#define MOT_BOTTOMLESS 0x19 // Respawning from falling +#define MOT_FLIP_AIR 0x1A // Flip into midair +#define MOT_DAMAGE 0x1B // Taking damage +#define MOT_28 0x1C +#define MOT_29 0x1D +#define MOT_30 0x1E +#define MOT_31 0x1F +#define MOT_32 0x20 +#define MOT_33 0x21 +#define MOT_34 0x22 +#define MOT_35 0x23 +#define MOT_GRAB 0x24 // Throwing thoreau +#define MOT_BOMB 0x25 // Placing boomer +#define MOT_FLEEP 0x26 // Using fleep +#define MOT_SHRINK 0x27 // Shrinking with dottie +#define MOT_GROW 0x28 // Growing with dottie +#define MOT_PICCOLO 0x29 // Using piccolo +#define MOT_BARRY 0x2A // Using barry +#define MOT_43 0x2B +#define MOT_CARRIE_MOUNT 0x2C // Mounting carrie +#define MOT_CARRIE_DISMOUNT 0x2D // Dismounting carrie +#define MOT_46 0x2E +#define MOT_47 0x2F +#define MOT_48 0x30 +#define MOT_49 0x31 +#define MOT_50 0x32 +#define MOT_51 0x33 +#define MOT_52 0x34 +#define MOT_53 0x35 +#define MOT_54 0x36 +#define MOT_55 0x37 +#define MOT_56 0x38 +#define MOT_57 0x39 +#define MOT_58 0x3A +#define MOT_59 0x3B +#define MOT_60 0x3C +#define MOT_61 0x3D +#define MOT_62 0x3E +#define MOT_63 0x3F +#define MOT_64 0x40 +#define MOT_65 0x41 +#define MOT_66 0x42 +#define MOT_67 0x43 +#define MOT_68 0x44 +#define MOT_SWIM 0x45 // Off-ground underwater +#define MOT_70 0x46 +#define MOT_CHAR_CHANGE 0x47 // Changing character +#define MOT_FAIRY_CHANGE 0x48 // Changing pixl +#define MOT_FLIP 0x49 // Flipping to 2d/3d +#define MOT_GLIDE 0x4A // Peach parasol glide +#define MOT_GUARD 0x4B // Peach parasol guard +#define MOT_FIRE 0x4C // Bowser fire +#define MOT_77 0x4D // Off ground, in water #define MARIO_MISC_FLAG_SWIM 0x20000000 diff --git a/spm-headers/include/spm/mario_pouch.h b/spm-headers/include/spm/mario_pouch.h index 13e76c2..fd3f474 100644 --- a/spm-headers/include/spm/mario_pouch.h +++ b/spm-headers/include/spm/mario_pouch.h @@ -102,10 +102,8 @@ SIZE_ASSERT(MarioPouchWork, 0x6a0) typedef struct { -/* 0x00 */ s32 unknown_0x0; -/* 0x04 */ s32 unknown_0x4; -/* 0x08 */ s32 unknown_0x8; -/* 0x0C */ s32 unknown_0xc; +/* 0x00 */ OSTime unknown_0x0; +/* 0x08 */ OSTime unknown_0x8; /* 0x10 */ s32 unknown_0x10; /* 0x14 */ s32 unknown_0x14; /* 0x18 */ OSTime unknown_0x18; diff --git a/src/mario_pouch.c b/src/mario_pouch.c index c4604f2..bac834c 100644 --- a/src/mario_pouch.c +++ b/src/mario_pouch.c @@ -10,6 +10,7 @@ #include #include #include +#include #include // .rodata @@ -155,9 +156,7 @@ void pouch2Init() memset(wp2, 0, sizeof(*wp2)); pp2 = pouch2GetPtr(); - pp2->unknown_0xc = 0; pp2->unknown_0x8 = 0; - pp2->unknown_0x4 = 0; pp2->unknown_0x0 = 0; pp2->unknown_0x14 = 0; // Probably fake match @@ -248,9 +247,93 @@ void pouchReInit() } } -asm void pouchMain() +void pouchMain() { - #include "asm/8014cd90.s" + MarioWork * mp; + s32 msec; + + if (pouchCheckHaveItem(ITEM_ID_CARD_MARIO)) + work.flipTimer = 10; + + if ( + !marioKeyOffChk() && !marioCtrlOffChk() && ((marioGetPtr()->flags & 0x10000000) == 0) && + (pouchCheckHaveItem(ITEM_ID_CARD_MARIO) == 0) + ) + { + camGetPtr(CAM_ID_3D); + mp = marioGetPtr(); + if (camCheck3d(CAM_ID_3D) != 0) + { + if ( + (mp->motionId != MOT_FAIRY_CHANGE) &&(mp->motionId != MOT_CHAR_CHANGE) && + (mp->motionId != MOT_31) && (mp->motionId != MOT_32) && + (mp->motionId != MOT_33) && (mp->motionId != MOT_34)) + { + wp2->unknown_0x8 += OSGetTime() - wp2->unknown_0x18; + wp2->unknown_0x0 = 0; + wp2->unknown_0x10 = 0; + + msec = OSTicksToMilliseconds(wp2->unknown_0x8); + if (abs(wp2->unknown_0x14 - msec) > (s32) (1500.0f / gp->gameSpeed)) + { + wp2->unknown_0x14 = msec; + if (fadeIsFinish() && seqGetSeq() == SEQ_GAME) + { + if (work.flipTimer >= 2) + spsndSFXOn("SFX_SYS_3D_GAGE_ALARM0"); + if (work.flipTimer == 6) + spsndSFXOn("SFX_SYS_3D_GAGE_ALARM1_0"); + if (work.flipTimer == 5) + spsndSFXOn("SFX_SYS_3D_GAGE_ALARM1_1"); + if (work.flipTimer == 4) + spsndSFXOn("SFX_SYS_3D_GAGE_ALARM1"); + if (work.flipTimer == 3) + spsndSFXOn("SFX_SYS_3D_GAGE_ALARM2"); + if (work.flipTimer == 2) + spsndSFXOn("SFX_SYS_3D_GAGE_ALARM3"); + } + work.flipTimer -= 1; + hudTurnOffFlipTimeBox(work.flipTimer); + if (work.flipTimer == 0) { + marioTakeDamage(NULL, 0x20000, 1); + work.flipTimer = 10; + func_8019af88(); + } + } + } + } + else + { + if ( + (mp->motionId != MOT_FAIRY_CHANGE) && (mp->motionId != MOT_CHAR_CHANGE) && + (mp->motionId != MOT_31) && (mp->motionId != MOT_32) && + (mp->motionId != MOT_33) && (mp->motionId != MOT_34) + ) + { + wp2->unknown_0x0 += OSGetTime() - wp2->unknown_0x18; + wp2->unknown_0x8 = 0; + wp2->unknown_0x14 = 0; + + msec = OSTicksToMilliseconds(wp2->unknown_0x0); + if (abs(wp2->unknown_0x10 - msec) > (s32) (1500.0f / gp->gameSpeed)) + { + wp2->unknown_0x10 = msec; + if (work.flipTimer < 10) + { + work.flipTimer += 1; + if ( + (work.flipTimer == 10) && (fadeIsFinish() != 0) && + (seqGetSeq() == SEQ_GAME) && (func_8012dab0() == 0) + ) + { + spsndSFXOn("SFX_SYS_3D_GAGE_RECOVER1"); + } + } + } + } + } + } + wp2->unknown_0x18 = OSGetTime(); } void pouchResetFlip() @@ -262,9 +345,7 @@ void pouchResetFlip() pp2 = pouch2GetPtr(); pp->flipTimer = 10; - pp2->unknown_0xc = 0; pp2->unknown_0x8 = 0; - pp2->unknown_0x4 = 0; pp2->unknown_0x0 = 0; pp2->unknown_0x14 = 0; pouch2GetPtr()->unknown_0x10 = 0;