diff --git a/config/SOUE01/splits.txt b/config/SOUE01/splits.txt index 8da0a0ef..545fe488 100644 --- a/config/SOUE01/splits.txt +++ b/config/SOUE01/splits.txt @@ -446,7 +446,9 @@ d/lyt/meter/d_lyt_meter_event_skip.cpp: d/lyt/meter/d_lyt_meter_timer.cpp: .text start:0x80105F70 end:0x8010AEB8 .ctors start:0x804DB720 end:0x804DB724 + .rodata start:0x804E6A68 end:0x804E6C28 .data start:0x80519748 end:0x80519F60 + .sdata2 start:0x80579D00 end:0x80579D30 d/lyt/meter/d_lyt_meter_heart.cpp: .text start:0x8010AEC0 end:0x8010BD48 @@ -1008,6 +1010,14 @@ d/lyt/d_lyt_save_mgr.cpp: .text start:0x80284FB0 end:0x80286C88 .ctors start:0x804DB864 end:0x804DB868 +d/lyt/d_lyt_drop_line.cpp: + .text start:0x80286C90 end:0x802884F8 + .ctors start:0x804DB868 end:0x804DB86C + +d/lyt/d_lyt_force_line.cpp: + .text start:0x80288500 end:0x8028A9F8 + .ctors start:0x804DB86C end:0x804DB870 + d/lyt/d_lyt_enemy_icon.cpp: .text start:0x8028AA00 end:0x8028BCD8 .ctors start:0x804DB870 end:0x804DB874 diff --git a/config/SOUE01/symbols.txt b/config/SOUE01/symbols.txt index 89c78c89..4c3abda1 100644 --- a/config/SOUE01/symbols.txt +++ b/config/SOUE01/symbols.txt @@ -4408,7 +4408,7 @@ Timekeeper__ctor = .text:0x800C7880; // type:function size:0x28 Timekeeper__dtorMaybe = .text:0x800C78B0; // type:function size:0x40 fn_800C78F0 = .text:0x800C78F0; // type:function size:0x34 setTime = .text:0x800C7930; // type:function size:0x6C -Timekeeper__getTime = .text:0x800C79A0; // type:function size:0x50 +getTime__10TimekeeperCFv = .text:0x800C79A0; // type:function size:0x50 Timekeeper__setIsCountingUp = .text:0x800C79F0; // type:function size:0x8 fn_800C7A00 = .text:0x800C7A00; // type:function size:0x8 fn_800C7A10 = .text:0x800C7A10; // type:function size:0x8 @@ -6336,62 +6336,62 @@ shouldPromptForSkip__20dLytMeterEventSkip_cCFv = .text:0x80105B00; // type:funct __sinit_\d_lyt_meter_event_skip_cpp = .text:0x80105B40; // type:function size:0x338 scope:local __dt__35sFStateID_c<20dLytMeterEventSkip_c>Fv = .text:0x80105E80; // type:function size:0x58 isSameName__35sFStateID_c<20dLytMeterEventSkip_c>CFPCc = .text:0x80105EE0; // type:function size:0x88 -fn_80105F70 = .text:0x80105F70; // type:function size:0xFC -fn_80106070 = .text:0x80106070; // type:function size:0x58 -fn_801060D0 = .text:0x801060D0; // type:function size:0xB4 -fn_80106190 = .text:0x80106190; // type:function size:0x68 -fn_80106200 = .text:0x80106200; // type:function size:0x74 -fn_80106280 = .text:0x80106280; // type:function size:0x14C -fn_801063D0 = .text:0x801063D0; // type:function size:0xC0 -fn_80106490 = .text:0x80106490; // type:function size:0xC4 -fn_80106560 = .text:0x80106560; // type:function size:0x74 -fn_801065E0 = .text:0x801065E0; // type:function size:0xC0 -fn_801066A0 = .text:0x801066A0; // type:function size:0xBC +build__20LytMeterTimerPart1_cFPQ23d2d10ResAccIf_c = .text:0x80105F70; // type:function size:0xFC +remove__20LytMeterTimerPart1_cFv = .text:0x80106070; // type:function size:0x58 +execute__20LytMeterTimerPart1_cFv = .text:0x801060D0; // type:function size:0xB4 +init__20LytMeterTimerPart1_cFv = .text:0x80106190; // type:function size:0x68 +initInAnim__20LytMeterTimerPart1_cFv = .text:0x80106200; // type:function size:0x74 +initLoopAnim__20LytMeterTimerPart1_cFv = .text:0x80106280; // type:function size:0x14C +initBowlNuts__20LytMeterTimerPart1_cFv = .text:0x801063D0; // type:function size:0xC0 +resetBowlNuts__20LytMeterTimerPart1_cFv = .text:0x80106490; // type:function size:0xC4 +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 -fn_801067F0 = .text:0x801067F0; // type:function size:0x54 -fn_80106850 = .text:0x80106850; // type:function size:0xC +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 -fn_801068A0 = .text:0x801068A0; // type:function size:0x90 -fn_80106930 = .text:0x80106930; // type:function size:0xC -fn_80106940 = .text:0x80106940; // type:function size:0x44 -fn_80106990 = .text:0x80106990; // type:function size:0x5C -fn_801069F0 = .text:0x801069F0; // type:function size:0x80 -fn_80106A70 = .text:0x80106A70; // type:function size:0x8 -fn_80106A80 = .text:0x80106A80; // type:function size:0x44 +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 +isCurrentFruitAnimFinished__20LytMeterTimerPart1_cFv = .text:0x80106990; // type:function size:0x5C +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 -fn_80106C30 = .text:0x80106C30; // type:function size:0x394 -fn_80106FD0 = .text:0x80106FD0; // type:function size:0x108 +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 -fn_80107120 = .text:0x80107120; // type:function size:0xD8 -fn_80107200 = .text:0x80107200; // type:function size:0x58 -fn_80107260 = .text:0x80107260; // type:function size:0xA0 -fn_80107300 = .text:0x80107300; // type:function size:0x90 -fn_80107390 = .text:0x80107390; // type:function size:0x74 -fn_80107410 = .text:0x80107410; // type:function size:0x74 -fn_80107490 = .text:0x80107490; // type:function size:0x74 -fn_80107510 = .text:0x80107510; // type:function size:0x74 -fn_80107590 = .text:0x80107590; // type:function size:0x74 -fn_80107610 = .text:0x80107610; // type:function size:0x74 -fn_80107690 = .text:0x80107690; // type:function size:0x74 -fn_80107710 = .text:0x80107710; // type:function size:0xD0 -fn_801077E0 = .text:0x801077E0; // type:function size:0xD0 -fn_801078B0 = .text:0x801078B0; // type:function size:0x74 -fn_80107930 = .text:0x80107930; // type:function size:0x74 -fn_801079B0 = .text:0x801079B0; // type:function size:0xC0 -fn_80107A70 = .text:0x80107A70; // type:function size:0xC -fn_80107A80 = .text:0x80107A80; // type:function size:0x1C -fn_80107AA0 = .text:0x80107AA0; // type:function size:0xC -fn_80107AB0 = .text:0x80107AB0; // type:function size:0xC -fn_80107AC0 = .text:0x80107AC0; // type:function size:0xC -fn_80107AD0 = .text:0x80107AD0; // type:function size:0x48 -fn_80107B20 = .text:0x80107B20; // type:function size:0x60 -fn_80107B80 = .text:0x80107B80; // type:function size:0x204 -fn_80107D90 = .text:0x80107D90; // type:function size:0xC0 -fn_80107E50 = .text:0x80107E50; // type:function size:0xD4 -fn_80107F30 = .text:0x80107F30; // type:function size:0x54 -fn_80107F90 = .text:0x80107F90; // type:function size:0xC +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 +init__20LytMeterTimerPart2_cFv = .text:0x80107300; // type:function size:0x90 +initInAnim__20LytMeterTimerPart2_cFv = .text:0x80107390; // type:function size:0x74 +initBloomAnim__20LytMeterTimerPart2_cFv = .text:0x80107410; // type:function size:0x74 +initBeforeFallAnim__20LytMeterTimerPart2_cFv = .text:0x80107490; // type:function size:0x74 +initChangeSirenAnim__20LytMeterTimerPart2_cFv = .text:0x80107510; // type:function size:0x74 +initSirenLoopAnim__20LytMeterTimerPart2_cFv = .text:0x80107590; // type:function size:0x74 +initSirenSafeAnim__20LytMeterTimerPart2_cFv = .text:0x80107610; // type:function size:0x74 +initFlowerLoopAnim__20LytMeterTimerPart2_cFv = .text:0x80107690; // type:function size:0x74 +initDyingAnims__20LytMeterTimerPart2_cFv = .text:0x80107710; // type:function size:0xD0 +initFallOutAnims__20LytMeterTimerPart2_cFv = .text:0x801077E0; // type:function size:0xD0 +initOutAnim__20LytMeterTimerPart2_cFv = .text:0x801078B0; // type:function size:0x74 +initChangeFruitAnim__20LytMeterTimerPart2_cFv = .text:0x80107930; // type:function size:0x74 +startInAnim__20LytMeterTimerPart2_cFv = .text:0x801079B0; // type:function size:0xC0 +enableBloomAnim__20LytMeterTimerPart2_cFv = .text:0x80107A70; // type:function size:0xC +enableBeforeFallAnim__20LytMeterTimerPart2_cFv = .text:0x80107A80; // type:function size:0x1C +enableChangeSirenAnim__20LytMeterTimerPart2_cFv = .text:0x80107AA0; // type:function size:0xC +enableSirenLoopAnim__20LytMeterTimerPart2_cFv = .text:0x80107AB0; // type:function size:0xC +enableSafeAnim__20LytMeterTimerPart2_cFv = .text:0x80107AC0; // type:function size:0xC +resumeFlowerLoop__20LytMeterTimerPart2_cFv = .text:0x80107AD0; // type:function size:0x48 +startFlowerLoop__20LytMeterTimerPart2_cFv = .text:0x80107B20; // type:function size:0x60 +syncPetalsTime__20LytMeterTimerPart2_cFv = .text:0x80107B80; // type:function size:0x204 +updatePetalsRate__20LytMeterTimerPart2_cFv = .text:0x80107D90; // type:function size:0xC0 +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 @@ -6421,34 +6421,34 @@ 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 -fn_80108A80 = .text:0x80108A80; // type:function size:0x88 +realizePetalsOnOff__20LytMeterTimerPart2_cFv = .text:0x80108A80; // type:function size:0x88 fn_80108B10 = .text:0x80108B10; // type:function size:0x5C -fn_80108B70 = .text:0x80108B70; // type:function size:0x5C +resetSingleAnim__20LytMeterTimerPart2_cFUc = .text:0x80108B70; // type:function size:0x5C fn_80108BD0 = .text:0x80108BD0; // type:function size:0x14 -fn_80108BF0 = .text:0x80108BF0; // type:function size:0x284 +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 -LytMeterTimer__stateChangeSirenEnter = .text:0x80109020; // type:function size:0x4 -LytMeterTimer__stateChangeSirenUpdate = .text:0x80109030; // type:function size:0x204 -LytMeterTimer__stateChangeSirenLeave = .text:0x80109240; // type:function size:0x4 -LytMeterTimer__stateSirenEnter = .text:0x80109250; // type:function size:0x4 -LytMeterTimer__stateSirenUpdate = .text:0x80109260; // type:function size:0xC8 -LytMeterTimer__stateSirenLeave = .text:0x80109330; // type:function size:0x4 -LytMeterTimer__stateSafeBloomEnter = .text:0x80109340; // type:function size:0x4 -LytMeterTimer__stateSafeBloomUpdate = .text:0x80109350; // type:function size:0xB8 -LytMeterTimer__stateSafeBloomLeave = .text:0x80109410; // type:function size:0x4 -LytMeterTimer__stateChangeSafeEnter = .text:0x80109420; // type:function size:0x4 -LytMeterTimer__stateChangeSafeUpdate = .text:0x80109430; // type:function size:0x118 -LytMeterTimer__stateChangeSafeLeave = .text:0x80109550; // type:function size:0x4 -LytMeterTimer__stateSafeEnter = .text:0x80109560; // type:function size:0x4 -LytMeterTimer__stateSafeUpdate = .text:0x80109570; // type:function size:0x280 -LytMeterTimer__stateSafeLeave = .text:0x801097F0; // type:function size:0x4 -LytMeterTimer__stateChangeFruitsEnter = .text:0x80109800; // type:function size:0x4 -LytMeterTimer__stateChangeFruitsUpdate = .text:0x80109810; // type:function size:0x218 -LytMeterTimer__stateChangeFruitsLeave = .text:0x80109A30; // type:function size:0x4 -LytMeterTimer__stateFruitsEnter = .text:0x80109A40; // type:function size:0xC -LytMeterTimer__stateFruitsUpdate = .text:0x80109A50; // type:function size:0x68 -LytMeterTimer__stateFruitsLeave = .text:0x80109AC0; // type:function size:0x4 +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 +initializeState_Siren__16dLytMeterTimer_cFv = .text:0x80109250; // type:function size:0x4 +executeState_Siren__16dLytMeterTimer_cFv = .text:0x80109260; // type:function size:0xC8 +finalizeState_Siren__16dLytMeterTimer_cFv = .text:0x80109330; // type:function size:0x4 +initializeState_ChangeSafeBloom__16dLytMeterTimer_cFv = .text:0x80109340; // type:function size:0x4 +executeState_ChangeSafeBloom__16dLytMeterTimer_cFv = .text:0x80109350; // type:function size:0xB8 +finalizeState_ChangeSafeBloom__16dLytMeterTimer_cFv = .text:0x80109410; // type:function size:0x4 +initializeState_ChangeSafe__16dLytMeterTimer_cFv = .text:0x80109420; // type:function size:0x4 +executeState_ChangeSafe__16dLytMeterTimer_cFv = .text:0x80109430; // type:function size:0x118 +finalizeState_ChangeSafe__16dLytMeterTimer_cFv = .text:0x80109550; // type:function size:0x4 +initializeState_Safe__16dLytMeterTimer_cFv = .text:0x80109560; // type:function size:0x4 +executeState_Safe__16dLytMeterTimer_cFv = .text:0x80109570; // type:function size:0x280 +finalizeState_Safe__16dLytMeterTimer_cFv = .text:0x801097F0; // type:function size:0x4 +initializeState_ChangeFruits__16dLytMeterTimer_cFv = .text:0x80109800; // type:function size:0x4 +executeState_ChangeFruits__16dLytMeterTimer_cFv = .text:0x80109810; // type:function size:0x218 +finalizeState_ChangeFruits__16dLytMeterTimer_cFv = .text:0x80109A30; // type:function size:0x4 +initializeState_Fruits__16dLytMeterTimer_cFv = .text:0x80109A40; // type:function size:0xC +executeState_Fruits__16dLytMeterTimer_cFv = .text:0x80109A50; // type:function size:0x68 +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 @@ -13395,7 +13395,7 @@ AcItem__getItemId = .text:0x8024A2B0; // type:function size:0x8 AcItem__getTearNumber = .text:0x8024A2C0; // type:function size:0xC getFirstBitParams2 = .text:0x8024A2D0; // type:function size:0x24 getParams2Lower_shift1_0x7 = .text:0x8024A300; // type:function size:0x24 -getTrialIndex1 = .text:0x8024A330; // type:function size:0x68 +getCurrentTrial__9dAcItem_cFv = .text:0x8024A330; // type:function size:0x68 getTearSubtype = .text:0x8024A3A0; // type:function size:0x68 AcItem__GetItemGetType = .text:0x8024A410; // type:function size:0x3C AcItem__getItemListElement = .text:0x8024A450; // type:function size:0x8 @@ -15099,8 +15099,8 @@ 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 -fn_80287B20 = .text:0x80287B20; // type:function size:0x1C -fn_80287B40 = .text:0x80287B40; // 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 fn_80287BC0 = .text:0x80287BC0; // type:function size:0x50 fn_80287C10 = .text:0x80287C10; // type:function size:0x50 @@ -40186,7 +40186,7 @@ sInstance__19GoddessChestCounter = .sbss:0x805756A8; // type:object size:0x8 dat sInstance__9dScBoot_c = .sbss:0x805756B0; // type:object size:0x4 data:4byte lbl_805756B4 = .sbss:0x805756B4; // type:object size:0x4 data:4byte TITLE_SCREEN_CHANGE = .sbss:0x805756B8; // type:object size:0x4 data:4byte -SIREN_TAG = .sbss:0x805756BC; // type:object size:0x4 data:4byte +sInstance__10dTgSiren_c = .sbss:0x805756BC; // type:object size:0x4 data:4byte WEATHER_TAG = .sbss:0x805756C0; // type:object size:0x8 data:4byte StreamTList = .sbss:0x805756C8; // type:object size:0x8 data:4byte SandStreamTList = .sbss:0x805756D0; // type:object size:0x8 data:4byte diff --git a/include/d/a/d_a_item.h b/include/d/a/d_a_item.h index b5e28d15..c3c44663 100644 --- a/include/d/a/d_a_item.h +++ b/include/d/a/d_a_item.h @@ -70,6 +70,15 @@ public: static void itemGetEventStart(dAcBase_c *); static void itemGetEventEnd(dAcBase_c *); + enum Trial_e { + TRIAL_SKYLOFT, + TRIAL_FARON, + TRIAL_ELDIN, + TRIAL_LANAYRU, + }; + + static Trial_e getCurrentTrial(); + static void healLink(u32 amount, bool); // move to dAcPy_c private: diff --git a/include/d/lyt/d2d.h b/include/d/lyt/d2d.h index eaeefae2..cc090009 100644 --- a/include/d/lyt/d2d.h +++ b/include/d/lyt/d2d.h @@ -258,6 +258,10 @@ struct AnmGroupBase_c { mpFrameCtrl->setFlags(FLAG_NO_LOOP); } + inline void setForwardLoop() { + mpFrameCtrl->setFlags(0); + } + inline void setToStart() { m2d::FrameCtrl_c &ctrl = *mpFrameCtrl; ctrl.setCurrFrame(ctrl.getStartFrame()); diff --git a/include/d/lyt/d_lyt_drop_line.h b/include/d/lyt/d_lyt_drop_line.h new file mode 100644 index 00000000..4b96ff5e --- /dev/null +++ b/include/d/lyt/d_lyt_drop_line.h @@ -0,0 +1,27 @@ +#ifndef D_LYT_DROP_LINE_H +#define D_LYT_DROP_LINE_H + +#include "common.h" +#include "nw4r/lyt/lyt_pane.h" + +class dLytDropLine_c { +public: + dLytDropLine_c() { + sInstance = this; + } + virtual ~dLytDropLine_c() { + sInstance = nullptr; + } + + static dLytDropLine_c *GetInstance() { + return sInstance; + } + + static nw4r::lyt::Pane *getActivePane(); + static nw4r::lyt::Pane *setPane(nw4r::lyt::Pane *pane); + +private: + static dLytDropLine_c *sInstance; +}; + +#endif diff --git a/include/d/lyt/meter/d_lyt_meter_timer.h b/include/d/lyt/meter/d_lyt_meter_timer.h index 6e4fe817..9eef832b 100644 --- a/include/d/lyt/meter/d_lyt_meter_timer.h +++ b/include/d/lyt/meter/d_lyt_meter_timer.h @@ -1,8 +1,10 @@ #ifndef D_LYT_METER_TIMER_H #define D_LYT_METER_TIMER_H +#include "d/a/d_a_item.h" #include "d/lyt/d2d.h" #include "m/m_color.h" +#include "nw4r/lyt/lyt_pane.h" #include "s/s_State.hpp" class LytMeterTimerPart1_c : public d2d::dSubPane { @@ -13,21 +15,60 @@ public: virtual bool build(d2d::ResAccIf_c *resAcc) override; virtual bool remove() override; virtual bool execute() override; - virtual nw4r::lyt::Pane *getPane() override; - virtual d2d::LytBase_c *getLyt() override; - virtual const char *getName() const override; + virtual nw4r::lyt::Pane *getPane() override { + return mLyt.getLayout()->GetRootPane(); + } + virtual d2d::LytBase_c *getLyt() override { + return &mLyt; + } + virtual const char *getName() const override { + return mLyt.getName(); + } virtual ~LytMeterTimerPart1_c() { sInstance = nullptr; } - static LytMeterTimerPart1_c *sInstance; + static LytMeterTimerPart1_c *GetInstance() { + return sInstance; + } + + void init(); + void startInAnim(); + void realizeTrial(); + + void startOutAnim(); + void stopInAnim(); + void stopFinishedFruit(); + void stopOutAnim(); + bool isInAnimFinished(); + bool isCurrentFruitAnimFinished(); + bool isAnyFruitAnimFinished(); + bool isLastFruitAnimFinished(); + bool isOutAnimFinished(); + + void createEffect(s32 fruitIndex); + private: + void initLoopAnim(); + void initBowlNuts(); + void resetBowlNuts(); + void initOutAnim(); + void initColors(); + void initInAnim(); + + static LytMeterTimerPart1_c *sInstance; + /* 0x008 */ d2d::dLytSub mLyt; - /* 0x09C */ d2d::AnmGroup_c mAnmGroups[26]; - /* 0x71C */ u8 field_0x71C[0x768 - 0x71C]; + /* 0x09C */ d2d::AnmGroup_c mAnm[26]; + /* 0x71C */ s32 mActualTearCount; + /* 0x720 */ u8 _0x720[0x724 - 0x720]; + /* 0x724 */ nw4r::lyt::Pane *mpPanes[15]; + /* 0x760 */ s32 field_0x760; + /* 0x764 */ dAcItem_c::Trial_e mTrial; /* 0x768 */ mColor mColors1[3]; /* 0x774 */ mColor mColors2[3]; + /* 0x780 */ s32 field_0x780; }; class LytMeterTimerPart2_c : public d2d::dSubPane { @@ -38,21 +79,73 @@ public: virtual bool build(d2d::ResAccIf_c *resAcc) override; virtual bool remove() override; virtual bool execute() override; - virtual nw4r::lyt::Pane *getPane() override; - virtual d2d::LytBase_c *getLyt() override; - virtual const char *getName() const override; + virtual nw4r::lyt::Pane *getPane() override { + return mLyt.getLayout()->GetRootPane(); + } + virtual d2d::LytBase_c *getLyt() override { + return &mLyt; + } + virtual const char *getName() const override { + return mLyt.getName(); + } virtual ~LytMeterTimerPart2_c() { sInstance = nullptr; } - static LytMeterTimerPart2_c *sInstance; + static LytMeterTimerPart2_c *GetInstance() { + return sInstance; + } + + void setNumPetals(s32 num) { + mNumPetals = num; + } + + void init(); + void initDyingAnims(); + void initFallOutAnims(); + void realizePetalsOnOff(); + void syncPetalsTime(); + void updatePetalsRate(); + void restartPetals(); + void resetSingleAnim(u8 idx); + + void startInAnim(); + void startOutAnim(); + + void enableChangeFruitAnim(); + + void enableBloomAnim(); + void enableBeforeFallAnim(); + void enableChangeSirenAnim(); + void enableSirenLoopAnim(); + void enableSafeAnim(); + void resumeFlowerLoop(); + void startFlowerLoop(); + private: + void initBloomAnim(); + void initBeforeFallAnim(); + void initChangeSirenAnim(); + void initSirenLoopAnim(); + void initSirenSafeAnim(); + void initFlowerLoopAnim(); + void initOutAnim(); + void initInAnim(); + void initChangeFruitAnim(); + void initColors(); + + static LytMeterTimerPart2_c *sInstance; + /* 0x008 */ d2d::dLytSub mLyt; - /* 0x09C */ d2d::AnmGroup_c mAnmGroups[30]; - /* 0x81C */ u8 field_0x81C[0x828 - 0x81C]; + /* 0x09C */ d2d::AnmGroup_c mAnm[30]; + /* 0x81C */ s32 mNumPetals; + /* 0x820 */ nw4r::lyt::Pane *mpPane; + /* 0x824 */ dAcItem_c::Trial_e mTrial; /* 0x828 */ mColor mColors1[2]; /* 0x830 */ mColor mColors2[2]; + /* 0x838 */ u8 mVisible; + /* 0x83C */ f32 mFlowerLoopFrame; }; class dLytMeterTimer_c { @@ -61,6 +154,7 @@ public: virtual ~dLytMeterTimer_c() {} bool build(); bool remove(); + private: STATE_FUNC_DECLARE(dLytMeterTimer_c, ChangeSiren); STATE_FUNC_DECLARE(dLytMeterTimer_c, Siren); @@ -70,7 +164,15 @@ private: STATE_FUNC_DECLARE(dLytMeterTimer_c, ChangeFruits); STATE_FUNC_DECLARE(dLytMeterTimer_c, Fruits); - UI_STATE_MGR_DECLARE(dLytMeterTimer_c); + static bool sDoExit; + static bool sDoFinishAnim; + static bool sFinished; + + /* 0x04 */ UI_STATE_MGR_DECLARE(dLytMeterTimer_c); + /* 0x40 */ LytMeterTimerPart1_c *mpPart1; + /* 0x44 */ LytMeterTimerPart2_c *mpPart2; + /* 0x48 */ u8 _0x48[0x60 - 0x48]; + /* 0x60 */ s32 field_0x60; }; #endif diff --git a/include/d/t/d_t_siren.h b/include/d/t/d_t_siren.h index 935e3217..9fe12a74 100644 --- a/include/d/t/d_t_siren.h +++ b/include/d/t/d_t_siren.h @@ -3,6 +3,7 @@ #include "common.h" #include "d/t/d_tg.h" +#include "toBeSorted/timekeeper.h" class dTgSiren_c : public dTg_c { public: @@ -16,10 +17,20 @@ public: return sInstance->outOfTime(); } + static s32 getTime() { + if (sInstance == nullptr) { + return -1; + } + return sInstance->mTimekeeper.getTime(); + } + private: bool outOfTime() const; static dTgSiren_c *sInstance; + + /* 0x0FC */ u8 _0x0FC[0x2C0 - 0x0FC]; + /* 0x2C0 */ Timekeeper mTimekeeper; }; #endif diff --git a/include/toBeSorted/timekeeper.h b/include/toBeSorted/timekeeper.h new file mode 100644 index 00000000..1bf6d842 --- /dev/null +++ b/include/toBeSorted/timekeeper.h @@ -0,0 +1,11 @@ +#ifndef TIMEKEEPER_H +#define TIMEKEEPER_H + +#include "common.h" + +class Timekeeper { +public: + s32 getTime() const; +}; + +#endif diff --git a/src/d/lyt/meter/d_lyt_meter_timer.cpp b/src/d/lyt/meter/d_lyt_meter_timer.cpp index 91a216dc..31aae230 100644 --- a/src/d/lyt/meter/d_lyt_meter_timer.cpp +++ b/src/d/lyt/meter/d_lyt_meter_timer.cpp @@ -1,5 +1,15 @@ #include "d/lyt/meter/d_lyt_meter_timer.h" +#include "common.h" +#include "d/a/d_a_item.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/math/math_types.h" +#include "toBeSorted/effects_struct.h" + STATE_DEFINE(dLytMeterTimer_c, ChangeSiren); STATE_DEFINE(dLytMeterTimer_c, Siren); STATE_DEFINE(dLytMeterTimer_c, ChangeSafeBloom); @@ -7,3 +17,729 @@ STATE_DEFINE(dLytMeterTimer_c, ChangeSafe); STATE_DEFINE(dLytMeterTimer_c, Safe); STATE_DEFINE(dLytMeterTimer_c, ChangeFruits); STATE_DEFINE(dLytMeterTimer_c, Fruits); + +static const d2d::LytBrlanMapping brlanMapPart1[] = { + { "timer_01_in.brlan", "G_inOut_00"}, + {"timer_01_mapPosition.brlan", "G_inOut_00"}, + { "timer_01_Loop.brlan", "G_nutLoop_00"}, + { "timer_01_Loop2.brlan", "G_nutLoop_00"}, + { "timer_01_Loop3.brlan", "G_nutLoop_00"}, + { "timer_01_Loop4.brlan", "G_nutLoop_00"}, + { "timer_01_Loop.brlan", "G_bowlLoop_00"}, + { "timer_01_Loop2.brlan", "G_bowlLoop_00"}, + { "timer_01_Loop3.brlan", "G_bowlLoop_00"}, + { "timer_01_Loop4.brlan", "G_bowlLoop_00"}, + { "timer_01_bowlNut.brlan", "G_nut_00"}, + { "timer_01_bowlNut.brlan", "G_nut_01"}, + { "timer_01_bowlNut.brlan", "G_nut_02"}, + { "timer_01_bowlNut.brlan", "G_nut_03"}, + { "timer_01_bowlNut.brlan", "G_nut_04"}, + { "timer_01_bowlNut.brlan", "G_nut_05"}, + { "timer_01_bowlNut.brlan", "G_nut_06"}, + { "timer_01_bowlNut.brlan", "G_nut_07"}, + { "timer_01_bowlNut.brlan", "G_nut_08"}, + { "timer_01_bowlNut.brlan", "G_nut_09"}, + { "timer_01_bowlNut.brlan", "G_nut_10"}, + { "timer_01_bowlNut.brlan", "G_nut_11"}, + { "timer_01_bowlNut.brlan", "G_nut_12"}, + { "timer_01_bowlNut.brlan", "G_nut_13"}, + { "timer_01_bowlNut.brlan", "G_nut_14"}, + { "timer_01_out.brlan", "G_inOut_00"}, +}; + +#define TIMER_01_ANIM_IN 0 +#define TIMER_01_ANIM_MAP_POSITION 1 +#define TIMER_01_ANIM_NUT_LOOP_OFFSET 2 +#define TIMER_01_ANIM_BOWL_LOOP_OFFSET 6 +#define TIMER_01_ANIM_BOWL_NUT_OFFSET 10 +#define TIMER_01_ANIM_OUT 25 + +#define TIMER_01_NUM_ANIMS 26 + +#define TIMER_01_COLOR_00_CIRCLE 0 +#define TIMER_01_COLOR_00_SHADOW 1 +#define TIMER_01_COLOR_00_RAINBOW_CIRCLE 2 + +#define TIMER_01_COLOR_01_CIRCLE 0 +#define TIMER_01_COLOR_01_SHADOW 1 +#define TIMER_01_COLOR_01_RAINBOW_CIRCLE 2 + +#define TIMER_01_NUM_TRIALS 4 + +static const char *sPaneNamesPart1[] = { + "N_bowlNut_00", "N_bowlNut_01", "N_bowlNut_02", "N_bowlNut_03", "N_bowlNut_04", + "N_bowlNut_05", "N_bowlNut_06", "N_bowlNut_07", "N_bowlNut_08", "N_bowlNut_09", + "N_bowlNut_10", "N_bowlNut_11", "N_bowlNut_12", "N_bowlNut_13", "N_bowlNut_14", +}; + +#define TIMER_01_NUM_TEARS 15 + +bool LytMeterTimerPart1_c::build(d2d::ResAccIf_c *resAcc) { + mLyt.build("timer_01.brlyt", resAcc); + mLyt.setPriority(0x8A); + + for (int i = 0; i < TIMER_01_NUM_ANIMS; i++) { + mAnm[i].init(brlanMapPart1[i].mFile, resAcc, mLyt.getLayout(), brlanMapPart1[i].mName); + mAnm[i].bind(false); + mAnm[i].setRate(1.0f); + mAnm[i].setAnimEnable(false); + } + + for (int i = 0; i < TIMER_01_NUM_TEARS; i++) { + mpPanes[i] = mLyt.findPane(sPaneNamesPart1[i]); + } + return true; +} + +bool LytMeterTimerPart1_c::remove() { + for (int i = 0; i < TIMER_01_NUM_ANIMS; i++) { + mAnm[i].unbind(); + mAnm[i].remove(); + } + return true; +} + +bool LytMeterTimerPart1_c::execute() { + if (dLytDropLine_c::getActivePane() == nullptr) { + dLytDropLine_c::setPane(mpPanes[field_0x760]); + } + for (int i = 0; i < TIMER_01_NUM_ANIMS; i++) { + if (mAnm[i].isEnabled()) { + mAnm[i].play(); + } + } + mLyt.calc(); + return true; +} + +void LytMeterTimerPart1_c::init() { + mTrial = dAcItem_c::getCurrentTrial(); + initLoopAnim(); + initBowlNuts(); + initOutAnim(); + initColors(); + initInAnim(); + field_0x760 = 0; + dLytDropLine_c::setPane(mpPanes[field_0x760]); +} + +void LytMeterTimerPart1_c::initInAnim() { + mAnm[TIMER_01_ANIM_IN].setForwardOnce(); + mAnm[TIMER_01_ANIM_IN].setFrame(0.0f); + mAnm[TIMER_01_ANIM_IN].setAnimEnable(true); + mLyt.calc(); + mAnm[TIMER_01_ANIM_IN].setAnimEnable(false); +} + +void LytMeterTimerPart1_c::initLoopAnim() { + for (u8 i = 0; i < TIMER_01_NUM_TRIALS; i++) { + if (i == mTrial) { + mAnm[i + TIMER_01_ANIM_BOWL_LOOP_OFFSET].setForwardLoop(); + mAnm[i + TIMER_01_ANIM_BOWL_LOOP_OFFSET].setFrame(0.0f); + mAnm[i + TIMER_01_ANIM_BOWL_LOOP_OFFSET].setAnimEnable(true); + mLyt.calc(); + mAnm[i + TIMER_01_ANIM_BOWL_LOOP_OFFSET].setAnimEnable(false); + + mAnm[i + TIMER_01_ANIM_NUT_LOOP_OFFSET].setForwardLoop(); + mAnm[i + TIMER_01_ANIM_NUT_LOOP_OFFSET].setFrame(0.0f); + mAnm[i + TIMER_01_ANIM_NUT_LOOP_OFFSET].setAnimEnable(true); + mLyt.calc(); + mAnm[i + TIMER_01_ANIM_NUT_LOOP_OFFSET].setAnimEnable(false); + } else { + mAnm[i + TIMER_01_ANIM_BOWL_LOOP_OFFSET].setAnimEnable(false); + mAnm[i + TIMER_01_ANIM_NUT_LOOP_OFFSET].setAnimEnable(false); + } + } +} + +void LytMeterTimerPart1_c::initBowlNuts() { + for (int i = 0; i < TIMER_01_NUM_TEARS; i++) { + mAnm[i + TIMER_01_ANIM_BOWL_NUT_OFFSET].setForwardOnce(); + mAnm[i + TIMER_01_ANIM_BOWL_NUT_OFFSET].setFrame(0.0f); + mAnm[i + TIMER_01_ANIM_BOWL_NUT_OFFSET].setAnimEnable(true); + } + mLyt.calc(); + for (int i = 0; i < TIMER_01_NUM_TEARS; i++) { + mAnm[i + TIMER_01_ANIM_BOWL_NUT_OFFSET].setAnimEnable(false); + } +} + +void LytMeterTimerPart1_c::resetBowlNuts() { + for (int i = 0; i < TIMER_01_NUM_TEARS; i++) { + mAnm[i + TIMER_01_ANIM_BOWL_NUT_OFFSET].setBackwardsOnce(); + mAnm[i + TIMER_01_ANIM_BOWL_NUT_OFFSET].setToStart(); + mAnm[i + TIMER_01_ANIM_BOWL_NUT_OFFSET].setAnimEnable(true); + } + mLyt.calc(); + for (int i = 0; i < TIMER_01_NUM_TEARS; i++) { + mAnm[i + TIMER_01_ANIM_BOWL_NUT_OFFSET].setAnimEnable(false); + } +} + +void LytMeterTimerPart1_c::initOutAnim() { + mAnm[TIMER_01_ANIM_OUT].setForwardOnce(); + mAnm[TIMER_01_ANIM_OUT].setFrame(0.0f); + mAnm[TIMER_01_ANIM_OUT].setAnimEnable(true); + mLyt.calc(); + mAnm[TIMER_01_ANIM_OUT].setAnimEnable(false); +} + +void LytMeterTimerPart1_c::startInAnim() { + if (dLytMeterContainer_c::GetMeter()->fn_800D5650()) { + mAnm[TIMER_01_ANIM_MAP_POSITION].setFrame(1.0f); + } else { + mAnm[TIMER_01_ANIM_MAP_POSITION].setFrame(0.0f); + } + mAnm[TIMER_01_ANIM_MAP_POSITION].setAnimEnable(true); + mLyt.calc(); + mAnm[TIMER_01_ANIM_MAP_POSITION].setAnimEnable(false); + + mAnm[TIMER_01_ANIM_IN].setToStart(); + mAnm[TIMER_01_ANIM_IN].setAnimEnable(true); +} + +void LytMeterTimerPart1_c::realizeTrial() { + switch (mTrial) { + case dAcItem_c::TRIAL_ELDIN: + mAnm[0 + TIMER_01_ANIM_NUT_LOOP_OFFSET].setAnimEnable(true); + mAnm[0 + TIMER_01_ANIM_BOWL_LOOP_OFFSET].setAnimEnable(true); + break; + case dAcItem_c::TRIAL_FARON: + mAnm[1 + TIMER_01_ANIM_NUT_LOOP_OFFSET].setAnimEnable(true); + mAnm[1 + TIMER_01_ANIM_BOWL_LOOP_OFFSET].setAnimEnable(true); + break; + case dAcItem_c::TRIAL_SKYLOFT: + mAnm[2 + TIMER_01_ANIM_NUT_LOOP_OFFSET].setAnimEnable(true); + mAnm[2 + TIMER_01_ANIM_BOWL_LOOP_OFFSET].setAnimEnable(true); + break; + case dAcItem_c::TRIAL_LANAYRU: + mAnm[3 + TIMER_01_ANIM_NUT_LOOP_OFFSET].setAnimEnable(true); + mAnm[3 + TIMER_01_ANIM_BOWL_LOOP_OFFSET].setAnimEnable(true); + break; + } +} + +void LytMeterTimerPart1_c::startOutAnim() { + mAnm[TIMER_01_ANIM_OUT].setToStart(); + mAnm[TIMER_01_ANIM_OUT].setAnimEnable(true); +} + +void LytMeterTimerPart1_c::stopInAnim() { + mAnm[TIMER_01_ANIM_IN].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()) { + mAnm[i + TIMER_01_ANIM_BOWL_NUT_OFFSET].setAnimEnable(false); + return; + } + } +} + +void LytMeterTimerPart1_c::stopOutAnim() { + mAnm[TIMER_01_ANIM_OUT].setAnimEnable(false); +} + +bool LytMeterTimerPart1_c::isInAnimFinished() { + if (mAnm[TIMER_01_ANIM_IN].isEnabled() && mAnm[TIMER_01_ANIM_IN].isEndReached()) { + return true; + } + return false; +} + +bool LytMeterTimerPart1_c::isCurrentFruitAnimFinished() { + if (mActualTearCount > 0 && mAnm[mActualTearCount - 1 + TIMER_01_ANIM_BOWL_NUT_OFFSET].isEnabled() && + mAnm[mActualTearCount - 1 + TIMER_01_ANIM_BOWL_NUT_OFFSET].isStop2()) { + return true; + } + return false; +} + +bool LytMeterTimerPart1_c::isAnyFruitAnimFinished() { + 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()) { + return true; + } + } + return false; +} + +bool LytMeterTimerPart1_c::isLastFruitAnimFinished() { + return mAnm[TIMER_01_ANIM_BOWL_NUT_OFFSET + TIMER_01_NUM_TEARS - 1].isStop2(); +} + +bool LytMeterTimerPart1_c::isOutAnimFinished() { + if (mAnm[TIMER_01_ANIM_OUT].isEnabled() && mAnm[TIMER_01_ANIM_OUT].isEndReached()) { + return true; + } + 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] + ); +} + +void LytMeterTimerPart1_c::initColors() { + switch (mTrial) { + case dAcItem_c::TRIAL_ELDIN: + mColors1[TIMER_01_COLOR_00_CIRCLE] = mColor(0xFF, 0xFF, 0x80, 0xFF); + mColors1[TIMER_01_COLOR_00_SHADOW] = mColor(0xFF, 0xFF, 0xC8, 0xFF); + mColors1[TIMER_01_COLOR_00_RAINBOW_CIRCLE] = mColor(0xFF, 0xFF, 0xFF, 0xFF); + mColors2[TIMER_01_COLOR_01_CIRCLE] = mColor(0xFF, 0xFF, 0x00, 0xFF); + mColors2[TIMER_01_COLOR_01_SHADOW] = mColor(0xFF, 0xFF, 0x40, 0xFF); + mColors2[TIMER_01_COLOR_01_RAINBOW_CIRCLE] = mColor(0xFF, 0xFF, 0xFF, 0xFF); + break; + case dAcItem_c::TRIAL_FARON: + mColors1[TIMER_01_COLOR_00_CIRCLE] = mColor(0xFF, 0x80, 0xA0, 0xFF); + mColors1[TIMER_01_COLOR_00_SHADOW] = mColor(0xFF, 0xC8, 0xC8, 0xFF); + mColors1[TIMER_01_COLOR_00_RAINBOW_CIRCLE] = mColor(0xFF, 0xFF, 0xFF, 0xFF); + mColors2[TIMER_01_COLOR_01_CIRCLE] = mColor(0xFF, 0x40, 0x80, 0xFF); + mColors2[TIMER_01_COLOR_01_SHADOW] = mColor(0xFF, 0x40, 0x80, 0xFF); + mColors2[TIMER_01_COLOR_01_RAINBOW_CIRCLE] = mColor(0xFF, 0xFF, 0xFF, 0xFF); + break; + case dAcItem_c::TRIAL_SKYLOFT: + mColors1[TIMER_01_COLOR_00_CIRCLE] = mColor(0x80, 0xFF, 0x80, 0xFF); + mColors1[TIMER_01_COLOR_00_SHADOW] = mColor(0xC8, 0xFF, 0xC8, 0xFF); + mColors1[TIMER_01_COLOR_00_RAINBOW_CIRCLE] = mColor(0xFF, 0xFF, 0xFF, 0xFF); + mColors2[TIMER_01_COLOR_01_CIRCLE] = mColor(0x00, 0xFF, 0x40, 0xFF); + mColors2[TIMER_01_COLOR_01_SHADOW] = mColor(0x40, 0xFF, 0x40, 0xFF); + mColors2[TIMER_01_COLOR_01_RAINBOW_CIRCLE] = mColor(0xFF, 0xFF, 0xFF, 0xFF); + break; + case dAcItem_c::TRIAL_LANAYRU: + mColors1[TIMER_01_COLOR_00_CIRCLE] = mColor(0x80, 0xFF, 0xFF, 0xFF); + mColors1[TIMER_01_COLOR_00_SHADOW] = mColor(0xC8, 0xC8, 0xFF, 0xFF); + mColors1[TIMER_01_COLOR_00_RAINBOW_CIRCLE] = mColor(0xFF, 0xFF, 0xFF, 0xFF); + mColors2[TIMER_01_COLOR_01_CIRCLE] = mColor(0x00, 0x80, 0xFF, 0xFF); + mColors2[TIMER_01_COLOR_01_SHADOW] = mColor(0x40, 0xA0, 0xFF, 0xFF); + mColors2[TIMER_01_COLOR_01_RAINBOW_CIRCLE] = mColor(0xFF, 0xFF, 0xFF, 0xFF); + break; + } +} + +static const d2d::LytBrlanMapping brlanMapPart2[] = { + { "timer_02_in.brlan", "G_inOut_00"}, + {"timer_02_mapPosition.brlan", "G_inOut_00"}, + { "timer_02_dying.brlan", "G_fall_08"}, + { "timer_02_dying.brlan", "G_fall_07"}, + { "timer_02_dying.brlan", "G_fall_06"}, + { "timer_02_dying.brlan", "G_fall_05"}, + { "timer_02_dying.brlan", "G_fall_04"}, + { "timer_02_dying.brlan", "G_fall_03"}, + { "timer_02_dying.brlan", "G_fall_02"}, + { "timer_02_dying.brlan", "G_fall_01"}, + { "timer_02_dying.brlan", "G_fall_00"}, + { "timer_02_fallOut.brlan", "G_fall_08"}, + { "timer_02_fallOut.brlan", "G_fall_07"}, + { "timer_02_fallOut.brlan", "G_fall_06"}, + { "timer_02_fallOut.brlan", "G_fall_05"}, + { "timer_02_fallOut.brlan", "G_fall_04"}, + { "timer_02_fallOut.brlan", "G_fall_03"}, + { "timer_02_fallOut.brlan", "G_fall_02"}, + { "timer_02_fallOut.brlan", "G_fall_01"}, + { "timer_02_fallOut.brlan", "G_fall_00"}, + {"timer_02_changeFruit.brlan", "G_fruitsAll_00"}, + {"timer_02_fruitsColor.brlan", "G_fruitsAll_00"}, + { "timer_02_petalOnOff.brlan", "G_petalOnOff_00"}, + { "timer_02_bloom.brlan", "G_bloom_00"}, + { "timer_02_beforeFall.brlan", "G_beforeFall_00"}, + {"timer_02_changeSiren.brlan", "G_change_00"}, + { "timer_02_sirenLoop.brlan", "G_sirenLoop_00"}, + { "timer_02_changeSafe.brlan", "G_change_00"}, + { "timer_02_Loop.brlan", "G_flowreLoop_00"}, + { "timer_02_out.brlan", "G_inOut_00"}, +}; + +#define TIMER_02_ANIM_IN 0 +#define TIMER_02_ANIM_MAP_POSITION 1 +#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_PETAL_ONOFF 22 +#define TIMER_02_ANIM_BLOOM 23 +#define TIMER_02_ANIM_BEFORE_FALL 24 +#define TIMER_02_ANIM_CHANGE_SIREN 25 +#define TIMER_02_ANIM_SIREN_LOOP 26 +#define TIMER_02_ANIM_SIREN_SAFE 27 +#define TIMER_02_ANIM_FLOWER_LOOP 28 +#define TIMER_02_ANIM_OUT 29 + +#define TIMER_02_NUM_ANIMS 30 + +static const char *sPaneNamePart2 = "N_flowerAll_00"; + +#define TIMER_02_NUM_PETALS 9 + +#define TIMER_02_COLOR_00_00 0 +#define TIMER_02_COLOR_00_01 1 + +#define TIMER_02_COLOR_01_00 0 +#define TIMER_02_COLOR_01_01 1 + +bool LytMeterTimerPart2_c::build(d2d::ResAccIf_c *resAcc) { + mLyt.build("timer_02.brlyt", resAcc); + mLyt.setPriority(0x8A); + + for (int i = 0; i < TIMER_02_NUM_ANIMS; i++) { + mAnm[i].init(brlanMapPart2[i].mFile, resAcc, mLyt.getLayout(), brlanMapPart2[i].mName); + mAnm[i].bind(false); + mAnm[i].setRate(1.0f); + mAnm[i].setAnimEnable(false); + } + + mpPane = mLyt.findPane(sPaneNamePart2); + + return true; +} + +bool LytMeterTimerPart2_c::remove() { + for (int i = 0; i < TIMER_02_NUM_ANIMS; i++) { + mAnm[i].unbind(); + mAnm[i].remove(); + } + return true; +} + +bool LytMeterTimerPart2_c::execute() { + if (mVisible) { + for (int i = 0; i < TIMER_02_NUM_ANIMS; i++) { + if (mAnm[i].isEnabled()) { + mAnm[i].play(); + } + } + mLyt.calc(); + } + return true; +} + +void LytMeterTimerPart2_c::init() { + mTrial = dAcItem_c::getCurrentTrial(); + initBloomAnim(); + initBeforeFallAnim(); + initChangeSirenAnim(); + initSirenLoopAnim(); + initSirenSafeAnim(); + initFlowerLoopAnim(); + initDyingAnims(); + initFallOutAnims(); + initOutAnim(); + initInAnim(); + initChangeFruitAnim(); + initColors(); +} + +void LytMeterTimerPart2_c::initInAnim() { + mAnm[TIMER_02_ANIM_IN].setForwardOnce(); + mAnm[TIMER_02_ANIM_IN].setFrame(0.0f); + mAnm[TIMER_02_ANIM_IN].setAnimEnable(true); + mLyt.calc(); + mAnm[TIMER_02_ANIM_IN].setAnimEnable(false); +} + +void LytMeterTimerPart2_c::initBloomAnim() { + mAnm[TIMER_02_ANIM_BLOOM].setForwardOnce(); + mAnm[TIMER_02_ANIM_BLOOM].setFrame(0.0f); + mAnm[TIMER_02_ANIM_BLOOM].setAnimEnable(true); + mLyt.calc(); + mAnm[TIMER_02_ANIM_BLOOM].setAnimEnable(false); +} + +void LytMeterTimerPart2_c::initBeforeFallAnim() { + mAnm[TIMER_02_ANIM_BEFORE_FALL].setForwardOnce(); + mAnm[TIMER_02_ANIM_BEFORE_FALL].setFrame(0.0f); + mAnm[TIMER_02_ANIM_BEFORE_FALL].setAnimEnable(true); + mLyt.calc(); + mAnm[TIMER_02_ANIM_BEFORE_FALL].setAnimEnable(false); +} + +void LytMeterTimerPart2_c::initChangeSirenAnim() { + mAnm[TIMER_02_ANIM_CHANGE_SIREN].setForwardOnce(); + mAnm[TIMER_02_ANIM_CHANGE_SIREN].setFrame(0.0f); + mAnm[TIMER_02_ANIM_CHANGE_SIREN].setAnimEnable(true); + mLyt.calc(); + mAnm[TIMER_02_ANIM_CHANGE_SIREN].setAnimEnable(false); +} + +void LytMeterTimerPart2_c::initSirenLoopAnim() { + mAnm[TIMER_02_ANIM_SIREN_LOOP].setForwardLoop(); + mAnm[TIMER_02_ANIM_SIREN_LOOP].setFrame(0.0f); + mAnm[TIMER_02_ANIM_SIREN_LOOP].setAnimEnable(true); + mLyt.calc(); + mAnm[TIMER_02_ANIM_SIREN_LOOP].setAnimEnable(false); +} + +void LytMeterTimerPart2_c::initSirenSafeAnim() { + mAnm[TIMER_02_ANIM_SIREN_SAFE].setForwardOnce(); + mAnm[TIMER_02_ANIM_SIREN_SAFE].setFrame(0.0f); + mAnm[TIMER_02_ANIM_SIREN_SAFE].setAnimEnable(true); + mLyt.calc(); + mAnm[TIMER_02_ANIM_SIREN_SAFE].setAnimEnable(false); +} + +void LytMeterTimerPart2_c::initFlowerLoopAnim() { + mAnm[TIMER_02_ANIM_FLOWER_LOOP].setForwardOnce(); + 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::initDyingAnims() { + for (int i = 0; i < TIMER_02_NUM_PETALS; i++) { + if (i < mNumPetals) { + mAnm[i + TIMER_02_ANIM_DYING_OFFSET].setForwardOnce(); + mAnm[i + TIMER_02_ANIM_DYING_OFFSET].setToStart(); + mAnm[i + TIMER_02_ANIM_DYING_OFFSET].setAnimEnable(true); + } + } + mLyt.calc(); + for (int i = 0; i < TIMER_02_NUM_PETALS; i++) { + mAnm[i + TIMER_02_ANIM_DYING_OFFSET].setAnimEnable(false); + } +} + +void LytMeterTimerPart2_c::initFallOutAnims() { + for (int i = 0; i < TIMER_02_NUM_PETALS; i++) { + if (i < mNumPetals) { + mAnm[i + TIMER_02_ANIM_FALL_OUT_OFFSET].setForwardOnce(); + mAnm[i + TIMER_02_ANIM_FALL_OUT_OFFSET].setToStart(); + mAnm[i + TIMER_02_ANIM_FALL_OUT_OFFSET].setAnimEnable(true); + } + } + mLyt.calc(); + for (int i = 0; i < TIMER_02_NUM_PETALS; i++) { + mAnm[i + TIMER_02_ANIM_FALL_OUT_OFFSET].setAnimEnable(false); + } +} + +void LytMeterTimerPart2_c::initOutAnim() { + mAnm[TIMER_02_ANIM_OUT].setForwardOnce(); + mAnm[TIMER_02_ANIM_OUT].setFrame(0.0f); + mAnm[TIMER_02_ANIM_OUT].setAnimEnable(true); + mLyt.calc(); + mAnm[TIMER_02_ANIM_OUT].setAnimEnable(false); +} + +void LytMeterTimerPart2_c::startInAnim() { + if (dLytMeterContainer_c::GetMeter()->fn_800D5650()) { + mAnm[TIMER_02_ANIM_MAP_POSITION].setFrame(1.0f); + } else { + mAnm[TIMER_02_ANIM_MAP_POSITION].setFrame(0.0f); + } + mAnm[TIMER_02_ANIM_MAP_POSITION].setAnimEnable(true); + mLyt.calc(); + mAnm[TIMER_02_ANIM_MAP_POSITION].setAnimEnable(false); + + mAnm[TIMER_02_ANIM_IN].setToStart(); + mAnm[TIMER_02_ANIM_IN].setAnimEnable(true); +} + +void LytMeterTimerPart2_c::initChangeFruitAnim() { + mAnm[TIMER_02_ANIM_CHANGE_FRUIT].setForwardOnce(); + mAnm[TIMER_02_ANIM_CHANGE_FRUIT].setFrame(0.0f); + mAnm[TIMER_02_ANIM_CHANGE_FRUIT].setAnimEnable(true); + mLyt.calc(); + mAnm[TIMER_02_ANIM_CHANGE_FRUIT].setAnimEnable(false); +} + +void LytMeterTimerPart2_c::enableBloomAnim() { + mAnm[TIMER_02_ANIM_BLOOM].setAnimEnable(true); +} + +void LytMeterTimerPart2_c::enableBeforeFallAnim() { + if (!mAnm[TIMER_02_ANIM_BEFORE_FALL].isEnabled()) { + mAnm[TIMER_02_ANIM_BEFORE_FALL].setAnimEnable(true); + } +} + +void LytMeterTimerPart2_c::enableChangeSirenAnim() { + mAnm[TIMER_02_ANIM_CHANGE_SIREN].setAnimEnable(true); +} + +void LytMeterTimerPart2_c::enableSirenLoopAnim() { + mAnm[TIMER_02_ANIM_SIREN_LOOP].setAnimEnable(true); +} + +void LytMeterTimerPart2_c::enableSafeAnim() { + mAnm[TIMER_02_ANIM_SIREN_SAFE].setAnimEnable(true); +} + +void LytMeterTimerPart2_c::resumeFlowerLoop() { + mAnm[TIMER_02_ANIM_FLOWER_LOOP].setFrame(mFlowerLoopFrame); + mAnm[TIMER_02_ANIM_FLOWER_LOOP].setAnimEnable(true); +} + +void LytMeterTimerPart2_c::startFlowerLoop() { + if (!mAnm[TIMER_02_ANIM_FLOWER_LOOP].isEnabled()) { + mAnm[TIMER_02_ANIM_FLOWER_LOOP].setToStart(); + mAnm[TIMER_02_ANIM_FLOWER_LOOP].setAnimEnable(true); + } +} + +void LytMeterTimerPart2_c::syncPetalsTime() { + for (s32 i = 0; i < TIMER_02_NUM_PETALS; i++) { + if (i == mNumPetals - 1) { + if (!mAnm[i + TIMER_02_ANIM_DYING_OFFSET].isEnabled()) { + f32 duration = mAnm[i + TIMER_02_ANIM_DYING_OFFSET].getAnimDuration() - 1.0f; + s32 time = dTgSiren_c::getTime() % 10000; + if (time == 0) { + time = 10000; + } + f32 targetFrame = (s32)(duration - (time / 10000.0f) * duration + 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); + } + } else if (mNumPetals <= i) { + if (!mAnm[i + TIMER_02_ANIM_DYING_OFFSET].isEnabled()) { + mAnm[i + TIMER_02_ANIM_DYING_OFFSET].setToEnd(); + mAnm[i + TIMER_02_ANIM_DYING_OFFSET].setAnimEnable(true); + mLyt.calc(); + mAnm[i + TIMER_02_ANIM_DYING_OFFSET].setAnimEnable(false); + } + } + } +} + +void LytMeterTimerPart2_c::updatePetalsRate() { + for (s32 i = 0; i < TIMER_02_NUM_PETALS; i++) { + if (i < mNumPetals) { + mAnm[i + TIMER_02_ANIM_DYING_OFFSET].setRate(20.0f); + mAnm[i + TIMER_02_ANIM_DYING_OFFSET].setAnimEnable(true); + } else { + mAnm[i + TIMER_02_ANIM_DYING_OFFSET].setToEnd2(); + mAnm[i + TIMER_02_ANIM_DYING_OFFSET].setAnimEnable(false); + } + } +} + +void LytMeterTimerPart2_c::restartPetals() { + for (s32 i = 0; i < TIMER_02_NUM_PETALS; i++) { + if (mAnm[i + TIMER_02_ANIM_DYING_OFFSET].isEndReached() && + !mAnm[i + TIMER_02_ANIM_FALL_OUT_OFFSET].isEnabled()) { + mAnm[i + TIMER_02_ANIM_DYING_OFFSET].setToStart(); + mAnm[i + TIMER_02_ANIM_FALL_OUT_OFFSET].setAnimEnable(true); + } + } +} + +void LytMeterTimerPart2_c::startOutAnim() { + mAnm[TIMER_02_ANIM_OUT].setToStart(); + mAnm[TIMER_02_ANIM_OUT].setAnimEnable(true); +} + +void LytMeterTimerPart2_c::enableChangeFruitAnim() { + mAnm[TIMER_02_ANIM_CHANGE_FRUIT].setAnimEnable(true); +} + +void LytMeterTimerPart2_c::realizePetalsOnOff() { + mAnm[TIMER_02_ANIM_PETAL_ONOFF].setAnimEnable(true); + mAnm[TIMER_02_ANIM_PETAL_ONOFF].setFrame(9 - mNumPetals); + mLyt.calc(); + mAnm[TIMER_02_ANIM_PETAL_ONOFF].setAnimEnable(false); +} + +void LytMeterTimerPart2_c::resetSingleAnim(u8 idx) { + mAnm[idx].setToStart(); +} + +void LytMeterTimerPart2_c::initColors() { + switch (mTrial) { + case dAcItem_c::TRIAL_ELDIN: + mColors1[TIMER_02_COLOR_00_00] = mColor(0xFF, 0xFF, 0xFF, 0xFF); + mColors1[TIMER_02_COLOR_00_01] = mColor(0xFF, 0xFF, 0x40, 0xFF); + mColors2[TIMER_02_COLOR_01_00] = mColor(0xFF, 0xFF, 0x00, 0xFF); + mColors2[TIMER_02_COLOR_01_01] = mColor(0xFF, 0xFF, 0xFF, 0xFF); + break; + case dAcItem_c::TRIAL_FARON: + mColors1[TIMER_02_COLOR_00_00] = mColor(0xFF, 0xFF, 0xFF, 0xFF); + mColors1[TIMER_02_COLOR_00_01] = mColor(0xFF, 0x50, 0x82, 0xFF); + mColors2[TIMER_02_COLOR_01_00] = mColor(0xFF, 0x00, 0x40, 0xFF); + mColors2[TIMER_02_COLOR_01_01] = mColor(0xFF, 0xFF, 0xFF, 0xFF); + break; + case dAcItem_c::TRIAL_SKYLOFT: + mColors1[TIMER_02_COLOR_00_00] = mColor(0xFF, 0xFF, 0xFF, 0xFF); + mColors1[TIMER_02_COLOR_00_01] = mColor(0x78, 0xFF, 0x78, 0xFF); + mColors2[TIMER_02_COLOR_01_00] = mColor(0x00, 0xFF, 0x3C, 0xFF); + mColors2[TIMER_02_COLOR_01_01] = mColor(0xFF, 0xFF, 0xFF, 0xFF); + break; + case dAcItem_c::TRIAL_LANAYRU: + mColors1[TIMER_02_COLOR_00_00] = mColor(0xFF, 0xFF, 0xFF, 0xFF); + mColors1[TIMER_02_COLOR_00_01] = mColor(0x78, 0xB4, 0xFF, 0xFF); + mColors2[TIMER_02_COLOR_01_00] = mColor(0x00, 0x80, 0xFF, 0xFF); + mColors2[TIMER_02_COLOR_01_01] = mColor(0xFF, 0xFF, 0xFF, 0xFF); + break; + } +} + +void dLytMeterTimer_c::initializeState_ChangeSiren() {} +void dLytMeterTimer_c::executeState_ChangeSiren() {} +void dLytMeterTimer_c::finalizeState_ChangeSiren() {} + +void dLytMeterTimer_c::initializeState_Siren() {} +void dLytMeterTimer_c::executeState_Siren() {} +void dLytMeterTimer_c::finalizeState_Siren() {} + +void dLytMeterTimer_c::initializeState_ChangeSafeBloom() {} +void dLytMeterTimer_c::executeState_ChangeSafeBloom() {} +void dLytMeterTimer_c::finalizeState_ChangeSafeBloom() {} + +void dLytMeterTimer_c::initializeState_ChangeSafe() {} +void dLytMeterTimer_c::executeState_ChangeSafe() {} +void dLytMeterTimer_c::finalizeState_ChangeSafe() {} + +void dLytMeterTimer_c::initializeState_Safe() {} +void dLytMeterTimer_c::executeState_Safe() {} +void dLytMeterTimer_c::finalizeState_Safe() {} + +void dLytMeterTimer_c::initializeState_ChangeFruits() {} +void dLytMeterTimer_c::executeState_ChangeFruits() {} +void dLytMeterTimer_c::finalizeState_ChangeFruits() {} + +void dLytMeterTimer_c::initializeState_Fruits() {} +void dLytMeterTimer_c::executeState_Fruits() {} +void dLytMeterTimer_c::finalizeState_Fruits() {} + +bool dLytMeterTimer_c::build() { + mpPart1 = LytMeterTimerPart1_c::GetInstance(); + mpPart2 = LytMeterTimerPart2_c::GetInstance(); + mpPart1->init(); + mpPart2->init(); + mpPart1->realizeTrial(); + mpPart2->setNumPetals(9); + mpPart2->realizePetalsOnOff(); + mpPart2->initFallOutAnims(); + mpPart2->initDyingAnims(); + mpPart2->resetSingleAnim(TIMER_02_ANIM_SIREN_SAFE); + mpPart2->enableSafeAnim(); + mStateMgr.changeState(StateID_Siren); + field_0x60 = 20; + sDoExit = false; + sDoFinishAnim = false; + sFinished = false; + return true; +} + +bool dLytMeterTimer_c::remove() { + mpPart1 = nullptr; + mpPart2 = nullptr; + return true; +}