Merge pull request #50 from robojumper/state_system

Port and match the NSMBW state system, match 1½ RELs with that state system
This commit is contained in:
Elijah Thomas
2024-06-09 22:48:10 -04:00
committed by GitHub
34 changed files with 1141 additions and 149 deletions
@@ -2,7 +2,7 @@ Sections:
.text type:code align:16
.ctors type:rodata align:4
.dtors type:rodata align:4
.rodata type:rodata align:16
.data type:data align:16
.bss type:bss align:8
REL/executor.c:
@@ -16,3 +16,5 @@ REL/global_destructor_chain.c:
REL/d/t/d_t_rock_boat.cpp:
.text start:0x000000F0 end:0x00000A28
.ctors start:0x00000000 end:0x00000004
.data start:0x00000000 end:0x00000200
.bss start:0x00000008 end:0x00000048
+43 -43
View File
@@ -3,50 +3,50 @@ _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_487_F0 = .text:0x000000F0; // type:function size:0xAC
fn_487_1A0 = .text:0x000001A0; // type:function size:0x58
fn_487_200 = .text:0x00000200; // type:function size:0x58
fn_487_260 = .text:0x00000260; // type:function size:0x6C
fn_487_2D0 = .text:0x000002D0; // type:function size:0xA0
fn_487_370 = .text:0x00000370; // type:function size:0xA4
fn_487_420 = .text:0x00000420; // type:function size:0x50
fn_487_470 = .text:0x00000470; // type:function size:0x10
fn_487_480 = .text:0x00000480; // type:function size:0x8
fn_487_490 = .text:0x00000490; // type:function size:0x30
fn_487_4C0 = .text:0x000004C0; // type:function size:0x10
fn_487_4D0 = .text:0x000004D0; // type:function size:0x8
fn_487_4E0 = .text:0x000004E0; // type:function size:0x4
fn_487_4F0 = .text:0x000004F0; // type:function size:0x90
fn_487_580 = .text:0x00000580; // type:function size:0x4
fn_487_590 = .text:0x00000590; // type:function size:0xC8
fn_487_660 = .text:0x00000660; // type:function size:0x10
fn_487_670 = .text:0x00000670; // type:function size:0x60
fn_487_6D0 = .text:0x000006D0; // type:function size:0xC
fn_487_6E0 = .text:0x000006E0; // type:function size:0x1C
fn_487_700 = .text:0x00000700; // type:function size:0x1C
fn_487_720 = .text:0x00000720; // type:function size:0x1C
fn_487_740 = .text:0x00000740; // type:function size:0x10
fn_487_750 = .text:0x00000750; // type:function size:0x10
fn_487_760 = .text:0x00000760; // type:function size:0x10
fn_487_770 = .text:0x00000770; // type:function size:0x10
fn_487_780 = .text:0x00000780; // type:function size:0x10
fn_487_790 = .text:0x00000790; // type:function size:0x10
fn_487_7A0 = .text:0x000007A0; // type:function size:0x30
fn_487_7D0 = .text:0x000007D0; // type:function size:0x30
fn_487_800 = .text:0x00000800; // type:function size:0x30
fn_487_830 = .text:0x00000830; // type:function size:0x10C
fn_487_940 = .text:0x00000940; // type:function size:0x58
fn_487_9A0 = .text:0x000009A0; // type:function size:0x88
dTgRockBoat_c_classInit__Fv = .text:0x000000F0; // type:function size:0xAC
__dt__8dTgAbs_cFv = .text:0x000001A0; // type:function size:0x58
__dt__26sFState_c<13dTgRockBoat_c>Fv = .text:0x00000200; // type:function size:0x58
__dt__29sFStateFct_c<13dTgRockBoat_c>Fv = .text:0x00000260; // type:function size:0x6C
__dt__82sStateMgr_c<13dTgRockBoat_c,20sStateMethodUsr_FI_c,12sFStateFct_c,13sStateIDChk_c>Fv = .text:0x000002D0; // type:function size:0xA0
__dt__52sFStateMgr_c<13dTgRockBoat_c,20sStateMethodUsr_FI_c>Fv = .text:0x00000370; // type:function size:0xA4
create__13dTgRockBoat_cFv = .text:0x00000420; // type:function size:0x50
changeState__82sStateMgr_c<13dTgRockBoat_c,20sStateMethodUsr_FI_c,12sFStateFct_c,13sStateIDChk_c>FRC12sStateIDIf_c = .text:0x00000470; // type:function size:0x10
doDelete__13dTgRockBoat_cFv = .text:0x00000480; // type:function size:0x8
actorExecute__13dTgRockBoat_cFv = .text:0x00000490; // type:function size:0x30
executeState__82sStateMgr_c<13dTgRockBoat_c,20sStateMethodUsr_FI_c,12sFStateFct_c,13sStateIDChk_c>Fv = .text:0x000004C0; // type:function size:0x10
draw__13dTgRockBoat_cFv = .text:0x000004D0; // type:function size:0x8
initializeState_Wait__13dTgRockBoat_cFv = .text:0x000004E0; // type:function size:0x4
executeState_Wait__13dTgRockBoat_cFv = .text:0x000004F0; // type:function size:0x90
finalizeState_Wait__13dTgRockBoat_cFv = .text:0x00000580; // type:function size:0x4
__dt__13dTgRockBoat_cFv = .text:0x00000590; // type:function size:0xC8
getStateID__82sStateMgr_c<13dTgRockBoat_c,20sStateMethodUsr_FI_c,12sFStateFct_c,13sStateIDChk_c>CFv = .text:0x00000660; // type:function size:0x10
build__29sFStateFct_c<13dTgRockBoat_c>FRC12sStateIDIf_c = .text:0x00000670; // type:function size:0x60
dispose__29sFStateFct_c<13dTgRockBoat_c>FRP10sStateIf_c = .text:0x000006D0; // type:function size:0xC
initialize__26sFState_c<13dTgRockBoat_c>Fv = .text:0x000006E0; // type:function size:0x1C
execute__26sFState_c<13dTgRockBoat_c>Fv = .text:0x00000700; // type:function size:0x1C
finalize__26sFState_c<13dTgRockBoat_c>Fv = .text:0x00000720; // type:function size:0x1C
initializeState__82sStateMgr_c<13dTgRockBoat_c,20sStateMethodUsr_FI_c,12sFStateFct_c,13sStateIDChk_c>Fv = .text:0x00000740; // type:function size:0x10
finalizeState__82sStateMgr_c<13dTgRockBoat_c,20sStateMethodUsr_FI_c,12sFStateFct_c,13sStateIDChk_c>Fv = .text:0x00000750; // type:function size:0x10
refreshState__82sStateMgr_c<13dTgRockBoat_c,20sStateMethodUsr_FI_c,12sFStateFct_c,13sStateIDChk_c>Fv = .text:0x00000760; // type:function size:0x10
getState__82sStateMgr_c<13dTgRockBoat_c,20sStateMethodUsr_FI_c,12sFStateFct_c,13sStateIDChk_c>CFv = .text:0x00000770; // type:function size:0x10
getNewStateID__82sStateMgr_c<13dTgRockBoat_c,20sStateMethodUsr_FI_c,12sFStateFct_c,13sStateIDChk_c>CFv = .text:0x00000780; // type:function size:0x10
getOldStateID__82sStateMgr_c<13dTgRockBoat_c,20sStateMethodUsr_FI_c,12sFStateFct_c,13sStateIDChk_c>CFv = .text:0x00000790; // type:function size:0x10
finalizeState__28sFStateID_c<13dTgRockBoat_c>CFR13dTgRockBoat_c = .text:0x000007A0; // type:function size:0x30
executeState__28sFStateID_c<13dTgRockBoat_c>CFR13dTgRockBoat_c = .text:0x000007D0; // type:function size:0x30
initializeState__28sFStateID_c<13dTgRockBoat_c>CFR13dTgRockBoat_c = .text:0x00000800; // type:function size:0x30
__sinit_\d_t_rock_boat_cpp = .text:0x00000830; // type:function size:0x10C scope:local
__dt__28sFStateID_c<13dTgRockBoat_c>Fv = .text:0x00000940; // type:function size:0x58
isSameName__28sFStateID_c<13dTgRockBoat_c>CFPCc = .text:0x000009A0; // 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_487_section4_0 = .rodata:0x00000000; // type:object size:0x10 data:4byte
lbl_487_section4_10 = .rodata:0x00000010; // type:object size:0x78
lbl_487_section4_88 = .rodata:0x00000088; // type:object size:0x30
lbl_487_section4_B8 = .rodata:0x000000B8; // type:object size:0x30
lbl_487_section4_E8 = .rodata:0x000000E8; // type:object size:0x18
lbl_487_section4_100 = .rodata:0x00000100; // type:object size:0xCC
lbl_487_section4_1CC = .rodata:0x000001CC; // type:object size:0x34
g_profile_TAG_ROCK_BOAT = .data:0x00000000; // type:object size:0x10 data:4byte
__vt__13dTgRockBoat_c = .data:0x00000010; // type:object size:0x74
__vt__52sFStateMgr_c<13dTgRockBoat_c,20sStateMethodUsr_FI_c> = .data:0x00000088; // type:object size:0x30
__vt__82sStateMgr_c<13dTgRockBoat_c,20sStateMethodUsr_FI_c,12sFStateFct_c,13sStateIDChk_c> = .data:0x000000B8; // type:object size:0x30
__vt__29sFStateFct_c<13dTgRockBoat_c> = .data:0x000000E8; // type:object size:0x14
__vt__26sFState_c<13dTgRockBoat_c> = .data:0x00000100; // type:object size:0x18
__vt__28sFStateID_c<13dTgRockBoat_c> = .data:0x000001CC; // type:object size:0x34
__global_destructor_chain = .bss:0x00000000; // type:object size:0x4 scope:global
lbl_487_bss_8 = .bss:0x00000008; // type:object size:0x10
lbl_487_bss_18 = .bss:0x00000018; // type:object size:0x30 data:4byte
lbl_487_bss_8 = .bss:0x00000008; // type:object size:0xC scope:local
StateID_Wait__13dTgRockBoat_c = .bss:0x00000018; // type:object size:0x30 data:4byte
@@ -17,3 +17,6 @@ REL/global_destructor_chain.c:
REL/d/t/d_t_tumble_weed.cpp:
.text start:0x000000F0 end:0x00001288
.ctors start:0x00000000 end:0x00000004
.rodata start:0x00000000 end:0x00000064
.data start:0x00000000 end:0x00000294
.bss start:0x00000008 end:0x000000C8
@@ -3,66 +3,66 @@ _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_476_F0 = .text:0x000000F0; // type:function size:0xC0
fn_476_1B0 = .text:0x000001B0; // type:function size:0x58
fn_476_210 = .text:0x00000210; // type:function size:0x58
fn_476_270 = .text:0x00000270; // type:function size:0x6C
fn_476_2E0 = .text:0x000002E0; // type:function size:0xA0
fn_476_380 = .text:0x00000380; // type:function size:0xA4
fn_476_430 = .text:0x00000430; // type:function size:0x48
fn_476_480 = .text:0x00000480; // type:function size:0x10
fn_476_490 = .text:0x00000490; // type:function size:0x8
fn_476_4A0 = .text:0x000004A0; // type:function size:0x48
fn_476_4F0 = .text:0x000004F0; // type:function size:0x10
fn_476_500 = .text:0x00000500; // type:function size:0x1C
fn_476_520 = .text:0x00000520; // type:function size:0x8
fn_476_530 = .text:0x00000530; // type:function size:0x4
fn_476_540 = .text:0x00000540; // type:function size:0xA0
fn_476_5E0 = .text:0x000005E0; // type:function size:0x4
fn_476_5F0 = .text:0x000005F0; // type:function size:0x4
fn_476_600 = .text:0x00000600; // type:function size:0xC8
fn_476_6D0 = .text:0x000006D0; // type:function size:0x4
fn_476_6E0 = .text:0x000006E0; // type:function size:0x44
fn_476_730 = .text:0x00000730; // type:function size:0x74
fn_476_7B0 = .text:0x000007B0; // type:function size:0x4
fn_476_7C0 = .text:0x000007C0; // type:function size:0x98
fn_476_860 = .text:0x00000860; // type:function size:0x54
fn_476_8C0 = .text:0x000008C0; // type:function size:0x288
fn_476_B50 = .text:0x00000B50; // type:function size:0x114
fn_476_C70 = .text:0x00000C70; // type:function size:0xD8
fn_476_D50 = .text:0x00000D50; // type:function size:0x10
fn_476_D60 = .text:0x00000D60; // type:function size:0x60
fn_476_DC0 = .text:0x00000DC0; // type:function size:0xC
fn_476_DD0 = .text:0x00000DD0; // type:function size:0x1C
fn_476_DF0 = .text:0x00000DF0; // type:function size:0x1C
fn_476_E10 = .text:0x00000E10; // type:function size:0x1C
fn_476_E30 = .text:0x00000E30; // type:function size:0x10
fn_476_E40 = .text:0x00000E40; // type:function size:0x10
fn_476_E50 = .text:0x00000E50; // type:function size:0x10
fn_476_E60 = .text:0x00000E60; // type:function size:0x10
fn_476_E70 = .text:0x00000E70; // type:function size:0x10
fn_476_E80 = .text:0x00000E80; // type:function size:0x10
fn_476_E90 = .text:0x00000E90; // type:function size:0x30
fn_476_EC0 = .text:0x00000EC0; // type:function size:0x30
fn_476_EF0 = .text:0x00000EF0; // type:function size:0x30
fn_476_F20 = .text:0x00000F20; // type:function size:0x27C
fn_476_11A0 = .text:0x000011A0; // type:function size:0x58
fn_476_1200 = .text:0x00001200; // type:function size:0x88
dTgTumbleWeed_c_classInit__Fv = .text:0x000000F0; // type:function size:0xC0
__dt__8dTgAbs_cFv = .text:0x000001B0; // type:function size:0x58
__dt__28sFState_c<15dTgTumbleWeed_c>Fv = .text:0x00000210; // type:function size:0x58
__dt__31sFStateFct_c<15dTgTumbleWeed_c>Fv = .text:0x00000270; // type:function size:0x6C
__dt__84sStateMgr_c<15dTgTumbleWeed_c,20sStateMethodUsr_FI_c,12sFStateFct_c,13sStateIDChk_c>Fv = .text:0x000002E0; // type:function size:0xA0
__dt__54sFStateMgr_c<15dTgTumbleWeed_c,20sStateMethodUsr_FI_c>Fv = .text:0x00000380; // type:function size:0xA4
create__15dTgTumbleWeed_cFv = .text:0x00000430; // type:function size:0x48
changeState__84sStateMgr_c<15dTgTumbleWeed_c,20sStateMethodUsr_FI_c,12sFStateFct_c,13sStateIDChk_c>FRC12sStateIDIf_c = .text:0x00000480; // type:function size:0x10
doDelete__15dTgTumbleWeed_cFv = .text:0x00000490; // type:function size:0x8
actorExecute__15dTgTumbleWeed_cFv = .text:0x000004A0; // type:function size:0x48
executeState__84sStateMgr_c<15dTgTumbleWeed_c,20sStateMethodUsr_FI_c,12sFStateFct_c,13sStateIDChk_c>Fv = .text:0x000004F0; // type:function size:0x10
decr__FPUs = .text:0x00000500; // type:function size:0x1C
draw__15dTgTumbleWeed_cFv = .text:0x00000520; // type:function size:0x8
initializeState_AreaOut__15dTgTumbleWeed_cFv = .text:0x00000530; // type:function size:0x4
executeState_AreaOut__15dTgTumbleWeed_cFv = .text:0x00000540; // type:function size:0xA0
finalizeState_AreaOut__15dTgTumbleWeed_cFv = .text:0x000005E0; // type:function size:0x4
initializeState_AreaIn__15dTgTumbleWeed_cFv = .text:0x000005F0; // type:function size:0x4
executeState_AreaIn__15dTgTumbleWeed_cFv = .text:0x00000600; // type:function size:0xC8
finalizeState_AreaIn__15dTgTumbleWeed_cFv = .text:0x000006D0; // type:function size:0x4
initializeState_Wind__15dTgTumbleWeed_cFv = .text:0x000006E0; // type:function size:0x44
executeState_Wind__15dTgTumbleWeed_cFv = .text:0x00000730; // type:function size:0x74
finalizeState_Wind__15dTgTumbleWeed_cFv = .text:0x000007B0; // type:function size:0x4
shouldSpawnTumbleweed__15dTgTumbleWeed_cFv = .text:0x000007C0; // type:function size:0x98
shouldDoWind__15dTgTumbleWeed_cFv = .text:0x00000860; // type:function size:0x54
doSpawnTumbleweed__15dTgTumbleWeed_cFv = .text:0x000008C0; // type:function size:0x288
getWind__15dTgTumbleWeed_cFP7mVec3_c = .text:0x00000B50; // type:function size:0x114
__dt__15dTgTumbleWeed_cFv = .text:0x00000C70; // type:function size:0xD8
getStateID__84sStateMgr_c<15dTgTumbleWeed_c,20sStateMethodUsr_FI_c,12sFStateFct_c,13sStateIDChk_c>CFv = .text:0x00000D50; // type:function size:0x10
build__31sFStateFct_c<15dTgTumbleWeed_c>FRC12sStateIDIf_c = .text:0x00000D60; // type:function size:0x60
dispose__31sFStateFct_c<15dTgTumbleWeed_c>FRP10sStateIf_c = .text:0x00000DC0; // type:function size:0xC
initialize__28sFState_c<15dTgTumbleWeed_c>Fv = .text:0x00000DD0; // type:function size:0x1C
execute__28sFState_c<15dTgTumbleWeed_c>Fv = .text:0x00000DF0; // type:function size:0x1C
finalize__28sFState_c<15dTgTumbleWeed_c>Fv = .text:0x00000E10; // type:function size:0x1C
initializeState__84sStateMgr_c<15dTgTumbleWeed_c,20sStateMethodUsr_FI_c,12sFStateFct_c,13sStateIDChk_c>Fv = .text:0x00000E30; // type:function size:0x10
finalizeState__84sStateMgr_c<15dTgTumbleWeed_c,20sStateMethodUsr_FI_c,12sFStateFct_c,13sStateIDChk_c>Fv = .text:0x00000E40; // type:function size:0x10
refreshState__84sStateMgr_c<15dTgTumbleWeed_c,20sStateMethodUsr_FI_c,12sFStateFct_c,13sStateIDChk_c>Fv = .text:0x00000E50; // type:function size:0x10
getState__84sStateMgr_c<15dTgTumbleWeed_c,20sStateMethodUsr_FI_c,12sFStateFct_c,13sStateIDChk_c>CFv = .text:0x00000E60; // type:function size:0x10
getNewStateID__84sStateMgr_c<15dTgTumbleWeed_c,20sStateMethodUsr_FI_c,12sFStateFct_c,13sStateIDChk_c>CFv = .text:0x00000E70; // type:function size:0x10
getOldStateID__84sStateMgr_c<15dTgTumbleWeed_c,20sStateMethodUsr_FI_c,12sFStateFct_c,13sStateIDChk_c>CFv = .text:0x00000E80; // type:function size:0x10
finalizeState__30sFStateID_c<15dTgTumbleWeed_c>CFR15dTgTumbleWeed_c = .text:0x00000E90; // type:function size:0x30
executeState__30sFStateID_c<15dTgTumbleWeed_c>CFR15dTgTumbleWeed_c = .text:0x00000EC0; // type:function size:0x30
initializeState__30sFStateID_c<15dTgTumbleWeed_c>CFR15dTgTumbleWeed_c = .text:0x00000EF0; // type:function size:0x30
__sinit_\d_t_tumble_weed_cpp = .text:0x00000F20; // type:function size:0x27C
__dt__30sFStateID_c<15dTgTumbleWeed_c>Fv = .text:0x000011A0; // type:function size:0x58
isSameName__30sFStateID_c<15dTgTumbleWeed_c>CFPCc = .text:0x00001200; // 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_476_rodata_0 = .rodata:0x00000000; // type:object size:0x1C data:float
lbl_476_rodata_1C = .rodata:0x0000001C; // type:object size:0x4 data:float
lbl_476_rodata_20 = .rodata:0x00000020; // type:object size:0x44 data:float
lbl_476_data_0 = .data:0x00000000; // type:object size:0x10 data:4byte
lbl_476_data_10 = .data:0x00000010; // type:object size:0x78
lbl_476_data_88 = .data:0x00000088; // type:object size:0x30
lbl_476_data_B8 = .data:0x000000B8; // type:object size:0x30
lbl_476_data_E8 = .data:0x000000E8; // type:object size:0x18
lbl_476_data_100 = .data:0x00000100; // type:object size:0x160
lbl_476_data_260 = .data:0x00000260; // type:object size:0x34
g_profile_TAG_TUMBLE_WEED = .data:0x00000000; // type:object size:0x10 data:4byte
__vt__15dTgTumbleWeed_c = .data:0x00000010; // type:object size:0x74
__vt__54sFStateMgr_c<15dTgTumbleWeed_c,20sStateMethodUsr_FI_c> = .data:0x00000088; // type:object size:0x30
__vt__84sStateMgr_c<15dTgTumbleWeed_c,20sStateMethodUsr_FI_c,12sFStateFct_c,13sStateIDChk_c> = .data:0x000000B8; // type:object size:0x30
__vt__31sFStateFct_c<15dTgTumbleWeed_c> = .data:0x000000E8; // type:object size:0x14
__vt__28sFState_c<15dTgTumbleWeed_c> = .data:0x00000100; // type:object size:0x18
__vt__30sFStateID_c<15dTgTumbleWeed_c> = .data:0x00000260; // type:object size:0x34
__global_destructor_chain = .bss:0x00000000; // type:object size:0x4 scope:global
lbl_476_bss_8 = .bss:0x00000008; // type:object size:0x10 data:4byte
lbl_476_bss_18 = .bss:0x00000018; // type:object size:0x40 data:4byte
lbl_476_bss_58 = .bss:0x00000058; // type:object size:0x40 data:4byte
StateID_AreaOut__15dTgTumbleWeed_c = .bss:0x00000018; // type:object size:0x30 data:4byte
lbl_476_bss_58 = .bss:0x00000058; // type:object size:0x30 data:4byte
lbl_476_bss_98 = .bss:0x00000098; // type:object size:0x30 data:4byte
+17
View File
@@ -219,6 +219,23 @@ toBeSorted/counters/extra_wallet_counter.cpp:
.data start:0x805280B0 end:0x805280D0
.sbss start:0x80575640 end:0x80575648
s/s_StateId.cpp:
.text start:0x802DDDB0 end:0x802DE1F4
.ctors start:0x804DB8B8 end:0x804DB8BC
.data start:0x80541930 end:0x805419A8
.sbss start:0x80575B68 end:0x80575B70
.bss start:0x805B84B0 end:0x805B84C8
s/s_StateMethod.cpp:
.text start:0x802DE200 end:0x802DE534
.data start:0x805419A8 end:0x805419E8
s/s_StateMethodUsr_FI.cpp:
.text start:0x802DE540 end:0x802DE6EC
s/s_Phase.cpp:
.text start:0x802DEEB0 end:0x802DEF74
DynamicLink.cpp:
.text start:0x802DF100 end:0x802DFD74
.data start:0x805419E8 end:0x80541A70
+45 -45
View File
@@ -1118,7 +1118,7 @@ fn_8002E2A0 = .text:0x8002E2A0; // type:function size:0x90
fn_8002E330 = .text:0x8002E330; // type:function size:0x27C
fn_8002E5B0 = .text:0x8002E5B0; // type:function size:0x8
fn_8002E5C0 = .text:0x8002E5C0; // type:function size:0x70
fn_8002E630 = .text:0x8002E630; // type:function size:0x98
create__12dAcObjBase_cFQ28fProfile14PROFILE_NAME_eScUlP7mVec3_cP7mAng3_cP7mVec3_cUl = .text:0x8002E630; // type:function size:0x98
fn_8002E6D0 = .text:0x8002E6D0; // type:function size:0xA0
fn_8002E770 = .text:0x8002E770; // type:function size:0x7C
fn_8002E7F0 = .text:0x8002E7F0; // type:function size:0x58
@@ -1231,7 +1231,7 @@ fn_80032840 = .text:0x80032840; // type:function size:0x10
fn_80032850 = .text:0x80032850; // type:function size:0x64
fn_800328C0 = .text:0x800328C0; // type:function size:0x58
fn_80032920 = .text:0x80032920; // type:function size:0x10
fn_80032930 = .text:0x80032930; // type:function size:0x8
getStateID__14sStateMethod_cCFv = .text:0x80032930; // type:function size:0x8
fn_80032940 = .text:0x80032940; // type:function size:0x10
fn_80032950 = .text:0x80032950; // type:function size:0x8
fn_80032960 = .text:0x80032960; // type:function size:0x94
@@ -1620,10 +1620,10 @@ fn_8003EE80 = .text:0x8003EE80; // type:function size:0xC
fn_8003EE90 = .text:0x8003EE90; // type:function size:0x1C
fn_8003EEB0 = .text:0x8003EEB0; // type:function size:0x1C
fn_8003EED0 = .text:0x8003EED0; // type:function size:0x1C
fn_8003EEF0 = .text:0x8003EEF0; // type:function size:0xC
fn_8003EF00 = .text:0x8003EF00; // type:function size:0x8
fn_8003EF10 = .text:0x8003EF10; // type:function size:0x8
fn_8003EF20 = .text:0x8003EF20; // type:function size:0x8
refreshStateMethod__14sStateMethod_cFv = .text:0x8003EEF0; // type:function size:0xC
getState__14sStateMethod_cCFv = .text:0x8003EF00; // type:function size:0x8
getNewStateID__14sStateMethod_cCFv = .text:0x8003EF10; // type:function size:0x8
getOldStateID__14sStateMethod_cCFv = .text:0x8003EF20; // type:function size:0x8
fn_8003EF30 = .text:0x8003EF30; // type:function size:0x10
fn_8003EF40 = .text:0x8003EF40; // type:function size:0x10
fn_8003EF50 = .text:0x8003EF50; // type:function size:0x10
@@ -17168,36 +17168,36 @@ fn_802DDC20 = .text:0x802DDC20; // type:function size:0x40
fn_802DDC60 = .text:0x802DDC60; // type:function size:0x58
fn_802DDCC0 = .text:0x802DDCC0; // type:function size:0xA8
fn_802DDD70 = .text:0x802DDD70; // type:function size:0x40
fn_802DDDB0 = .text:0x802DDDB0; // type:function size:0x34
fn_802DDDF0 = .text:0x802DDDF0; // type:function size:0x58
fn_802DDE50 = .text:0x802DDE50; // type:function size:0x10
fn_802DDE60 = .text:0x802DDE60; // type:function size:0x68
fn_802DDED0 = .text:0x802DDED0; // type:function size:0x10
fn_802DDEE0 = .text:0x802DDEE0; // type:function size:0x34
fn_802DDF20 = .text:0x802DDF20; // type:function size:0x8
fn_802DDF30 = .text:0x802DDF30; // type:function size:0x8
fn_802DDF40 = .text:0x802DDF40; // type:function size:0x8
fn_802DDF50 = .text:0x802DDF50; // type:function size:0x40
fn_802DDF90 = .text:0x802DDF90; // type:function size:0x40
fn_802DDFD0 = .text:0x802DDFD0; // type:function size:0x58
fn_802DE030 = .text:0x802DE030; // type:function size:0x40
fn_802DE070 = .text:0x802DE070; // type:function size:0x40
fn_802DE0B0 = .text:0x802DE0B0; // type:function size:0x40
fn_802DE0F0 = .text:0x802DE0F0; // type:function size:0x58
fn_802DE150 = .text:0x802DE150; // type:function size:0x40
fn_802DE190 = .text:0x802DE190; // type:function size:0x8
fn_802DE1A0 = .text:0x802DE1A0; // type:function size:0x54
fn_802DE200 = .text:0x802DE200; // type:function size:0x48
fn_802DE250 = .text:0x802DE250; // type:function size:0x58
fn_802DE2B0 = .text:0x802DE2B0; // type:function size:0xA8
fn_802DE360 = .text:0x802DE360; // type:function size:0xC4
fn_802DE430 = .text:0x802DE430; // type:function size:0x8C
fn_802DE4C0 = .text:0x802DE4C0; // type:function size:0x74
fn_802DE540 = .text:0x802DE540; // type:function size:0x3C
fn_802DE580 = .text:0x802DE580; // type:function size:0x68
fn_802DE5F0 = .text:0x802DE5F0; // type:function size:0x4C
fn_802DE640 = .text:0x802DE640; // type:function size:0x54
fn_802DE6A0 = .text:0x802DE6A0; // type:function size:0x4C
__ct__10sStateID_cFPCc = .text:0x802DDDB0; // type:function size:0x34
__dt__10sStateID_cFv = .text:0x802DDDF0; // type:function size:0x58
isNull__10sStateID_cCFv = .text:0x802DDE50; // type:function size:0x10
isEqual__10sStateID_cCFRC12sStateIDIf_c = .text:0x802DDE60; // type:function size:0x68
__eq__10sStateID_cCFRC12sStateIDIf_c = .text:0x802DDED0; // type:function size:0x10
__ne__10sStateID_cCFRC12sStateIDIf_c = .text:0x802DDEE0; // type:function size:0x34
isSameName__10sStateID_cCFPCc = .text:0x802DDF20; // type:function size:0x8
name__10sStateID_cCFv = .text:0x802DDF30; // type:function size:0x8
number__10sStateID_cCFv = .text:0x802DDF40; // type:function size:0x8
__dt__13sStateFctIf_cFv = .text:0x802DDF50; // type:function size:0x40
__dt__15sStateIDChkIf_cFv = .text:0x802DDF90; // type:function size:0x40
__dt__13sStateIDChk_cFv = .text:0x802DDFD0; // type:function size:0x58
__dt__12sStateIDIf_cFv = .text:0x802DE030; // type:function size:0x40
__dt__10sStateIf_cFv = .text:0x802DE070; // type:function size:0x40
__dt__16sStateMethodIf_cFv = .text:0x802DE0B0; // type:function size:0x40
__dt__20sStateMethodUsr_FI_cFv = .text:0x802DE0F0; // type:function size:0x58
__dt__13sStateMgrIf_cFv = .text:0x802DE150; // type:function size:0x40
isNormalID__13sStateIDChk_cCFRC12sStateIDIf_c = .text:0x802DE190; // type:function size:0x8
__sinit_\s_StateId_cpp = .text:0x802DE1A0; // type:function size:0x54 scope:local
__ct__14sStateMethod_cFR15sStateIDChkIf_cR13sStateFctIf_cRC12sStateIDIf_c = .text:0x802DE200; // type:function size:0x48
__dt__14sStateMethod_cFv = .text:0x802DE250; // type:function size:0x58
initializeStateMethod__14sStateMethod_cFv = .text:0x802DE2B0; // type:function size:0xA8
executeStateMethod__14sStateMethod_cFv = .text:0x802DE360; // type:function size:0xC4
finalizeStateMethod__14sStateMethod_cFv = .text:0x802DE430; // type:function size:0x8C
changeStateMethod__14sStateMethod_cFRC12sStateIDIf_c = .text:0x802DE4C0; // type:function size:0x74
__ct__20sStateMethodUsr_FI_cFR15sStateIDChkIf_cR13sStateFctIf_cRC12sStateIDIf_c = .text:0x802DE540; // type:function size:0x3C
initializeStateLocalMethod__20sStateMethodUsr_FI_cFv = .text:0x802DE580; // type:function size:0x68
executeStateLocalMethod__20sStateMethodUsr_FI_cFv = .text:0x802DE5F0; // type:function size:0x4C
finalizeStateLocalMethod__20sStateMethodUsr_FI_cFv = .text:0x802DE640; // type:function size:0x54
changeStateLocalMethod__20sStateMethodUsr_FI_cFRC12sStateIDIf_c = .text:0x802DE6A0; // type:function size:0x4C
fn_802DE6F0 = .text:0x802DE6F0; // type:function size:0x4
fn_802DE700 = .text:0x802DE700; // type:function size:0x8
fn_802DE710 = .text:0x802DE710; // type:function size:0x2C
@@ -17221,8 +17221,8 @@ fn_802DED40 = .text:0x802DED40; // type:function size:0x4
fn_802DED50 = .text:0x802DED50; // type:function size:0x50
fn_802DEDA0 = .text:0x802DEDA0; // type:function size:0x64
fn_802DEE10 = .text:0x802DEE10; // type:function size:0x98
fn_802DEEB0 = .text:0x802DEEB0; // type:function size:0x14
fn_802DEED0 = .text:0x802DEED0; // type:function size:0xA4
__ct__8sPhase_cFPPFPv_Q28sPhase_c15METHOD_RESULT_ei = .text:0x802DEEB0; // type:function size:0x14
callMethod__8sPhase_cFPv = .text:0x802DEED0; // type:function size:0xA4
fn_802DEF80 = .text:0x802DEF80; // type:function size:0x8
fn_802DEF90 = .text:0x802DEF90; // type:function size:0x4C
fn_802DEFE0 = .text:0x802DEFE0; // type:function size:0x80
@@ -17288,7 +17288,7 @@ fn_802E0AB0 = .text:0x802E0AB0; // type:function size:0x34
fn_802E0AF0 = .text:0x802E0AF0; // type:function size:0x1BC
fn_802E0CB0 = .text:0x802E0CB0; // type:function size:0x48
fn_802E0D00 = .text:0x802E0D00; // type:function size:0x8
fn_802E0D10 = .text:0x802E0D10; // type:function size:0x8
rnd__2cMFv = .text:0x802E0D10; // type:function size:0x8
fn_802E0D20 = .text:0x802E0D20; // type:function size:0x58
fn_802E0D80 = .text:0x802E0D80; // type:function size:0x38
fn_802E0DC0 = .text:0x802E0DC0; // type:function size:0x48
@@ -35658,10 +35658,10 @@ lbl_805417B8 = .data:0x805417B8; // type:object size:0x8C
lbl_80541844 = .data:0x80541844; // type:object size:0x58
lbl_8054189C = .data:0x8054189C; // type:object size:0x4C
lbl_805418E8 = .data:0x805418E8; // type:object size:0x48
lbl_80541930 = .data:0x80541930; // type:object size:0x10
lbl_80541940 = .data:0x80541940; // type:object size:0x40
lbl_80541980 = .data:0x80541980; // type:object size:0x28
lbl_805419A8 = .data:0x805419A8; // type:object size:0x40
__vt__13sStateIDChk_c = .data:0x80541930; // type:object size:0x10
__vt__20sStateMethodUsr_FI_c = .data:0x80541940; // type:object size:0x40
__vt__10sStateID_c = .data:0x80541980; // type:object size:0x28
__vt__14sStateMethod_c = .data:0x805419A8; // type:object size:0x40
lbl_805419E8 = .data:0x805419E8; // type:object size:0xC data:string
lbl_805419F4 = .data:0x805419F4; // type:object size:0xC data:string
@LOCAL@getModuleTypeString__20DynamicModuleControlCFv@REL_LOAD_TYPES = .data:0x80541A00; // type:object size:0x10
@@ -40272,7 +40272,7 @@ lbl_80575B00 = .sbss:0x80575B00; // type:object size:0x20 data:4byte
lbl_80575B20 = .sbss:0x80575B20; // type:object size:0x20 data:4byte
lbl_80575B40 = .sbss:0x80575B40; // type:object size:0x20 data:4byte
lbl_80575B60 = .sbss:0x80575B60; // type:object size:0x8 data:4byte
lbl_80575B68 = .sbss:0x80575B68; // type:object size:0x8 data:4byte
sm_numberMemo__10sStateID_c = .sbss:0x80575B68; // type:object size:0x8 data:4byte
lbl_80575B70 = .sbss:0x80575B70; // type:object size:0x8 data:4byte
lbl_80575B78 = .sbss:0x80575B78; // type:object size:0x4 data:4byte
lbl_80575B7C = .sbss:0x80575B7C; // type:object size:0x4 data:4byte
@@ -49102,7 +49102,7 @@ lbl_805B8378 = .bss:0x805B8378; // type:object size:0x28 data:4byte
lbl_805B83A0 = .bss:0x805B83A0; // type:object size:0x100
lbl_805B84A0 = .bss:0x805B84A0; // type:object size:0x10 data:4byte
lbl_805B84B0 = .bss:0x805B84B0; // type:object size:0xC
lbl_805B84BC = .bss:0x805B84BC; // type:object size:0xC
null__8sStateID = .bss:0x805B84BC; // type:object size:0xC
m_tmpCtData__7fBase_c = .bss:0x805B84C8; // type:object size:0x10 data:4byte
m_connectManage__10fManager_c = .bss:0x805B84D8; // type:object size:0x10 data:4byte
m_createManage__10fManager_c = .bss:0x805B84E8; // type:object size:0x14 data:4byte
+5 -1
View File
@@ -315,6 +315,10 @@ config.libs = [
Object(Matching, "m/m_heap.cpp"),
Object(NonMatching, "m/m_mtx.cpp"),
Object(Matching, "m/m_pad.cpp"),
Object(Matching, "s/s_StateId.cpp"),
Object(Matching, "s/s_StateMethod.cpp"),
Object(Matching, "s/s_StateMethodUsr_FI.cpp"),
Object(Matching, "s/s_Phase.cpp"),
Object(Matching, "DynamicLink.cpp"),
# framework (f_name)
# d stuff (d_name)
@@ -1055,7 +1059,7 @@ config.libs = [
Rel(NonMatching, "d_t_reaction", "REL/d/t/d_t_reaction.cpp"),
Rel(NonMatching, "d_t_restart_time_stone", "REL/d/t/d_t_restart_time_stone.cpp"),
Rel(NonMatching, "d_t_ride_rock_set", "REL/d/t/d_t_ride_rock_set.cpp"),
Rel(NonMatching, "d_t_rock_boat", "REL/d/t/d_t_rock_boat.cpp"),
Rel(Matching, "d_t_rock_boat", "REL/d/t/d_t_rock_boat.cpp"),
Rel(NonMatching, "d_t_roll_attack_log", "REL/d/t/d_t_roll_attack_log.cpp"),
Rel(NonMatching, "d_t_ro_at_target_manager", "REL/d/t/d_t_ro_at_target_manager.cpp"),
Rel(NonMatching, "d_t_scene_change", "REL/d/t/d_t_scene_change.cpp"),
+5
View File
@@ -5,6 +5,11 @@
namespace cM {
static s16 atan2s(f32, f32);
void initRnd(s32);
f32 rnd();
int rndInt(int max);
f32 rndF(f32 max);
f32 rndFX(f32 amp);
} // namespace cM
#endif
+2 -2
View File
@@ -49,9 +49,9 @@ public:
/* 8002ea20 */ virtual bool drop();
public:
/* 8002e630 */ static dAcObjBase_c create(fProfile::PROFILE_NAME_e actorId, u32 roomId, u32 params1, mVec3_c *pos,
/* 8002e630 */ static dAcObjBase_c *create(fProfile::PROFILE_NAME_e actorId, s8 roomId, u32 params1, mVec3_c *pos,
mAng3_c *rot, mVec3_c *scale, u32 params2);
/* 8002e6d0 */ static dAcObjBase_c create(char *name, u32 roomId, u32 params1, mVec3_c *pos, mAng3_c *rot,
/* 8002e6d0 */ static dAcObjBase_c *create(char *name, u32 roomId, u32 params1, mVec3_c *pos, mAng3_c *rot,
mVec3_c *scale, u32 params2, u16 id, u8 viewclipId);
/* 8002e770 */ static dAcObjBase_c *findObject(fProfile::PROFILE_NAME_e actorId, fLiNdBa_c *refList,
dAcObjBase_c *parent);
+31
View File
@@ -0,0 +1,31 @@
#ifndef D_T_ROCK_BOAT
#define D_T_ROCK_BOAT
#include <d/a/d_a_base.h>
#include <f/f_list_nd.h>
#include <s/s_State.hpp>
#include <s/s_StateMgr.hpp>
class dTgAbs_c : public dAcBase_c {
public:
virtual ~dTgAbs_c() {}
};
class dTgRockBoat_c : public dTgAbs_c {
public:
dTgRockBoat_c() : mStateMgr(*this, sStateID::null) {}
virtual ~dTgRockBoat_c() {}
virtual int create() override;
virtual int actorExecute() override;
virtual int draw() override;
virtual int doDelete() override;
STATE_FUNC_DECLARE(dTgRockBoat_c, Wait);
private:
STATE_MGR_DECLARE(dTgRockBoat_c);
int cooldown;
int boatNum;
};
#endif
+41
View File
@@ -0,0 +1,41 @@
#ifndef D_T_TUMBLE_WEED_H
#define D_T_TUMBLE_WEED_H
#include <d/tg/d_tg.h>
#include <f/f_list_nd.h>
#include <s/s_State.hpp>
#include <s/s_StateMgr.hpp>
class fLiNdTumbleweed_c : public fLiNdBaAutoUnlink_c {
public:
fLiNdTumbleweed_c(fBase_c *owner) : fLiNdBaAutoUnlink_c(owner) {}
u16 someField;
};
class dTgTumbleWeed_c : public dTg_c {
public:
dTgTumbleWeed_c() : mStateMgr(*this, sStateID::null), childTumbleweed(nullptr) {}
virtual ~dTgTumbleWeed_c() {}
virtual int create() override;
virtual int actorExecute() override;
virtual int draw() override;
virtual int doDelete() override;
STATE_FUNC_DECLARE(dTgTumbleWeed_c, AreaOut);
STATE_FUNC_DECLARE(dTgTumbleWeed_c, AreaIn);
STATE_FUNC_DECLARE(dTgTumbleWeed_c, Wind);
private:
bool shouldSpawnTumbleweed();
bool shouldDoWind();
void doSpawnTumbleweed();
void getWind(mVec3_c *);
STATE_MGR_DECLARE(dTgTumbleWeed_c);
u16 tumbleweedTimer;
u16 padding;
u16 windTimer;
fLiNdTumbleweed_c childTumbleweed;
};
#endif
+7
View File
@@ -12,6 +12,7 @@ class fBase_c;
class fLiNdBa_c : public cListNd_c {
public:
fLiNdBa_c(fBase_c *owner) : p_owner(owner) {}
~fLiNdBa_c() {}
inline fLiNdBa_c *getPrev() const {
return (fLiNdBa_c *)cListNd_c::getPrev();
@@ -27,4 +28,10 @@ public:
fBase_c *p_owner;
};
class fLiNdBaAutoUnlink_c : public fLiNdBa_c {
public:
fLiNdBaAutoUnlink_c(fBase_c *owner) : fLiNdBa_c(owner) {}
~fLiNdBaAutoUnlink_c() { unlink(); }
};
#endif
+1
View File
@@ -29,6 +29,7 @@ public:
PROC_FLAG_DRAW = GET_PROC_FLAG(DRAW)
};
fManager_c(fBase_c *owner) : connect_node(owner), execute_node(owner), draw_node(owner), search_node(owner) {}
~fManager_c() {}
/* 802e28c0 */ int getSearchTableNum();
/* 802e28d0 */ static fBase_c *searchBaseByID(fBaseID_e id);
/* 802e2920 */ static fBase_c *searchBaseByProfName(ProfileName profID, const fBase_c *parent);
+18
View File
@@ -0,0 +1,18 @@
This library was ported from https://github.com/NSMBW-Community/NSMBW-Decomp/tree/master/include/dol/sLib
with differences/modifications outlined below:
## No inline destructors
The NSMBW code uses inlined destructors. In SS, these destructors are all part of the s_StateID.cpp(?) TU,
and pretty much every generic instantiation of the state manager (which for a large part are in RELs)
will call back into those destructors in the main DOL. As a result, the destructors were made not inline
and explicitly instantiated in s_StateID.cpp
## s_StateIDChk.hpp
In order for vtable ordering to match, some classes had to be extracted to a new header.
## sStateMethodIf_c
S_StateMethod_c's destructors calls back into another destructors. sStateMethodIf_c follows the example of
the other abstract interface classes and provides this dtor.
+14
View File
@@ -0,0 +1,14 @@
#ifndef S_DOCGROUP_H
#define S_DOCGROUP_H
// [This header file defines documentation groups for better categorization]
/// @ingroup game
/// @defgroup slib sLib
/// @brief Provides various utilities (including the state system).
/// @defgroup state sState
/// @ingroup slib
/// @brief A state system implementation.
#endif
+48
View File
@@ -0,0 +1,48 @@
#ifndef S_FSTATE_H
#define S_FSTATE_H
#include <s/s_StateInterfaces.hpp>
#include <s/s_FStateID.hpp>
// Note: Ported from https://github.com/NSMBW-Community/NSMBW-Decomp/tree/master/include/dol/sLib
// See include/s/README.txt for changes made
/// @brief A state holder for a given class.
/// @tparam T The class that this state belongs to.
/// @ingroup state
template<class T>
class sFState_c : public sStateIf_c {
public:
sFState_c(T &owner) : mpOwner(owner) { mpID = nullptr; }
enum STATE_ACTION_e {
INITIALIZE,
EXECUTE,
FINALIZE
};
/// @brief Performs a state action.
/// @details [Gets inlined, needed for function order to match].
/// @param action The action to perform.
void performAction(STATE_ACTION_e action) {
if (action == FINALIZE) {
mpID->finalizeState(mpOwner);
} else if (action == EXECUTE) {
mpID->executeState(mpOwner);
} else if (action == INITIALIZE) {
mpID->initializeState(mpOwner);
}
}
virtual void initialize() { performAction(INITIALIZE); }
virtual void execute() { performAction(EXECUTE); }
virtual void finalize() { performAction(FINALIZE); }
void setID(const sFStateID_c<T> *id) { mpID = id; }
private:
T &mpOwner; ///< The owner of this state.
const sFStateID_c<T> *mpID; ///< The state ID that runs the state methods.
};
#endif
+33
View File
@@ -0,0 +1,33 @@
#ifndef S_FSTATEFCT_H
#define S_FSTATEFCT_H
#include <s/s_StateInterfaces.hpp>
#include <s/s_FState.hpp>
#include <s/s_StateID.hpp>
// Note: Ported from https://github.com/NSMBW-Community/NSMBW-Decomp/tree/master/include/dol/sLib
// See include/s/README.txt for changes made
/// @brief A state factory for a given class.
/// @tparam T The class that this state belongs to.
/// @ingroup state
template <class T>
class sFStateFct_c : public sStateFctIf_c {
public:
sFStateFct_c(T &owner) : mState(owner) {}
virtual sStateIf_c* build(const sStateIDIf_c &id) {
if (!id.isNull()) {
mState.setID((const sFStateID_c<T> *) &id);
return &mState;
}
return nullptr;
}
virtual void dispose(sStateIf_c *&id) { id = nullptr; }
private:
sFState_c<T> mState;
};
#endif
+65
View File
@@ -0,0 +1,65 @@
#ifndef S_FSTATEID_H
#define S_FSTATEID_H
#include <s/s_StateID.hpp>
#include <MSL_C/string.h>
// Note: Ported from https://github.com/NSMBW-Community/NSMBW-Decomp/tree/master/include/dol/sLib
// See include/s/README.txt for changes made
/// @brief An implementation of a state ID for a given class.
/// @details It adds the ability to call the three state methods on a state owner class.
/// @tparam T The class that this state belongs to.
/// @ingroup state
template<class T>
class sFStateID_c : public sStateID_c {
public:
typedef void (T::*stateFunc)();
/**
* @brief Constructs a new sFStateID_c instance.
*
* @param name The name of this state ID.
* @param initialize The initialize method for this state ID.
* @param execute The execute method for this state ID.
* @param finalize The finalize method for this state ID.
*/
sFStateID_c(const char *name, stateFunc initialize, stateFunc execute, stateFunc finalize) :
sStateID_c(name),
mpInitialize(initialize),
mpExecute(execute),
mpFinalize(finalize) {}
/// @brief Returns true if the given name matches this state ID's name.
virtual bool isSameName(const char *otherName) const {
char *part = strrchr(otherName, ':');
if (part != nullptr) {
otherName = part + 1;
}
const char *thisName = strrchr(name(), ':') + 1;
if (strcmp(thisName, otherName) == 0) {
return true;
} else {
return false;
}
}
/// @brief Calls the initialize method on the owner.
/// @param owner The owner of this state ID.
virtual void initializeState(T &owner) const { (owner.*mpInitialize)(); }
/// @brief Calls the execute method on the owner.
/// @param owner The owner of this state ID.
virtual void executeState(T &owner) const { (owner.*mpExecute)(); }
/// @brief Calls the finalize method on the owner.
/// @param owner The owner of this state ID.
virtual void finalizeState(T &owner) const { (owner.*mpFinalize)(); }
private:
stateFunc mpInitialize; ///< The initialize method for this state ID.
stateFunc mpExecute; ///< The execute method for this state ID.
stateFunc mpFinalize; ///< The finalize method for this state ID.
};
#endif
+24
View File
@@ -0,0 +1,24 @@
#ifndef S_FSTATEMGR_H
#define S_FSTATEMGR_H
#include <s/s_FStateID.hpp>
#include <s/s_StateMgr.hpp>
#include <s/s_FState.hpp>
#include <s/s_FStateFct.hpp>
#include <s/s_StateIDChk.hpp>
// Note: Ported from https://github.com/NSMBW-Community/NSMBW-Decomp/tree/master/include/dol/sLib
// See include/s/README.txt for changes made
/// @brief A wrapper for sStateMgr_c that uses sFStateFct_c and sStateIDChk_c.
/// @tparam T The class that this state belongs to.
/// @tparam Method The method to use for the state manager.
/// @ingroup state
template <class T, class Method>
class sFStateMgr_c : public sStateMgr_c<T, Method, sFStateFct_c, sStateIDChk_c> {
public:
sFStateMgr_c(T &owner, const sStateIDIf_c &initializeState) :
sStateMgr_c<T, Method, sFStateFct_c, sStateIDChk_c>(owner, initializeState) {}
};
#endif
+40
View File
@@ -0,0 +1,40 @@
#ifndef S_PHASE_H
#define S_PHASE_H
// Note: Ported from https://github.com/NSMBW-Community/NSMBW-Decomp/tree/master/include/dol/sLib
// See include/s/README.txt for changes made
/// @brief A phase is a list of methods to be called in order.
/// @ingroup slib dol
class sPhase_c {
public:
/// @brief Return value of a phase method and ::callMethod.
/// @unofficial
enum METHOD_RESULT_e {
WAIT, ///< Do not proceed to the next method in the phase.
OK, ///< Proceed to the next method in the phase.
DONE ///< The phase is done.
};
typedef METHOD_RESULT_e (phaseMethod)(void *);
/**
* @brief Constructs a new phase with a given method list.
*
* @param methodList The list of methods in the phase.
* @param count The length of the method list.
*/
sPhase_c(phaseMethod **methodList, int count);
/**
* @brief Executes the phase until the end is reached or a method returns METHOD_RESULT_e::WAIT.
*
* @param thisPtr A pointer to the owner.
* @return METHOD_RESULT_e::WAIT if the phase is not done yet, and METHOD_RESULT_e::DONE if the phase is finished.
*/
METHOD_RESULT_e callMethod(void *thisPtr);
phaseMethod **mpMethodList; ///< The method list.
unsigned short mPhaseLength; ///< The length of the method list.
unsigned short mCurrMethod; ///< The index of the method to execute.
};
#endif
+25
View File
@@ -0,0 +1,25 @@
#ifndef S_STATE_H
#define S_STATE_H
#include <s/s_FStateMgr.hpp>
#include <s/s_StateMethodUsr_FI.hpp>
// Note: Ported from https://github.com/NSMBW-Community/NSMBW-Decomp/tree/master/include/dol/sLib
// See include/s/README.txt for changes made
#define STATE_FUNC_DECLARE(class, name) \
void initializeState_##name(); \
void executeState_##name(); \
void finalizeState_##name(); \
static sFStateID_c<class> StateID_##name
#define STATE_DEFINE(class, name) \
sFStateID_c<class> class ::StateID_##name(#class "::StateID_" #name, &class ::initializeState_##name, \
&class ::executeState_##name, &class ::finalizeState_##name)
#define STATE_MGR_DECLARE(class_name) \
sFStateMgr_c<class_name, sStateMethodUsr_FI_c> mStateMgr; \
void dummy_GetStateID() { \
mStateMgr.getStateID(); \
}
#endif
+50
View File
@@ -0,0 +1,50 @@
#ifndef S_STATEID_H
#define S_STATEID_H
#include <s/s_StateInterfaces.hpp>
// Note: Ported from https://github.com/NSMBW-Community/NSMBW-Decomp/tree/master/include/dol/sLib
// See include/s/README.txt for changes made
/// @brief A generic implementation of a state ID.
/// @details It simply contains a name string and a unique number.
/// @ingroup state
class sStateID_c : public sStateIDIf_c {
public:
class NumberMemo_c {
public:
NumberMemo_c() : curr(0) {}
unsigned int get() {
curr++;
return curr;
}
unsigned int curr;
};
sStateID_c(const char *name);
virtual ~sStateID_c();
virtual bool isNull() const;
virtual bool isEqual(const sStateIDIf_c &other) const;
virtual bool operator==(const sStateIDIf_c &other) const;
virtual bool operator!=(const sStateIDIf_c &other) const;
virtual bool isSameName(const char *name) const;
virtual const char *name() const;
virtual unsigned int number() const;
protected:
const char *mpName; ///< The name of this state ID.
unsigned int mNumber; ///< The number of this state ID.
static NumberMemo_c sm_numberMemo; ///< Used to give each state a unique number.
};
namespace sStateID {
/// @ingroup state
extern sStateID_c null; ///< A null state instance.
}
#endif
+17
View File
@@ -0,0 +1,17 @@
#ifndef S_STATEIDCHK_H
#define S_STATEIDCHK_H
#include <s/s_StateInterfaces.hpp>
// Note: Ported from https://github.com/NSMBW-Community/NSMBW-Decomp/tree/master/include/dol/sLib
// See include/s/README.txt for changes made
/// @brief A default implementation of a state ID checker.
/// @details ::isNormalID always returns true.
class sStateIDChk_c : public sStateIDChkIf_c {
public:
virtual ~sStateIDChk_c();
virtual bool isNormalID(const sStateIDIf_c &) const { return true; }
};
#endif
+79
View File
@@ -0,0 +1,79 @@
#ifndef S_STATEINTERFACES_H
#define S_STATEINTERFACES_H
// Note: Ported from https://github.com/NSMBW-Community/NSMBW-Decomp/tree/master/include/dol/sLib
// See include/s/README.txt for changes made
/// @addtogroup state
/// @{
class sStateMethodIf_c {
public:
virtual ~sStateMethodIf_c();
};
/// @brief The interface for state IDs.
/// @details A state ID is made up of a name string and a unique number, where 0 denotes a null state.
/// Null states do not have any corresponding behaviour. They can be used, for example,
/// if a state holder needs to be initialized but the initial state ID is not known yet.
class sStateIDIf_c {
public:
virtual ~sStateIDIf_c();
virtual bool isNull() const = 0; ///< Returns whether this is a null state.
virtual bool isEqual(const sStateIDIf_c &other) const = 0; ///< Returns whether both states have the same number.
virtual bool operator==(const sStateIDIf_c &other) const = 0; ///< Overloaded equality operator, using ::isEqual.
virtual bool operator!=(const sStateIDIf_c &other) const = 0; ///< Overloaded inequality operator, using ::isEqual.
virtual bool isSameName(const char *name) const = 0; ///< Returns whether this state ID is called @p name.
virtual const char *name() const = 0; ///< Returns the name of this state ID.
virtual unsigned int number() const = 0; ///< Returns the number of this state ID.
};
/// @brief The interface for a state holder.
/// @details A state holder is linked to a state ID and can execute its corresponding behaviour.
class sStateIf_c {
public:
virtual ~sStateIf_c();
virtual const void initialize() = 0; ///< Initializes the state.
virtual const void execute() = 0; ///< Executes the state.
virtual const void finalize() = 0; ///< Prepares the state for termination.
};
/// @brief The interface for state factories.
/// @details A state factory produces a state holder from a given state ID.
class sStateFctIf_c {
public:
virtual ~sStateFctIf_c();
virtual sStateIf_c *build(sStateIDIf_c const &id) = 0; ///< Returns a new state with a given state ID.
virtual void dispose(sStateIf_c *&id) = 0; ///< Clears out the pointer to a state.
};
/// @brief The interface for state ID checkers.
/// @details [This class is not really used, but it seems to be intended for testing if a state is "normal", most likely a debug leftover].
class sStateIDChkIf_c {
public:
virtual ~sStateIDChkIf_c();
virtual bool isNormalID(const sStateIDIf_c &id) const = 0; ///< Returns whether a state ID is normal.
};
/// @brief The interface for state managers.
/// @details A state manager handles execution of and transitioning between state IDs.
class sStateMgrIf_c {
public:
virtual ~sStateMgrIf_c();
virtual void initializeState() = 0; ///< Initializes the current state.
virtual void executeState() = 0; ///< Executes the current state.
virtual void finalizeState() = 0; ///< Prepares the current state for termination.
virtual void changeState(const sStateIDIf_c &newStateID) = 0; ///< Transitions to a new state ID.
virtual void refreshState() = 0; ///< Marks the current state to be executed again.
virtual sStateIf_c *getState() const = 0; ///< Gets the state holder.
virtual const sStateIDIf_c *getNewStateID() const = 0; ///< Gets the next state ID.
virtual const sStateIDIf_c *getStateID() const = 0; ///< Gets the current state ID.
virtual const sStateIDIf_c *getOldStateID() const = 0; ///< Gets the previous state ID.
};
/// @}
#endif
+56
View File
@@ -0,0 +1,56 @@
#ifndef S_STATEMETHOD_H
#define S_STATEMETHOD_H
#include <s/s_StateInterfaces.hpp>
// Note: Ported from https://github.com/NSMBW-Community/NSMBW-Decomp/tree/master/include/dol/sLib
// See include/s/README.txt for changes made
/// @brief A class that handles state execution and transition.
/// @details [Presumably, sStateMethod_c actually means "methods for state interaction", or something like that].
/// @ingroup state
class sStateMethod_c : public sStateMethodIf_c {
public:
/**
* @brief Constructs a new sStateMethod_c instance.
*
* @param checker The state checker to use.
* @param factory The state factory to use.
* @param initialState The initial state ID of this instance.
*/
sStateMethod_c(sStateIDChkIf_c &checker, sStateFctIf_c &factory, const sStateIDIf_c &initialState);
virtual ~sStateMethod_c(); ///< Destroys the sStateMethod_c instance.
virtual void initializeStateMethod(); ///< @copydoc sStateMgrIf_c::initializeState
virtual void executeStateMethod(); ///< @copydoc sStateMgrIf_c::executeState
virtual void finalizeStateMethod(); ///< @copydoc sStateMgrIf_c::finalizeState
virtual void changeStateMethod(const sStateIDIf_c &newStateID); ///< @copydoc sStateMgrIf_c::changeState
virtual void refreshStateMethod() { mRefreshStateMethod = true; } ///< @copydoc sStateMgrIf_c::refreshState
virtual sStateIf_c *getState() const { return mpState; } ///< @copydoc sStateMgrIf_c::getState
virtual const sStateIDIf_c *getNewStateID() const { return mpNewStateID; } ///< @copydoc sStateMgrIf_c::getNewStateID
virtual const sStateIDIf_c *getStateID() const { return mpStateID; } ///< @copydoc sStateMgrIf_c::getStateID
virtual const sStateIDIf_c *getOldStateID() const { return mpOldStateID; } ///< @copydoc sStateMgrIf_c::getOldStateID
virtual int initializeStateLocalMethod() = 0; ///< Performs the actual state initialization.
virtual void executeStateLocalMethod() = 0; ///< Performs the actual state execution.
virtual void finalizeStateLocalMethod() = 0; ///< Performs the actual state termination.
virtual void changeStateLocalMethod(const sStateIDIf_c &newStateID) = 0; ///< Performs the actual state transition.
protected:
sStateIDChkIf_c &mpStateChk; ///< @unused The state checker to use.
sStateFctIf_c &mpStateFct; ///< The state factory which produces the state holder.
bool mInitFinalizeLock; ///< A lock to ensure ::initializeStateMethod and ::finalizeStateMethod are not called recursively.
bool mExecutionLock; ///< A lock to ensure ::executeStateMethod is not called recursively.
bool mIsValid; ///< If the state holder contains a valid state ID.
bool mStateChanged; ///< If the current state has changed during execution.
bool mRefreshStateMethod; ///< True, if after a state transition, the state should be executed again.
const sStateIDIf_c *mpNewStateID; ///< The next state ID.
const sStateIDIf_c *mpOldStateID; ///< The previous state ID.
const sStateIDIf_c *mpStateID; ///< The current state ID.
sStateIf_c *mpState; ///< The current state holder.
};
#endif
+23
View File
@@ -0,0 +1,23 @@
#ifndef S_STATEMETHODUSR_FI_H
#define S_STATEMETHODUSR_FI_H
#include <s/s_StateMethod.hpp>
// Note: Ported from https://github.com/NSMBW-Community/NSMBW-Decomp/tree/master/include/dol/sLib
// See include/s/README.txt for changes made
/// @brief An extension to sStateMethod_c that implements the remaining abstract methods.
/// @details [Name might mean "Functionality implementation"].
/// @ingroup state
class sStateMethodUsr_FI_c : public sStateMethod_c {
public:
sStateMethodUsr_FI_c(sStateIDChkIf_c &checker, sStateFctIf_c &factory, const sStateIDIf_c &initialState);
virtual ~sStateMethodUsr_FI_c();
virtual int initializeStateLocalMethod();
virtual void executeStateLocalMethod();
virtual void finalizeStateLocalMethod();
virtual void changeStateLocalMethod(const sStateIDIf_c &newStateID);
};
#endif
+44
View File
@@ -0,0 +1,44 @@
#ifndef S_STATEMGR_H
#define S_STATEMGR_H
#include <s/s_StateInterfaces.hpp>
// Note: Ported from https://github.com/NSMBW-Community/NSMBW-Decomp/tree/master/include/dol/sLib
// See include/s/README.txt for changes made
/**
* @brief An implementation of sStateMgrIf_c.
*
* @tparam T The parent class for this state manager.
* @tparam Method The state method handler to use.
* @tparam Factory The state factory to use.
* @tparam Check The state ID checker to use.
* @ingroup state
*/
template <class T, class Method, template <class> class Factory, class Check>
class sStateMgr_c : sStateMgrIf_c {
public:
sStateMgr_c(T &owner, const sStateIDIf_c &initialState) :
mFactory(owner),
mMethod(mCheck, mFactory, initialState) {}
virtual void initializeState() { mMethod.initializeStateMethod(); }
virtual void executeState() { mMethod.executeStateMethod(); }
virtual void finalizeState() { mMethod.finalizeStateMethod(); }
virtual void changeState(const sStateIDIf_c &newState) { mMethod.changeStateMethod(newState); }
virtual void refreshState() { mMethod.refreshStateMethod(); }
virtual sStateIf_c *getState() const { return mMethod.getState(); }
virtual const sStateIDIf_c *getNewStateID() const { return mMethod.getNewStateID(); }
virtual const sStateIDIf_c *getStateID() const { return mMethod.getStateID(); }
virtual const sStateIDIf_c *getOldStateID() const { return mMethod.getOldStateID(); }
private:
Check mCheck;
Factory<T> mFactory;
Method mMethod;
};
#endif
+37
View File
@@ -0,0 +1,37 @@
#include <d/tg/d_t_rock_boat.h>
#include <d/a/obj/d_a_obj_base.h>
SPECIAL_ACTOR_PROFILE(TAG_ROCK_BOAT, dTgRockBoat_c, fProfile::TAG_ROCK_BOAT, 0x173, 0, 3);
STATE_DEFINE(dTgRockBoat_c, Wait);
int dTgRockBoat_c::create() {
mStateMgr.changeState(StateID_Wait);
cooldown = 1;
return 1;
}
int dTgRockBoat_c::doDelete() {
return 1;
}
int dTgRockBoat_c::actorExecute() {
mStateMgr.executeState();
return 1;
}
int dTgRockBoat_c::draw() {
return 1;
}
void dTgRockBoat_c::initializeState_Wait() {}
void dTgRockBoat_c::executeState_Wait() {
if (cooldown > 0 && --cooldown == 0) {
dAcObjBase_c::create(fProfile::OBJ_ROCK_BOAT, roomid, (boatNum << 0x1c) | 0xff, &position, 0, 0, -1);
cooldown = 0x259;
if (++boatNum == 0xf) {
boatNum = 0;
}
}
}
void dTgRockBoat_c::finalizeState_Wait() {}
+114
View File
@@ -0,0 +1,114 @@
#include <c/c_math.h>
#include <d/tg/d_t_tumble_weed.h>
#include <m/m_vec.h>
SPECIAL_ACTOR_PROFILE(TAG_TUMBLE_WEED, dTgTumbleWeed_c, fProfile::TUMBLE_WEED_TAG, 0x0244, 0, 0);
STATE_DEFINE(dTgTumbleWeed_c, AreaOut);
STATE_DEFINE(dTgTumbleWeed_c, AreaIn);
STATE_DEFINE(dTgTumbleWeed_c, Wind);
int dTgTumbleWeed_c::create() {
tumbleweedTimer = 0;
windTimer = 0x96;
mStateMgr.changeState(StateID_AreaOut);
return 1;
}
u16 decr(u16 *num);
int dTgTumbleWeed_c::doDelete() {
return 1;
}
int dTgTumbleWeed_c::actorExecute() {
mStateMgr.executeState();
decr(&tumbleweedTimer);
return 1;
}
u16 decr(u16 *num) {
if (*num != 0) {
(*num)--;
}
return *num;
}
int dTgTumbleWeed_c::draw() {
return 1;
}
void dTgTumbleWeed_c::initializeState_AreaOut() {}
void dTgTumbleWeed_c::executeState_AreaOut() {
if (decr(&windTimer) == 0) {
windTimer = 0x96;
if (shouldDoWind()) {
mStateMgr.changeState(StateID_Wind);
return;
}
}
if (isWithinPlayerRadius(scale.x)) {
mStateMgr.changeState(StateID_AreaIn);
}
}
void dTgTumbleWeed_c::finalizeState_AreaOut() {}
void dTgTumbleWeed_c::initializeState_AreaIn() {}
void dTgTumbleWeed_c::executeState_AreaIn() {
if (tumbleweedTimer == 0) {
if (shouldSpawnTumbleweed()) {
doSpawnTumbleweed();
}
tumbleweedTimer = 600;
}
if (decr(&windTimer) == 0) {
windTimer = 0x96;
if (shouldDoWind()) {
mStateMgr.changeState(StateID_Wind);
return;
}
}
if (!isWithinPlayerRadius(scale.x)) {
mStateMgr.changeState(StateID_AreaOut);
}
}
void dTgTumbleWeed_c::finalizeState_AreaIn() {}
extern "C" void fn_475_1B00(fBase_c *, mVec3_c&);
void dTgTumbleWeed_c::initializeState_Wind() {
mVec3_c vec;
getWind(&vec);
if (childTumbleweed.p_owner != nullptr) {
fn_475_1B00(childTumbleweed.p_owner, vec);
}
}
void dTgTumbleWeed_c::executeState_Wind() {
if (isWithinPlayerRadius(scale.x)) {
mStateMgr.changeState(StateID_AreaIn);
} else {
mStateMgr.changeState(StateID_AreaOut);
}
}
void dTgTumbleWeed_c::finalizeState_Wind() {}
bool dTgTumbleWeed_c::shouldSpawnTumbleweed() {
bool spawnAllowed = false;
if (childTumbleweed.p_owner == nullptr && cM::rnd() <= 0.8f) {
spawnAllowed = true;
}
if (spawnAllowed) {
return true;
}
return false;
}
bool dTgTumbleWeed_c::shouldDoWind() {
return childTumbleweed.p_owner != nullptr && cM::rnd() <= 0.5f;
}
void dTgTumbleWeed_c::doSpawnTumbleweed() {
}
void dTgTumbleWeed_c::getWind(mVec3_c*) {}
+2 -3
View File
@@ -24,7 +24,6 @@ void (*fBase_c::sUnloadCallback)();
fBase_c::fBase_c()
: unique_ID(m_rootUniqueID), params(m_tmpCtData.params), profile_name(m_tmpCtData.prof_name),
group_type(m_tmpCtData.group_type), manager(this) {
fManager_c *mgr = &manager;
m_rootUniqueID = (fBaseID_e)(m_rootUniqueID + 1);
if (m_rootUniqueID == INVALID) {
@@ -33,8 +32,8 @@ fBase_c::fBase_c()
}
}
fManager_c::m_connectManage.addTreeNode(&mgr->connect_node, m_tmpCtData.connect_parent);
int searchTableIdx = mgr->getSearchTableNum();
fManager_c::m_connectManage.addTreeNode(&manager.connect_node, m_tmpCtData.connect_parent);
int searchTableIdx = manager.getSearchTableNum();
fManager_c::m_searchManage[searchTableIdx].prepend(&manager.search_node);
const fProfile::fBaseProfile_c *profile = (*fProfile::sProfileList)[profile_name];
+31
View File
@@ -0,0 +1,31 @@
#include <s/s_Phase.hpp>
// Note: Ported from https://github.com/NSMBW-Community/NSMBW-Decomp/tree/master/include/dol/sLib
// See include/s/README.txt for changes made
sPhase_c::sPhase_c(phaseMethod **methodList, int count) {
mpMethodList = methodList;
mPhaseLength = count;
mCurrMethod = 0;
}
sPhase_c::METHOD_RESULT_e sPhase_c::callMethod(void *thisPtr) {
if (mCurrMethod >= mPhaseLength) {
return DONE;
}
METHOD_RESULT_e result = OK;
while (result == OK) {
result = (mpMethodList[mCurrMethod])(thisPtr);
if (result == OK) {
// Go to the next method
mCurrMethod++;
if (mCurrMethod >= mPhaseLength) {
return DONE;
}
}
}
return result;
}
+56
View File
@@ -0,0 +1,56 @@
#include <common.h>
#include <s/s_StateInterfaces.hpp>
#include <s/s_StateID.hpp>
#include <s/s_StateMethodUsr_FI.hpp>
#include <s/s_StateIDChk.hpp>
// Note: Ported from https://github.com/NSMBW-Community/NSMBW-Decomp/tree/master/include/dol/sLib
// See include/s/README.txt for changes made
sStateID_c::NumberMemo_c sStateID_c::sm_numberMemo;
sStateID_c sStateID::null(nullptr);
sStateID_c::sStateID_c(const char *name) {
mpName = name;
mNumber = (name != nullptr) ? sm_numberMemo.get() : 0;
}
sStateID_c::~sStateID_c() {}
bool sStateID_c::isNull() const {
return mNumber == 0;
}
bool sStateID_c::isEqual(const sStateIDIf_c &other) const {
return number() == other.number();
}
bool sStateID_c::operator==(const sStateIDIf_c &other) const {
return isEqual(other);
}
bool sStateID_c::operator!=(const sStateIDIf_c &other) const {
return !isEqual(other);
}
bool sStateID_c::isSameName(const char *name) const {
// Just return false, the full implementation is in sFStateID_c
return false;
}
const char *sStateID_c::name() const {
return mpName;
}
unsigned int sStateID_c::number() const {
return mNumber;
}
sStateFctIf_c::~sStateFctIf_c() {}
sStateIDChkIf_c::~sStateIDChkIf_c() {}
sStateIDChk_c::~sStateIDChk_c() {}
sStateIDIf_c::~sStateIDIf_c() {}
sStateIf_c::~sStateIf_c() {}
sStateMethodIf_c::~sStateMethodIf_c() {}
sStateMethodUsr_FI_c::~sStateMethodUsr_FI_c() {}
sStateMgrIf_c::~sStateMgrIf_c() {}
+78
View File
@@ -0,0 +1,78 @@
#include <common.h>
#include <s/s_StateInterfaces.hpp>
#include <s/s_StateMethod.hpp>
#include <s/s_StateID.hpp>
// Note: Ported from https://github.com/NSMBW-Community/NSMBW-Decomp/tree/master/include/dol/sLib
// See include/s/README.txt for changes made
sStateMethod_c::sStateMethod_c(sStateIDChkIf_c &checker, sStateFctIf_c &factory, const sStateIDIf_c &initialState) :
mpStateChk(checker),
mpStateFct(factory),
mInitFinalizeLock(false),
mExecutionLock(false),
mIsValid(false),
mStateChanged(false),
mRefreshStateMethod(false),
mpNewStateID(&initialState),
mpOldStateID(&sStateID::null),
mpStateID(&initialState),
mpState(nullptr) {
}
sStateMethod_c::~sStateMethod_c() {}
void sStateMethod_c::initializeStateMethod() {
if (!mpNewStateID->isNull() && !mInitFinalizeLock && !mIsValid) {
mInitFinalizeLock = true;
mpStateID = mpNewStateID;
int ret = initializeStateLocalMethod();
if (ret != 0) {
mIsValid = true;
} else {
mIsValid = false;
}
mInitFinalizeLock = false;
}
}
void sStateMethod_c::executeStateMethod() {
if (!mExecutionLock) {
// Skyward Sword change: Prevent runaway state changes?
int i = 2;
do {
if (mRefreshStateMethod) {
i--;
}
mRefreshStateMethod = false;
// We only want to execute if we have a valid next state
if (!mpNewStateID->isNull()) {
mExecutionLock = true;
executeStateLocalMethod();
mExecutionLock = false;
}
} while (mRefreshStateMethod && mStateChanged && i);
}
}
void sStateMethod_c::finalizeStateMethod() {
if (!mpNewStateID->isNull() && mIsValid && !mInitFinalizeLock) {
mInitFinalizeLock = true;
mpOldStateID = mpStateID;
finalizeStateLocalMethod();
mIsValid = false;
mInitFinalizeLock = false;
}
}
void sStateMethod_c::changeStateMethod(const sStateIDIf_c &newID) {
if (!newID.isNull()) {
mpNewStateID = &newID;
changeStateLocalMethod(newID);
mStateChanged = true;
}
}
+30
View File
@@ -0,0 +1,30 @@
#include <common.h>
#include <s/s_StateMethodUsr_FI.hpp>
// Note: Ported from https://github.com/NSMBW-Community/NSMBW-Decomp/tree/master/include/dol/sLib
// See include/s/README.txt for changes made
sStateMethodUsr_FI_c::sStateMethodUsr_FI_c(sStateIDChkIf_c &check, sStateFctIf_c &factory, const sStateIDIf_c &state) :
sStateMethod_c(check, factory, state) {
}
int sStateMethodUsr_FI_c::initializeStateLocalMethod() {
mpState = mpStateFct.build(*getNewStateID()); // Create new state holder with the next state ID
mpState->initialize();
return 1;
}
void sStateMethodUsr_FI_c::executeStateLocalMethod() {
initializeStateMethod(); // Ensure we are in a valid state (this only actually initializes the state if !mIsValid)
mpState->execute();
}
void sStateMethodUsr_FI_c::finalizeStateLocalMethod() {
mpState->finalize();
mpStateFct.dispose(mpState);
}
void sStateMethodUsr_FI_c::changeStateLocalMethod(const sStateIDIf_c &newID) {
finalizeStateMethod(); // Terminate the current state
initializeStateMethod(); // Initialize the new state
}