diff --git a/config/SOUE01/splits.txt b/config/SOUE01/splits.txt index 545fe488..1b625f93 100644 --- a/config/SOUE01/splits.txt +++ b/config/SOUE01/splits.txt @@ -448,7 +448,10 @@ d/lyt/meter/d_lyt_meter_timer.cpp: .ctors start:0x804DB720 end:0x804DB724 .rodata start:0x804E6A68 end:0x804E6C28 .data start:0x80519748 end:0x80519F60 + .sdata start:0x80572510 end:0x80572518 + .sbss start:0x80575458 end:0x80575468 .sdata2 start:0x80579D00 end:0x80579D30 + .bss start:0x805ACB90 end:0x805ACD50 d/lyt/meter/d_lyt_meter_heart.cpp: .text start:0x8010AEC0 end:0x8010BD48 diff --git a/config/SOUE01/symbols.txt b/config/SOUE01/symbols.txt index 4c3abda1..586a5337 100644 --- a/config/SOUE01/symbols.txt +++ b/config/SOUE01/symbols.txt @@ -4498,7 +4498,7 @@ thisFadesUIInAndOut = .text:0x800C9F00; // type:function size:0x10 executeState__85sStateMgr_c<16dLytMeterParts_c,20sStateMethodUsr_FI_c,12sFStateFct_c,13sStateIDChk_c>Fv = .text:0x800C9F10; // type:function size:0x10 fn_800C9F20 = .text:0x800C9F20; // type:function size:0x44 fn_800C9F70 = .text:0x800C9F70; // type:function size:0x70 -fn_800C9FE0 = .text:0x800C9FE0; // type:function size:0x60 +fn_800C9FE0__11dLytMeter_cFv = .text:0x800C9FE0; // type:function size:0x60 fn_800CA040 = .text:0x800CA040; // type:function size:0x60 setUiMode__11dLytMeter_cCFUs = .text:0x800CA0A0; // type:function size:0x1C getUiMode__11dLytMeter_cFv = .text:0x800CA0C0; // type:function size:0x38 @@ -4755,8 +4755,8 @@ fn_800D57B0 = .text:0x800D57B0; // type:function size:0x1A58 fn_800D7210 = .text:0x800D7210; // type:function size:0x92C fn_800D7B40 = .text:0x800D7B40; // type:function size:0xC draw__11dLytMeter_cFv = .text:0x800D7B50; // type:function size:0x128 -fn_800D7C80 = .text:0x800D7C80; // type:function size:0x8 -fn_800D7C90 = .text:0x800D7C90; // type:function size:0x8 +getLyt__20LytMeterTimerPart1_cFv = .text:0x800D7C80; // type:function size:0x8 +getLyt__20LytMeterTimerPart2_cFv = .text:0x800D7C90; // type:function size:0x8 getLyt__14dLytSkyGauge_cFv = .text:0x800D7CA0; // type:function size:0x8 getLyt__15dLytBirdGauge_cFv = .text:0x800D7CB0; // type:function size:0x8 __ct__20dLytMeterContainer_cFv = .text:0x800D7CC0; // type:function size:0x84 @@ -4783,7 +4783,7 @@ fn_800D9710 = .text:0x800D9710; // type:function size:0x10 fn_800D9720 = .text:0x800D9720; // type:function size:0x8 fn_800D9730 = .text:0x800D9730; // type:function size:0x4C fn_800D9780 = .text:0x800D9780; // type:function size:0x18 -fn_800D97A0 = .text:0x800D97A0; // type:function size:0x20 +fn_800D97A0__20dLytMeterContainer_cFv = .text:0x800D97A0; // type:function size:0x20 setStaminaWheelPercent = .text:0x800D97C0; // type:function size:0x14 fn_800D97E0 = .text:0x800D97E0; // type:function size:0x1C fn_800D9800 = .text:0x800D9800; // type:function size:0x18 @@ -6347,11 +6347,11 @@ resetBowlNuts__20LytMeterTimerPart1_cFv = .text:0x80106490; // type:function siz initOutAnim__20LytMeterTimerPart1_cFv = .text:0x80106560; // type:function size:0x74 startInAnim__20LytMeterTimerPart1_cFv = .text:0x801065E0; // type:function size:0xC0 realizeTrial__20LytMeterTimerPart1_cFv = .text:0x801066A0; // type:function size:0xBC -fn_80106760 = .text:0x80106760; // type:function size:0x48 -fn_801067B0 = .text:0x801067B0; // type:function size:0x3C +startNextFruitAnim__20LytMeterTimerPart1_cFv = .text:0x80106760; // type:function size:0x48 +startFruitAnim__20LytMeterTimerPart1_cFl = .text:0x801067B0; // type:function size:0x3C startOutAnim__20LytMeterTimerPart1_cFv = .text:0x801067F0; // type:function size:0x54 stopInAnim__20LytMeterTimerPart1_cFv = .text:0x80106850; // type:function size:0xC -fn_80106860 = .text:0x80106860; // type:function size:0x34 +disableCurrentFruitAnim__20LytMeterTimerPart1_cFv = .text:0x80106860; // type:function size:0x34 stopFinishedFruit__20LytMeterTimerPart1_cFv = .text:0x801068A0; // type:function size:0x90 stopOutAnim__20LytMeterTimerPart1_cFv = .text:0x80106930; // type:function size:0xC isInAnimFinished__20LytMeterTimerPart1_cFv = .text:0x80106940; // type:function size:0x44 @@ -6359,11 +6359,11 @@ isCurrentFruitAnimFinished__20LytMeterTimerPart1_cFv = .text:0x80106990; // type isAnyFruitAnimFinished__20LytMeterTimerPart1_cFv = .text:0x801069F0; // type:function size:0x80 isLastFruitAnimFinished__20LytMeterTimerPart1_cFv = .text:0x80106A70; // type:function size:0x8 isOutAnimFinished__20LytMeterTimerPart1_cFv = .text:0x80106A80; // type:function size:0x44 -fn_80106AD0 = .text:0x80106AD0; // type:function size:0x60 -LytMeterTimer__incrementTearcount = .text:0x80106B30; // type:function size:0xF4 +isAnyFruitAnimAtFrame__20LytMeterTimerPart1_cCFf = .text:0x80106AD0; // type:function size:0x60 +incrementTearCount__20LytMeterTimerPart1_cFv = .text:0x80106B30; // type:function size:0xF4 initColors__20LytMeterTimerPart1_cFv = .text:0x80106C30; // type:function size:0x394 createEffect__20LytMeterTimerPart1_cFl = .text:0x80106FD0; // type:function size:0x108 -fn_801070E0 = .text:0x801070E0; // type:function size:0x34 +updateDropLine__20LytMeterTimerPart1_cFPQ34nw4r3lyt4Pane = .text:0x801070E0; // type:function size:0x34 build__20LytMeterTimerPart2_cFPQ23d2d10ResAccIf_c = .text:0x80107120; // type:function size:0xD8 remove__20LytMeterTimerPart2_cFv = .text:0x80107200; // type:function size:0x58 execute__20LytMeterTimerPart2_cFv = .text:0x80107260; // type:function size:0xA0 @@ -6392,42 +6392,42 @@ updatePetalsRate__20LytMeterTimerPart2_cFv = .text:0x80107D90; // type:function restartPetals__20LytMeterTimerPart2_cFv = .text:0x80107E50; // type:function size:0xD4 startOutAnim__20LytMeterTimerPart2_cFv = .text:0x80107F30; // type:function size:0x54 enableChangeFruitAnim__20LytMeterTimerPart2_cFv = .text:0x80107F90; // type:function size:0xC -fn_80107FA0 = .text:0x80107FA0; // type:function size:0xC8 -fn_80108070 = .text:0x80108070; // type:function size:0xE4 -fn_80108160 = .text:0x80108160; // type:function size:0xC -fn_80108170 = .text:0x80108170; // type:function size:0xC -fn_80108180 = .text:0x80108180; // type:function size:0x1C -fn_801081A0 = .text:0x801081A0; // type:function size:0xC -fn_801081B0 = .text:0x801081B0; // type:function size:0xC -fn_801081C0 = .text:0x801081C0; // type:function size:0xC -fn_801081D0 = .text:0x801081D0; // type:function size:0xC -fn_801081E0 = .text:0x801081E0; // type:function size:0x68 -fn_80108250 = .text:0x80108250; // type:function size:0x74 -fn_801082D0 = .text:0x801082D0; // type:function size:0xAC -fn_80108380 = .text:0x80108380; // type:function size:0x74 -fn_80108400 = .text:0x80108400; // type:function size:0xB4 -fn_801084C0 = .text:0x801084C0; // type:function size:0xC -fn_801084D0 = .text:0x801084D0; // type:function size:0xC -fn_801084E0 = .text:0x801084E0; // type:function size:0x44 -fn_80108530 = .text:0x80108530; // type:function size:0x44 -fn_80108580 = .text:0x80108580; // type:function size:0x40 -fn_801085C0 = .text:0x801085C0; // type:function size:0x44 -fn_80108610 = .text:0x80108610; // type:function size:0x44 -fn_80108660 = .text:0x80108660; // type:function size:0x44 -fn_801086B0 = .text:0x801086B0; // type:function size:0x5C -fn_80108710 = .text:0x80108710; // type:function size:0x44 -fn_80108760 = .text:0x80108760; // type:function size:0x44 -fn_801087B0 = .text:0x801087B0; // type:function size:0x44 -fn_80108800 = .text:0x80108800; // type:function size:0xB4 -fn_801088C0 = .text:0x801088C0; // type:function size:0xC8 -fn_80108990 = .text:0x80108990; // type:function size:0xEC +syncTime__20LytMeterTimerPart2_cFv = .text:0x80107FA0; // type:function size:0xC8 +syncTimeWithSafe__20LytMeterTimerPart2_cFv = .text:0x80108070; // type:function size:0xE4 +stopInAnim__20LytMeterTimerPart2_cFv = .text:0x80108160; // type:function size:0xC +stopBloomAnim__20LytMeterTimerPart2_cFv = .text:0x80108170; // type:function size:0xC +stopBeforeFallAnim__20LytMeterTimerPart2_cFv = .text:0x80108180; // type:function size:0x1C +stopChangeSirenAnim__20LytMeterTimerPart2_cFv = .text:0x801081A0; // type:function size:0xC +stopSirenLoopAnim__20LytMeterTimerPart2_cFv = .text:0x801081B0; // type:function size:0xC +stopSirenSafeAnim__20LytMeterTimerPart2_cFv = .text:0x801081C0; // type:function size:0xC +stopFlowerLoopAnim__20LytMeterTimerPart2_cFv = .text:0x801081D0; // type:function size:0xC +resetFlowerLoopAnim__20LytMeterTimerPart2_cFv = .text:0x801081E0; // type:function size:0x68 +stopDyingAnims__20LytMeterTimerPart2_cFv = .text:0x80108250; // type:function size:0x74 +stopFinishedDyingAnims__20LytMeterTimerPart2_cFv = .text:0x801082D0; // type:function size:0xAC +stopFallOutAnims__20LytMeterTimerPart2_cFv = .text:0x80108380; // type:function size:0x74 +stopFinishedFallOutAnims__20LytMeterTimerPart2_cFv = .text:0x80108400; // type:function size:0xB4 +stopOutAnim__20LytMeterTimerPart2_cFv = .text:0x801084C0; // type:function size:0xC +stopChangeFruitAnim__20LytMeterTimerPart2_cFv = .text:0x801084D0; // type:function size:0xC +isInAnimFinished__20LytMeterTimerPart2_cFv = .text:0x801084E0; // type:function size:0x44 +isBloomAnimFinished__20LytMeterTimerPart2_cFv = .text:0x80108530; // type:function size:0x44 +isBeforeFallAnimAtStart__20LytMeterTimerPart2_cFv = .text:0x80108580; // type:function size:0x40 +isChangeSirenAnimFinished__20LytMeterTimerPart2_cFv = .text:0x801085C0; // type:function size:0x44 +isSirenSafeAnimFinished__20LytMeterTimerPart2_cFv = .text:0x80108610; // type:function size:0x44 +isFlowerLoopAnimFinished__20LytMeterTimerPart2_cFv = .text:0x80108660; // type:function size:0x44 +isPetalDyingAnimFinished__20LytMeterTimerPart2_cFv = .text:0x801086B0; // type:function size:0x5C +isFirstFallOutAnimFinished__20LytMeterTimerPart2_cFv = .text:0x80108710; // type:function size:0x44 +isOutAnimFinished__20LytMeterTimerPart2_cFv = .text:0x80108760; // type:function size:0x44 +isChangeFruitAnimFinished__20LytMeterTimerPart2_cFv = .text:0x801087B0; // type:function size:0x44 +realizeFruitsColor__20LytMeterTimerPart2_cFv = .text:0x80108800; // type:function size:0xB4 +finishDyingAnims__20LytMeterTimerPart2_cFv = .text:0x801088C0; // type:function size:0xC8 +setPetalsToStart__20LytMeterTimerPart2_cFv = .text:0x80108990; // type:function size:0xEC realizePetalsOnOff__20LytMeterTimerPart2_cFv = .text:0x80108A80; // type:function size:0x88 -fn_80108B10 = .text:0x80108B10; // type:function size:0x5C +finishSingleAnim__20LytMeterTimerPart2_cFUc = .text:0x80108B10; // type:function size:0x5C resetSingleAnim__20LytMeterTimerPart2_cFUc = .text:0x80108B70; // type:function size:0x5C -fn_80108BD0 = .text:0x80108BD0; // type:function size:0x14 +calc__20LytMeterTimerPart2_cFv = .text:0x80108BD0; // type:function size:0x14 initColors__20LytMeterTimerPart2_cFv = .text:0x80108BF0; // type:function size:0x284 -fn_80108E80 = .text:0x80108E80; // type:function size:0xC4 -fn_80108F50 = .text:0x80108F50; // type:function size:0xC4 +createSingleFruitEffect__20LytMeterTimerPart2_cFv = .text:0x80108E80; // type:function size:0xC4 +createFruitCompleteEffect__20LytMeterTimerPart2_cFv = .text:0x80108F50; // type:function size:0xC4 initializeState_ChangeSiren__16dLytMeterTimer_cFv = .text:0x80109020; // type:function size:0x4 executeState_ChangeSiren__16dLytMeterTimer_cFv = .text:0x80109030; // type:function size:0x204 finalizeState_ChangeSiren__16dLytMeterTimer_cFv = .text:0x80109240; // type:function size:0x4 @@ -6451,28 +6451,28 @@ executeState_Fruits__16dLytMeterTimer_cFv = .text:0x80109A50; // type:function s finalizeState_Fruits__16dLytMeterTimer_cFv = .text:0x80109AC0; // type:function size:0x4 build__16dLytMeterTimer_cFv = .text:0x80109AD0; // type:function size:0xC0 remove__16dLytMeterTimer_cFv = .text:0x80109B90; // type:function size:0x14 -LytMeterTimer__update = .text:0x80109BB0; // type:function size:0x194 -fn_80109D50 = .text:0x80109D50; // type:function size:0x38 -fn_80109D90 = .text:0x80109D90; // type:function size:0x38 -fn_80109DD0 = .text:0x80109DD0; // type:function size:0x20C -fn_80109FE0 = .text:0x80109FE0; // type:function size:0x100 -fn_8010A0E0 = .text:0x8010A0E0; // type:function size:0x54 -fn_8010A140 = .text:0x8010A140; // type:function size:0x158 -fn_8010A2A0 = .text:0x8010A2A0; // type:function size:0xC8 -fn_8010A370 = .text:0x8010A370; // type:function size:0x18 -fn_8010A390 = .text:0x8010A390; // type:function size:0x100 -fn_8010A490 = .text:0x8010A490; // type:function size:0x18 -fn_8010A4B0 = .text:0x8010A4B0; // type:function size:0x48 -fn_8010A500 = .text:0x8010A500; // type:function size:0x118 -fn_8010A620 = .text:0x8010A620; // type:function size:0x70 -fn_8010A690 = .text:0x8010A690; // type:function size:0x60 -fn_8010A6F0 = .text:0x8010A6F0; // type:function size:0x80 -fn_8010A770 = .text:0x8010A770; // type:function size:0x44 -fn_8010A7C0 = .text:0x8010A7C0; // type:function size:0x5C -fn_8010A820 = .text:0x8010A820; // type:function size:0x8 -fn_8010A830 = .text:0x8010A830; // type:function size:0x8 -fn_8010A840 = .text:0x8010A840; // type:function size:0x8 -fn_8010A850 = .text:0x8010A850; // type:function size:0x8 +execute__16dLytMeterTimer_cFv = .text:0x80109BB0; // type:function size:0x194 +startIn2__16dLytMeterTimer_cFv = .text:0x80109D50; // type:function size:0x38 +startOut2__16dLytMeterTimer_cFv = .text:0x80109D90; // type:function size:0x38 +startIn__16dLytMeterTimer_cFv = .text:0x80109DD0; // type:function size:0x20C +gotoChangeSiren__16dLytMeterTimer_cFv = .text:0x80109FE0; // type:function size:0x100 +gotoSiren__16dLytMeterTimer_cFv = .text:0x8010A0E0; // type:function size:0x54 +gotoChangeSafeBloom__16dLytMeterTimer_cFv = .text:0x8010A140; // type:function size:0x158 +gotoChangeSafe__16dLytMeterTimer_cFv = .text:0x8010A2A0; // type:function size:0xC8 +gotoSafe__16dLytMeterTimer_cFv = .text:0x8010A370; // type:function size:0x18 +gotoChangeFruits6__16dLytMeterTimer_cFv = .text:0x8010A390; // type:function size:0x100 +gotoFruits__16dLytMeterTimer_cFv = .text:0x8010A490; // type:function size:0x18 +startOut__16dLytMeterTimer_cFv = .text:0x8010A4B0; // type:function size:0x48 +gotoChangeFruits3__16dLytMeterTimer_cFv = .text:0x8010A500; // type:function size:0x118 +startSafe__16dLytMeterTimer_cFv = .text:0x8010A620; // type:function size:0x70 +doPickup__16dLytMeterTimer_cFv = .text:0x8010A690; // type:function size:0x60 +isInSiren__16dLytMeterTimer_cFv = .text:0x8010A6F0; // type:function size:0x80 +getPetalForTimerMaybe__16dLytMeterTimer_cFl = .text:0x8010A770; // type:function size:0x44 +checkForPetalChangeMaybe__16dLytMeterTimer_cFv = .text:0x8010A7C0; // type:function size:0x5C +getName__20LytMeterTimerPart2_cCFv = .text:0x8010A820; // type:function size:0x8 +getPane__20LytMeterTimerPart2_cFv = .text:0x8010A830; // type:function size:0x8 +getName__20LytMeterTimerPart1_cCFv = .text:0x8010A840; // type:function size:0x8 +getPane__20LytMeterTimerPart1_cFv = .text:0x8010A850; // type:function size:0x8 __sinit_\d_lyt_meter_timer_cpp = .text:0x8010A860; // type:function size:0x56C scope:local __dt__31sFStateID_c<16dLytMeterTimer_c>Fv = .text:0x8010ADD0; // type:function size:0x58 isSameName__31sFStateID_c<16dLytMeterTimer_c>CFPCc = .text:0x8010AE30; // type:function size:0x88 @@ -15097,8 +15097,8 @@ fn_802879E0 = .text:0x802879E0; // type:function size:0x28 fn_80287A10 = .text:0x80287A10; // type:function size:0x30 fn_80287A40 = .text:0x80287A40; // type:function size:0x30 fn_80287A70 = .text:0x80287A70; // type:function size:0x50 -fn_80287AC0 = .text:0x80287AC0; // type:function size:0x34 -fn_80287B00 = .text:0x80287B00; // type:function size:0x18 +update__14dLytDropLine_cFPQ34nw4r3lyt4PanePQ34nw4r3lyt4PaneQ29dAcItem_c7Trial_eb = .text:0x80287AC0; // type:function size:0x34 +finishPartMaybe__14dLytDropLine_cFv = .text:0x80287B00; // type:function size:0x18 setPane__14dLytDropLine_cFPQ34nw4r3lyt4Pane = .text:0x80287B20; // type:function size:0x1C getActivePane__14dLytDropLine_cFv = .text:0x80287B40; // type:function size:0x18 fn_80287B60 = .text:0x80287B60; // type:function size:0x60 @@ -40097,9 +40097,9 @@ sInstance__20dLytMeterContainer_c = .sbss:0x80575448; // type:object size:0x8 da sInstance__24dLytMeterConfiguration_c = .sbss:0x80575450; // type:object size:0x8 data:4byte sInstance__20LytMeterTimerPart1_c = .sbss:0x80575458; // type:object size:0x4 data:4byte sInstance__20LytMeterTimerPart2_c = .sbss:0x8057545C; // type:object size:0x4 data:4byte -lbl_80575460 = .sbss:0x80575460; // type:object size:0x1 data:byte -DO_FINISH_TRIAL_TEAR_ANIM = .sbss:0x80575461; // type:object size:0x1 data:byte -LytMeterTimer__FINISHED = .sbss:0x80575462; // type:object size:0x6 data:byte +sDoExit__16dLytMeterTimer_c = .sbss:0x80575460; // type:object size:0x1 data:byte +sDoFinishAnim__16dLytMeterTimer_c = .sbss:0x80575461; // type:object size:0x1 data:byte +sFinished__16dLytMeterTimer_c = .sbss:0x80575462; // type:object size:0x1 data:byte sInstance__14dLytDobutton_c = .sbss:0x80575468; // type:object size:0x8 data:4byte lbl_80575470 = .sbss:0x80575470; // type:object size:0x8 sInstance__18LytDoButtonRelated = .sbss:0x80575478; // type:object size:0x8 data:4byte diff --git a/include/d/lyt/d_lyt_drop_line.h b/include/d/lyt/d_lyt_drop_line.h index 4b96ff5e..173b2b7c 100644 --- a/include/d/lyt/d_lyt_drop_line.h +++ b/include/d/lyt/d_lyt_drop_line.h @@ -2,6 +2,7 @@ #define D_LYT_DROP_LINE_H #include "common.h" +#include "d/a/d_a_item.h" #include "nw4r/lyt/lyt_pane.h" class dLytDropLine_c { @@ -19,6 +20,8 @@ public: static nw4r::lyt::Pane *getActivePane(); static nw4r::lyt::Pane *setPane(nw4r::lyt::Pane *pane); + static nw4r::lyt::Pane *update(nw4r::lyt::Pane *pane, nw4r::lyt::Pane *otherPane, dAcItem_c::Trial_e, bool); + static bool finishPartMaybe(); private: static dLytDropLine_c *sInstance; diff --git a/include/d/lyt/meter/d_lyt_meter.h b/include/d/lyt/meter/d_lyt_meter.h index 126ee7da..b10cb27d 100644 --- a/include/d/lyt/meter/d_lyt_meter.h +++ b/include/d/lyt/meter/d_lyt_meter.h @@ -47,6 +47,7 @@ public: bool fn_800D5380(u8); bool fn_800D5650(); bool fn_800D5680(); + bool fn_800C9FE0(); bool isSilentRealm(); @@ -161,6 +162,7 @@ public: bool draw(); bool fn_800D5670(); + bool fn_800D97A0(); static dLytMeterContainer_c *GetInstance() { return sInstance; @@ -218,6 +220,27 @@ public: } } + static u8 getField_0x13B63() { + if (sInstance != nullptr) { + return sInstance->field_0x13B63; + } else { + return 0; + } + } + + static void setField_0x13B61(u8 val) { + if (sInstance != nullptr) { + sInstance->field_0x13B61 = val; + } + } + + static void setField_0x13B64(u8 val) { + if (sInstance != nullptr) { + sInstance->field_0x13B64 = val; + } + } + + static u8 getDowsing0x550A() { if (sInstance != nullptr) { return sInstance->mMeter.mDowsing.getField_0x550A(); @@ -226,6 +249,22 @@ public: } } + static bool getfn_800C9FE0() { + if (sInstance != nullptr) { + return sInstance->mMeter.fn_800C9FE0(); + } else { + return false; + } + } + + static bool getfn_800D97A0() { + if (sInstance != nullptr) { + return sInstance->fn_800D97A0(); + } else { + return false; + } + } + private: /* 0x00004 */ d2d::ResAccIf_c mResAcc; /* 0x00374 */ dLytMeterEventSkip_c *mpEventSkip; @@ -236,6 +275,11 @@ private: /* 0x13B48 */ bool mVisible; /* 0x13B49 */ u8 _0x13B49[0x13B50 - 0x13B49]; /* 0x13B50 */ s32 mFlags; + /* 0x13B54 */ u8 _0x13B54[0x13B61 - 0x13B54]; + /* 0x13B61 */ u8 field_0x13B61; + /* 0x13B62 */ u8 field_0x13B62; + /* 0x13B63 */ u8 field_0x13B63; + /* 0x13B64 */ u8 field_0x13B64; static dLytMeterContainer_c *sInstance; }; diff --git a/include/d/lyt/meter/d_lyt_meter_timer.h b/include/d/lyt/meter/d_lyt_meter_timer.h index 9eef832b..8012fbeb 100644 --- a/include/d/lyt/meter/d_lyt_meter_timer.h +++ b/include/d/lyt/meter/d_lyt_meter_timer.h @@ -46,23 +46,45 @@ public: bool isAnyFruitAnimFinished(); bool isLastFruitAnimFinished(); bool isOutAnimFinished(); + void startFruitAnim(s32 index); + void resetBowlNuts(); + void updateDropLine(nw4r::lyt::Pane *pane); void createEffect(s32 fruitIndex); + bool incrementTearCount(); + bool isAnyFruitAnimAtFrame(f32 f) const; + + s32 getActualTearCount() const { + return mActualTearCount; + } + + s32 getDisplayedTearCount() const { + return mDisplayedTearCount; + } + + s32 getField0x780() const { + return field_0x780; + } + + void setField0x780(s32 val) { + field_0x780 = val; + } private: void initLoopAnim(); void initBowlNuts(); - void resetBowlNuts(); void initOutAnim(); void initColors(); void initInAnim(); + void startNextFruitAnim(); + void disableCurrentFruitAnim(); static LytMeterTimerPart1_c *sInstance; /* 0x008 */ d2d::dLytSub mLyt; /* 0x09C */ d2d::AnmGroup_c mAnm[26]; /* 0x71C */ s32 mActualTearCount; - /* 0x720 */ u8 _0x720[0x724 - 0x720]; + /* 0x720 */ s32 mDisplayedTearCount; /* 0x724 */ nw4r::lyt::Pane *mpPanes[15]; /* 0x760 */ s32 field_0x760; /* 0x764 */ dAcItem_c::Trial_e mTrial; @@ -101,6 +123,20 @@ public: mNumPetals = num; } + s32 getNumPetals() const { + return mNumPetals; + } + + nw4r::lyt::Pane *i_getPane() const { + return mpPane; + } + + void setVisible(bool bVisible) { + mVisible = bVisible; + } + + void calc(); + void init(); void initDyingAnims(); void initFallOutAnims(); @@ -108,10 +144,37 @@ public: void syncPetalsTime(); void updatePetalsRate(); void restartPetals(); + void finishSingleAnim(u8 idx); void resetSingleAnim(u8 idx); void startInAnim(); void startOutAnim(); + void stopInAnim(); + void stopBloomAnim(); + void stopBeforeFallAnim(); + void stopChangeSirenAnim(); + void stopSirenLoopAnim(); + void stopSirenSafeAnim(); + void stopFlowerLoopAnim(); + + void resetFlowerLoopAnim(); + void stopDyingAnims(); + void stopFinishedDyingAnims(); + void stopFallOutAnims(); + void stopFinishedFallOutAnims(); + void stopOutAnim(); + void stopChangeFruitAnim(); + bool isInAnimFinished(); + bool isBloomAnimFinished(); + bool isBeforeFallAnimAtStart(); + bool isChangeSirenAnimFinished(); + bool isSirenSafeAnimFinished(); + bool isFlowerLoopAnimFinished(); + bool isOutAnimFinished(); + bool isChangeFruitAnimFinished(); + void realizeFruitsColor(); + void finishDyingAnims(); + void setPetalsToStart(); void enableChangeFruitAnim(); @@ -122,11 +185,21 @@ public: void enableSafeAnim(); void resumeFlowerLoop(); void startFlowerLoop(); + void syncTime(); + void syncTimeWithSafe(); + /** Played when the finish animation is played and each tear hits the flower */ + void createSingleFruitEffect(); + /** Played when the whole fruit is finished */ + void createFruitCompleteEffect(); + + void initBeforeFallAnim(); + + bool isPetalDyingAnimFinished(); + bool isFirstFallOutAnimFinished(); + void initChangeSirenAnim(); private: void initBloomAnim(); - void initBeforeFallAnim(); - void initChangeSirenAnim(); void initSirenLoopAnim(); void initSirenSafeAnim(); void initFlowerLoopAnim(); @@ -154,8 +227,27 @@ public: virtual ~dLytMeterTimer_c() {} bool build(); bool remove(); + bool execute(); private: + bool startIn2(); + bool startOut2(); + void startIn(); + void gotoChangeSiren(); + void gotoSiren(); + void gotoChangeSafeBloom(); + void gotoChangeSafe(); + void gotoSafe(); + void gotoChangeFruits6(); + void gotoFruits(); + void startOut(); + void gotoChangeFruits3(); + void startSafe(); + void doPickup(); + bool isInSiren(); + s32 getPetalForTimerMaybe(s32 time); + bool checkForPetalChangeMaybe(); + STATE_FUNC_DECLARE(dLytMeterTimer_c, ChangeSiren); STATE_FUNC_DECLARE(dLytMeterTimer_c, Siren); STATE_FUNC_DECLARE(dLytMeterTimer_c, ChangeSafeBloom); @@ -168,10 +260,22 @@ private: static bool sDoFinishAnim; static bool sFinished; + STATE_MGR_DEFINE_UTIL_CHANGESTATE(dLytMeterTimer_c); + STATE_MGR_DEFINE_UTIL_ISSTATE(dLytMeterTimer_c); + /* 0x04 */ UI_STATE_MGR_DECLARE(dLytMeterTimer_c); /* 0x40 */ LytMeterTimerPart1_c *mpPart1; /* 0x44 */ LytMeterTimerPart2_c *mpPart2; - /* 0x48 */ u8 _0x48[0x60 - 0x48]; + /* 0x48 */ u8 field_0x48; + /* 0x4C */ s32 mActualTime; + /* 0x50 */ s32 mLastTime; + /* 0x54 */ u8 field_0x54; + /* 0x55 */ u8 field_0x55; + /* 0x56 */ u8 field_0x56; + /* 0x57 */ u8 field_0x57; + /* 0x58 */ u8 field_0x58; + /* 0x59 */ u8 field_0x59; + /* 0x5C */ s32 field_0x5C; /* 0x60 */ s32 field_0x60; }; diff --git a/src/d/lyt/meter/d_lyt_meter_timer.cpp b/src/d/lyt/meter/d_lyt_meter_timer.cpp index 31aae230..feb86b3b 100644 --- a/src/d/lyt/meter/d_lyt_meter_timer.cpp +++ b/src/d/lyt/meter/d_lyt_meter_timer.cpp @@ -2,13 +2,21 @@ #include "common.h" #include "d/a/d_a_item.h" +#include "d/col/c/c_m3d.h" +#include "d/d_sc_game.h" +#include "d/flag/itemflag_manager.h" #include "d/lyt/d2d.h" #include "d/lyt/d_lyt_drop_line.h" #include "d/lyt/meter/d_lyt_meter.h" #include "d/t/d_t_siren.h" #include "m/m_vec.h" +#include "nw4r/lyt/lyt_pane.h" #include "nw4r/math/math_types.h" #include "toBeSorted/effects_struct.h" +#include "toBeSorted/event_manager.h" +#include "toBeSorted/small_sound_mgr.h" + +#include STATE_DEFINE(dLytMeterTimer_c, ChangeSiren); STATE_DEFINE(dLytMeterTimer_c, Siren); @@ -18,6 +26,12 @@ STATE_DEFINE(dLytMeterTimer_c, Safe); STATE_DEFINE(dLytMeterTimer_c, ChangeFruits); STATE_DEFINE(dLytMeterTimer_c, Fruits); +LytMeterTimerPart1_c *LytMeterTimerPart1_c::sInstance; +LytMeterTimerPart2_c *LytMeterTimerPart2_c::sInstance; +bool dLytMeterTimer_c::sDoExit; +bool dLytMeterTimer_c::sDoFinishAnim; +bool dLytMeterTimer_c::sFinished; + static const d2d::LytBrlanMapping brlanMapPart1[] = { { "timer_01_in.brlan", "G_inOut_00"}, {"timer_01_mapPosition.brlan", "G_inOut_00"}, @@ -219,6 +233,19 @@ void LytMeterTimerPart1_c::realizeTrial() { } } +void LytMeterTimerPart1_c::startNextFruitAnim() { + if (mActualTearCount > 0 && !mAnm[mActualTearCount - 1 + TIMER_01_ANIM_BOWL_NUT_OFFSET].isEnabled() && + mAnm[mActualTearCount - 1 + TIMER_01_ANIM_BOWL_NUT_OFFSET].getFrame() == 0.0f) { + mAnm[mActualTearCount - 1 + TIMER_01_ANIM_BOWL_NUT_OFFSET].setAnimEnable(true); + } +} + +void LytMeterTimerPart1_c::startFruitAnim(s32 index) { + if (field_0x780 < TIMER_01_NUM_TEARS && !mAnm[index + TIMER_01_ANIM_BOWL_NUT_OFFSET].isEnabled()) { + mAnm[index + TIMER_01_ANIM_BOWL_NUT_OFFSET].setAnimEnable(true); + } +} + void LytMeterTimerPart1_c::startOutAnim() { mAnm[TIMER_01_ANIM_OUT].setToStart(); mAnm[TIMER_01_ANIM_OUT].setAnimEnable(true); @@ -228,6 +255,12 @@ void LytMeterTimerPart1_c::stopInAnim() { mAnm[TIMER_01_ANIM_IN].setAnimEnable(false); } +void LytMeterTimerPart1_c::disableCurrentFruitAnim() { + if (mActualTearCount > 0 && mAnm[mActualTearCount - 1 + TIMER_01_ANIM_BOWL_NUT_OFFSET].isEnabled()) { + mAnm[mActualTearCount - 1 + TIMER_01_ANIM_BOWL_NUT_OFFSET].setAnimEnable(false); + } +} + void LytMeterTimerPart1_c::stopFinishedFruit() { for (s32 i = 0; i <= field_0x780; i++) { if (mAnm[i + TIMER_01_ANIM_BOWL_NUT_OFFSET].isEnabled() && mAnm[i + TIMER_01_ANIM_BOWL_NUT_OFFSET].isStop2()) { @@ -275,27 +308,39 @@ bool LytMeterTimerPart1_c::isOutAnimFinished() { } return false; } -extern "C" const u16 PARTICLE_RESOURCE_ID_MAPPING_135_; -extern "C" const u16 PARTICLE_RESOURCE_ID_MAPPING_136_; -extern "C" const u16 PARTICLE_RESOURCE_ID_MAPPING_137_; -void LytMeterTimerPart1_c::createEffect(s32 fruitIndex) { - nw4r::math::MTX34 mtx = mpPanes[fruitIndex]->GetGlobalMtx(); - mVec3_c pos; - pos.x = mtx._03; - pos.y = mtx._13; - pos.z = 0.0f; - EffectsStruct::fn_800298C0( - PARTICLE_RESOURCE_ID_MAPPING_135_, &pos, nullptr, nullptr, &mColors1[TIMER_01_COLOR_00_CIRCLE], - &mColors2[TIMER_01_COLOR_01_CIRCLE] - ); - EffectsStruct::fn_800298C0( - PARTICLE_RESOURCE_ID_MAPPING_136_, &pos, nullptr, nullptr, &mColors1[TIMER_01_COLOR_00_SHADOW], - &mColors2[TIMER_01_COLOR_01_SHADOW] - ); - EffectsStruct::fn_800298C0( - PARTICLE_RESOURCE_ID_MAPPING_137_, &pos, nullptr, nullptr, &mColors1[TIMER_01_COLOR_00_RAINBOW_CIRCLE], - &mColors2[TIMER_01_COLOR_01_RAINBOW_CIRCLE] - ); + +bool LytMeterTimerPart1_c::isAnyFruitAnimAtFrame(f32 f) const { + for (int i = 0; i <= field_0x780; i++) { + if (mAnm[i + TIMER_01_ANIM_BOWL_NUT_OFFSET].isEnabled() && + f - 1.0f < mAnm[i + TIMER_01_ANIM_BOWL_NUT_OFFSET].getFrame() && + mAnm[i + TIMER_01_ANIM_BOWL_NUT_OFFSET].getFrame() <= f) { + return true; + } + } + return false; +} + +bool LytMeterTimerPart1_c::incrementTearCount() { + mActualTearCount = ItemflagManager::sInstance->getFlagDirect(500); + if (mDisplayedTearCount < mActualTearCount && dLytDropLine_c::finishPartMaybe()) { + startNextFruitAnim(); + if (!dLytMeterContainer_c::getfn_800C9FE0()) { + createEffect(mActualTearCount - 1); + SmallSoundManager::GetInstance()->playSound(SE_S_SIREN_SHIZUKU_GET_IN); + } + + if (mActualTearCount < TIMER_01_NUM_TEARS) { + field_0x760++; + dLytDropLine_c::setPane(mpPanes[field_0x760]); + } + mDisplayedTearCount++; + } + + if (isCurrentFruitAnimFinished()) { + disableCurrentFruitAnim(); + return true; + } + return false; } void LytMeterTimerPart1_c::initColors() { @@ -335,6 +380,34 @@ void LytMeterTimerPart1_c::initColors() { } } +extern "C" const u16 PARTICLE_RESOURCE_ID_MAPPING_135_; +extern "C" const u16 PARTICLE_RESOURCE_ID_MAPPING_136_; +extern "C" const u16 PARTICLE_RESOURCE_ID_MAPPING_137_; +void LytMeterTimerPart1_c::createEffect(s32 fruitIndex) { + nw4r::math::MTX34 mtx = mpPanes[fruitIndex]->GetGlobalMtx(); + mVec3_c pos; + pos.x = mtx._03; + pos.y = mtx._13; + pos.z = 0.0f; + EffectsStruct::fn_800298C0( + PARTICLE_RESOURCE_ID_MAPPING_135_, &pos, nullptr, nullptr, &mColors1[TIMER_01_COLOR_00_CIRCLE], + &mColors2[TIMER_01_COLOR_01_CIRCLE] + ); + EffectsStruct::fn_800298C0( + PARTICLE_RESOURCE_ID_MAPPING_136_, &pos, nullptr, nullptr, &mColors1[TIMER_01_COLOR_00_SHADOW], + &mColors2[TIMER_01_COLOR_01_SHADOW] + ); + EffectsStruct::fn_800298C0( + PARTICLE_RESOURCE_ID_MAPPING_137_, &pos, nullptr, nullptr, &mColors1[TIMER_01_COLOR_00_RAINBOW_CIRCLE], + &mColors2[TIMER_01_COLOR_01_RAINBOW_CIRCLE] + ); +} + +void LytMeterTimerPart1_c::updateDropLine(nw4r::lyt::Pane *pane) { + u8 idx = field_0x780; + dLytDropLine_c::update(mpPanes[idx], pane, mTrial, field_0x780 % 2 != 0); +} + static const d2d::LytBrlanMapping brlanMapPart2[] = { { "timer_02_in.brlan", "G_inOut_00"}, {"timer_02_mapPosition.brlan", "G_inOut_00"}, @@ -373,6 +446,7 @@ static const d2d::LytBrlanMapping brlanMapPart2[] = { #define TIMER_02_ANIM_DYING_OFFSET 2 #define TIMER_02_ANIM_FALL_OUT_OFFSET 11 #define TIMER_02_ANIM_CHANGE_FRUIT 20 +#define TIMER_02_ANIM_FRUITS_COLOR 21 #define TIMER_02_ANIM_PETAL_ONOFF 22 #define TIMER_02_ANIM_BLOOM 23 #define TIMER_02_ANIM_BEFORE_FALL 24 @@ -463,7 +537,7 @@ void LytMeterTimerPart2_c::initBloomAnim() { } void LytMeterTimerPart2_c::initBeforeFallAnim() { - mAnm[TIMER_02_ANIM_BEFORE_FALL].setForwardOnce(); + mAnm[TIMER_02_ANIM_BEFORE_FALL].setForwardLoop(); mAnm[TIMER_02_ANIM_BEFORE_FALL].setFrame(0.0f); mAnm[TIMER_02_ANIM_BEFORE_FALL].setAnimEnable(true); mLyt.calc(); @@ -603,7 +677,8 @@ void LytMeterTimerPart2_c::syncPetalsTime() { if (time == 0) { time = 10000; } - f32 targetFrame = (s32)(duration - (time / 10000.0f) * duration + 0.5f); + f32 tmp = duration - (time / 10000.0f) * duration; + f32 targetFrame = (s32)(tmp + 0.5f); mAnm[i + TIMER_02_ANIM_DYING_OFFSET].setRate(1.0f); mAnm[i + TIMER_02_ANIM_DYING_OFFSET].setFrame(targetFrame); mAnm[i + TIMER_02_ANIM_DYING_OFFSET].setAnimEnable(true); @@ -650,6 +725,230 @@ void LytMeterTimerPart2_c::enableChangeFruitAnim() { mAnm[TIMER_02_ANIM_CHANGE_FRUIT].setAnimEnable(true); } +void LytMeterTimerPart2_c::syncTime() { + f32 duration = mAnm[TIMER_02_ANIM_FLOWER_LOOP].getAnimDuration() - 1.0f; + s32 time = dTgSiren_c::getTime() % 2000; + if (time == 0) { + time = 2000; + } + mFlowerLoopFrame = duration - (time / 2000.0f) * duration; + mAnm[TIMER_02_ANIM_FLOWER_LOOP].setRate(1.0f); +} + +void LytMeterTimerPart2_c::syncTimeWithSafe() { + f32 duration = mAnm[TIMER_02_ANIM_FLOWER_LOOP].getAnimDuration() - 1.0f; + s32 time = dTgSiren_c::getTime() % 2000; + if (time == 0) { + time = 2000; + } + // FPR regswap between 2000.0f and cast constant + // Not sure why the cast needs to be pulled out here + + // This way works in other functions, but breaks instructions in this case + // f32 loopFrame = duration - (time / 2000.0f) * duration; + f32 fTime = time; + f32 loopFrame = duration - (fTime / 2000.0f) * duration; + f32 safeDuration = mAnm[TIMER_02_ANIM_SIREN_SAFE].getAnimDuration() - 1.0f; + f32 finalFrame = loopFrame; + if (safeDuration < finalFrame) { + finalFrame = finalFrame - safeDuration; + } + mFlowerLoopFrame = finalFrame; + mAnm[TIMER_02_ANIM_FLOWER_LOOP].setRate(1.0f); +} + +void LytMeterTimerPart2_c::stopInAnim() { + mAnm[TIMER_02_ANIM_IN].setAnimEnable(false); +} + +void LytMeterTimerPart2_c::stopBloomAnim() { + mAnm[TIMER_02_ANIM_BLOOM].setAnimEnable(false); +} + +void LytMeterTimerPart2_c::stopBeforeFallAnim() { + if (mAnm[TIMER_02_ANIM_BEFORE_FALL].isEnabled()) { + mAnm[TIMER_02_ANIM_BEFORE_FALL].setAnimEnable(false); + } +} + +void LytMeterTimerPart2_c::stopChangeSirenAnim() { + mAnm[TIMER_02_ANIM_CHANGE_SIREN].setAnimEnable(false); +} + +void LytMeterTimerPart2_c::stopSirenLoopAnim() { + mAnm[TIMER_02_ANIM_SIREN_LOOP].setAnimEnable(false); +} + +void LytMeterTimerPart2_c::stopSirenSafeAnim() { + mAnm[TIMER_02_ANIM_SIREN_SAFE].setAnimEnable(false); +} + +void LytMeterTimerPart2_c::stopFlowerLoopAnim() { + mAnm[TIMER_02_ANIM_FLOWER_LOOP].setAnimEnable(false); +} + +void LytMeterTimerPart2_c::resetFlowerLoopAnim() { + mAnm[TIMER_02_ANIM_FLOWER_LOOP].setFrame(0.0f); + mAnm[TIMER_02_ANIM_FLOWER_LOOP].setAnimEnable(true); + mLyt.calc(); + mAnm[TIMER_02_ANIM_FLOWER_LOOP].setAnimEnable(false); +} + +void LytMeterTimerPart2_c::stopDyingAnims() { + for (int i = 0; i < TIMER_02_NUM_PETALS; i++) { + if (mAnm[i + TIMER_02_ANIM_DYING_OFFSET].isEnabled()) { + mAnm[i + TIMER_02_ANIM_DYING_OFFSET].setAnimEnable(false); + } + } +} + +void LytMeterTimerPart2_c::stopFinishedDyingAnims() { + for (int i = 0; i < TIMER_02_NUM_PETALS; i++) { + if (mAnm[i + TIMER_02_ANIM_DYING_OFFSET].isEnabled() && mAnm[i + TIMER_02_ANIM_DYING_OFFSET].isEndReached()) { + mAnm[i + TIMER_02_ANIM_DYING_OFFSET].setAnimEnable(false); + } + } +} + +void LytMeterTimerPart2_c::stopFallOutAnims() { + for (int i = 0; i < TIMER_02_NUM_PETALS; i++) { + if (mAnm[i + TIMER_02_ANIM_FALL_OUT_OFFSET].isEnabled()) { + mAnm[i + TIMER_02_ANIM_FALL_OUT_OFFSET].setAnimEnable(false); + } + } +} + +void LytMeterTimerPart2_c::stopFinishedFallOutAnims() { + for (int i = 0; i < TIMER_02_NUM_PETALS; i++) { + if (mAnm[i + TIMER_02_ANIM_FALL_OUT_OFFSET].isEnabled() && + mAnm[i + TIMER_02_ANIM_FALL_OUT_OFFSET].isEndReached()) { + mAnm[i + TIMER_02_ANIM_FALL_OUT_OFFSET].setAnimEnable(false); + // ??? - if one of the fall out anims is finished, stop all others too??? + stopFallOutAnims(); + } + } +} + +void LytMeterTimerPart2_c::stopOutAnim() { + mAnm[TIMER_02_ANIM_OUT].setAnimEnable(false); +} + +void LytMeterTimerPart2_c::stopChangeFruitAnim() { + mAnm[TIMER_02_ANIM_CHANGE_FRUIT].setAnimEnable(false); +} + +bool LytMeterTimerPart2_c::isInAnimFinished() { + if (mAnm[TIMER_02_ANIM_IN].isEnabled() && mAnm[TIMER_02_ANIM_IN].isEndReached()) { + return true; + } + return false; +} + +bool LytMeterTimerPart2_c::isBloomAnimFinished() { + if (mAnm[TIMER_02_ANIM_BLOOM].isEnabled() && mAnm[TIMER_02_ANIM_BLOOM].isEndReached()) { + return true; + } + return false; +} + +bool LytMeterTimerPart2_c::isBeforeFallAnimAtStart() { + if (mAnm[TIMER_02_ANIM_BEFORE_FALL].isEnabled() && cM3d_IsZero(mAnm[TIMER_02_ANIM_BEFORE_FALL].getFrame())) { + return true; + } + return false; +} + +bool LytMeterTimerPart2_c::isChangeSirenAnimFinished() { + if (mAnm[TIMER_02_ANIM_CHANGE_SIREN].isEnabled() && mAnm[TIMER_02_ANIM_CHANGE_SIREN].isEndReached()) { + return true; + } + return false; +} + +bool LytMeterTimerPart2_c::isSirenSafeAnimFinished() { + if (mAnm[TIMER_02_ANIM_SIREN_SAFE].isEnabled() && mAnm[TIMER_02_ANIM_SIREN_SAFE].isEndReached()) { + return true; + } + return false; +} + +bool LytMeterTimerPart2_c::isFlowerLoopAnimFinished() { + if (mAnm[TIMER_02_ANIM_FLOWER_LOOP].isEnabled() && mAnm[TIMER_02_ANIM_FLOWER_LOOP].isEndReached()) { + return true; + } + return false; +} + +bool LytMeterTimerPart2_c::isPetalDyingAnimFinished() { + if (mNumPetals > 0) { + s32 idx = mNumPetals - 1; + if (mAnm[idx + TIMER_02_ANIM_DYING_OFFSET].isEnabled() && + mAnm[idx + TIMER_02_ANIM_DYING_OFFSET].isEndReached()) { + return true; + } + } + return false; +} + +bool LytMeterTimerPart2_c::isFirstFallOutAnimFinished() { + if (mAnm[TIMER_02_ANIM_FALL_OUT_OFFSET].isEnabled() && mAnm[TIMER_02_ANIM_FALL_OUT_OFFSET].isEndReached()) { + return true; + } + return false; +} + +bool LytMeterTimerPart2_c::isOutAnimFinished() { + if (mAnm[TIMER_02_ANIM_OUT].isEnabled() && mAnm[TIMER_02_ANIM_OUT].isEndReached()) { + return true; + } + return false; +} + +bool LytMeterTimerPart2_c::isChangeFruitAnimFinished() { + if (mAnm[TIMER_02_ANIM_CHANGE_FRUIT].isEnabled() && mAnm[TIMER_02_ANIM_CHANGE_FRUIT].isEndReached()) { + return true; + } + return false; +} + +void LytMeterTimerPart2_c::realizeFruitsColor() { + f32 frame = 0.0f; + switch (mTrial) { + case dAcItem_c::TRIAL_ELDIN: frame = 0.0f; break; + case dAcItem_c::TRIAL_FARON: frame = 1.0f; break; + case dAcItem_c::TRIAL_SKYLOFT: frame = 2.0f; break; + case dAcItem_c::TRIAL_LANAYRU: frame = 3.0f; break; + } + mAnm[TIMER_02_ANIM_FRUITS_COLOR].setForwardOnce(); + mAnm[TIMER_02_ANIM_FRUITS_COLOR].setFrame(frame); + mAnm[TIMER_02_ANIM_FRUITS_COLOR].setAnimEnable(true); + mLyt.calc(); + mAnm[TIMER_02_ANIM_FRUITS_COLOR].setAnimEnable(false); +} + +void LytMeterTimerPart2_c::finishDyingAnims() { + for (s32 i = 0; i < TIMER_02_NUM_PETALS; i++) { + mAnm[i + TIMER_02_ANIM_DYING_OFFSET].setToEnd2(); + mAnm[i + TIMER_02_ANIM_DYING_OFFSET].setAnimEnable(true); + } + mLyt.calc(); + for (s32 i = 0; i < TIMER_02_NUM_PETALS; i++) { + mAnm[i + TIMER_02_ANIM_DYING_OFFSET].setAnimEnable(false); + } +} + +void LytMeterTimerPart2_c::setPetalsToStart() { + for (s32 i = 0; i < TIMER_02_NUM_PETALS; i++) { + mAnm[i + TIMER_02_ANIM_DYING_OFFSET].setToStart(); + mAnm[i + TIMER_02_ANIM_FALL_OUT_OFFSET].setToEnd2(); + mAnm[i + TIMER_02_ANIM_FALL_OUT_OFFSET].setAnimEnable(true); + } + mLyt.calc(); + for (s32 i = 0; i < TIMER_02_NUM_PETALS; i++) { + mAnm[i + TIMER_02_ANIM_FALL_OUT_OFFSET].setAnimEnable(false); + } +} + void LytMeterTimerPart2_c::realizePetalsOnOff() { mAnm[TIMER_02_ANIM_PETAL_ONOFF].setAnimEnable(true); mAnm[TIMER_02_ANIM_PETAL_ONOFF].setFrame(9 - mNumPetals); @@ -657,10 +956,18 @@ void LytMeterTimerPart2_c::realizePetalsOnOff() { mAnm[TIMER_02_ANIM_PETAL_ONOFF].setAnimEnable(false); } +void LytMeterTimerPart2_c::finishSingleAnim(u8 idx) { + mAnm[idx].setToEnd2(); +} + void LytMeterTimerPart2_c::resetSingleAnim(u8 idx) { mAnm[idx].setToStart(); } +void LytMeterTimerPart2_c::calc() { + mLyt.calc(); +} + void LytMeterTimerPart2_c::initColors() { switch (mTrial) { case dAcItem_c::TRIAL_ELDIN: @@ -690,32 +997,298 @@ void LytMeterTimerPart2_c::initColors() { } } +extern "C" const u16 PARTICLE_RESOURCE_ID_MAPPING_174_; +void LytMeterTimerPart2_c::createSingleFruitEffect() { + nw4r::math::MTX34 mtx = mpPane->GetGlobalMtx(); + mVec3_c pos; + pos.x = mtx._03; + pos.y = mtx._13; + pos.z = 0.0f; + EffectsStruct::fn_800298C0( + PARTICLE_RESOURCE_ID_MAPPING_174_, &pos, nullptr, nullptr, &mColors1[TIMER_02_COLOR_00_00], + &mColors2[TIMER_02_COLOR_01_00] + ); +} +extern "C" const u16 PARTICLE_RESOURCE_ID_MAPPING_206_; +void LytMeterTimerPart2_c::createFruitCompleteEffect() { + nw4r::math::MTX34 mtx = mpPane->GetGlobalMtx(); + mVec3_c pos; + pos.x = mtx._03; + pos.y = mtx._13; + pos.z = 0.0f; + EffectsStruct::fn_800298C0( + PARTICLE_RESOURCE_ID_MAPPING_206_, &pos, nullptr, nullptr, &mColors1[TIMER_02_COLOR_00_01], + &mColors2[TIMER_02_COLOR_01_01] + ); +} + void dLytMeterTimer_c::initializeState_ChangeSiren() {} -void dLytMeterTimer_c::executeState_ChangeSiren() {} +void dLytMeterTimer_c::executeState_ChangeSiren() { + if (mpPart2->isFlowerLoopAnimFinished()) { + mpPart2->stopFlowerLoopAnim(); + mpPart2->resetFlowerLoopAnim(); + mpPart2->resetSingleAnim(TIMER_02_ANIM_FLOWER_LOOP); + } + if (mpPart2->isBeforeFallAnimAtStart()) { + mpPart2->stopBeforeFallAnim(); + mpPart2->resetSingleAnim(TIMER_02_ANIM_BEFORE_FALL); + } + + if (field_0x57 <= 1) { + if (mLastTime < mActualTime && field_0x58 == 1 && mpPart1->getActualTearCount() != TIMER_01_NUM_TEARS) { + gotoChangeSafeBloom(); + } + if (!EventManager::isInEvent()) { + mpPart2->setVisible(true); + } + } + + if (dLytMeterContainer_c::getfn_800D97A0() && !field_0x54) { + mpPart2->setVisible(true); + } + + switch (field_0x57) { + case 0: + if (mpPart2->isPetalDyingAnimFinished()) { + mpPart2->stopFinishedDyingAnims(); + field_0x57 = 1; + mpPart2->restartPetals(); + } + break; + case 1: + if (mpPart2->isFirstFallOutAnimFinished()) { + dLytMeterContainer_c::setField_0x13B61(1); + field_0x57 = 2; + } + break; + case 2: + if (mpPart2->isFirstFallOutAnimFinished() && field_0x48) { + mpPart2->stopFinishedFallOutAnims(); + mpPart2->enableChangeSirenAnim(); + } + if (mpPart2->isChangeSirenAnimFinished()) { + mpPart2->stopChangeSirenAnim(); + mpPart2->resetSingleAnim(TIMER_02_ANIM_CHANGE_SIREN); + field_0x58 = 1; + gotoSiren(); + } + break; + } +} void dLytMeterTimer_c::finalizeState_ChangeSiren() {} void dLytMeterTimer_c::initializeState_Siren() {} -void dLytMeterTimer_c::executeState_Siren() {} +void dLytMeterTimer_c::executeState_Siren() { + if (!field_0x58) { + if (mpPart2->isSirenSafeAnimFinished()) { + mpPart2->stopSirenSafeAnim(); + } + const char *eventName = EventManager::getCurrentEventName(); + if (eventName != nullptr && (!strcmp(eventName, "SirenChaser") || !strcmp(eventName, "SirenChaserL"))) { + gotoChangeSiren(); + } + } +} void dLytMeterTimer_c::finalizeState_Siren() {} void dLytMeterTimer_c::initializeState_ChangeSafeBloom() {} -void dLytMeterTimer_c::executeState_ChangeSafeBloom() {} +void dLytMeterTimer_c::executeState_ChangeSafeBloom() { + if (mpPart2->isBloomAnimFinished()) { + mpPart2->stopSirenSafeAnim(); + mpPart2->stopBloomAnim(); + gotoChangeSafe(); + } else if (mpPart1->incrementTearCount() == true) { + mpPart2->stopSirenSafeAnim(); + mpPart2->initBeforeFallAnim(); + mpPart2->setNumPetals(0); + mpPart2->realizePetalsOnOff(); + mpPart2->enableSafeAnim(); + mpPart2->finishSingleAnim(TIMER_02_ANIM_SIREN_SAFE); + mpPart2->resetSingleAnim(TIMER_02_ANIM_BLOOM); + mpPart2->enableBloomAnim(); + mpPart2->stopDyingAnims(); + } +} void dLytMeterTimer_c::finalizeState_ChangeSafeBloom() {} void dLytMeterTimer_c::initializeState_ChangeSafe() {} -void dLytMeterTimer_c::executeState_ChangeSafe() {} +void dLytMeterTimer_c::executeState_ChangeSafe() { + if (mpPart1->getActualTearCount() != TIMER_01_NUM_TEARS && + mpPart1->getDisplayedTearCount() < mpPart1->getActualTearCount()) { + gotoChangeSafeBloom(); + } else { + if (mLastTime < mActualTime) { + gotoChangeSafeBloom(); + } else { + if (mpPart2->isSirenSafeAnimFinished()) { + mpPart2->stopSirenSafeAnim(); + gotoSafe(); + } + s32 rem = mActualTime % 1000; + s32 quot = mActualTime / 1000; + if (rem == 0 && quot % 2 == 0) { + mpPart2->syncTime(); + field_0x59 = true; + field_0x5C = 4; + } + + if (field_0x59) { + if (field_0x5C-- == 0) { + mpPart2->resumeFlowerLoop(); + field_0x59 = false; + } + } + } + } +} void dLytMeterTimer_c::finalizeState_ChangeSafe() {} void dLytMeterTimer_c::initializeState_Safe() {} -void dLytMeterTimer_c::executeState_Safe() {} +void dLytMeterTimer_c::executeState_Safe() { + const char *eventName = EventManager::getCurrentEventName(); + if (eventName != nullptr && !strcmp(eventName, "SirenSeekerFind")) { + gotoChangeSiren(); + } else if (eventName != nullptr && !strcmp(eventName, "SirenAreaEnter")) { + gotoChangeSiren(); + } else { + if (mActualTime == 0) { + gotoChangeSiren(); + } else if (!checkForPetalChangeMaybe()) { + if (mLastTime < mActualTime) { + gotoChangeSafeBloom(); + } else { + mpPart2->setNumPetals(getPetalForTimerMaybe(mActualTime)); + if (mpPart1->getActualTearCount() != TIMER_01_NUM_TEARS) { + if (mpPart2->getNumPetals() == 1 && mActualTime < 9000) { + mpPart2->enableBeforeFallAnim(); + } else { + mpPart2->stopBeforeFallAnim(); + } + } + if (mLastTime == mActualTime) { + if (mpPart1->getActualTearCount() != TIMER_01_NUM_TEARS) { + mpPart2->stopDyingAnims(); + mpPart2->stopFinishedFallOutAnims(); + } else { + mpPart2->startFlowerLoop(); + } + if (mpPart2->isFlowerLoopAnimFinished()) { + mpPart2->stopFlowerLoopAnim(); + } + } else { + s32 quot = mActualTime / 1000; + if (mpPart2->isFlowerLoopAnimFinished()) { + mpPart2->stopFlowerLoopAnim(); + } + s32 rem = mActualTime % 1000; + if (rem == 0 && quot % 2 == 0) { + mpPart2->syncTime(); + field_0x59 = true; + field_0x5C = 4; + } + if (field_0x59) { + if (field_0x5C-- == 0) { + mpPart2->resumeFlowerLoop(); + field_0x59 = false; + } + } + mpPart2->stopFinishedDyingAnims(); + mpPart2->stopFinishedFallOutAnims(); + if (mActualTime <= 90000) { + mpPart2->syncPetalsTime(); + } + } + } + } + } +} void dLytMeterTimer_c::finalizeState_Safe() {} void dLytMeterTimer_c::initializeState_ChangeFruits() {} -void dLytMeterTimer_c::executeState_ChangeFruits() {} +void dLytMeterTimer_c::executeState_ChangeFruits() { + switch (field_0x56) { + case 3: + if (mpPart2->isBloomAnimFinished()) { + mpPart2->stopSirenSafeAnim(); + mpPart2->stopBloomAnim(); + mpPart2->resetSingleAnim(TIMER_02_ANIM_BLOOM); + startSafe(); + } + break; + case 4: + if (mpPart2->isSirenSafeAnimFinished()) { + mpPart2->stopSirenSafeAnim(); + field_0x56 = 5; + } + break; + case 5: + if (sDoFinishAnim == true) { + doPickup(); + } + break; + case 6: + sFinished = true; + if (mpPart2->isFlowerLoopAnimFinished()) { + mpPart2->stopFlowerLoopAnim(); + mpPart2->resetFlowerLoopAnim(); + mpPart2->resetSingleAnim(TIMER_02_ANIM_FLOWER_LOOP); + } + + if (dLytDropLine_c::finishPartMaybe()) { + if (mpPart1->isLastFruitAnimFinished()) { + mpPart2->realizeFruitsColor(); + mpPart2->enableChangeFruitAnim(); + mpPart2->initChangeSirenAnim(); + mpPart2->createFruitCompleteEffect(); + } else { + mpPart2->createSingleFruitEffect(); + } + } + + if (mpPart1->isAnyFruitAnimAtFrame(4.0f)) { + s32 fruit = mpPart1->getField0x780() + 1; + mpPart1->setField0x780(fruit); + if (mpPart1->getField0x780() < TIMER_01_NUM_TEARS) { + mpPart1->updateDropLine(mpPart2->i_getPane()); + mpPart1->startFruitAnim(fruit); + mpPart1->createEffect(fruit); + } + } + + if (mpPart1->isAnyFruitAnimFinished()) { + mpPart1->stopFinishedFruit(); + } + + if (mpPart2->isChangeFruitAnimFinished()) { + if (field_0x60 <= 0) { + mpPart2->stopSirenSafeAnim(); + mpPart2->stopChangeFruitAnim(); + mpPart2->resetSingleAnim(TIMER_02_ANIM_CHANGE_FRUIT); + dLytMeterContainer_c::setField_0x13B64(1); + gotoFruits(); + } else { + field_0x60--; + } + } + break; + } +} void dLytMeterTimer_c::finalizeState_ChangeFruits() {} -void dLytMeterTimer_c::initializeState_Fruits() {} -void dLytMeterTimer_c::executeState_Fruits() {} +void dLytMeterTimer_c::initializeState_Fruits() { + sDoExit = true; +} +void dLytMeterTimer_c::executeState_Fruits() { + if (mpPart2->isFlowerLoopAnimFinished()) { + mpPart2->stopFlowerLoopAnim(); + mpPart2->resetFlowerLoopAnim(); + mpPart2->resetSingleAnim(TIMER_02_ANIM_FLOWER_LOOP); + } + + if (mActualTime == 0) { + gotoChangeSiren(); + } +} void dLytMeterTimer_c::finalizeState_Fruits() {} bool dLytMeterTimer_c::build() { @@ -724,7 +1297,7 @@ bool dLytMeterTimer_c::build() { mpPart1->init(); mpPart2->init(); mpPart1->realizeTrial(); - mpPart2->setNumPetals(9); + mpPart2->setNumPetals(TIMER_02_NUM_PETALS); mpPart2->realizePetalsOnOff(); mpPart2->initFallOutAnims(); mpPart2->initDyingAnims(); @@ -743,3 +1316,231 @@ bool dLytMeterTimer_c::remove() { mpPart2 = nullptr; return true; } + +bool dLytMeterTimer_c::execute() { + if (dScGame_c::currentSpawnInfo.getTrial() == SpawnInfo::TRIAL) { + mActualTime = dTgSiren_c::getTime(); + if (mActualTime > 500 && isInSiren() && mpPart1->getActualTearCount() != TIMER_01_NUM_TEARS) { + gotoChangeSafeBloom(); + } + + if (mpPart1->getActualTearCount() == TIMER_01_NUM_TEARS && dLytMeterContainer_c::getField_0x13B63()) { + if (!field_0x55) { + field_0x60 = 20; + } + field_0x55 = true; + } + + if (field_0x55) { + if (field_0x54) { + gotoChangeFruits3(); + } else if (sDoFinishAnim == true) { + gotoChangeFruits6(); + } + } + + if (mpPart1->isInAnimFinished() && mpPart2->isInAnimFinished()) { + mpPart1->stopInAnim(); + mpPart2->stopInAnim(); + } + + if (mpPart1->isOutAnimFinished() && mpPart2->isOutAnimFinished()) { + mpPart1->stopOutAnim(); + mpPart2->stopOutAnim(); + } + + mStateMgr.executeState(); + mLastTime = mActualTime; + } + + return true; +} + +bool dLytMeterTimer_c::startIn2() { + startIn(); + field_0x48 = 1; + return true; +} + +bool dLytMeterTimer_c::startOut2() { + startOut(); + field_0x48 = 0; + return true; +} + +void dLytMeterTimer_c::startIn() { + mpPart1->stopOutAnim(); + mpPart2->stopOutAnim(); + mpPart1->startInAnim(); + mpPart2->startInAnim(); + if (dLytMeterContainer_c::GetMeter()->fn_800D5650()) { + if (mStateMgr.isState(StateID_ChangeSiren)) { + mpPart2->stopFlowerLoopAnim(); + mpPart2->resetFlowerLoopAnim(); + mpPart2->resetSingleAnim(TIMER_02_ANIM_FLOWER_LOOP); + mpPart2->stopBeforeFallAnim(); + mpPart2->resetSingleAnim(TIMER_02_ANIM_BEFORE_FALL); + mpPart2->finishDyingAnims(); + mpPart2->setPetalsToStart(); + mpPart2->finishSingleAnim(TIMER_02_ANIM_CHANGE_SIREN); + mpPart2->enableChangeSirenAnim(); + mpPart2->calc(); + mpPart2->stopChangeSirenAnim(); + mpPart2->resetSingleAnim(TIMER_02_ANIM_CHANGE_SIREN); + gotoSiren(); + } else if (mStateMgr.isState(StateID_ChangeSafeBloom) || mStateMgr.isState(StateID_ChangeSafe)) { + mpPart2->stopSirenSafeAnim(); + mpPart2->finishSingleAnim(TIMER_02_ANIM_BLOOM); + mpPart2->enableBloomAnim(); + mpPart2->calc(); + mpPart2->stopBloomAnim(); + mpPart2->setNumPetals(TIMER_02_NUM_PETALS); + mpPart2->realizePetalsOnOff(); + mpPart2->initFallOutAnims(); + mpPart2->initDyingAnims(); + mpPart2->finishSingleAnim(TIMER_02_ANIM_SIREN_SAFE); + mpPart2->enableSafeAnim(); + mpPart2->calc(); + mpPart2->stopSirenSafeAnim(); + gotoSafe(); + } + } +} + +void dLytMeterTimer_c::gotoChangeSiren() { + if (mStateMgr.isState(StateID_Safe) || mStateMgr.isState(StateID_Siren)) { + if (mpPart2->getNumPetals() > 1) { + // Okay + mpPart2->setNumPetals(mpPart2->getNumPetals()); + mpPart2->initDyingAnims(); + mpPart2->updatePetalsRate(); + } else if (mpPart2->getNumPetals() == 1) { + mpPart2->updatePetalsRate(); + } + mpPart2->setVisible(false); + field_0x57 = 0; + mStateMgr.changeState(StateID_ChangeSiren); + } +} + +void dLytMeterTimer_c::gotoSiren() { + mpPart2->enableSirenLoopAnim(); + field_0x54 = true; + mStateMgr.changeState(StateID_Siren); +} + +void dLytMeterTimer_c::gotoChangeSafeBloom() { + if (mStateMgr.isState(StateID_Siren) || mStateMgr.isState(StateID_Safe) || mStateMgr.isState(StateID_ChangeSiren) || + mStateMgr.isState(StateID_ChangeSafe)) { + if (mpPart1->getActualTearCount() == TIMER_01_NUM_TEARS - 1) { + mpPart2->stopDyingAnims(); + } + mpPart2->stopSirenLoopAnim(); + field_0x54 = false; + mStateMgr.changeState(StateID_ChangeSafeBloom); + } +} + +void dLytMeterTimer_c::gotoChangeSafe() { + mpPart2->setNumPetals(TIMER_02_NUM_PETALS); + mpPart2->realizePetalsOnOff(); + mpPart2->initFallOutAnims(); + mpPart2->initDyingAnims(); + mpPart2->resetSingleAnim(TIMER_02_ANIM_SIREN_SAFE); + mpPart2->enableSafeAnim(); + mLastTime = mActualTime; + if ((mLastTime / 1000) % 2 != 0) { + mpPart2->syncTimeWithSafe(); + field_0x59 = true; + field_0x5C = 2; + } + mStateMgr.changeState(StateID_ChangeSafe); +} + +void dLytMeterTimer_c::gotoSafe() { + mStateMgr.changeState(StateID_Safe); +} + +void dLytMeterTimer_c::gotoChangeFruits6() { + if (mStateMgr.isState(StateID_Siren) || mStateMgr.isState(StateID_Safe)) { + mpPart1->resetBowlNuts(); + mpPart1->updateDropLine(mpPart2->i_getPane()); + mpPart1->startFruitAnim(mpPart1->getField0x780()); + mpPart1->createEffect(mpPart1->getField0x780()); + field_0x54 = false; + field_0x56 = 6; + mStateMgr.changeState(StateID_ChangeFruits); + } +} + +void dLytMeterTimer_c::gotoFruits() { + mStateMgr.changeState(StateID_Fruits); +} + +void dLytMeterTimer_c::startOut() { + mpPart1->stopInAnim(); + mpPart2->stopInAnim(); + mpPart1->startOutAnim(); + mpPart2->startOutAnim(); +} + +void dLytMeterTimer_c::gotoChangeFruits3() { + if (mStateMgr.isState(StateID_Siren) || mStateMgr.isState(StateID_Safe)) { + mpPart2->initBeforeFallAnim(); + mpPart2->setNumPetals(0); + mpPart2->realizePetalsOnOff(); + mpPart2->enableSafeAnim(); + mpPart2->finishSingleAnim(TIMER_02_ANIM_SIREN_SAFE); + mpPart2->resetSingleAnim(TIMER_02_ANIM_BLOOM); + mpPart2->enableBloomAnim(); + field_0x54 = false; + field_0x56 = 3; + mStateMgr.changeState(StateID_ChangeFruits); + } +} + +void dLytMeterTimer_c::startSafe() { + mpPart2->setNumPetals(TIMER_02_NUM_PETALS); + mpPart2->realizePetalsOnOff(); + mpPart2->initFallOutAnims(); + mpPart2->initDyingAnims(); + mpPart2->resetSingleAnim(TIMER_02_ANIM_SIREN_SAFE); + mpPart2->enableSafeAnim(); + mLastTime = mActualTime; + field_0x56 = 4; +} + +void dLytMeterTimer_c::doPickup() { + mpPart1->resetBowlNuts(); + mpPart1->updateDropLine(mpPart2->i_getPane()); + mpPart1->startFruitAnim(mpPart1->getField0x780()); + mpPart1->createEffect(mpPart1->getField0x780()); + field_0x56 = 6; +} + +bool dLytMeterTimer_c::isInSiren() { + if (EventManager::isInEvent()) { + return false; + } + return mStateMgr.isState(StateID_Siren); +} + +s32 dLytMeterTimer_c::getPetalForTimerMaybe(s32 time) { + s32 result = time / 10000; + if (time % 10000 != 0) { + result += 1; + } + if (result <= TIMER_02_NUM_PETALS) { + return result; + } + return TIMER_02_NUM_PETALS; +} + +bool dLytMeterTimer_c::checkForPetalChangeMaybe() { + if (mLastTime - mActualTime > 10000) { + mpPart2->setNumPetals(getPetalForTimerMaybe(mLastTime)); + mLastTime = mActualTime; + return true; + } + return false; +}