d_t_sword_battle_game OK - function order issue

This commit is contained in:
elijah-thomas774
2025-11-28 04:36:54 -05:00
parent 74e2548051
commit b568957bb4
8 changed files with 602 additions and 93 deletions
@@ -3,57 +3,57 @@ _epilog = .text:0x00000030; // type:function size:0x2C scope:global
_unresolved = .text:0x00000060; // type:function size:0x4 scope:global
__register_global_object = .text:0x00000070; // type:function size:0x1C scope:global
__destroy_global_chain = .text:0x00000090; // type:function size:0x54 scope:global
fn_72_F0 = .text:0x000000F0; // type:function size:0xC
fn_72_100 = .text:0x00000100; // type:function size:0xC
baseID_Wait<10sStateID_c>__Fv_RC12sStateIDIf_c = .text:0x000000F0; // type:function size:0xC
baseID_Manage<10sStateID_c>__Fv_RC12sStateIDIf_c = .text:0x00000100; // type:function size:0xC
dTgSwordBattleGame_c_classInit__Fv = .text:0x00000110; // type:function size:0xC4
__dt__20dTgSwordBattleGame_cFv = .text:0x000001E0; // type:function size:0x58
__dt__5dTg_cFv = .text:0x000001E0; // type:function size:0x58
__dt__33sFState_c<20dTgSwordBattleGame_c>Fv = .text:0x00000240; // type:function size:0x58
__dt__36sFStateFct_c<20dTgSwordBattleGame_c>Fv = .text:0x000002A0; // type:function size:0x6C
__dt__89sStateMgr_c<20dTgSwordBattleGame_c,20sStateMethodUsr_FI_c,12sFStateFct_c,13sStateIDChk_c>Fv = .text:0x00000310; // type:function size:0xA0
__dt__59sFStateMgr_c<20dTgSwordBattleGame_c,20sStateMethodUsr_FI_c>Fv = .text:0x000003B0; // type:function size:0xA4
TgSwordBattleGame__init = .text:0x00000460; // type:function size:0x70
TgSwordBattleGame__isInBossRush = .text:0x000004D0; // type:function size:0x8
create__20dTgSwordBattleGame_cFv = .text:0x00000460; // type:function size:0x70
checkInBossRushMinigame__20dTgSwordBattleGame_cFv = .text:0x000004D0; // type:function size:0x8
changeState__89sStateMgr_c<20dTgSwordBattleGame_c,20sStateMethodUsr_FI_c,12sFStateFct_c,13sStateIDChk_c>FRC12sStateIDIf_c = .text:0x000004E0; // type:function size:0x10
fn_72_4F0 = .text:0x000004F0; // type:function size:0x44
TgSwordBattleGame__update = .text:0x00000540; // type:function size:0x184
doDelete__20dTgSwordBattleGame_cFv = .text:0x000004F0; // type:function size:0x44
actorExecute__20dTgSwordBattleGame_cFv = .text:0x00000540; // type:function size:0x184
executeState__89sStateMgr_c<20dTgSwordBattleGame_c,20sStateMethodUsr_FI_c,12sFStateFct_c,13sStateIDChk_c>Fv = .text:0x000006D0; // type:function size:0x10
fn_72_6E0 = .text:0x000006E0; // type:function size:0x280
fn_72_960 = .text:0x00000960; // type:function size:0x8
fn_72_970 = .text:0x00000970; // type:function size:0x4
fn_72_980 = .text:0x00000980; // type:function size:0x70
fn_72_9F0 = .text:0x000009F0; // type:function size:0x4
fn_72_A00 = .text:0x00000A00; // type:function size:0x4
fn_72_A10 = .text:0x00000A10; // type:function size:0x114
fn_72_B30 = .text:0x00000B30; // type:function size:0x4
fn_72_B40 = .text:0x00000B40; // type:function size:0x88
fn_72_BD0 = .text:0x00000BD0; // type:function size:0x138
TgSwordBattleGame__getTime = .text:0x00000D10; // type:function size:0x38
TgSwordBattleGame__checkInBossRushStoryflag = .text:0x00000D50; // type:function size:0x48
fn_72_DA0 = .text:0x00000DA0; // type:function size:0x1C
fn_72_DC0 = .text:0x00000DC0; // type:function size:0xD4
fn_72_EA0 = .text:0x00000EA0; // type:function size:0x74
fn_72_F20 = .text:0x00000F20; // type:function size:0x1C
TgSwordBattleGame__setInBossRush = .text:0x00000F40; // type:function size:0x1C
fn_72_F60 = .text:0x00000F60; // type:function size:0x114
fn_72_1080 = .text:0x00001080; // type:function size:0xEC
fn_72_1170 = .text:0x00001170; // type:function size:0xB4
fn_72_1230 = .text:0x00001230; // type:function size:0xB4
fn_72_12F0 = .text:0x000012F0; // type:function size:0xB4
fn_72_13B0 = .text:0x000013B0; // type:function size:0xB4
fn_72_1470 = .text:0x00001470; // type:function size:0xB4
fn_72_1530 = .text:0x00001530; // type:function size:0xB4
fn_72_15F0 = .text:0x000015F0; // type:function size:0xB4
fn_72_16B0 = .text:0x000016B0; // type:function size:0xB4
fn_72_1770 = .text:0x00001770; // type:function size:0xB4
fn_72_1830 = .text:0x00001830; // type:function size:0xB4
fn_72_18F0 = .text:0x000018F0; // type:function size:0xB4
fn_72_19B0 = .text:0x000019B0; // type:function size:0xB4
fn_72_1A70 = .text:0x00001A70; // type:function size:0x3C
fn_72_1AB0 = .text:0x00001AB0; // type:function size:0x3C
TgSwordBattleGame__setCurrentBossNumber = .text:0x00001AF0; // type:function size:0x20
fn_72_1B10 = .text:0x00001B10; // type:function size:0x1C
fn_72_1B30 = .text:0x00001B30; // type:function size:0x8
fn_72_1B40 = .text:0x00001B40; // type:function size:0xE0
actorExecuteInEvent__20dTgSwordBattleGame_cFv = .text:0x000006E0; // type:function size:0x280
draw__20dTgSwordBattleGame_cFv = .text:0x00000960; // type:function size:0x8
initializeState_Wait__20dTgSwordBattleGame_cFv = .text:0x00000970; // type:function size:0x4
executeState_Wait__20dTgSwordBattleGame_cFv = .text:0x00000980; // type:function size:0x70
finalizeState_Wait__20dTgSwordBattleGame_cFv = .text:0x000009F0; // type:function size:0x4
initializeState_Manage__20dTgSwordBattleGame_cFv = .text:0x00000A00; // type:function size:0x4
executeState_Manage__20dTgSwordBattleGame_cFv = .text:0x00000A10; // type:function size:0x114
finalizeState_Manage__20dTgSwordBattleGame_cFv = .text:0x00000B30; // type:function size:0x4
init__20dTgSwordBattleGame_cFv = .text:0x00000B40; // type:function size:0x88
checkInEvent__20dTgSwordBattleGame_cFPCc = .text:0x00000BD0; // type:function size:0x138
getCurrentTime__20dTgSwordBattleGame_cCFv = .text:0x00000D10; // type:function size:0x38
checkInBossRushFlag__20dTgSwordBattleGame_cFv = .text:0x00000D50; // type:function size:0x48
unsetInBossRushFlag__20dTgSwordBattleGame_cFv = .text:0x00000DA0; // type:function size:0x1C
unsetEarlyFightFlags__20dTgSwordBattleGame_cCFv = .text:0x00000DC0; // type:function size:0xD4
unsetImprisonedFightFlags__20dTgSwordBattleGame_cCFv = .text:0x00000EA0; // type:function size:0x74
unsetDemiseFightFlag__20dTgSwordBattleGame_cCFv = .text:0x00000F20; // type:function size:0x1C
setInBossRushFlag__20dTgSwordBattleGame_cFv = .text:0x00000F40; // type:function size:0x1C
saveCurrentTime__20dTgSwordBattleGame_cCFl = .text:0x00000F60; // type:function size:0x114
getBossHighscore__20dTgSwordBattleGame_cCFv = .text:0x00001080; // type:function size:0xEC
getGhirahim1Highscore__20dTgSwordBattleGame_cCFv = .text:0x00001170; // type:function size:0xB4
getScalderaHighscore__20dTgSwordBattleGame_cCFv = .text:0x00001230; // type:function size:0xB4
getMolderachHighscore__20dTgSwordBattleGame_cCFv = .text:0x000012F0; // type:function size:0xB4
getKoloktosHighscore__20dTgSwordBattleGame_cCFv = .text:0x000013B0; // type:function size:0xB4
getTentalusHighscore__20dTgSwordBattleGame_cCFv = .text:0x00001470; // type:function size:0xB4
getGhirahim2Highscore__20dTgSwordBattleGame_cCFv = .text:0x00001530; // type:function size:0xB4
getImprisoned1Highscore__20dTgSwordBattleGame_cCFv = .text:0x000015F0; // type:function size:0xB4
getImprisoned2Highscore__20dTgSwordBattleGame_cCFv = .text:0x000016B0; // type:function size:0xB4
getImprisoned3Highscore__20dTgSwordBattleGame_cCFv = .text:0x00001770; // type:function size:0xB4
getHordeHighscore__20dTgSwordBattleGame_cCFv = .text:0x00001830; // type:function size:0xB4
getGhirahim3Highscore__20dTgSwordBattleGame_cCFv = .text:0x000018F0; // type:function size:0xB4
getDemiseHighscore__20dTgSwordBattleGame_cCFv = .text:0x000019B0; // type:function size:0xB4
getBossIdx__20dTgSwordBattleGame_cCFv = .text:0x00001A70; // type:function size:0x3C
getCurrentBossNumber__20dTgSwordBattleGame_cCFv = .text:0x00001AB0; // type:function size:0x3C
setCurrentBossNumber__20dTgSwordBattleGame_cFl = .text:0x00001AF0; // type:function size:0x20
notifyBossDeath__20dTgSwordBattleGame_cFb = .text:0x00001B10; // type:function size:0x1C
checkFightStarted__20dTgSwordBattleGame_cCFv = .text:0x00001B30; // type:function size:0x8
__dt__20dTgSwordBattleGame_cFv = .text:0x00001B40; // type:function size:0xE0
getStateID__89sStateMgr_c<20dTgSwordBattleGame_c,20sStateMethodUsr_FI_c,12sFStateFct_c,13sStateIDChk_c>CFv = .text:0x00001C20; // type:function size:0x10
build__36sFStateFct_c<20dTgSwordBattleGame_c>FRC12sStateIDIf_c = .text:0x00001C30; // type:function size:0x60
dispose__36sFStateFct_c<20dTgSwordBattleGame_c>FRP10sStateIf_c = .text:0x00001C90; // type:function size:0xC
@@ -71,39 +71,40 @@ executeState__35sFStateID_c<20dTgSwordBattleGame_c>CFR20dTgSwordBattleGame_c = .
initializeState__35sFStateID_c<20dTgSwordBattleGame_c>CFR20dTgSwordBattleGame_c = .text:0x00001DC0; // type:function size:0x30
__sinit_\d_t_sword_battle_game_cpp = .text:0x00001DF0; // type:function size:0x1E0 scope:local
__dt__35sFStateID_c<20dTgSwordBattleGame_c>Fv = .text:0x00001FD0; // type:function size:0x58
fn_72_2030 = .text:0x00002030; // type:function size:0x5C
fn_72_2090 = .text:0x00002090; // type:function size:0xDC
fn_72_2170 = .text:0x00002170; // type:function size:0xE0
__dt__42sFStateVirtualID_c<20dTgSwordBattleGame_c>Fv = .text:0x00002030; // type:function size:0x5C
number__42sFStateVirtualID_c<20dTgSwordBattleGame_c>CFv = .text:0x00002090; // type:function size:0xDC
superID__42sFStateVirtualID_c<20dTgSwordBattleGame_c>CFv = .text:0x00002170; // type:function size:0xE0
isSameName__35sFStateID_c<20dTgSwordBattleGame_c>CFPCc = .text:0x00002250; // type:function size:0x88
_ctors = .ctors:0x00000000; // type:label scope:global
_dtors = .dtors:0x00000000; // type:label scope:global
__destroy_global_chain_reference = .dtors:0x00000000; // type:object size:0x4 scope:global
lbl_72_section4_0 = .data:0x00000000; // type:object size:0x18 data:4byte
lbl_72_section4_18 = .data:0x00000018; // type:object size:0x13 data:string
lbl_72_section4_2C = .data:0x0000002C; // type:object size:0x14 data:string
lbl_72_section4_40 = .data:0x00000040; // type:object size:0xC data:4byte
lbl_72_section4_4C = .data:0x0000004C; // type:object size:0x12 data:string
lbl_72_section4_60 = .data:0x00000060; // type:object size:0x7 data:string
lbl_72_section4_68 = .data:0x00000068; // type:object size:0xB data:string
lbl_72_section4_78 = .data:0x00000078; // type:object size:0x8 data:string
lbl_72_section4_80 = .data:0x00000080; // type:object size:0xA data:string
lbl_72_section4_8C = .data:0x0000008C; // type:object size:0xB data:string
lbl_72_section4_98 = .data:0x00000098; // type:object size:0xB data:string
lbl_72_section4_A8 = .data:0x000000A8; // type:object size:0x8 data:string
lbl_72_section4_B0 = .data:0x000000B0; // type:object size:0x20 data:4byte
lbl_72_section4_0 = .data:0x00000000; // type:object size:0x18 scope:local data:4byte
lbl_72_section4_18 = .data:0x00000018; // type:object size:0x13 scope:local data:string
lbl_72_section4_2C = .data:0x0000002C; // type:object size:0x14 scope:local data:string
lbl_72_section4_40 = .data:0x00000040; // type:object size:0xC scope:local data:4byte
lbl_72_section4_4C = .data:0x0000004C; // type:object size:0x12 scope:local data:string
lbl_72_section4_60 = .data:0x00000060; // type:object size:0x7 scope:local data:string
lbl_72_section4_68 = .data:0x00000068; // type:object size:0xB scope:local data:string
lbl_72_section4_78 = .data:0x00000078; // type:object size:0x8 scope:local data:string
lbl_72_section4_80 = .data:0x00000080; // type:object size:0xA scope:local data:string
lbl_72_section4_8C = .data:0x0000008C; // type:object size:0xB scope:local data:string
lbl_72_section4_98 = .data:0x00000098; // type:object size:0xB scope:local data:string
lbl_72_section4_A8 = .data:0x000000A8; // type:object size:0x8 scope:local data:string
lbl_72_section4_B0 = .data:0x000000B0; // type:object size:0x20 scope:local data:4byte
g_profile_TAG_SWORD_BATTLE_GAME = .data:0x000000D0; // type:object size:0x10
lbl_72_section4_E0 = .data:0x000000E0; // type:object size:0x4 data:4byte
lbl_72_section4_E4 = .data:0x000000E4; // type:object size:0x4 data:4byte
lbl_72_section4_E0 = .data:0x000000E0; // type:object size:0x4 scope:local data:4byte
lbl_72_section4_E4 = .data:0x000000E4; // type:object size:0x4 scope:local data:4byte
jumptable_72_section4_E8 = .data:0x000000E8; // type:object size:0x30 scope:local
lbl_72_section4_118 = .data:0x00000118; // type:object size:0x90
lbl_72_section4_1A8 = .data:0x000001A8; // type:object size:0x30
lbl_72_section4_1D8 = .data:0x000001D8; // type:object size:0x30
lbl_72_section4_208 = .data:0x00000208; // type:object size:0x18
lbl_72_section4_220 = .data:0x00000220; // type:object size:0x120
lbl_72_section4_340 = .data:0x00000340; // type:object size:0x68
lbl_72_section4_118 = .data:0x00000118; // type:object size:0x90 scope:local
lbl_72_section4_1A8 = .data:0x000001A8; // type:object size:0x30 scope:local
lbl_72_section4_1D8 = .data:0x000001D8; // type:object size:0x30 scope:local
lbl_72_section4_208 = .data:0x00000208; // type:object size:0x18 scope:local
lbl_72_section4_220 = .data:0x00000220; // type:object size:0x120 scope:local
lbl_72_section4_340 = .data:0x00000340; // type:object size:0x68 scope:local
__global_destructor_chain = .bss:0x00000000; // type:object size:0x4 scope:global
lbl_72_bss_8 = .bss:0x00000008; // type:object size:0xC data:4byte
TgSwordBattleGame__STATE_WAIT = .bss:0x00000014; // type:object size:0x40 data:4byte
TgSwordBattleGame__STATE_MANAGE = .bss:0x00000054; // type:object size:0x34 data:4byte
lbl_72_bss_88 = .bss:0x00000088; // type:object size:0x4 data:4byte
lbl_72_bss_8C = .bss:0x0000008C; // type:object size:0x1 data:byte
lbl_72_bss_8 = .bss:0x00000008; // type:object size:0xC scope:local data:4byte
StateID_Wait__20dTgSwordBattleGame_c = .bss:0x00000014; // type:object size:0x34 data:4byte
lbl_72_bss_48 = .bss:0x00000048; // type:object size:0xC scope:local data:4byte
StateID_Manage__20dTgSwordBattleGame_c = .bss:0x00000054; // type:object size:0x34 data:4byte
lbl_72_bss_88 = .bss:0x00000088; // type:object size:0x4 scope:local data:4byte
lbl_72_bss_8C = .bss:0x0000008C; // type:object size:0x1 scope:local data:byte
+10 -10
View File
@@ -3635,7 +3635,7 @@ execute__15MinigameManagerFv = .text:0x800A5240; // type:function size:0x30
isInAnyMinigame__15MinigameManagerFv = .text:0x800A5270; // type:function size:0x2C
isInMinigameState__15MinigameManagerFQ215MinigameManager8Minigame = .text:0x800A52A0; // type:function size:0x28
setNextStoredSpecialMinigameState = .text:0x800A52D0; // type:function size:0x54
endSpecialMinigameState = .text:0x800A5330; // type:function size:0x50
endMinigame__15MinigameManagerFQ215MinigameManager8Minigame = .text:0x800A5330; // type:function size:0x50
fn_800A5380 = .text:0x800A5380; // type:function size:0x3C
fn_800A53C0 = .text:0x800A53C0; // type:function size:0x3C
fn_800A5400 = .text:0x800A5400; // type:function size:0x88
@@ -4405,9 +4405,9 @@ fn_800C7760 = .text:0x800C7760; // type:function size:0x38
model_getNodeWorldOrLocalMatrix = .text:0x800C77A0; // type:function size:0x24
fn_800C77D0 = .text:0x800C77D0; // type:function size:0x54
fn_800C7830 = .text:0x800C7830; // type:function size:0x44
Timekeeper__ctor = .text:0x800C7880; // type:function size:0x28
Timekeeper__dtorMaybe = .text:0x800C78B0; // type:function size:0x40
fn_800C78F0 = .text:0x800C78F0; // type:function size:0x34
__ct__10TimekeeperFv = .text:0x800C7880; // type:function size:0x28
__dt__10TimekeeperFv = .text:0x800C78B0; // type:function size:0x40
initUpCounter__10TimekeeperFv = .text:0x800C78F0; // type:function size:0x34
setTime = .text:0x800C7930; // type:function size:0x6C
getTime__10TimekeeperCFv = .text:0x800C79A0; // type:function size:0x50
Timekeeper__setIsCountingUp = .text:0x800C79F0; // type:function size:0x8
@@ -15441,19 +15441,19 @@ scoreRelatedExecute__14dLytMiniGame_cFv = .text:0x80295740; // type:function siz
scoreRelated__14dLytMiniGame_cFv = .text:0x802957D0; // type:function size:0x78
setDisplayedPoints__14dLytMiniGame_cFl = .text:0x80295850; // type:function size:0xA8
fn_80295900 = .text:0x80295900; // type:function size:0x38
fn_80295940 = .text:0x80295940; // type:function size:0x38
fn_80295980 = .text:0x80295980; // type:function size:0x98
fn_80295940__14dLytMiniGame_cFv = .text:0x80295940; // type:function size:0x38
fn_80295980__14dLytMiniGame_cFv = .text:0x80295980; // type:function size:0x98
fn_80295A20 = .text:0x80295A20; // type:function size:0x90
fn_80295AB0 = .text:0x80295AB0; // type:function size:0x20
fn_80295AD0 = .text:0x80295AD0; // type:function size:0x20
fn_80295AB0__14dLytMiniGame_cFv = .text:0x80295AB0; // type:function size:0x20
fn_80295AD0__14dLytMiniGame_cFv = .text:0x80295AD0; // type:function size:0x20
fn_80295AF0 = .text:0x80295AF0; // type:function size:0x2C
fn_80295B20 = .text:0x80295B20; // type:function size:0x8
fn_80295B30 = .text:0x80295B30; // type:function size:0x8
timeRelatedExecute__14dLytMiniGame_cFv = .text:0x80295B40; // type:function size:0xA8
timeRelated__14dLytMiniGame_cFv = .text:0x80295BF0; // type:function size:0x24
setDisplayedTime__14dLytMiniGame_cFl = .text:0x80295C20; // type:function size:0x4C
fn_80295C70 = .text:0x80295C70; // type:function size:0x38
fn_80295CB0 = .text:0x80295CB0; // type:function size:0x38
setHighscore__14dLytMiniGame_cFl = .text:0x80295C70; // type:function size:0x38
fn_80295CB0__14dLytMiniGame_cFb = .text:0x80295CB0; // type:function size:0x38
fn_80295CF0 = .text:0x80295CF0; // type:function size:0x8
fn_80295D00 = .text:0x80295D00; // type:function size:0xC
fn_80295D10 = .text:0x80295D10; // type:function size:0xC
+5 -5
View File
@@ -2883,7 +2883,7 @@ enum StoryFlags_e {
/** [In Boss Rush mode (can be unset)]
* Story Flag #572 (0x023C) - JP 805ACD98 0x08 / US 805A9B18 0x08
*/
STORYFLAG_572,
STORYFLAG_BOSSRUSH_ACTIVE,
/** [In redoing slient realm mode?]
* Story Flag #573 (0x023D) - JP 805ACD98 0x10 / US 805A9B18 0x10
@@ -3538,17 +3538,17 @@ enum StoryFlags_e {
/** [Sets when you refight imp 1 (Sealed Grounds layer 2)]
* Story Flag #703 (0x02BF) - JP 805ACDA2 0x08 / US 805A9B22 0x08
*/
STORYFLAG_703,
STORYFLAG_IMPRISONED1_BOSSRUSH,
/** [Sets when you refight imp 2 (Sealed Grounds layer 3)]
* Story Flag #704 (0x02C0) - JP 805ACDA2 0x10 / US 805A9B22 0x10
*/
STORYFLAG_704,
STORYFLAG_IMPRISONED2_BOSSRUSH,
/** [Sets when you refight imp3 (Sealed Grounds layer 4)]
* Story Flag #705 (0x02C1) - JP 805ACDA2 0x20 / US 805A9B22 0x20
*/
STORYFLAG_705,
STORYFLAG_IMPRISONED3_BOSSRUSH,
/** [Minecart Escort done (Lanayru Gorge layer 2)]
* Story Flag #706 (0x02C2) - JP 805ACDA2 0x40 / US 805A9B22 0x40
@@ -3653,7 +3653,7 @@ enum StoryFlags_e {
/** [[Gets Set in a refight](Hylia's Realm layer 4)]
* Story Flag #726 (0x02D6) - JP 805ACDA4 0x40 / US 805A9B24 0x40
*/
STORYFLAG_726,
STORYFLAG_DEMISE_BOSSRUSH,
/** [Talking to Fi after filling Wallet]
* Story Flag #727 (0x02D7) - JP 805ACDA4 0x80 / US 805A9B24 0x80
+22
View File
@@ -9,6 +9,20 @@ public:
return sInstance;
}
/** Updates some window */
void fn_80295940();
/** ??? */
void fn_80295980();
/** Checks to see if in BAMBOO_CUTTING .. BOSS_RUSH and returns some boolean (start?) */
bool fn_80295AB0();
/** Checks to see if in BAMBOO_CUTTING .. BOSS_RUSH and returns some boolean (end?) */
bool fn_80295AD0();
void setHighscore(s32 time);
/** GUESS: sets the start for the high score? */
void fn_80295CB0(bool);
void timeRelatedExecute();
void scoreRelatedExecute();
@@ -18,7 +32,15 @@ public:
void timeRelated();
void scoreRelated();
/** GUESS: Assumption based on function caller */
void setComplete() {
field_0x3866 = true;
}
private:
u8 _0x0000[0x3866 - 0x0000];
bool field_0x3866;
static dLytMiniGame_c *sInstance;
};
+78 -5
View File
@@ -1,17 +1,90 @@
#ifndef D_T_SWORD_BATTLE_GAME_H
#define D_T_SWORD_BATTLE_GAME_H
#include "d/a/d_a_base.h"
#include "d/flag/storyflag_manager.h"
#include "d/t/d_tg.h"
#include "s/s_State.hpp"
#include "s/s_StateMgr.hpp"
#include "toBeSorted/actor_event.h"
#include "toBeSorted/timekeeper.h"
class dTgSwordBattleGame_c : public dAcBase_c {
class dTgSwordBattleGame_c : public dTg_c {
public:
dTgSwordBattleGame_c() : mStateMgr(*this, sStateID::null) {}
dTgSwordBattleGame_c() : mStateMgr(*this, sStateID::null), mEventRelated(*this, 0) {}
virtual ~dTgSwordBattleGame_c() {}
virtual int create() override;
virtual int doDelete() override;
virtual int draw() override;
virtual int actorExecute() override;
virtual int actorExecuteInEvent() override;
/* vt 0x74-0x80*/ STATE_VIRTUAL_FUNC_DECLARE(dTgSwordBattleGame_c, Wait);
/* vt 0x80-0x88*/ STATE_VIRTUAL_FUNC_DECLARE(dTgSwordBattleGame_c, Manage);
void init();
bool checkInEvent(const char *eventName);
static bool checkInBossRushFlag();
void unsetInBossRushFlag();
void setInBossRushFlag();
static bool checkInBossRushMinigame();
void unsetEarlyFightFlags() const;
void unsetImprisonedFightFlags() const;
void unsetDemiseFightFlag() const;
s32 getCurrentTime() const;
void saveCurrentTime(s32 time) const;
s32 getBossIdx() const;
s32 getBossHighscore() const;
/** Index 0 */
s32 getGhirahim1Highscore() const;
/** Index 1 */
s32 getScalderaHighscore() const;
/** Index 2 */
s32 getMolderachHighscore() const;
/** Index 3 */
s32 getImprisoned1Highscore() const;
/** Index 4 */
s32 getKoloktosHighscore() const;
/** Index 5 */
s32 getTentalusHighscore() const;
/** Index 6 */
s32 getGhirahim2Highscore() const;
/** Index 7 */
s32 getImprisoned2Highscore() const;
/** Index 8 */
s32 getImprisoned3Highscore() const;
/** Index 9 */
s32 getHordeHighscore() const;
/** Index 10 */
s32 getGhirahim3Highscore() const;
/** Index 11 */
s32 getDemiseHighscore() const;
s32 getCurrentBossNumber() const;
void setCurrentBossNumber(s32 num);
void notifyBossDeath(bool ghirahim_related = false);
bool checkFightStarted() const;
private:
/* 0x??? */ STATE_MGR_DECLARE(dTgSwordBattleGame_c);
/* 0x0FC */ STATE_MGR_DECLARE(dTgSwordBattleGame_c);
/* 0x138 */ ActorEventRelated mEventRelated;
/* 0x188 */ Timekeeper mTimer;
/* 0x1A8 */ bool field_0x1A8;
/* 0x1A9 */ bool field_0x1A9;
/* 0x1AA */ bool field_0x1AA;
/* 0x1AB */ bool field_0x1AB; ///< set if current boss is complete
/* 0x1AC */ bool field_0x1AC;
/* 0x1AD */ u8 field_0x1AD;
/* 0x1AE */ u8 field_0x1AE;
/* 0x1B0 */ u32 mBossNumber;
// Note: Gets padded to 0x1B8 due to Timekeepers 8-byte alignment
};
#endif
+3
View File
@@ -19,8 +19,11 @@ public:
HARP_PLAYING,
};
static bool isInMinigameState(Minigame game);
static bool isInAnyMinigame();
static bool endMinigame(Minigame game);
static void create();
static void destroy();
static void execute();
+17
View File
@@ -3,9 +3,26 @@
#include "common.h"
#define TIME_CONVERT(min, sec, msec) ((min * 60 * 1000) + (sec * 1000) + (msec * 10))
class Timekeeper {
public:
Timekeeper();
virtual ~Timekeeper();
virtual s32 vt_0x0C(); ///< Init
virtual s32 vt_0x10(); ///< Delete
virtual s32 vt_0x14();
virtual s32 doCount();
virtual s32 vt_0x1C();
s32 getTime() const;
void initUpCounter();
/* 0x08 */ s64 mTime;
/* 0x10 */ u32 mCountingUp;
/* 0x14 */ u32 mCountingDown;
/* 0x1C */ bool field_0x1C;
};
#endif
+393
View File
@@ -1,3 +1,396 @@
#include "d/t/d_t_sword_battle_game.h"
#include "common.h"
#include "d/a/d_a_player.h"
#include "d/d_sc_game.h"
#include "d/flag/storyflag_manager.h"
#include "d/lyt/d_lyt_mini_game.h"
#include "egg/prim/eggBitFlag.h"
#include "f/f_base.h"
#include "f/f_profile_name.h"
#include "sized_string.h"
#include "toBeSorted/event.h"
#include "toBeSorted/event_manager.h"
#include "toBeSorted/minigame_mgr.h"
const char *sGameEvents[] = {"StartSwordBattleGame", "EndSwordBattleGame", "EndSwordBattleGame2"};
const char *endEventNames[] = {
"dAcBvd_c_DeadDEMO", "MG_end", "AsuraDeadB", "BKR_end", "BBossEvac", "BBoss2Evac", "BBoss3Evac", "BLS_end",
};
STATE_VIRTUAL_DEFINE(dTgSwordBattleGame_c, Wait);
STATE_VIRTUAL_DEFINE(dTgSwordBattleGame_c, Manage);
SPECIAL_ACTOR_PROFILE(TAG_SWORD_BATTLE_GAME, dTgSwordBattleGame_c, fProfile::TAG_SWORD_BATTLE_GAME, 0x6F, 0, 4);
int dTgSwordBattleGame_c::create() {
if (!checkInBossRushFlag() && !checkInBossRushMinigame()) {
return FAILED;
}
init();
mStateMgr.changeState(StateID_Wait);
return SUCCEEDED;
}
// This needs to be emitted before the change state function...
bool dTgSwordBattleGame_c::checkInBossRushMinigame() {
return MinigameManager::isInMinigameState(MinigameManager::BOSS_RUSH);
}
int dTgSwordBattleGame_c::doDelete() {
fBase_c::doDelete();
mTimer.vt_0x10();
return SUCCEEDED;
}
int dTgSwordBattleGame_c::actorExecute() {
if (EventManager::isInEvent()) {
static const char *l_currentEvent = EventManager::getCurrentEventName();
if (strequals(l_currentEvent, endEventNames[0]) || strequals(l_currentEvent, endEventNames[1]) ||
strequals(l_currentEvent, endEventNames[2]) || strequals(l_currentEvent, endEventNames[3]) ||
strequals(l_currentEvent, endEventNames[4]) || strequals(l_currentEvent, endEventNames[5]) ||
strequals(l_currentEvent, endEventNames[6]) || strequals(l_currentEvent, endEventNames[7])) {
field_0x1AB = true;
}
}
mStateMgr.executeState();
return SUCCEEDED;
}
int dTgSwordBattleGame_c::actorExecuteInEvent() {
bool advance = mEventRelated.isAdvance();
int ret = NOT_READY;
switch (mEventRelated.getCurrentEventCommand()) {
case 'none': {
mEventRelated.advanceNext();
ret = SUCCEEDED;
} break;
case 'gini': {
mEventRelated.advanceNext();
ret = SUCCEEDED;
} break;
case 'cndn': {
if (advance) {
dLytMiniGame_c::GetInstance()->fn_80295940();
} else if (dLytMiniGame_c::GetInstance()->fn_80295AB0()) {
dLytMiniGame_c::GetInstance()->timeRelatedExecute();
dLytMiniGame_c::GetInstance()->setHighscore(getBossHighscore());
dLytMiniGame_c::GetInstance()->fn_80295CB0(true);
mTimer.initUpCounter();
field_0x1A8 = true;
field_0x1AC = true;
mEventRelated.advanceNext();
}
ret = SUCCEEDED;
} break;
case 'fnsh': {
if (advance) {
dLytMiniGame_c::GetInstance()->fn_80295980();
} else if (dLytMiniGame_c::GetInstance()->fn_80295AD0()) {
mEventRelated.advanceNext();
}
ret = SUCCEEDED;
} break;
case 'gend': {
if (advance) {
dScGame_c::GetInstance()->triggerExit(mRoomID, getFromParams(0, 0xFF));
}
ret = SUCCEEDED;
} break;
default: {
if (dAcPy_c::GetLink()->checkFlags0x340(0x200) && !field_0x1AD &&
MinigameManager::endMinigame(MinigameManager::BOSS_RUSH)) {
field_0x1AD = true;
unsetInBossRushFlag();
unsetEarlyFightFlags();
unsetImprisonedFightFlags();
unsetDemiseFightFlag();
setCurrentBossNumber(0);
}
if (!field_0x1AE && field_0x1A9 && !field_0x1AA) {
field_0x1AE = true;
saveCurrentTime(getCurrentTime());
setInBossRushFlag();
setCurrentBossNumber(mBossNumber + 1);
if (MinigameManager::endMinigame(MinigameManager::BOSS_RUSH)) {
dLytMiniGame_c::GetInstance()->fn_80295980();
dLytMiniGame_c::GetInstance()->timeRelated();
}
}
} break;
}
return ret;
}
int dTgSwordBattleGame_c::draw() {
return SUCCEEDED;
}
void dTgSwordBattleGame_c::initializeState_Wait() {}
void dTgSwordBattleGame_c::executeState_Wait() {
if (checkInBossRushMinigame()) {
if (field_0x1A8) {
mStateMgr.changeState(StateID_Manage);
} else {
checkInEvent(sGameEvents[0]);
}
}
}
void dTgSwordBattleGame_c::finalizeState_Wait() {}
void dTgSwordBattleGame_c::initializeState_Manage() {}
void dTgSwordBattleGame_c::executeState_Manage() {
if (!field_0x1A9) {
mTimer.vt_0x14();
}
s32 time = getCurrentTime();
dLytMiniGame_c::GetInstance()->setDisplayedTime(time);
if (!field_0x1AE && field_0x1A9 && field_0x1AA) {
saveCurrentTime(time);
setInBossRushFlag();
setCurrentBossNumber(mBossNumber + 1);
if (MinigameManager::endMinigame(MinigameManager::BOSS_RUSH) && checkInEvent(sGameEvents[1])) {
field_0x1AE = true;
}
}
if (field_0x1AB && checkInEvent(sGameEvents[2])) {
field_0x1AB = false;
}
}
void dTgSwordBattleGame_c::finalizeState_Manage() {}
void dTgSwordBattleGame_c::init() {
if (checkInBossRushMinigame()) {
createBase(fProfile::LYT_MINI_GAME, this, 8, OTHER);
}
mTimer.vt_0x0C();
field_0x1A8 = false;
field_0x1A9 = false;
field_0x1AA = false;
field_0x1AB = false;
field_0x1AC = false;
field_0x1AD = false;
field_0x1AE = false;
mBossNumber = getCurrentBossNumber();
}
bool dTgSwordBattleGame_c::checkInEvent(const char *eventName) {
if (EventManager::isInEvent() && strequals(EventManager::getCurrentEventName(), eventName)) {
return true;
}
if (EventManager::isInEvent0Or7()) {
static volatile u32 FLAGS_1 = 0x00000001;
static u32 FLAGS_2 = 0x00100001;
u32 f1 = FLAGS_1;
u32 f2 = FLAGS_2;
u32 eventFlag = f2 & ~f1;
Event event = Event(eventName, 100, eventFlag, nullptr, nullptr);
EventManager::alsoSetAsCurrentEvent(this, &event, nullptr);
}
return false;
}
s32 dTgSwordBattleGame_c::getCurrentTime() const {
s32 time = mTimer.getTime();
if (time > TIME_CONVERT(59, 59, 99)) {
time = TIME_CONVERT(59, 59, 99);
}
return time;
}
bool dTgSwordBattleGame_c::checkInBossRushFlag() {
return StoryflagManager::sInstance->getCounterOrFlag(STORYFLAG_BOSS_RUSH_ACTIVE);
}
void dTgSwordBattleGame_c::unsetInBossRushFlag() {
StoryflagManager::sInstance->unsetFlag(STORYFLAG_BOSS_RUSH_ACTIVE);
}
void dTgSwordBattleGame_c::unsetEarlyFightFlags() const {
StoryflagManager *pMgr = StoryflagManager::sInstance;
// Not naming these flags due to the weirdness...
pMgr->unsetFlag(STORYFLAG_351);
pMgr->unsetFlag(STORYFLAG_352);
pMgr->unsetFlag(STORYFLAG_353);
pMgr->unsetFlag(STORYFLAG_354);
pMgr->unsetFlag(STORYFLAG_355);
pMgr->unsetFlag(STORYFLAG_356);
pMgr->unsetFlag(STORYFLAG_357);
}
void dTgSwordBattleGame_c::unsetImprisonedFightFlags() const {
StoryflagManager *pMgr = StoryflagManager::sInstance;
pMgr->unsetFlag(STORYFLAG_IMPRISONED1_BOSSRUSH);
pMgr->unsetFlag(STORYFLAG_IMPRISONED2_BOSSRUSH);
pMgr->unsetFlag(STORYFLAG_IMPRISONED3_BOSSRUSH);
}
void dTgSwordBattleGame_c::unsetDemiseFightFlag() const {
StoryflagManager *pMgr = StoryflagManager::sInstance;
pMgr->unsetFlag(STORYFLAG_DEMISE_BOSSRUSH);
}
void dTgSwordBattleGame_c::setInBossRushFlag() {
StoryflagManager::sInstance->setFlag(STORYFLAG_BOSSRUSH_ACTIVE);
}
void dTgSwordBattleGame_c::saveCurrentTime(s32 time) const {
StoryflagManager *pMgr = StoryflagManager::sInstance;
pMgr->setFlagOrCounterToValue(STORYFLAG_533, (time / 1000) / 60);
pMgr->setFlagOrCounterToValue(STORYFLAG_534, (time / 1000) % 60);
pMgr->setFlagOrCounterToValue(STORYFLAG_535, (time % 1000) / 10);
}
s32 dTgSwordBattleGame_c::getBossHighscore() const {
s32 time;
switch (getBossIdx()) {
case 0: time = getGhirahim1Highscore(); break;
case 1: time = getScalderaHighscore(); break;
case 2: time = getMolderachHighscore(); break;
case 4: time = getKoloktosHighscore(); break;
case 5: time = getTentalusHighscore(); break;
case 6: time = getGhirahim2Highscore(); break;
case 3: time = getImprisoned1Highscore(); break;
case 7: time = getImprisoned2Highscore(); break;
case 8: time = getImprisoned3Highscore(); break;
case 9: time = getHordeHighscore(); break;
case 10: time = getGhirahim3Highscore(); break;
case 11: time = getDemiseHighscore(); break;
}
if (time > TIME_CONVERT(59, 59, 99)) {
time = TIME_CONVERT(59, 59, 99);
}
return time;
}
s32 dTgSwordBattleGame_c::getGhirahim1Highscore() const {
StoryflagManager *pMgr = StoryflagManager::sInstance;
u16 min = pMgr->getCounterOrFlag(STORYFLAG_536);
u16 sec = pMgr->getCounterOrFlag(STORYFLAG_537);
u16 msec = pMgr->getCounterOrFlag(STORYFLAG_538);
return TIME_CONVERT(min, sec, msec);
}
s32 dTgSwordBattleGame_c::getScalderaHighscore() const {
StoryflagManager *pMgr = StoryflagManager::sInstance;
u16 min = pMgr->getCounterOrFlag(STORYFLAG_593);
u16 sec = pMgr->getCounterOrFlag(STORYFLAG_594);
u16 msec = pMgr->getCounterOrFlag(STORYFLAG_595);
return TIME_CONVERT(min, sec, msec);
}
s32 dTgSwordBattleGame_c::getMolderachHighscore() const {
StoryflagManager *pMgr = StoryflagManager::sInstance;
u16 min = pMgr->getCounterOrFlag(STORYFLAG_596);
u16 sec = pMgr->getCounterOrFlag(STORYFLAG_597);
u16 msec = pMgr->getCounterOrFlag(STORYFLAG_598);
return TIME_CONVERT(min, sec, msec);
}
s32 dTgSwordBattleGame_c::getKoloktosHighscore() const {
StoryflagManager *pMgr = StoryflagManager::sInstance;
u16 min = pMgr->getCounterOrFlag(STORYFLAG_602);
u16 sec = pMgr->getCounterOrFlag(STORYFLAG_603);
u16 msec = pMgr->getCounterOrFlag(STORYFLAG_604);
return TIME_CONVERT(min, sec, msec);
}
s32 dTgSwordBattleGame_c::getTentalusHighscore() const {
StoryflagManager *pMgr = StoryflagManager::sInstance;
u16 min = pMgr->getCounterOrFlag(STORYFLAG_605);
u16 sec = pMgr->getCounterOrFlag(STORYFLAG_606);
u16 msec = pMgr->getCounterOrFlag(STORYFLAG_607);
return TIME_CONVERT(min, sec, msec);
}
s32 dTgSwordBattleGame_c::getGhirahim2Highscore() const {
StoryflagManager *pMgr = StoryflagManager::sInstance;
u16 min = pMgr->getCounterOrFlag(STORYFLAG_608);
u16 sec = pMgr->getCounterOrFlag(STORYFLAG_609);
u16 msec = pMgr->getCounterOrFlag(STORYFLAG_610);
return TIME_CONVERT(min, sec, msec);
}
s32 dTgSwordBattleGame_c::getImprisoned1Highscore() const {
StoryflagManager *pMgr = StoryflagManager::sInstance;
u16 min = pMgr->getCounterOrFlag(STORYFLAG_599);
u16 sec = pMgr->getCounterOrFlag(STORYFLAG_600);
u16 msec = pMgr->getCounterOrFlag(STORYFLAG_601);
return TIME_CONVERT(min, sec, msec);
}
s32 dTgSwordBattleGame_c::getImprisoned2Highscore() const {
StoryflagManager *pMgr = StoryflagManager::sInstance;
u16 min = pMgr->getCounterOrFlag(STORYFLAG_611);
u16 sec = pMgr->getCounterOrFlag(STORYFLAG_612);
u16 msec = pMgr->getCounterOrFlag(STORYFLAG_613);
return TIME_CONVERT(min, sec, msec);
}
s32 dTgSwordBattleGame_c::getImprisoned3Highscore() const {
StoryflagManager *pMgr = StoryflagManager::sInstance;
u16 min = pMgr->getCounterOrFlag(STORYFLAG_614);
u16 sec = pMgr->getCounterOrFlag(STORYFLAG_615);
u16 msec = pMgr->getCounterOrFlag(STORYFLAG_616);
return TIME_CONVERT(min, sec, msec);
}
s32 dTgSwordBattleGame_c::getHordeHighscore() const {
StoryflagManager *pMgr = StoryflagManager::sInstance;
u16 min = pMgr->getCounterOrFlag(STORYFLAG_617);
u16 sec = pMgr->getCounterOrFlag(STORYFLAG_618);
u16 msec = pMgr->getCounterOrFlag(STORYFLAG_619);
return TIME_CONVERT(min, sec, msec);
}
s32 dTgSwordBattleGame_c::getGhirahim3Highscore() const {
StoryflagManager *pMgr = StoryflagManager::sInstance;
u16 min = pMgr->getCounterOrFlag(STORYFLAG_620);
u16 sec = pMgr->getCounterOrFlag(STORYFLAG_621);
u16 msec = pMgr->getCounterOrFlag(STORYFLAG_622);
return TIME_CONVERT(min, sec, msec);
}
s32 dTgSwordBattleGame_c::getDemiseHighscore() const {
StoryflagManager *pMgr = StoryflagManager::sInstance;
u16 min = pMgr->getCounterOrFlag(STORYFLAG_623);
u16 sec = pMgr->getCounterOrFlag(STORYFLAG_624);
u16 msec = pMgr->getCounterOrFlag(STORYFLAG_625);
return TIME_CONVERT(min, sec, msec);
}
s32 dTgSwordBattleGame_c::getBossIdx() const {
return StoryflagManager::sInstance->getCounterOrFlag(STORYFLAG_563);
}
s32 dTgSwordBattleGame_c::getCurrentBossNumber() const {
return StoryflagManager::sInstance->getCounterOrFlag(STORYFLAG_654);
}
void dTgSwordBattleGame_c::setCurrentBossNumber(s32 num) {
StoryflagManager::sInstance->setFlagOrCounterToValue(STORYFLAG_654, num);
}
void dTgSwordBattleGame_c::notifyBossDeath(bool ghirahim_related) {
field_0x1A9 = true;
field_0x1AA = ghirahim_related;
dLytMiniGame_c::GetInstance()->setComplete();
}
bool dTgSwordBattleGame_c::checkFightStarted() const {
return field_0x1AC;
}