diff --git a/config/GM8E01_00/symbols.txt b/config/GM8E01_00/symbols.txt index 2a2bc371..6de06e6d 100644 --- a/config/GM8E01_00/symbols.txt +++ b/config/GM8E01_00/symbols.txt @@ -1018,15 +1018,15 @@ __dl__24TOneStatic<10CPlayerGun>FPv = .text:0x80043B4C; // type:function size:0x __sinit_CPlayerGun_cpp = .text:0x80043B78; // type:function size:0x268 scope:local IntegrateVisorFog__13CStateManagerFf = .text:0x80043DE0; // type:function size:0x74 scope:global SendScriptMsgAlways__13CStateManagerF9TUniqueId9TUniqueId20EScriptObjectMessage = .text:0x80043E54; // type:function size:0x7C scope:global -SendScriptMsg__13CStateManagerFP7CEntity9TUniqueId20EScriptObjectMessage = .text:0x80043ED0; // type:function size:0x5C scope:global +DeliverScriptMsg__13CStateManagerFP7CEntity9TUniqueId20EScriptObjectMessage = .text:0x80043ED0; // type:function size:0x5C scope:global QueueMessage__13CStateManagerFiUif = .text:0x80043F2C; // type:function size:0x10 scope:global GetPlayer__13CStateManagerCFv = .text:0x80043F3C; // type:function size:0x8 scope:global SetBossParams__13CStateManagerF9TUniqueIdfUi = .text:0x80043F44; // type:function size:0x14 scope:global SetGameState__13CStateManagerFQ213CStateManager10EGameState = .text:0x80043F58; // type:function size:0xB0 scope:global fn_80044008 = .text:0x80044008; // type:function size:0x28 -SetCurrentMaze__13CStateManagerFQ24rstl24single_ptr<10CMazeState> = .text:0x80044030; // type:function size:0x58 scope:global -CurrentMaze__13CStateManagerFv = .text:0x80044088; // type:function size:0x8 scope:global -GetCurrentMaze__13CStateManagerCFv = .text:0x80044090; // type:function size:0x8 scope:global +SetSinglePathMaze__13CStateManagerFQ24rstl29single_ptr<15CSinglePathMaze> = .text:0x80044030; // type:function size:0x58 scope:global +SinglePathMaze__13CStateManagerFv = .text:0x80044088; // type:function size:0x8 scope:global +GetSinglePathMaze__13CStateManagerCFv = .text:0x80044090; // type:function size:0x8 scope:global fn_80044098 = .text:0x80044098; // type:function size:0x3D8 GetCharacterRenderMaskAndTarget__13CStateManagerFbRiRi = .text:0x80044470; // type:function size:0xF8 scope:global UpdateThermalVisor__13CStateManagerFv = .text:0x80044568; // type:function size:0x284 scope:global @@ -1127,7 +1127,7 @@ fn_8004BEB0 = .text:0x8004BEB0; // type:function size:0x94 UpdateRoomAcoustics__13CStateManagerF7TAreaId = .text:0x8004BF44; // type:function size:0x188 scope:global SetCurrentAreaId__13CStateManagerF7TAreaId = .text:0x8004C0CC; // type:function size:0xC8 scope:global ClearGraveyard__13CStateManagerFv = .text:0x8004C194; // type:function size:0xD8 scope:global -FreeScriptObject__13CStateManagerF9TUniqueId = .text:0x8004C26C; // type:function size:0x200 scope:global +DeleteObjectRequest__13CStateManagerF9TUniqueId = .text:0x8004C26C; // type:function size:0x200 scope:global fn_8004C46C = .text:0x8004C46C; // type:function size:0x28 fn_8004C494 = .text:0x8004C494; // type:function size:0xE0 ObjectById__13CStateManagerF9TUniqueId = .text:0x8004C574; // type:function size:0x30 scope:global @@ -5696,7 +5696,7 @@ Remove__10CWeaponMgrF9TUniqueId = .text:0x800C2174; // type:function size:0x160 __ct__10CWeaponMgrFv = .text:0x800C22D4; // type:function size:0x30 scope:global __dl__FPv = .text:0x800C2304; // type:function size:0x20 scope:global insert_into__Q24rstl215red_black_tree<9TUniqueId,Q24rstl47pair<9TUniqueId,Q24rstl21reserved_vector>,0,Q24rstl67select1st>>,Q24rstl16less<9TUniqueId>,Q24rstl17rmemory_allocator>FPQ34rstl215red_black_tree<9TUniqueId,Q24rstl47pair<9TUniqueId,Q24rstl21reserved_vector>,0,Q24rstl67select1st>>,Q24rstl16less<9TUniqueId>,Q24rstl17rmemory_allocator>4nodeRCQ24rstl47pair<9TUniqueId,Q24rstl21reserved_vector> = .text:0x800C2324; // type:function size:0x2CC scope:global -SetSpawned__13CScriptPickupFv = .text:0x800C25F0; // type:function size:0x14 scope:global +SetWasGenerated__13CScriptPickupFv = .text:0x800C25F0; // type:function size:0x14 scope:global GetPossibility__13CScriptPickupCFv = .text:0x800C2604; // type:function size:0x8 scope:global GetItem__13CScriptPickupCFv = .text:0x800C260C; // type:function size:0x8 scope:global Accept__13CScriptPickupFR8IVisitor = .text:0x800C2614; // type:function size:0x38 scope:global @@ -7672,10 +7672,10 @@ BuildProjectileCameraShake__16CCameraShakeDataFff = .text:0x8015DBB4; // type:fu __sinit_CCameraShakeData_cpp = .text:0x8015DCB4; // type:function size:0x1D4 scope:local Accept__22CScriptPickupGeneratorFR8IVisitor = .text:0x8015DE88; // type:function size:0x38 scope:global AcceptScriptMsg__22CScriptPickupGeneratorF20EScriptObjectMessage9TUniqueIdR13CStateManager = .text:0x8015DEC0; // type:function size:0x360 scope:global -ResetDelayTimer__22CScriptPickupGeneratorFv = .text:0x8015E220; // type:function size:0x34 scope:global -GeneratePickup__22CScriptPickupGeneratorCFR13CStateManager9TEditorId9TUniqueId = .text:0x8015E254; // type:function size:0x208 scope:global -GetPickupTemplates__22CScriptPickupGeneratorCFR13CStateManagerRQ24rstl62vector,Q24rstl17rmemory_allocator> = .text:0x8015E45C; // type:function size:0x2EC scope:global -GetGeneratorIds__22CScriptPickupGeneratorCFR13CStateManager9TUniqueIdRQ24rstl45vector<9TUniqueId,Q24rstl17rmemory_allocator> = .text:0x8015E748; // type:function size:0x190 scope:global +ResetSpawnNothingCounter__22CScriptPickupGeneratorFv = .text:0x8015E220; // type:function size:0x34 scope:global +SpawnPickup__22CScriptPickupGeneratorCFR13CStateManager9TEditorId9TUniqueId = .text:0x8015E254; // type:function size:0x208 scope:global +GetSpawnablePickups__22CScriptPickupGeneratorCFR13CStateManagerRQ24rstl62vector,Q24rstl17rmemory_allocator> = .text:0x8015E45C; // type:function size:0x2EC scope:global +GetTargets__22CScriptPickupGeneratorCFR13CStateManager9TUniqueIdRQ24rstl45vector<9TUniqueId,Q24rstl17rmemory_allocator> = .text:0x8015E748; // type:function size:0x190 scope:global __dt__22CScriptPickupGeneratorFv = .text:0x8015E8D8; // type:function size:0x60 scope:global __ct__22CScriptPickupGeneratorF9TUniqueIdRCQ24rstl66basic_string,Q24rstl17rmemory_allocator>RC11CEntityInfoRC9CVector3ffb = .text:0x8015E938; // type:function size:0xA4 scope:global reserve__Q24rstl62vector,Q24rstl17rmemory_allocator>Fi = .text:0x8015E9DC; // type:function size:0xF4 scope:global @@ -7945,7 +7945,7 @@ InhabitantExited__18CScriptBallTriggerFR6CActorR13CStateManager = .text:0x801768 InhabitantAdded__18CScriptBallTriggerFR6CActorR13CStateManager = .text:0x80176890; // type:function size:0x3C scope:global __dt__18CScriptBallTriggerFv = .text:0x801768CC; // type:function size:0x60 scope:global __ct__18CScriptBallTriggerF9TUniqueIdRCQ24rstl66basic_string,Q24rstl17rmemory_allocator>RC11CEntityInfoRC9CVector3fRC9CVector3fbfffRC9CVector3fb = .text:0x8017692C; // type:function size:0x1AC scope:global -calculate_ball_aabox__Fv = .text:0x80176AD8; // type:function size:0x54 scope:global +calculate_ball_aabox__Fv = .text:0x80176AD8; // type:function size:0x54 scope:local __dt__17CPlasmaProjectileFv = .text:0x80176B2C; // type:function size:0x1EC scope:global __dt__15CBeamProjectileFv = .text:0x80176D18; // type:function size:0x11C scope:global fn_80176E34 = .text:0x80176E34; // type:function size:0x68 @@ -11321,17 +11321,17 @@ __dt__15CScriptMazeNodeFv = .text:0x802887C8; // type:function size:0xAC scope:g LoadMazeSeeds__15CScriptMazeNodeFv = .text:0x80288874; // type:function size:0xC4 scope:global Think__15CScriptMazeNodeFfR13CStateManager = .text:0x80288938; // type:function size:0x94 scope:global AcceptScriptMsg__15CScriptMazeNodeF20EScriptObjectMessage9TUniqueIdR13CStateManager = .text:0x802889CC; // type:function size:0x854 scope:global -SendScriptMsgs__15CScriptMazeNodeFR13CStateManager20EScriptObjectMessage = .text:0x80289220; // type:function size:0x120 scope:global -Reset__15CScriptMazeNodeFR13CStateManager = .text:0x80289340; // type:function size:0xA4 scope:global -GenerateObjects__15CScriptMazeNodeFR13CStateManager = .text:0x802893E4; // type:function size:0x250 scope:global +SendBarrierMsg__15CScriptMazeNodeFR13CStateManager20EScriptObjectMessage = .text:0x80289220; // type:function size:0x120 scope:global +DeleteBarrier__15CScriptMazeNodeFR13CStateManager = .text:0x80289340; // type:function size:0xA4 scope:global +GenerateBarrier__15CScriptMazeNodeFR13CStateManager = .text:0x802893E4; // type:function size:0x250 scope:global Accept__15CScriptMazeNodeFR8IVisitor = .text:0x80289634; // type:function size:0x38 scope:global __ct__15CScriptMazeNodeF9TUniqueIdRCQ24rstl66basic_string,Q24rstl17rmemory_allocator>RC11CEntityInfoRC12CTransform4fbiiiRC9CVector3fRC9CVector3fRC9CVector3f = .text:0x8028966C; // type:function size:0x190 scope:global -Initialize__10CMazeStateFv = .text:0x802897FC; // type:function size:0x1CC scope:global -GenerateObstacles__10CMazeStateFv = .text:0x802899C8; // type:function size:0x530 scope:global -GetCell__10CMazeStateFUiUi = .text:0x80289EF8; // type:function size:0x1C scope:global -GetCell__10CMazeStateCFUiUi = .text:0x80289F14; // type:function size:0x1C scope:global -Reset__10CMazeStateFi = .text:0x80289F30; // type:function size:0x968 scope:global -__ct__10CMazeStateFiiii = .text:0x8028A898; // type:function size:0x80 scope:global +SolveMaze__15CSinglePathMazeFv = .text:0x802897FC; // type:function size:0x1CC scope:global +AddGimmicks__15CSinglePathMazeFv = .text:0x802899C8; // type:function size:0x530 scope:global +MazePoint__15CSinglePathMazeFUiUi = .text:0x80289EF8; // type:function size:0x1C scope:global +GetMazePoint__15CSinglePathMazeCFUiUi = .text:0x80289F14; // type:function size:0x1C scope:global +CreateMaze__15CSinglePathMazeFi = .text:0x80289F30; // type:function size:0x968 scope:global +__ct__15CSinglePathMazeFiiii = .text:0x8028A898; // type:function size:0x80 scope:global __ct__9SMazeCellFv = .text:0x8028A918; // type:function size:0xB4 scope:weak get_current_suit__12NWeaponTypesFRC13CStateManager = .text:0x8028A9CC; // type:function size:0x58 scope:global GetShotDamageInfo__10CGunWeaponCFRC10SShotParamR13CStateManager = .text:0x8028AA24; // type:function size:0xD4 scope:global @@ -17118,7 +17118,7 @@ lbl_803CFDB8 = .rodata:0x803CFDB8; // type:object size:0x108 lbl_803CFEC0 = .rodata:0x803CFEC0; // type:object size:0xB0 lbl_803CFF70 = .rodata:0x803CFF70; // type:object size:0xC8 lbl_803D0038 = .rodata:0x803D0038; // type:object size:0x10 -lbl_803D0048 = .rodata:0x803D0048; // type:object size:0x8 +@stringBase0 = .rodata:0x803D0048; // type:object size:0x7 scope:local data:string_table lbl_803D0050 = .rodata:0x803D0050; // type:object size:0x8 lbl_803D0058 = .rodata:0x803D0058; // type:object size:0x8 lbl_803D0060 = .rodata:0x803D0060; // type:object size:0x10 @@ -17688,7 +17688,7 @@ lbl_803D5E29 = .rodata:0x803D5E29; // type:object size:0xD data:string lbl_803D5E36 = .rodata:0x803D5E36; // type:object size:0x1A lbl_803D5E50 = .rodata:0x803D5E50; // type:object size:0x30 @stringBase0 = .rodata:0x803D5E80; // type:object size:0x15 scope:local data:string_table -lbl_803D5E98 = .rodata:0x803D5E98; // type:object size:0x18 +@stringBase0 = .rodata:0x803D5E98; // type:object size:0x15 scope:local data:string_table lbl_803D5EB0 = .rodata:0x803D5EB0; // type:object size:0x8 lbl_803D5EB8 = .rodata:0x803D5EB8; // type:object size:0x30 @stringBase0 = .rodata:0x803D5EE8; // type:object size:0x7 scope:local data:string_table @@ -17857,7 +17857,7 @@ cplext = .rodata:0x803D7CFC; // type:object size:0x7C scope:local cpdist = .rodata:0x803D7D78; // type:object size:0x78 scope:local cpdext = .rodata:0x803D7DF0; // type:object size:0x78 scope:local @stringBase0 = .rodata:0x803D7E68; // type:object size:0xE5 scope:local data:string_table -@stringBase0 = .rodata:0x803D7F50; // type:object size:0x8 data:string_table +@stringBase0 = .rodata:0x803D7F50; // type:object size:0x7 data:string_table lbl_803D7F58 = .rodata:0x803D7F58; // type:object size:0xF0 lbl_803D8048 = .rodata:0x803D8048; // type:object size:0x30 data:4byte lbl_803D8078 = .rodata:0x803D8078; // type:object size:0x30 @@ -18196,7 +18196,7 @@ jumptable_803DF194 = .data:0x803DF194; // type:object size:0x8C scope:local __vt__15CScriptPlatform = .data:0x803DF220; // type:object size:0x8C scope:global jumptable_803DF2AC = .data:0x803DF2AC; // type:object size:0x7C scope:local __vt__16CScriptGenerator = .data:0x803DF328; // type:object size:0x20 scope:global -__vt__21CScriptCameraWaypoint = .data:0x803DF348; // type:object size:0x70 scope:global +__vt__21CScriptCameraWaypoint = .data:0x803DF348; // type:object size:0x6C scope:global __vt__10CGameLight = .data:0x803DF3B8; // type:object size:0x6C scope:global lbl_803DF428 = .data:0x803DF428; // type:object size:0x10 __vt__16CTweakAutoMapper = .data:0x803DF438; // type:object size:0xC scope:global @@ -18210,7 +18210,7 @@ lbl_803DF688 = .data:0x803DF688; // type:object size:0x6C lbl_803DF6F4 = .data:0x803DF6F4; // type:object size:0xC __vt__41TObjOwnerDerivedFromIObj<13CStateMachine> = .data:0x803DF700; // type:object size:0x10 __vt__11CPlasmaBeam = .data:0x803DF710; // type:object size:0x44 scope:global -__vt__10CPowerBeam = .data:0x803DF758; // type:object size:0x48 scope:global +__vt__10CPowerBeam = .data:0x803DF758; // type:object size:0x44 scope:global __vt__9CWaveBeam = .data:0x803DF7A0; // type:object size:0x48 scope:global __vt__8CIceBeam = .data:0x803DF7E8; // type:object size:0x48 scope:global __vt__12CScriptRelay = .data:0x803DF830; // type:object size:0x20 scope:global @@ -18229,7 +18229,7 @@ lbl_803DFD08 = .data:0x803DFD08; // type:object size:0x70 lbl_803DFD78 = .data:0x803DFD78; // type:object size:0x88 __vt__19CScriptCameraShaker = .data:0x803DFE00; // type:object size:0x20 scope:global __vt__20CScriptActorKeyframe = .data:0x803DFE20; // type:object size:0x20 scope:global -__vt__14CBCScriptedCmd = .data:0x803DFE40; // type:object size:0x10 scope:global +__vt__14CBCScriptedCmd = .data:0x803DFE40; // type:object size:0xC scope:global lbl_803DFE50 = .data:0x803DFE50; // type:object size:0x20 lbl_803DFE70 = .data:0x803DFE70; // type:object size:0x80 __vt__7CWeapon = .data:0x803DFEF0; // type:object size:0x6C scope:global @@ -18267,11 +18267,11 @@ jumptable_803E0AF8 = .data:0x803E0AF8; // type:object size:0x94 scope:local __vt__11CBCCoverCmd = .data:0x803E0B8C; // type:object size:0xC scope:global __vt__14CBCWallHangCmd = .data:0x803E0B98; // type:object size:0x48 scope:global lbl_803E0BE0 = .data:0x803E0BE0; // type:object size:0x18 -__vt__17CScriptCoverPoint = .data:0x803E0BF8; // type:object size:0x70 scope:global +__vt__17CScriptCoverPoint = .data:0x803E0BF8; // type:object size:0x6C scope:global lbl_803E0C68 = .data:0x803E0C68; // type:object size:0x78 lbl_803E0CE0 = .data:0x803E0CE0; // type:object size:0x20 __vt__19CScriptGrapplePoint = .data:0x803E0D00; // type:object size:0x6C scope:global -__vt__19CHUDBillboardEffect = .data:0x803E0D70; // type:object size:0x70 scope:global +__vt__19CHUDBillboardEffect = .data:0x803E0D70; // type:object size:0x6C scope:global lbl_803E0DE0 = .data:0x803E0DE0; // type:object size:0x2D0 __vt__16CBCLoopAttackCmd = .data:0x803E10B0; // type:object size:0xC scope:global __vt__20CBCAdditiveFlinchCmd = .data:0x803E10BC; // type:object size:0xC scope:global @@ -19169,7 +19169,7 @@ lbl_8046C564 = .bss:0x8046C564; // type:object size:0xC lbl_8046C570 = .bss:0x8046C570; // type:object size:0xA8 lbl_8046C618 = .bss:0x8046C618; // type:object size:0x108 lbl_8046C720 = .bss:0x8046C720; // type:object size:0x18 data:4byte -lbl_8046C738 = .bss:0x8046C738; // type:object size:0x10 data:float +lbl_8046C738 = .bss:0x8046C738; // type:object size:0xC data:float lbl_8046C748 = .bss:0x8046C748; // type:object size:0x10 lbl_8046C758 = .bss:0x8046C758; // type:object size:0x18 data:4byte lbl_8046C770 = .bss:0x8046C770; // type:object size:0x18 data:4byte @@ -19243,7 +19243,7 @@ lbl_804BFF00 = .bss:0x804BFF00; // type:object size:0x10 lbl_804BFF10 = .bss:0x804BFF10; // type:object size:0xC lbl_804BFF1C = .bss:0x804BFF1C; // type:object size:0x14 lbl_804BFF30 = .bss:0x804BFF30; // type:object size:0x10 -@52 = .bss:0x804BFF40; // type:object size:0x10 +@52 = .bss:0x804BFF40; // type:object size:0xC sPlayerPosition = .bss:0x804BFF50; // type:object size:0xC scope:local data:float sTextureProjectionTransform = .bss:0x804BFF5C; // type:object size:0x34 scope:local data:float lbl_804BFF90 = .bss:0x804BFF90; // type:object size:0x10 @@ -19917,7 +19917,7 @@ lbl_805A7200 = .sdata:0x805A7200; // type:object size:0x4 data:4byte lbl_805A7204 = .sdata:0x805A7204; // type:object size:0x4 data:4byte lbl_805A7208 = .sdata:0x805A7208; // type:object size:0x4 data:4byte lbl_805A720C = .sdata:0x805A720C; // type:object size:0x4 data:4byte -lbl_805A7210 = .sdata:0x805A7210; // type:object size:0x8 data:4byte +lbl_805A7210 = .sdata:0x805A7210; // type:object size:0x4 data:4byte @192 = .sdata:0x805A7218; // type:object size:0x4 scope:local data:4byte lbl_805A7220 = .sdata:0x805A7220; // type:object size:0x1 data:byte lbl_805A7221 = .sdata:0x805A7221; // type:object size:0x1 data:byte @@ -20203,7 +20203,7 @@ lbl_805A7694 = .sdata:0x805A7694; // type:object size:0x4 lbl_805A7698 = .sdata:0x805A7698; // type:object size:0x4 lbl_805A769C = .sdata:0x805A769C; // type:object size:0x4 lbl_805A76A0 = .sdata:0x805A76A0; // type:object size:0x8 -lbl_805A76A8 = .sdata:0x805A76A8; // type:object size:0x8 data:4byte +lbl_805A76A8 = .sdata:0x805A76A8; // type:object size:0x4 data:4byte lbl_805A76B0 = .sdata:0x805A76B0; // type:object size:0x4 data:4byte lbl_805A76B4 = .sdata:0x805A76B4; // type:object size:0x4 data:4byte lbl_805A76B8 = .sdata:0x805A76B8; // type:object size:0x4 data:float @@ -20215,7 +20215,7 @@ lbl_805A76D0 = .sdata:0x805A76D0; // type:object size:0x8 data:float lbl_805A76D8 = .sdata:0x805A76D8; // type:object size:0x4 data:4byte lbl_805A76DC = .sdata:0x805A76DC; // type:object size:0x4 data:4byte @191 = .sdata:0x805A76E0; // type:object size:0x4 scope:local data:4byte -lbl_805A76E8 = .sdata:0x805A76E8; // type:object size:0x8 data:float +lbl_805A76E8 = .sdata:0x805A76E8; // type:object size:0x4 data:float lbl_805A76F0 = .sdata:0x805A76F0; // type:object size:0x4 data:4byte lbl_805A76F4 = .sdata:0x805A76F4; // type:object size:0x4 data:4byte lbl_805A76F8 = .sdata:0x805A76F8; // type:object size:0x4 data:4byte @@ -21661,7 +21661,7 @@ lbl_805A8F68 = .sbss:0x805A8F68; // type:object size:0x4 data:4byte lbl_805A8F6C = .sbss:0x805A8F6C; // type:object size:0x4 data:4byte g_BillboardCount__19CHUDBillboardEffect = .sbss:0x805A8F70; // type:object size:0x4 scope:global data:4byte g_IndirectTexturedBillboardCount__19CHUDBillboardEffect = .sbss:0x805A8F74; // type:object size:0x4 scope:global data:4byte -lbl_805A8F78 = .sbss:0x805A8F78; // type:object size:0x8 data:byte +lbl_805A8F78 = .sbss:0x805A8F78; // type:object size:0x1 data:byte lbl_805A8F80 = .sbss:0x805A8F80; // type:object size:0x8 data:float lbl_805A8F88 = .sbss:0x805A8F88; // type:object size:0x4 data:float lbl_805A8F8C = .sbss:0x805A8F8C; // type:object size:0x1 data:byte @@ -23690,7 +23690,7 @@ lbl_805AB3DC = .sdata2:0x805AB3DC; // type:object size:0x4 data:float lbl_805AB3E0 = .sdata2:0x805AB3E0; // type:object size:0x4 data:float lbl_805AB3E4 = .sdata2:0x805AB3E4; // type:object size:0x4 data:float lbl_805AB3E8 = .sdata2:0x805AB3E8; // type:object size:0x8 data:float -lbl_805AB3F0 = .sdata2:0x805AB3F0; // type:object size:0x4 data:float +kDefaultScale__7CRipple = .sdata2:0x805AB3F0; // type:object size:0x4 data:float lbl_805AB3F4 = .sdata2:0x805AB3F4; // type:object size:0x4 data:float lbl_805AB3F8 = .sdata2:0x805AB3F8; // type:object size:0x4 data:float lbl_805AB3FC = .sdata2:0x805AB3FC; // type:object size:0x4 data:float diff --git a/config/GM8E01_01/symbols.txt b/config/GM8E01_01/symbols.txt index ee06f438..5ec8bc38 100644 --- a/config/GM8E01_01/symbols.txt +++ b/config/GM8E01_01/symbols.txt @@ -1018,7 +1018,7 @@ __dl__24TOneStatic<10CPlayerGun>FPv = .text:0x80043BC8; // type:function size:0x __sinit_CPlayerGun_cpp = .text:0x80043BF4; // type:function size:0x268 scope:global IntegrateVisorFog__13CStateManagerFf = .text:0x80043E5C; // type:function size:0x74 scope:global SendScriptMsgAlways__13CStateManagerF9TUniqueId9TUniqueId20EScriptObjectMessage = .text:0x80043ED0; // type:function size:0x7C scope:global -SendScriptMsg__13CStateManagerFP7CEntity9TUniqueId20EScriptObjectMessage = .text:0x80043F4C; // type:function size:0x5C scope:global +DeliverScriptMsg__13CStateManagerFP7CEntity9TUniqueId20EScriptObjectMessage = .text:0x80043F4C; // type:function size:0x5C scope:global QueueMessage__13CStateManagerFiUif = .text:0x80043FA8; // type:function size:0x10 scope:global GetPlayer__13CStateManagerCFv = .text:0x80043FB8; // type:function size:0x8 scope:global SetBossParams__13CStateManagerF9TUniqueIdfUi = .text:0x80043FC0; // type:function size:0x14 scope:global @@ -1127,7 +1127,7 @@ fn_8004BEB0 = .text:0x8004BF2C; // type:function size:0x94 scope:global UpdateRoomAcoustics__13CStateManagerF7TAreaId = .text:0x8004BFC0; // type:function size:0x188 scope:global SetCurrentAreaId__13CStateManagerF7TAreaId = .text:0x8004C148; // type:function size:0xC8 scope:global ClearGraveyard__13CStateManagerFv = .text:0x8004C210; // type:function size:0xD8 scope:global -FreeScriptObject__13CStateManagerF9TUniqueId = .text:0x8004C2E8; // type:function size:0x200 scope:global +DeleteObjectRequest__13CStateManagerF9TUniqueId = .text:0x8004C2E8; // type:function size:0x200 scope:global fn_8004C46C = .text:0x8004C4E8; // type:function size:0x28 scope:global fn_8004C494 = .text:0x8004C510; // type:function size:0xE0 scope:global ObjectById__13CStateManagerF9TUniqueId = .text:0x8004C5F0; // type:function size:0x30 scope:global @@ -5698,7 +5698,7 @@ Remove__10CWeaponMgrF9TUniqueId = .text:0x800C21F0; // type:function size:0x160 __ct__10CWeaponMgrFv = .text:0x800C2350; // type:function size:0x30 scope:global __dl__FPv = .text:0x800C2380; // type:function size:0x20 scope:global insert_into__Q24rstl215red_black_tree<9TUniqueId,Q24rstl47pair<9TUniqueId,Q24rstl21reserved_vector>,0,Q24rstl67select1st>>,Q24rstl16less<9TUniqueId>,Q24rstl17rmemory_allocator>FPQ34rstl215red_black_tree<9TUniqueId,Q24rstl47pair<9TUniqueId,Q24rstl21reserved_vector>,0,Q24rstl67select1st>>,Q24rstl16less<9TUniqueId>,Q24rstl17rmemory_allocator>4nodeRCQ24rstl47pair<9TUniqueId,Q24rstl21reserved_vector> = .text:0x800C23A0; // type:function size:0x2CC scope:global -SetSpawned__13CScriptPickupFv = .text:0x800C266C; // type:function size:0x14 scope:global +SetWasGenerated__13CScriptPickupFv = .text:0x800C266C; // type:function size:0x14 scope:global GetPossibility__13CScriptPickupCFv = .text:0x800C2680; // type:function size:0x8 scope:global GetItem__13CScriptPickupCFv = .text:0x800C2688; // type:function size:0x8 scope:global Accept__13CScriptPickupFR8IVisitor = .text:0x800C2690; // type:function size:0x38 scope:global @@ -7675,10 +7675,10 @@ BuildProjectileCameraShake__16CCameraShakeDataFff = .text:0x8015DC30; // type:fu __sinit_CCameraShakeData_cpp = .text:0x8015DD30; // type:function size:0x1D4 scope:global Accept__22CScriptPickupGeneratorFR8IVisitor = .text:0x8015DF04; // type:function size:0x38 scope:global AcceptScriptMsg__22CScriptPickupGeneratorF20EScriptObjectMessage9TUniqueIdR13CStateManager = .text:0x8015DF3C; // type:function size:0x360 scope:global -ResetDelayTimer__22CScriptPickupGeneratorFv = .text:0x8015E29C; // type:function size:0x34 scope:global -GeneratePickup__22CScriptPickupGeneratorCFR13CStateManager9TEditorId9TUniqueId = .text:0x8015E2D0; // type:function size:0x208 scope:global -GetPickupTemplates__22CScriptPickupGeneratorCFR13CStateManagerRQ24rstl62vector,Q24rstl17rmemory_allocator> = .text:0x8015E4D8; // type:function size:0x2EC scope:global -GetGeneratorIds__22CScriptPickupGeneratorCFR13CStateManager9TUniqueIdRQ24rstl45vector<9TUniqueId,Q24rstl17rmemory_allocator> = .text:0x8015E7C4; // type:function size:0x190 scope:global +ResetSpawnNothingCounter__22CScriptPickupGeneratorFv = .text:0x8015E29C; // type:function size:0x34 scope:global +SpawnPickup__22CScriptPickupGeneratorCFR13CStateManager9TEditorId9TUniqueId = .text:0x8015E2D0; // type:function size:0x208 scope:global +GetSpawnablePickups__22CScriptPickupGeneratorCFR13CStateManagerRQ24rstl62vector,Q24rstl17rmemory_allocator> = .text:0x8015E4D8; // type:function size:0x2EC scope:global +GetTargets__22CScriptPickupGeneratorCFR13CStateManager9TUniqueIdRQ24rstl45vector<9TUniqueId,Q24rstl17rmemory_allocator> = .text:0x8015E7C4; // type:function size:0x190 scope:global __dt__22CScriptPickupGeneratorFv = .text:0x8015E954; // type:function size:0x60 scope:global __ct__22CScriptPickupGeneratorF9TUniqueIdRCQ24rstl66basic_string,Q24rstl17rmemory_allocator>RC11CEntityInfoRC9CVector3ffb = .text:0x8015E9B4; // type:function size:0xA4 scope:global reserve__Q24rstl62vector,Q24rstl17rmemory_allocator>Fi = .text:0x8015EA58; // type:function size:0xF4 scope:global @@ -7949,7 +7949,7 @@ InhabitantExited__18CScriptBallTriggerFR6CActorR13CStateManager = .text:0x801768 InhabitantAdded__18CScriptBallTriggerFR6CActorR13CStateManager = .text:0x8017690C; // type:function size:0x3C scope:global __dt__18CScriptBallTriggerFv = .text:0x80176948; // type:function size:0x60 scope:global __ct__18CScriptBallTriggerF9TUniqueIdRCQ24rstl66basic_string,Q24rstl17rmemory_allocator>RC11CEntityInfoRC9CVector3fRC9CVector3fbfffRC9CVector3fb = .text:0x801769A8; // type:function size:0x1AC scope:global -calculate_ball_aabox__Fv = .text:0x80176B54; // type:function size:0x54 scope:global +calculate_ball_aabox__Fv = .text:0x80176B54; // type:function size:0x54 scope:local __dt__17CPlasmaProjectileFv = .text:0x80176BA8; // type:function size:0x1EC scope:global __dt__15CBeamProjectileFv = .text:0x80176D94; // type:function size:0x11C scope:global fn_80176E34 = .text:0x80176EB0; // type:function size:0x68 scope:global @@ -11334,17 +11334,17 @@ __dt__15CScriptMazeNodeFv = .text:0x80288844; // type:function size:0xAC scope:g LoadMazeSeeds__15CScriptMazeNodeFv = .text:0x802888F0; // type:function size:0xC4 scope:global Think__15CScriptMazeNodeFfR13CStateManager = .text:0x802889B4; // type:function size:0x94 scope:global AcceptScriptMsg__15CScriptMazeNodeF20EScriptObjectMessage9TUniqueIdR13CStateManager = .text:0x80288A48; // type:function size:0x854 scope:global -SendScriptMsgs__15CScriptMazeNodeFR13CStateManager20EScriptObjectMessage = .text:0x8028929C; // type:function size:0x120 scope:global -Reset__15CScriptMazeNodeFR13CStateManager = .text:0x802893BC; // type:function size:0xA4 scope:global -GenerateObjects__15CScriptMazeNodeFR13CStateManager = .text:0x80289460; // type:function size:0x250 scope:global +SendBarrierMsg__15CScriptMazeNodeFR13CStateManager20EScriptObjectMessage = .text:0x8028929C; // type:function size:0x120 scope:global +DeleteBarrier__15CScriptMazeNodeFR13CStateManager = .text:0x802893BC; // type:function size:0xA4 scope:global +GenerateBarrier__15CScriptMazeNodeFR13CStateManager = .text:0x80289460; // type:function size:0x250 scope:global Accept__15CScriptMazeNodeFR8IVisitor = .text:0x802896B0; // type:function size:0x38 scope:global __ct__15CScriptMazeNodeF9TUniqueIdRCQ24rstl66basic_string,Q24rstl17rmemory_allocator>RC11CEntityInfoRC12CTransform4fbiiiRC9CVector3fRC9CVector3fRC9CVector3f = .text:0x802896E8; // type:function size:0x190 scope:global -Initialize__10CMazeStateFv = .text:0x80289878; // type:function size:0x1CC scope:global -GenerateObstacles__10CMazeStateFv = .text:0x80289A44; // type:function size:0x530 scope:global -GetCell__10CMazeStateFUiUi = .text:0x80289F74; // type:function size:0x1C scope:global -GetCell__10CMazeStateCFUiUi = .text:0x80289F90; // type:function size:0x1C scope:global -Reset__10CMazeStateFi = .text:0x80289FAC; // type:function size:0x968 scope:global -__ct__10CMazeStateFiiii = .text:0x8028A914; // type:function size:0x80 scope:global +SolveMaze__15CSinglePathMazeFv = .text:0x80289878; // type:function size:0x1CC scope:global +AddGimmicks__15CSinglePathMazeFv = .text:0x80289A44; // type:function size:0x530 scope:global +MazePoint__15CSinglePathMazeFUiUi = .text:0x80289F74; // type:function size:0x1C scope:global +GetMazePoint__15CSinglePathMazeCFUiUi = .text:0x80289F90; // type:function size:0x1C scope:global +CreateMaze__15CSinglePathMazeFi = .text:0x80289FAC; // type:function size:0x968 scope:global +__ct__15CSinglePathMazeFiiii = .text:0x8028A914; // type:function size:0x80 scope:global __ct__9SMazeCellFv = .text:0x8028A994; // type:function size:0xB4 scope:weak get_current_suit__12NWeaponTypesFRC13CStateManager = .text:0x8028AA48; // type:function size:0x58 scope:global GetShotDamageInfo__10CGunWeaponCFRC10SShotParamR13CStateManager = .text:0x8028AAA0; // type:function size:0xD4 scope:global @@ -23736,7 +23736,7 @@ lbl_805AB3DC = .sdata2:0x805AB5BC; // type:object size:0x4 scope:global data:flo lbl_805AB3E0 = .sdata2:0x805AB5C0; // type:object size:0x4 scope:global data:float lbl_805AB3E4 = .sdata2:0x805AB5C4; // type:object size:0x4 scope:global data:float lbl_805AB3E8 = .sdata2:0x805AB5C8; // type:object size:0x8 scope:global data:float -lbl_805AB3F0 = .sdata2:0x805AB5D0; // type:object size:0x4 scope:global data:float +kDefaultScale__7CRipple = .sdata2:0x805AB5D0; // type:object size:0x4 scope:global data:float lbl_805AB3F4 = .sdata2:0x805AB5D4; // type:object size:0x4 scope:global data:float lbl_805AB3F8 = .sdata2:0x805AB5D8; // type:object size:0x4 scope:global data:float lbl_805AB3FC = .sdata2:0x805AB5DC; // type:object size:0x4 scope:global data:float diff --git a/configure.py b/configure.py index ad3a967e..ab3d7cfa 100755 --- a/configure.py +++ b/configure.py @@ -493,12 +493,12 @@ config.libs = [ Object(NonMatching, "MetroidPrime/Factories/CScannableObjectInfo.cpp"), Object(NonMatching, "MetroidPrime/Enemies/CMetroid.cpp"), Object(NonMatching, "MetroidPrime/Player/CScanDisplay.cpp"), - Object(NonMatching, "MetroidPrime/ScriptObjects/CScriptSteam.cpp"), - Object(NonMatching, "MetroidPrime/ScriptObjects/CScriptRipple.cpp"), + Object(Matching, "MetroidPrime/ScriptObjects/CScriptSteam.cpp"), + Object(Matching, "MetroidPrime/ScriptObjects/CScriptRipple.cpp"), Object(NonMatching, "MetroidPrime/CBoneTracking.cpp"), Object(NonMatching, "MetroidPrime/Player/CFaceplateDecoration.cpp"), Object(NonMatching, "MetroidPrime/BodyState/CBSCover.cpp"), - Object(NonMatching, "MetroidPrime/ScriptObjects/CScriptBallTrigger.cpp"), + Object(Matching, "MetroidPrime/ScriptObjects/CScriptBallTrigger.cpp"), Object(NonMatching, "MetroidPrime/Weapons/CPlasmaProjectile.cpp"), Object(NonMatching, "MetroidPrime/Player/CPlayerOrbit.cpp"), Object(NonMatching, "MetroidPrime/CGameCollision.cpp"), @@ -509,7 +509,7 @@ config.libs = [ Object(NonMatching, "MetroidPrime/Weapons/CPhazonBeam.cpp"), Object(Matching, "MetroidPrime/ScriptObjects/CScriptTargetingPoint.cpp"), Object(NonMatching, "MetroidPrime/BodyState/CBSWallHang.cpp"), - Object(NonMatching, "MetroidPrime/ScriptObjects/CScriptEMPulse.cpp"), + Object(Matching, "MetroidPrime/ScriptObjects/CScriptEMPulse.cpp"), Object(NonMatching, "MetroidPrime/HUD/CHudDecoInterface.cpp"), Object(NonMatching, "MetroidPrime/Weapons/CFlameThrower.cpp"), Object(NonMatching, "MetroidPrime/Weapons/CBeamProjectile.cpp"), diff --git a/include/Kyoto/Streams/CInputStream.hpp b/include/Kyoto/Streams/CInputStream.hpp index 3b5862e1..b6b71c07 100644 --- a/include/Kyoto/Streams/CInputStream.hpp +++ b/include/Kyoto/Streams/CInputStream.hpp @@ -12,7 +12,7 @@ template < typename T > T cinput_stream_helper(const TType< T >& type, CInputStream& in); template < typename T > -TType< T > TGetType() { +inline TType< T > TGetType() { return TType< T >(); } @@ -40,12 +40,9 @@ public: bool ReadPackedBool() { return ReadBits(1) != 0; } - // TODO: this cast to uint fixes regalloc in - // CIEKeyframeEmitter / rstl::vector(CInputStream&) - // why? - int ReadInt32() { return static_cast< uint >(Get(TType< int >())); } - ushort ReadUint16() { return Get(); } - short ReadInt16() { return Get(); } + int ReadInt32() { return Get< int >(); } + ushort ReadUint16() { return Get< ushort >(); } + short ReadInt16() { return Get< short >(); } uint GetBlockOffset() const { return x4_blockOffset; } @@ -121,10 +118,10 @@ inline rstl::pair< L, R > cinput_stream_helper(const TType< rstl::pair< L, R > > template < typename T, typename Alloc > inline rstl::vector< T, Alloc >::vector(CInputStream& in, const Alloc& allocator) : x4_count(0), x8_capacity(0), xc_items(nullptr) { - int count = in.ReadInt32(); + int count = in.Get< int >(); reserve(count); for (int i = 0; i < count; i++) { - push_back(in.Get(TType< T >())); + push_back(in.Get(TGetType< T >())); } } diff --git a/include/MetroidPrime/CEntity.hpp b/include/MetroidPrime/CEntity.hpp index 96263649..1d661a62 100644 --- a/include/MetroidPrime/CEntity.hpp +++ b/include/MetroidPrime/CEntity.hpp @@ -23,10 +23,6 @@ public: CEntity(TUniqueId id, const CEntityInfo& info, bool active, const rstl::string& name); void SendScriptMsgs(EScriptObjectState state, CStateManager& mgr, EScriptObjectMessage msg); - static inline void SendScriptMsg(CStateManager& mgr, CEntity* to, TUniqueId sender, - EScriptObjectMessage msg) { - mgr.SendScriptMsg(to, sender, msg); - } TUniqueId GetUniqueId() const { return x8_uid; } TEditorId GetEditorId() const { return xc_editorId; } const rstl::string& GetDebugName() const { return x10_name; } diff --git a/include/MetroidPrime/CEnvFxManager.hpp b/include/MetroidPrime/CEnvFxManager.hpp index 9aca9b87..8bcb508c 100644 --- a/include/MetroidPrime/CEnvFxManager.hpp +++ b/include/MetroidPrime/CEnvFxManager.hpp @@ -58,7 +58,8 @@ private: float x38_maxDensityDeltaSpeed; bool x3c_snowflakeTextureMipBlanked; TLockedToken< CTexture > x40_txtrEnvGradient; - rstl::reserved_vector< CEnvFxManagerGrid, 64 > x50_grids; + rstl::reserved_vector< CEnvFxManagerGrid, 64 > x4c_grids; + int xb50_; // padding? float xb54_baseSplashRate; TLockedToken< CGenDescription > xb58_envRainSplash; bool xb64_; @@ -71,7 +72,6 @@ private: rstl::reserved_vector< CVector3f, 16 > xb84_snowZDeltas; TLockedToken< CTexture > xc48_underwaterFlake; bool xc54_; - int xc58_; }; CHECK_SIZEOF(CEnvFxManager, 0xc58); diff --git a/include/MetroidPrime/CRipple.hpp b/include/MetroidPrime/CRipple.hpp index 7f1530d4..5adbd8db 100644 --- a/include/MetroidPrime/CRipple.hpp +++ b/include/MetroidPrime/CRipple.hpp @@ -30,6 +30,8 @@ public: void SetTime(float t) { x4_time = t; } float GetTimeFalloff() const { return x14_timeFalloff; } + + static float kDefaultScale; }; #endif // _CRIPPLE diff --git a/include/MetroidPrime/CStateManager.hpp b/include/MetroidPrime/CStateManager.hpp index 358b9fdc..f98f1f1d 100644 --- a/include/MetroidPrime/CStateManager.hpp +++ b/include/MetroidPrime/CStateManager.hpp @@ -6,12 +6,13 @@ #include "Kyoto/CObjectReference.hpp" #include "Kyoto/CRandom16.hpp" #include "Kyoto/Input/CFinalInput.hpp" +#include "Kyoto/Math/CFrustumPlanes.hpp" #include "Kyoto/Math/CVector2f.hpp" #include "Kyoto/Math/CVector2i.hpp" -#include "Kyoto/Math/CFrustumPlanes.hpp" #include "Kyoto/TOneStatic.hpp" #include "Kyoto/TToken.hpp" + #include "MetroidPrime/CEntityInfo.hpp" #include "MetroidPrime/CObjectList.hpp" #include "MetroidPrime/Cameras/CCameraBlurPass.hpp" @@ -23,15 +24,16 @@ #include "rstl/auto_ptr.hpp" #include "rstl/list.hpp" -#include "rstl/set.hpp" #include "rstl/map.hpp" #include "rstl/multimap.hpp" #include "rstl/pair.hpp" #include "rstl/rc_ptr.hpp" #include "rstl/reserved_vector.hpp" +#include "rstl/set.hpp" #include "rstl/single_ptr.hpp" #include "rstl/string.hpp" + class CAABox; class CActor; class CActorModelParticles; @@ -50,7 +52,7 @@ class CWeaponMgr; class CWorld; class CWorldTransManager; class CEntity; -class CMazeState; +class CSinglePathMaze; class CRayCastResult; class CMaterialFilter; class CWorldLayerState; @@ -125,11 +127,11 @@ public: void ResetEscapeSequenceTimer(float); void SendScriptMsg(TUniqueId uid, TEditorId target, EScriptObjectMessage msg, EScriptObjectState state); - void SendScriptMsg(CEntity* ent, TUniqueId target, EScriptObjectMessage msg); + void DeliverScriptMsg(CEntity* ent, TUniqueId target, EScriptObjectMessage msg); void SendScriptMsgAlways(TUniqueId uid, TUniqueId src, EScriptObjectMessage msg); bool AddDrawableActor(const CActor& actor, const CVector3f& pos, const CAABox& bounds) const; void SetupParticleHook(const CActor& actor) const; - void FreeScriptObject(TUniqueId uid); + void DeleteObjectRequest(TUniqueId uid); rstl::pair< TEditorId, TUniqueId > GenerateObject(const TEditorId& eid); void AddObject(CEntity*); TUniqueId AllocateUniqueId(); @@ -164,9 +166,9 @@ public: bool CanCreateProjectile(TUniqueId, EWeaponType, int) const; - CMazeState* CurrentMaze(); - const CMazeState* GetCurrentMaze() const; - void SetCurrentMaze(rstl::single_ptr< CMazeState > maze); + CSinglePathMaze* SinglePathMaze(); + const CSinglePathMaze* GetSinglePathMaze() const; + void SetSinglePathMaze(rstl::single_ptr< CSinglePathMaze > maze); CPlayer* Player() { return x84c_player; } const CPlayer* GetPlayer() const { return x84c_player; } @@ -331,7 +333,7 @@ private: EGameState x904_gameState; rstl::reserved_vector< FScriptLoader, int(kST_MAX) > x90c_loaderFuncs; EInitPhase xb3c_initPhase; - rstl::set xb40_uniqueInstanceNames; + rstl::set< rstl::string > xb40_uniqueInstanceNames; CFinalInput xb54_finalInput; rstl::reserved_vector< CCameraFilterPass, kCFS_Max > xb84_camFilterPasses; @@ -355,7 +357,7 @@ private: rstl::list< TUniqueId > xf3c_activeFlickerBats; rstl::list< TUniqueId > xf54_activeParasites; TUniqueId xf6c_playerActorHead; - rstl::single_ptr< CMazeState > xf70_currentMaze; + rstl::single_ptr< CSinglePathMaze > xf70_currentMaze; TUniqueId xf74_lastTrigger; TUniqueId xf76_lastRelay; float xf78_hudMessageTime; diff --git a/include/MetroidPrime/CWorld.hpp b/include/MetroidPrime/CWorld.hpp index 97641864..0af54df0 100644 --- a/include/MetroidPrime/CWorld.hpp +++ b/include/MetroidPrime/CWorld.hpp @@ -82,7 +82,7 @@ public: const CGameArea& GetAreaAlways(TAreaId id) const { return *x18_areas[id.Value()]; } CGameArea* Area(TAreaId id) { return x18_areas[id.Value()].get(); } const CGameArea* GetArea(TAreaId id) const { return x18_areas[id.Value()].get(); } - bool IsAreaValid(TAreaId id) const { return GetArea(id)->IsLoaded(); } + bool IsAreaValid(TAreaId id) const { return x18_areas[id.Value()]->IsLoaded(); } CAssetId GetWorldAssetId() const { return x8_mlvlId; } TAreaId GetCurrentAreaId() const { return x68_curAreaId; } TAreaId GetAreaIdForSaveId(int saveId) const; diff --git a/include/MetroidPrime/ScriptObjects/CScriptMazeNode.hpp b/include/MetroidPrime/ScriptObjects/CScriptMazeNode.hpp index 53484e93..48ab1c95 100644 --- a/include/MetroidPrime/ScriptObjects/CScriptMazeNode.hpp +++ b/include/MetroidPrime/ScriptObjects/CScriptMazeNode.hpp @@ -43,7 +43,7 @@ struct SMazeCell { } }; -class CMazeState { +class CSinglePathMaze { CRandom16 x0_rand; SMazeCell x4_cells[skMazeRows * skMazeCols]; int x84_enterCol; @@ -61,15 +61,15 @@ public: kS_Left = 3, }; - CMazeState(int enterCol, int enterRow, int targetCol, int targetRow); - void Reset(int seed); - void Initialize(); - void GenerateObstacles(); + CSinglePathMaze(int enterCol, int enterRow, int targetCol, int targetRow); + void CreateMaze(int seed); + void SolveMaze(); + void AddGimmicks(); - SMazeCell& GetCell(uint col, uint row); - const SMazeCell& GetCell(uint col, uint row) const; - SMazeCell& GetCellInline(uint col, uint row) { return x4_cells[col + row * skMazeCols]; } // ???? - inline SMazeCell& GetCell(uint idx) { return x4_cells[idx]; } + SMazeCell& MazePoint(uint col, uint row); + const SMazeCell& GetMazePoint(uint col, uint row) const; + SMazeCell& MazePointInline(uint col, uint row) { return x4_cells[col + row * skMazeCols]; } // ???? + inline SMazeCell& MazePoint(uint idx) { return x4_cells[idx]; } }; class CScriptMazeNode : public CActor { @@ -111,11 +111,17 @@ private: bool x13c_25_hasGate : 1; bool x13c_26_gateActive : 1; - void GenerateObjects(CStateManager& mgr); - void Reset(CStateManager& mgr); - void SendScriptMsgs(CStateManager& mgr, EScriptObjectMessage msg); + void GenerateBarrier(CStateManager& mgr); + void DeleteBarrier(CStateManager& mgr); + void SendBarrierMsg(CStateManager& mgr, EScriptObjectMessage msg); static uint sMazeSeeds[300]; + + // hack for SendBarrierMsg + static inline void DeliverScriptMsg(CStateManager& mgr, CEntity* to, TUniqueId sender, + EScriptObjectMessage msg) { + mgr.DeliverScriptMsg(to, sender, msg); + } }; #endif // _CSCRIPTMAZENODE diff --git a/include/MetroidPrime/ScriptObjects/CScriptPickup.hpp b/include/MetroidPrime/ScriptObjects/CScriptPickup.hpp index 795cb16f..d0be67a7 100644 --- a/include/MetroidPrime/ScriptObjects/CScriptPickup.hpp +++ b/include/MetroidPrime/ScriptObjects/CScriptPickup.hpp @@ -40,7 +40,7 @@ public: float GetPossibility() const; CPlayerState::EItemType GetItem() const; - void SetSpawned(); + void SetWasGenerated(); }; #endif // _CSCRIPTPICKUP diff --git a/include/MetroidPrime/ScriptObjects/CScriptPickupGenerator.hpp b/include/MetroidPrime/ScriptObjects/CScriptPickupGenerator.hpp index 0946b758..846cc45d 100644 --- a/include/MetroidPrime/ScriptObjects/CScriptPickupGenerator.hpp +++ b/include/MetroidPrime/ScriptObjects/CScriptPickupGenerator.hpp @@ -13,16 +13,18 @@ public: void AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId sender, CStateManager& stateMgr) override; + // float GetNothingPossibility() const; + private: CVector3f x34_position; float x40_frequency; float x44_delayTimer; - void ResetDelayTimer(); - void GetGeneratorIds(CStateManager& mgr, TUniqueId sender, - rstl::vector< TUniqueId >& idsOut) const; - float GetPickupTemplates(CStateManager& mgr, - rstl::vector< rstl::pair< float, TEditorId > >& idsOut) const; - void GeneratePickup(CStateManager& mgr, TEditorId templateId, TUniqueId generatorId) const; + + void ResetSpawnNothingCounter(); + void GetTargets(CStateManager& mgr, TUniqueId sender, rstl::vector< TUniqueId >& idsOut) const; + float GetSpawnablePickups(CStateManager& mgr, + rstl::vector< rstl::pair< float, TEditorId > >& idsOut) const; + void SpawnPickup(CStateManager& mgr, TEditorId templateId, TUniqueId generatorId) const; }; #endif // _CSCRIPTPICKUPGENERATOR diff --git a/include/MetroidPrime/ScriptObjects/CScriptSteam.hpp b/include/MetroidPrime/ScriptObjects/CScriptSteam.hpp index e69a36d9..6da05632 100644 --- a/include/MetroidPrime/ScriptObjects/CScriptSteam.hpp +++ b/include/MetroidPrime/ScriptObjects/CScriptSteam.hpp @@ -4,14 +4,6 @@ #include "MetroidPrime/ScriptObjects/CScriptTrigger.hpp" class CScriptSteam : public CScriptTrigger { - bool x150_; - CAssetId x154_texture; - float x158_; - float x15c_alphaInDur; - float x160_alphaOutDur; - float x164_; - float x168_; - public: CScriptSteam(TUniqueId, const rstl::string& name, const CEntityInfo& info, const CVector3f& pos, const CAABox&, const CDamageInfo& dInfo, const CVector3f& orientedForce, @@ -21,6 +13,22 @@ public: void AcceptScriptMsg(EScriptObjectMessage, TUniqueId, CStateManager&); void Think(float, CStateManager&); void Accept(IVisitor&); + +private: + bool x150_; + CAssetId x154_texture; + float x158_strength; + float x15c_alphaInDur; + float x160_alphaOutDur; + float x164_maxDist; + float x168_ooMaxDist; + + float GetMaxDist() const { return x164_maxDist; } + float GetStrength() const { return x158_strength; } + float GetOOMaxDist() const { return x168_ooMaxDist; } + CAssetId GetTextureId() const { return x154_texture; } + float GetFadeOutRate() const { return x160_alphaOutDur; } + float GetFadeInRate() const { return x15c_alphaInDur; } }; #endif // _CSCRIPTSTEAM diff --git a/include/rstl/vector.hpp b/include/rstl/vector.hpp index 63b3db21..20f8e8de 100644 --- a/include/rstl/vector.hpp +++ b/include/rstl/vector.hpp @@ -79,8 +79,7 @@ public: if (x4_count >= x8_capacity) { reserve(x8_capacity != 0 ? x8_capacity * 2 : 4); } - iterator out = begin() + x4_count; - out = in; + rstl::construct(xc_items + x4_count, in); ++x4_count; } diff --git a/src/Kyoto/Animation/CSegIdList.cpp b/src/Kyoto/Animation/CSegIdList.cpp index f280099d..20e6af9d 100644 --- a/src/Kyoto/Animation/CSegIdList.cpp +++ b/src/Kyoto/Animation/CSegIdList.cpp @@ -4,7 +4,7 @@ #include "Kyoto/Streams/CInputStream.hpp" /* this is such a hack... */ -#pragma inline_max_size(250) +#pragma inline_max_size(200) CSegIdList::CSegIdList(CInputStream& in) : x0_segList(in) { diff --git a/src/MetroidPrime/CCollisionActorManager.cpp b/src/MetroidPrime/CCollisionActorManager.cpp index 3290e9f8..3651cd89 100644 --- a/src/MetroidPrime/CCollisionActorManager.cpp +++ b/src/MetroidPrime/CCollisionActorManager.cpp @@ -70,7 +70,7 @@ void CCollisionActorManager::Update(float dt, CStateManager& mgr, void CCollisionActorManager::Destroy(CStateManager& mgr) const { for (int i = 0; i < x0_jointDescriptions.size(); ++i) { - mgr.FreeScriptObject(x0_jointDescriptions[i].GetCollisionActorId()); + mgr.DeleteObjectRequest(x0_jointDescriptions[i].GetCollisionActorId()); } x13_destroyed = true; diff --git a/src/MetroidPrime/CExplosion.cpp b/src/MetroidPrime/CExplosion.cpp index c33f1e73..111a8a9c 100644 --- a/src/MetroidPrime/CExplosion.cpp +++ b/src/MetroidPrime/CExplosion.cpp @@ -90,9 +90,9 @@ void CExplosion::Think(float dt, CStateManager& mgr) { xf8_time += dt; if (xf8_time > 15.f) { - mgr.FreeScriptObject(GetUniqueId()); + mgr.DeleteObjectRequest(GetUniqueId()); } else if (xe8_particleGen->IsSystemDeletable()) { - mgr.FreeScriptObject(GetUniqueId()); + mgr.DeleteObjectRequest(GetUniqueId()); } } @@ -112,7 +112,7 @@ void CExplosion::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId sender, CSt break; case kSM_Deleted: if (xec_explosionLight != kInvalidUniqueId) { - mgr.FreeScriptObject(xec_explosionLight); + mgr.DeleteObjectRequest(xec_explosionLight); xec_explosionLight = kInvalidUniqueId; } break; diff --git a/src/MetroidPrime/CGameLight.cpp b/src/MetroidPrime/CGameLight.cpp index 363502cd..1718a8d1 100644 --- a/src/MetroidPrime/CGameLight.cpp +++ b/src/MetroidPrime/CGameLight.cpp @@ -42,7 +42,7 @@ void CGameLight::Think(float dt, CStateManager& mgr) { x144_lifeTime -= dt; if (x144_lifeTime <= 0.f) - mgr.FreeScriptObject(GetUniqueId()); + mgr.DeleteObjectRequest(GetUniqueId()); } } diff --git a/src/MetroidPrime/CParticleGenInfoGeneric.cpp b/src/MetroidPrime/CParticleGenInfoGeneric.cpp index ea66910b..7bcc5df2 100644 --- a/src/MetroidPrime/CParticleGenInfoGeneric.cpp +++ b/src/MetroidPrime/CParticleGenInfoGeneric.cpp @@ -108,7 +108,7 @@ void CParticleGenInfoGeneric::DeleteLight(CStateManager& stateMgr) { return; } - stateMgr.FreeScriptObject(x88_lightId); + stateMgr.DeleteObjectRequest(x88_lightId); x88_lightId = kInvalidUniqueId; } diff --git a/src/MetroidPrime/Enemies/CFlaahgraPlants.cpp b/src/MetroidPrime/Enemies/CFlaahgraPlants.cpp index b2ce5a94..aafe46fc 100644 --- a/src/MetroidPrime/Enemies/CFlaahgraPlants.cpp +++ b/src/MetroidPrime/Enemies/CFlaahgraPlants.cpp @@ -67,7 +67,7 @@ void CFlaahgraPlants::Think(float dt, CStateManager& mgr) { } if (xe8_elementGen->IsSystemDeletable()) { - mgr.FreeScriptObject(GetUniqueId()); + mgr.DeleteObjectRequest(GetUniqueId()); } } @@ -98,7 +98,7 @@ void CFlaahgraPlants::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId uid, C } case kSM_Deleted: { if (x16c_colAct != kInvalidUniqueId) { - mgr.FreeScriptObject(x16c_colAct); + mgr.DeleteObjectRequest(x16c_colAct); } break; } diff --git a/src/MetroidPrime/ScriptObjects/CHUDBillboardEffect.cpp b/src/MetroidPrime/ScriptObjects/CHUDBillboardEffect.cpp index ae68f64b..445b8233 100644 --- a/src/MetroidPrime/ScriptObjects/CHUDBillboardEffect.cpp +++ b/src/MetroidPrime/ScriptObjects/CHUDBillboardEffect.cpp @@ -103,12 +103,12 @@ void CHUDBillboardEffect::Think(float dt, CStateManager& mgr) { if (!x104_27_runIndefinitely) { x108_timeoutTimer += dt; if (x108_timeoutTimer > 30.f) { - mgr.FreeScriptObject(GetUniqueId()); + mgr.DeleteObjectRequest(GetUniqueId()); return; } } if (xe8_generator->IsSystemDeletable()) - mgr.FreeScriptObject(GetUniqueId()); + mgr.DeleteObjectRequest(GetUniqueId()); } } diff --git a/src/MetroidPrime/ScriptObjects/CScriptActorKeyframe.cpp b/src/MetroidPrime/ScriptObjects/CScriptActorKeyframe.cpp index 00d053ea..34ec2418 100644 --- a/src/MetroidPrime/ScriptObjects/CScriptActorKeyframe.cpp +++ b/src/MetroidPrime/ScriptObjects/CScriptActorKeyframe.cpp @@ -69,7 +69,7 @@ void CScriptActorKeyframe::UpdateEntity(TUniqueId uid, CStateManager& mgr) { } if (act) { if (!act->GetActive()) { - mgr.SendScriptMsg(act, GetUniqueId(), kSM_Activate); + mgr.DeliverScriptMsg(act, GetUniqueId(), kSM_Activate); } act->SetModelFlags(CModelFlags::Normal()); if (act->HasAnimation()) { diff --git a/src/MetroidPrime/ScriptObjects/CScriptBallTrigger.cpp b/src/MetroidPrime/ScriptObjects/CScriptBallTrigger.cpp index 0505eaa3..8c5146ca 100644 --- a/src/MetroidPrime/ScriptObjects/CScriptBallTrigger.cpp +++ b/src/MetroidPrime/ScriptObjects/CScriptBallTrigger.cpp @@ -7,7 +7,7 @@ #include "rstl/math.hpp" -CAABox calculate_ball_aabox() { +static CAABox calculate_ball_aabox() { const float extent = 0.33f * gpTweakPlayer->GetPlayerBallHalfExtent(); return CAABox(CVector3f(-extent, -extent, -extent), CVector3f(extent, extent, extent)); } diff --git a/src/MetroidPrime/ScriptObjects/CScriptBeam.cpp b/src/MetroidPrime/ScriptObjects/CScriptBeam.cpp index 7de52b98..42adb27a 100644 --- a/src/MetroidPrime/ScriptObjects/CScriptBeam.cpp +++ b/src/MetroidPrime/ScriptObjects/CScriptBeam.cpp @@ -29,7 +29,7 @@ void CScriptBeam::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId objId, CSt } break; case kSM_Deleted: - mgr.FreeScriptObject(x154_projectileId); + mgr.DeleteObjectRequest(x154_projectileId); break; case kSM_Increment: diff --git a/src/MetroidPrime/ScriptObjects/CScriptCameraHintTrigger.cpp b/src/MetroidPrime/ScriptObjects/CScriptCameraHintTrigger.cpp index 9ce88a84..49f4a903 100644 --- a/src/MetroidPrime/ScriptObjects/CScriptCameraHintTrigger.cpp +++ b/src/MetroidPrime/ScriptObjects/CScriptCameraHintTrigger.cpp @@ -42,7 +42,7 @@ void CScriptCameraHintTrigger::Think(float dt, CStateManager& mgr) { x130_27_playerWasInside = true; SendScriptMsgs(kSS_Entered, mgr, kSM_None); if (x130_24_deactivateOnEnter) { - mgr.SendScriptMsg(this, kInvalidUniqueId, kSM_Deactivate); + mgr.DeliverScriptMsg(this, kInvalidUniqueId, kSM_Deactivate); } } @@ -50,7 +50,7 @@ void CScriptCameraHintTrigger::Think(float dt, CStateManager& mgr) { x130_27_playerWasInside = false; SendScriptMsgs(kSS_Exited, mgr, kSM_None); if (x130_25_deactivateOnExit) { - mgr.SendScriptMsg(this, kInvalidUniqueId, kSM_Deactivate); + mgr.DeliverScriptMsg(this, kInvalidUniqueId, kSM_Deactivate); } } diff --git a/src/MetroidPrime/ScriptObjects/CScriptDistanceFog.cpp b/src/MetroidPrime/ScriptObjects/CScriptDistanceFog.cpp index 4e3a11fe..27d1668e 100644 --- a/src/MetroidPrime/ScriptObjects/CScriptDistanceFog.cpp +++ b/src/MetroidPrime/ScriptObjects/CScriptDistanceFog.cpp @@ -57,10 +57,14 @@ void CScriptDistanceFog::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId obj } if (!close_enough(x54_thermalSpeed, 0.f)) { - stateMgr.World()->Area(GetCurrentAreaId())->SetThermalSpeedAndTarget(x54_thermalSpeed, x50_thermalTarget); + stateMgr.World() + ->Area(GetCurrentAreaId()) + ->SetThermalSpeedAndTarget(x54_thermalSpeed, x50_thermalTarget); } if (!close_enough(x5c_xraySpeed, 0.f)) { - stateMgr.World()->Area(GetCurrentAreaId())->SetXRaySpeedAndTarget(x5c_xraySpeed, x58_xrayTarget); + stateMgr.World() + ->Area(GetCurrentAreaId()) + ->SetXRaySpeedAndTarget(x5c_xraySpeed, x58_xrayTarget); } break; } diff --git a/src/MetroidPrime/ScriptObjects/CScriptEMPulse.cpp b/src/MetroidPrime/ScriptObjects/CScriptEMPulse.cpp index e8cc6ca0..92179954 100644 --- a/src/MetroidPrime/ScriptObjects/CScriptEMPulse.cpp +++ b/src/MetroidPrime/ScriptObjects/CScriptEMPulse.cpp @@ -52,10 +52,11 @@ void CScriptEMPulse::Think(float dt, CStateManager& mgr) { if (!GetActive()) { return; } - xf0_currentRadius += ((xec_finalRadius - xf4_initialRadius) / xe8_duration) * dt; - if (xf0_currentRadius <= xec_finalRadius) { - mgr.FreeScriptObject(GetUniqueId()); + float step = (xec_finalRadius - xf4_initialRadius) / xe8_duration; + xf0_currentRadius = xf0_currentRadius + step * dt; + if (xf0_currentRadius >= xec_finalRadius) { + mgr.DeleteObjectRequest(GetUniqueId()); } x114_particleGen->Update(dt); @@ -64,9 +65,8 @@ void CScriptEMPulse::Think(float dt, CStateManager& mgr) { CAABox CScriptEMPulse::CalculateBoundingBox() const { float radius = xf0_currentRadius; CVector3f position(GetTranslation()); - return CAABox( - CVector3f(position.GetX() - radius, position.GetY() - radius, position.GetZ() - radius), - CVector3f(position.GetX() + radius, position.GetY() + radius, position.GetZ() + radius)); + return CAABox(position - CVector3f(radius, radius, radius), + position + CVector3f(radius, radius, radius)); } rstl::optional_object< CAABox > CScriptEMPulse::GetTouchBounds() const { diff --git a/src/MetroidPrime/ScriptObjects/CScriptMazeNode.cpp b/src/MetroidPrime/ScriptObjects/CScriptMazeNode.cpp index 91b13fa6..65441128 100644 --- a/src/MetroidPrime/ScriptObjects/CScriptMazeNode.cpp +++ b/src/MetroidPrime/ScriptObjects/CScriptMazeNode.cpp @@ -8,7 +8,7 @@ uint CScriptMazeNode::sMazeSeeds[300]; -CMazeState::CMazeState(int enterCol, int enterRow, int targetCol, int targetRow) +CSinglePathMaze::CSinglePathMaze(int enterCol, int enterRow, int targetCol, int targetRow) : x0_rand(0) , x84_enterCol(enterCol) , x88_enterRow(enterRow) @@ -16,7 +16,7 @@ CMazeState::CMazeState(int enterCol, int enterRow, int targetCol, int targetRow) , x90_targetRow(targetRow) , x94_24_initialized(false) {} -void CMazeState::Reset(int seed) { +void CSinglePathMaze::CreateMaze(int seed) { int numCells = NUM_MAZE_CELLS - 1; int cellIdx = 0; @@ -29,17 +29,17 @@ void CMazeState::Reset(int seed) { ESide sides[4]; while (numCells != 0) { int acc = 0; - if (cellIdx - skMazeCols > 0 && GetCell(cellIdx - skMazeCols).IsClosed()) { + if (cellIdx - skMazeCols > 0 && MazePoint(cellIdx - skMazeCols).IsClosed()) { sides[acc++] = kS_Top; } if (cellIdx < NUM_MAZE_CELLS - 2 && (cellIdx + 1) % skMazeCols != 0 && - GetCell(cellIdx + 1).IsClosed()) { + MazePoint(cellIdx + 1).IsClosed()) { sides[acc++] = kS_Right; } - if (cellIdx + skMazeCols <= NUM_MAZE_CELLS - 1 && GetCell(cellIdx + skMazeCols).IsClosed()) { + if (cellIdx + skMazeCols <= NUM_MAZE_CELLS - 1 && MazePoint(cellIdx + skMazeCols).IsClosed()) { sides[acc++] = kS_Bottom; } - if (cellIdx > 0 && cellIdx % skMazeCols != 0 && GetCell(cellIdx - 1).IsClosed()) { + if (cellIdx > 0 && cellIdx % skMazeCols != 0 && MazePoint(cellIdx - 1).IsClosed()) { sides[acc++] = kS_Left; } @@ -49,23 +49,23 @@ void CMazeState::Reset(int seed) { ESide side = sides[x0_rand.Next() % static_cast< uint >(acc)]; switch (side) { case kS_Top: - GetCell(cellIdx).x0_24_openTop = true; - GetCell(cellIdx - skMazeCols).x0_26_openBottom = true; + MazePoint(cellIdx).x0_24_openTop = true; + MazePoint(cellIdx - skMazeCols).x0_26_openBottom = true; cellIdx -= skMazeCols; break; case kS_Right: - GetCell(cellIdx).x0_25_openRight = true; - GetCell(cellIdx + 1).x0_27_openLeft = true; + MazePoint(cellIdx).x0_25_openRight = true; + MazePoint(cellIdx + 1).x0_27_openLeft = true; cellIdx++; break; case kS_Bottom: - GetCell(cellIdx).x0_26_openBottom = true; - GetCell(cellIdx + skMazeCols).x0_24_openTop = true; + MazePoint(cellIdx).x0_26_openBottom = true; + MazePoint(cellIdx + skMazeCols).x0_24_openTop = true; cellIdx += skMazeCols; break; case kS_Left: - GetCell(cellIdx).x0_27_openLeft = true; - GetCell(cellIdx - 1).x0_25_openRight = true; + MazePoint(cellIdx).x0_27_openLeft = true; + MazePoint(cellIdx - 1).x0_25_openRight = true; cellIdx--; break; } @@ -77,24 +77,26 @@ void CMazeState::Reset(int seed) { if (cellIdx > NUM_MAZE_CELLS - 1) { cellIdx = 0; } - } while (GetCell(cellIdx).IsClosed()); + } while (MazePoint(cellIdx).IsClosed()); } } -const SMazeCell& CMazeState::GetCell(uint col, uint row) const { +const SMazeCell& CSinglePathMaze::GetMazePoint(uint col, uint row) const { return x4_cells[col + row * skMazeCols]; } -SMazeCell& CMazeState::GetCell(uint col, uint row) { return x4_cells[col + row * skMazeCols]; } +SMazeCell& CSinglePathMaze::MazePoint(uint col, uint row) { + return x4_cells[col + row * skMazeCols]; +} static inline int GetRandom(CRandom16& rand, int offset) { int tmp = rand.Next(); return tmp - ((tmp / 5) * 5) + offset; } -void CMazeState::GenerateObstacles() { +void CSinglePathMaze::AddGimmicks() { if (!x94_24_initialized) { - Initialize(); + SolveMaze(); } int gate1Idx = GetRandom(x0_rand, 9); @@ -114,47 +116,49 @@ void CMazeState::GenerateObstacles() { if (idx == gate1Idx || idx == gate2Idx || idx == gate3Idx) { switch (side) { case kS_Top: - GetCellInline(col, row).x0_30_gateBottom = true; - GetCellInline(prevCol, prevRow).x0_28_gateTop = true; + MazePointInline(col, row).x0_30_gateBottom = true; + MazePointInline(prevCol, prevRow).x0_28_gateTop = true; break; case kS_Right: - GetCellInline(col, row).x0_31_gateLeft = true; - GetCellInline(prevCol, prevRow).x0_29_gateRight = true; + MazePointInline(col, row).x0_31_gateLeft = true; + MazePointInline(prevCol, prevRow).x0_29_gateRight = true; break; case kS_Bottom: - GetCellInline(col, row).x0_28_gateTop = true; - GetCellInline(prevCol, prevRow).x0_30_gateBottom = true; + MazePointInline(col, row).x0_28_gateTop = true; + MazePointInline(prevCol, prevRow).x0_30_gateBottom = true; break; case kS_Left: - GetCellInline(col, row).x0_29_gateRight = true; - GetCellInline(prevCol, prevRow).x0_31_gateLeft = true; + MazePointInline(col, row).x0_29_gateRight = true; + MazePointInline(prevCol, prevRow).x0_31_gateLeft = true; break; } } int curCol = col; int curRow = row; - if (row > 0 && side != kS_Bottom && GetCellInline(col, row).x0_24_openTop && - GetCellInline(col, row - 1).x1_25_onPath) { + if (row > 0 && side != kS_Bottom && MazePointInline(col, row).x0_24_openTop && + MazePointInline(col, row - 1).x1_25_onPath) { side = kS_Top; row--; - } else if (row < skMazeRows - 1 && side != kS_Top && GetCellInline(col, row).x0_26_openBottom && - GetCellInline(col, row + 1).x1_25_onPath) { + } else if (row < skMazeRows - 1 && side != kS_Top && + MazePointInline(col, row).x0_26_openBottom && + MazePointInline(col, row + 1).x1_25_onPath) { side = kS_Bottom; row++; - } else if (col > 0 && side != kS_Right && GetCellInline(col, row).x0_27_openLeft && - GetCellInline(col - 1, row).x1_25_onPath) { + } else if (col > 0 && side != kS_Right && MazePointInline(col, row).x0_27_openLeft && + MazePointInline(col - 1, row).x1_25_onPath) { side = kS_Left; col--; - } else if (col < skMazeCols - 1 && side != kS_Left && GetCellInline(col, row).x0_25_openRight && - GetCellInline(col + 1, row).x1_25_onPath) { + } else if (col < skMazeCols - 1 && side != kS_Left && + MazePointInline(col, row).x0_25_openRight && + MazePointInline(col + 1, row).x1_25_onPath) { side = kS_Right; col++; } else { return; } -#define GetCellInline(c, r) x4_cells[c + r * skMazeCols] +#define MazePointInline(c, r) x4_cells[c + r * skMazeCols] if (idx == puddle1Idx || idx == puddle2Idx) { if (curCol == 0 || curRow == 0 || curCol == skMazeCols - 1 || curRow == skMazeRows - 1) { if (idx == puddle1Idx) { @@ -163,28 +167,28 @@ void CMazeState::GenerateObstacles() { puddle2Idx++; } } else { - GetCellInline(curCol, curRow).x1_24_puddle = true; + MazePointInline(curCol, curRow).x1_24_puddle = true; switch (side) { case kS_Top: - GetCellInline(col, row).x0_26_openBottom = false; - GetCellInline(curCol, curRow).x0_24_openTop = false; + MazePointInline(col, row).x0_26_openBottom = false; + MazePointInline(curCol, curRow).x0_24_openTop = false; break; case kS_Right: - GetCellInline(col, row).x0_27_openLeft = false; - GetCellInline(curCol, curRow).x0_25_openRight = false; + MazePointInline(col, row).x0_27_openLeft = false; + MazePointInline(curCol, curRow).x0_25_openRight = false; break; case kS_Bottom: - GetCellInline(col, row).x0_24_openTop = false; - GetCellInline(curCol, curRow).x0_26_openBottom = false; + MazePointInline(col, row).x0_24_openTop = false; + MazePointInline(curCol, curRow).x0_26_openBottom = false; break; case kS_Left: - GetCellInline(col, row).x0_25_openRight = false; - GetCellInline(curCol, curRow).x0_27_openLeft = false; + MazePointInline(col, row).x0_25_openRight = false; + MazePointInline(curCol, curRow).x0_27_openLeft = false; break; } } } -#undef GetCellInline +#undef MazePointInline idx++; prevCol = curCol; @@ -192,7 +196,7 @@ void CMazeState::GenerateObstacles() { } } -void CMazeState::Initialize() { +void CSinglePathMaze::SolveMaze() { int path[NUM_MAZE_CELLS]; int pathIdx = 0; int targetRow = x90_targetRow; @@ -256,7 +260,7 @@ CScriptMazeNode::CScriptMazeNode(TUniqueId uid, const rstl::string& name, const void CScriptMazeNode::Accept(IVisitor& visitor) { visitor.Visit(*this); } -void CScriptMazeNode::GenerateObjects(CStateManager& mgr) { +void CScriptMazeNode::GenerateBarrier(CStateManager& mgr) { rstl::vector< SConnection >::iterator conn = ConnectionList().begin(); for (; conn != ConnectionList().end(); ++conn) { if (conn->x0_state != kSS_MaxReached || conn->x4_msg != kSM_Activate) { @@ -280,7 +284,7 @@ void CScriptMazeNode::GenerateObjects(CStateManager& mgr) { mgr.SetIsGeneratingObject(wasGeneratingObject); if (CActor* actor = static_cast< CActor* >(mgr.ObjectById(objUid))) { - mgr.SendScriptMsg(actor, GetUniqueId(), kSM_Activate); + mgr.DeliverScriptMsg(actor, GetUniqueId(), kSM_Activate); if (scriptEffect) { actor->SetTranslation(GetTranslation() + x120_effectPos); x11c_effectId = objUid; @@ -297,45 +301,45 @@ void CScriptMazeNode::GenerateObjects(CStateManager& mgr) { } } -void CScriptMazeNode::Reset(CStateManager& mgr) { - mgr.FreeScriptObject(x11c_effectId); - mgr.FreeScriptObject(xfc_actorId); - mgr.FreeScriptObject(x10c_triggerId); - mgr.FreeScriptObject(xf4_gateEffectId); +void CScriptMazeNode::DeleteBarrier(CStateManager& mgr) { + mgr.DeleteObjectRequest(x11c_effectId); + mgr.DeleteObjectRequest(xfc_actorId); + mgr.DeleteObjectRequest(x10c_triggerId); + mgr.DeleteObjectRequest(xf4_gateEffectId); x11c_effectId = xfc_actorId = x10c_triggerId = xf4_gateEffectId = kInvalidUniqueId; } -void CScriptMazeNode::SendScriptMsgs(CStateManager& mgr, EScriptObjectMessage msg) { - SendScriptMsg(mgr, mgr.ObjectById(x11c_effectId), GetUniqueId(), msg); - SendScriptMsg(mgr, mgr.ObjectById(xfc_actorId), GetUniqueId(), msg); - SendScriptMsg(mgr, mgr.ObjectById(x10c_triggerId), GetUniqueId(), msg); - SendScriptMsg(mgr, mgr.ObjectById(xf4_gateEffectId), GetUniqueId(), msg); +void CScriptMazeNode::SendBarrierMsg(CStateManager& mgr, EScriptObjectMessage msg) { + DeliverScriptMsg(mgr, mgr.ObjectById(x11c_effectId), GetUniqueId(), msg); + DeliverScriptMsg(mgr, mgr.ObjectById(xfc_actorId), GetUniqueId(), msg); + DeliverScriptMsg(mgr, mgr.ObjectById(x10c_triggerId), GetUniqueId(), msg); + DeliverScriptMsg(mgr, mgr.ObjectById(xf4_gateEffectId), GetUniqueId(), msg); } void CScriptMazeNode::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId uid, CStateManager& mgr) { if (GetActive()) { switch (msg) { case kSM_InitializedInArea: { - if (mgr.CurrentMaze() == nullptr) { - rstl::single_ptr< CMazeState > maze = - rs_new CMazeState(skEnterCol, skEnterRow, skTargetCol, skTargetRow); - maze->Reset(sMazeSeeds[mgr.Random()->Next() % 300]); - maze->Initialize(); - maze->GenerateObstacles(); - mgr.SetCurrentMaze(maze); + if (mgr.SinglePathMaze() == nullptr) { + rstl::single_ptr< CSinglePathMaze > maze = + rs_new CSinglePathMaze(skEnterCol, skEnterRow, skTargetCol, skTargetRow); + maze->CreateMaze(sMazeSeeds[mgr.Random()->Next() % 300]); + maze->SolveMaze(); + maze->AddGimmicks(); + mgr.SetSinglePathMaze(maze); } break; } case kSM_Action: { bool shouldGenObjs = false; - if (const CMazeState* maze = mgr.CurrentMaze()) { - const SMazeCell& cell = maze->GetCell(xe8_col, xec_row); - if (xf0_side == CMazeState::kS_Top && cell.x0_24_openTop) { + if (const CSinglePathMaze* maze = mgr.SinglePathMaze()) { + const SMazeCell& cell = maze->GetMazePoint(xe8_col, xec_row); + if (xf0_side == CSinglePathMaze::kS_Top && cell.x0_24_openTop) { if (cell.x0_28_gateTop) { shouldGenObjs = true; x13c_25_hasGate = true; } - } else if (xf0_side == CMazeState::kS_Right && cell.x0_25_openRight) { + } else if (xf0_side == CSinglePathMaze::kS_Right && cell.x0_25_openRight) { if (cell.x0_29_gateRight) { shouldGenObjs = true; x13c_25_hasGate = true; @@ -344,9 +348,9 @@ void CScriptMazeNode::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId uid, C shouldGenObjs = true; } if (shouldGenObjs) { - GenerateObjects(mgr); + GenerateBarrier(mgr); } - if (xf0_side == CMazeState::kS_Right && cell.x1_24_puddle) { + if (xf0_side == CSinglePathMaze::kS_Right && cell.x1_24_puddle) { x13c_24_hasPuddle = true; } if (x13c_25_hasGate) { @@ -368,7 +372,7 @@ void CScriptMazeNode::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId uid, C xf4_gateEffectId = genObj; if (CActor* actor = TCastToPtr< CActor >(mgr.ObjectById(genObj))) { actor->SetTranslation(GetTranslation() + x120_effectPos); - mgr.SendScriptMsg(actor, GetUniqueId(), kSM_Activate); + mgr.DeliverScriptMsg(actor, GetUniqueId(), kSM_Activate); } break; } @@ -387,7 +391,6 @@ void CScriptMazeNode::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId uid, C for (; conn != GetConnectionList().end(); ++conn) { if ((conn->x0_state == kSS_Closed || conn->x0_state == kSS_DeactivateState) && conn->x4_msg == kSM_Activate) { - // TUniqueId genObj = GenerateObject(mgr, conn->x8_objId); bool wasGeneratingObject = mgr.IsGeneratingObject(); mgr.SetIsGeneratingObject(true); TUniqueId genObj = mgr.GenerateObject(conn->x8_objId).second; @@ -397,7 +400,7 @@ void CScriptMazeNode::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId uid, C if (CActor* actor = TCastToPtr< CActor >(mgr.ObjectById(genObj))) { actor->SetTransform(GetTransform()); if (conn->x0_state == kSS_Closed) { - mgr.SendScriptMsg(actor, GetUniqueId(), kSM_Activate); + mgr.DeliverScriptMsg(actor, GetUniqueId(), kSM_Activate); } } } @@ -407,7 +410,7 @@ void CScriptMazeNode::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId uid, C break; } case kSM_SetToZero: { - CMazeState* maze = mgr.CurrentMaze(); + CSinglePathMaze* maze = mgr.SinglePathMaze(); if (x13c_24_hasPuddle && maze != nullptr) { if (rstl::find(x12c_puddleObjectIds.begin(), x12c_puddleObjectIds.end(), uid) != x12c_puddleObjectIds.end()) { @@ -415,9 +418,9 @@ void CScriptMazeNode::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId uid, C for (; it != x12c_puddleObjectIds.end(); ++it) { if (CEntity* ent = mgr.ObjectById(*it)) { if (!ent->GetActive()) { - mgr.SendScriptMsg(ent, GetUniqueId(), kSM_Activate); + mgr.DeliverScriptMsg(ent, GetUniqueId(), kSM_Activate); } else { - mgr.FreeScriptObject(ent->GetUniqueId()); + mgr.DeleteObjectRequest(ent->GetUniqueId()); } } } @@ -426,38 +429,38 @@ void CScriptMazeNode::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId uid, C objIdx = list.GetNextObjectIndex(objIdx)) { if (CScriptMazeNode* node = TCastToPtr< CScriptMazeNode >(list[objIdx])) { if (node->xe8_col == xe8_col - 1 && node->xec_row == xec_row && - node->xf0_side == CMazeState::kS_Right) { - SMazeCell& cell = maze->GetCell(xe8_col - 1, xec_row); + node->xf0_side == CSinglePathMaze::kS_Right) { + SMazeCell& cell = maze->MazePoint(xe8_col - 1, xec_row); if (!cell.x0_25_openRight) { cell.x0_25_openRight = true; - node->Reset(mgr); + node->DeleteBarrier(mgr); node->x13c_25_hasGate = false; } } if (node->xe8_col == xe8_col && node->xec_row == xec_row && - node->xf0_side == CMazeState::kS_Right) { - SMazeCell& cell = maze->GetCell(xe8_col, xec_row); + node->xf0_side == CSinglePathMaze::kS_Right) { + SMazeCell& cell = maze->MazePoint(xe8_col, xec_row); if (!cell.x0_25_openRight) { cell.x0_25_openRight = true; - node->Reset(mgr); + node->DeleteBarrier(mgr); node->x13c_25_hasGate = false; } } if (node->xe8_col == xe8_col && node->xec_row == xec_row && - node->xf0_side == CMazeState::kS_Top) { - SMazeCell& cell = maze->GetCell(xe8_col, xec_row); + node->xf0_side == CSinglePathMaze::kS_Top) { + SMazeCell& cell = maze->MazePoint(xe8_col, xec_row); if (!cell.x0_24_openTop) { cell.x0_24_openTop = true; - node->Reset(mgr); + node->DeleteBarrier(mgr); node->x13c_25_hasGate = false; } } if (node->xe8_col == xe8_col && node->xec_row == xec_row + 1 && - node->xf0_side == CMazeState::kS_Top) { - SMazeCell& cell = maze->GetCell(xe8_col, xec_row + 1); + node->xf0_side == CSinglePathMaze::kS_Top) { + SMazeCell& cell = maze->MazePoint(xe8_col, xec_row + 1); if (!cell.x0_24_openTop) { cell.x0_24_openTop = true; - node->Reset(mgr); + node->DeleteBarrier(mgr); node->x13c_25_hasGate = false; } } @@ -468,14 +471,14 @@ void CScriptMazeNode::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId uid, C break; } case kSM_Deleted: { - if (mgr.GetCurrentMaze()) { - mgr.SetCurrentMaze(nullptr); + if (mgr.GetSinglePathMaze()) { + mgr.SetSinglePathMaze(nullptr); } - Reset(mgr); + DeleteBarrier(mgr); break; } case kSM_Deactivate: { - Reset(mgr); + DeleteBarrier(mgr); break; } } @@ -490,10 +493,10 @@ void CScriptMazeNode::Think(float dt, CStateManager& mgr) { xf8_msgTimer = 1.f; if (x13c_26_gateActive) { x13c_26_gateActive = false; - SendScriptMsgs(mgr, kSM_Deactivate); + SendBarrierMsg(mgr, kSM_Deactivate); } else { x13c_26_gateActive = true; - SendScriptMsgs(mgr, kSM_Activate); + SendBarrierMsg(mgr, kSM_Activate); } } } diff --git a/src/MetroidPrime/ScriptObjects/CScriptPickup.cpp b/src/MetroidPrime/ScriptObjects/CScriptPickup.cpp index f2e3f7b7..3785932b 100644 --- a/src/MetroidPrime/ScriptObjects/CScriptPickup.cpp +++ b/src/MetroidPrime/ScriptObjects/CScriptPickup.cpp @@ -137,7 +137,7 @@ void CScriptPickup::Think(float dt, CStateManager& mgr) { } if (x26c_lifeTime && x270_curTime > x26c_lifeTime) { - mgr.FreeScriptObject(GetUniqueId()); + mgr.DeleteObjectRequest(GetUniqueId()); } } @@ -163,7 +163,7 @@ void CScriptPickup::Touch(CActor& act, CStateManager& mgr) { mgr.PlayerState()->InitializePowerUp(itemType, x260_capacity); mgr.PlayerState()->IncrPickUp(itemType, x25c_amount); - mgr.FreeScriptObject(GetUniqueId()); + mgr.DeleteObjectRequest(GetUniqueId()); SendScriptMsgs(kSS_Arrived, mgr, kSM_None); if (x260_capacity > 0) { @@ -209,4 +209,4 @@ CPlayerState::EItemType CScriptPickup::GetItem() const { return x258_itemType; } float CScriptPickup::GetPossibility() const { return x264_possibility; } -void CScriptPickup::SetSpawned() { x28c_24_generated = true; } +void CScriptPickup::SetWasGenerated() { x28c_24_generated = true; } diff --git a/src/MetroidPrime/ScriptObjects/CScriptPickupGenerator.cpp b/src/MetroidPrime/ScriptObjects/CScriptPickupGenerator.cpp index 22e68fcd..cadba7cb 100644 --- a/src/MetroidPrime/ScriptObjects/CScriptPickupGenerator.cpp +++ b/src/MetroidPrime/ScriptObjects/CScriptPickupGenerator.cpp @@ -14,13 +14,13 @@ CScriptPickupGenerator::CScriptPickupGenerator(TUniqueId uid, const rstl::string , x34_position(pos) , x40_frequency(frequency) , x44_delayTimer(0.0f) { - ResetDelayTimer(); + ResetSpawnNothingCounter(); } CScriptPickupGenerator::~CScriptPickupGenerator() {} -void CScriptPickupGenerator::GetGeneratorIds(CStateManager& mgr, TUniqueId sender, - rstl::vector< TUniqueId >& idsOut) const { +void CScriptPickupGenerator::GetTargets(CStateManager& mgr, TUniqueId sender, + rstl::vector< TUniqueId >& idsOut) const { idsOut.reserve(rstl::max_val(1, GetConnectionList().size())); rstl::vector< SConnection >::const_iterator iter = GetConnectionList().begin(); for (; iter != GetConnectionList().end(); ++iter) { @@ -40,7 +40,7 @@ void CScriptPickupGenerator::GetGeneratorIds(CStateManager& mgr, TUniqueId sende } } -float CScriptPickupGenerator::GetPickupTemplates( +float CScriptPickupGenerator::GetSpawnablePickups( CStateManager& mgr, rstl::vector< rstl::pair< float, TEditorId > >& idsOut) const { float totalPossibility = 0.f; CPlayerState& pState = *mgr.PlayerState(); @@ -105,16 +105,16 @@ float CScriptPickupGenerator::GetPickupTemplates( return totalPossibility; } -void CScriptPickupGenerator::GeneratePickup(CStateManager& mgr, TEditorId templateId, - TUniqueId generatorId) const { +void CScriptPickupGenerator::SpawnPickup(CStateManager& mgr, TEditorId templateId, + TUniqueId generatorId) const { TUniqueId templateUnideId = mgr.GetIdForScript(templateId); CEntity* pickupTempl = mgr.ObjectById(templateUnideId); CEntity* generator = mgr.ObjectById(generatorId); if (pickupTempl && generator) { - const bool oldGeneratingObject = mgr.IsGeneratingObject(); + bool oldGeneratingObject = mgr.IsGeneratingObject(); mgr.SetIsGeneratingObject(true); - const TUniqueId p = mgr.GenerateObject(templateId).second; + TUniqueId p = mgr.GenerateObject(templateId).second; mgr.SetIsGeneratingObject(oldGeneratingObject); if (p == kInvalidUniqueId) { @@ -134,14 +134,14 @@ void CScriptPickupGenerator::GeneratePickup(CStateManager& mgr, TEditorId templa } if (newPickup) { - newPickup->SetSpawned(); + newPickup->SetWasGenerated(); } - mgr.SendScriptMsg(newObj, GetUniqueId(), kSM_Activate); + mgr.DeliverScriptMsg(newObj, GetUniqueId(), kSM_Activate); } } -void CScriptPickupGenerator::ResetDelayTimer() { +void CScriptPickupGenerator::ResetSpawnNothingCounter() { if (x40_frequency > 0.f) { x44_delayTimer += 100.f / x40_frequency; } else { @@ -156,12 +156,12 @@ void CScriptPickupGenerator::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId if (GetActive() && x40_frequency != 100.f) { x44_delayTimer -= 1.f; if (x44_delayTimer < 0.000009f) { - ResetDelayTimer(); + ResetSpawnNothingCounter(); } else { rstl::vector< TUniqueId > generatorIds; - GetGeneratorIds(stateMgr, sender, generatorIds); + GetTargets(stateMgr, sender, generatorIds); rstl::vector< rstl::pair< float, TEditorId > > pickupTemplates; - const float totalProb = GetPickupTemplates(stateMgr, pickupTemplates); + const float totalProb = GetSpawnablePickups(stateMgr, pickupTemplates); if (pickupTemplates.empty()) { break; } else { @@ -180,8 +180,8 @@ void CScriptPickupGenerator::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId break; } else { const TEditorId templateId = pickupTemplates[count].second; - GeneratePickup(stateMgr, templateId, - generatorIds[stateMgr.Random()->Float() * generatorIds.size() * 0.99f]); + SpawnPickup(stateMgr, templateId, + generatorIds[stateMgr.Random()->Float() * generatorIds.size() * 0.99f]); } } } diff --git a/src/MetroidPrime/ScriptObjects/CScriptProjectedShadow.cpp b/src/MetroidPrime/ScriptObjects/CScriptProjectedShadow.cpp index 439d9f53..f0914b7c 100644 --- a/src/MetroidPrime/ScriptObjects/CScriptProjectedShadow.cpp +++ b/src/MetroidPrime/ScriptObjects/CScriptProjectedShadow.cpp @@ -45,7 +45,7 @@ void CScriptShadowProjector::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId } } if (x104_target == kInvalidUniqueId) { - mgr.FreeScriptObject(GetUniqueId()); + mgr.DeleteObjectRequest(GetUniqueId()); break; } diff --git a/src/MetroidPrime/ScriptObjects/CScriptRipple.cpp b/src/MetroidPrime/ScriptObjects/CScriptRipple.cpp index c06244a7..6fb382af 100644 --- a/src/MetroidPrime/ScriptObjects/CScriptRipple.cpp +++ b/src/MetroidPrime/ScriptObjects/CScriptRipple.cpp @@ -1,12 +1,15 @@ #include "MetroidPrime/ScriptObjects/CScriptRipple.hpp" #include "MetroidPrime/CFluidPlaneCPU.hpp" +#include "MetroidPrime/CRipple.hpp" #include "MetroidPrime/CStateManager.hpp" #include "MetroidPrime/ScriptObjects/CScriptWater.hpp" CScriptRipple::CScriptRipple(TUniqueId uid, const rstl::string& name, const CEntityInfo& info, const CVector3f& vec, bool active, float f1) -: CEntity(uid, info, active, name), x34_magnitude(f1 >= 0.f ? f1 : 0.5f), x38_center(vec) {} +: CEntity(uid, info, active, name) +, x34_magnitude(f1 >= 0.f ? f1 : CRipple::kDefaultScale) +, x38_center(vec) {} CScriptRipple::~CScriptRipple() {} @@ -23,7 +26,7 @@ void CScriptRipple::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId uid, CSt continue; } - const CStateManager::TIdListResult& search = mgr.GetIdListForScript(conn->x8_objId); + CStateManager::TIdListResult search = mgr.GetIdListForScript(conn->x8_objId); if (search.first != search.second) { if (CScriptWater* water = TCastToPtr< CScriptWater >(mgr.ObjectById(search.first->second))) { diff --git a/src/MetroidPrime/ScriptObjects/CScriptSteam.cpp b/src/MetroidPrime/ScriptObjects/CScriptSteam.cpp index 230c3e61..f4f2de5f 100644 --- a/src/MetroidPrime/ScriptObjects/CScriptSteam.cpp +++ b/src/MetroidPrime/ScriptObjects/CScriptSteam.cpp @@ -7,26 +7,24 @@ #include "Kyoto/Math/CloseEnough.hpp" +#include "rstl/math.hpp" + CScriptSteam::CScriptSteam(TUniqueId uid, const rstl::string& name, const CEntityInfo& info, const CVector3f& pos, const CAABox& aabb, const CDamageInfo& dInfo, const CVector3f& orientedForce, unsigned int flags, bool active, - CAssetId texture, float f1, float f2, float f3, float f4, bool b1) + CAssetId texture, float f1, float f2, float f3, const float f4, bool b1) : CScriptTrigger(uid, name, info, pos, aabb, dInfo, orientedForce, flags, active, false, false) , x150_(b1) , x154_texture(texture) -, x158_(f1) +, x158_strength(f1) , x15c_alphaInDur(f2 / f1) -, x160_alphaOutDur(f3 / f1) { - float r3 = (aabb.GetMaxPoint().GetZ() < aabb.GetMaxPoint().GetY() ? aabb.GetMaxPoint().GetZ() - : aabb.GetMaxPoint().GetY()); - r3 = (r3 < aabb.GetMaxPoint().GetX() ? r3 : aabb.GetMaxPoint().GetX()); - - if (close_enough(f4, 0.f)) { - r3 = (r3 < f2 ? r3 : f4); - } - - x164_ = r3; - x168_ = 1.f / x164_; +, x160_alphaOutDur(f3 / f1) +, x164_maxDist(0.f) +, x168_ooMaxDist(0.f) { + float r3 = rstl::min_val(aabb.GetMaxPoint().GetX(), + rstl::min_val(aabb.GetMaxPoint().GetY(), aabb.GetMaxPoint().GetZ())); + x164_maxDist = close_enough(f4, 0.f) ? r3 : rstl::min_val(f4, r3); + x168_ooMaxDist = 1.f / x164_maxDist; } CScriptSteam::~CScriptSteam() {} @@ -34,7 +32,7 @@ CScriptSteam::~CScriptSteam() {} void CScriptSteam::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId uid, CStateManager& mgr) { switch (msg) { case kSM_Deactivate: - mgr.Player()->SetVisorSteam(0.f, x15c_alphaInDur, x160_alphaOutDur, kInvalidAssetId, x150_); + mgr.Player()->SetVisorSteam(0.f, x15c_alphaInDur, x160_alphaOutDur, kInvalidAssetId, !x150_); break; } @@ -49,20 +47,25 @@ void CScriptSteam::Think(float dt, CStateManager& mgr) { CScriptTrigger::Think(dt, mgr); if (x148_28_playerTriggerProc && mgr.GetCameraManager()->GetFluidCounter() == 0) { - const CVector3f& eyePos = mgr.GetPlayer()->GetEyePosition(); - const CVector3f& posDiff = (GetTranslation() - eyePos); - const float mag = posDiff.Magnitude(); - - const float distance = - (mag >= x164_ ? 0.f : x158_ * CMath::FastCosR((1.5707964f * mag) * x168_)); - mgr.Player()->SetVisorSteam(distance, x15c_alphaInDur, x160_alphaOutDur, x154_texture, - x150_ == true); + CVector3f eyePos = mgr.GetPlayer()->GetEyePosition(); + const float mag = (GetTranslation() - eyePos).Magnitude(); + // const float distance = + // (mag >= GetMaxDist() + // ? 0.f + // : CMath::FastCosR((mag * 1.5707964f /* 90 deg */) * GetOOMaxDist()) * GetStrength()); + float distance; + if (mag >= GetMaxDist()) { + distance = 0.f; + } else { + distance = CMath::FastCosR((mag * 1.5707964f /* 90 deg */) * GetOOMaxDist()) * GetStrength(); + } + mgr.Player()->SetVisorSteam(distance, GetFadeInRate(), GetFadeOutRate(), GetTextureId(), + !x150_); if (x150_) { mgr.EnvFxManager()->SetSplashRate(2.f * distance); } } else { - mgr.Player()->SetVisorSteam(0.f, x15c_alphaInDur, x160_alphaOutDur, kInvalidAssetId, - x150_ == true); + mgr.Player()->SetVisorSteam(0.f, GetFadeInRate(), GetFadeOutRate(), kInvalidAssetId, !x150_); } } diff --git a/src/MetroidPrime/ScriptObjects/CScriptVisorGoo.cpp b/src/MetroidPrime/ScriptObjects/CScriptVisorGoo.cpp index c8c04ce4..e0d2d270 100644 --- a/src/MetroidPrime/ScriptObjects/CScriptVisorGoo.cpp +++ b/src/MetroidPrime/ScriptObjects/CScriptVisorGoo.cpp @@ -101,7 +101,7 @@ void CScriptVisorGoo::Think(float, CStateManager& mgr) { } } } - mgr.FreeScriptObject(GetUniqueId()); + mgr.DeleteObjectRequest(GetUniqueId()); } } } diff --git a/src/MetroidPrime/Weapons/CPowerBomb.cpp b/src/MetroidPrime/Weapons/CPowerBomb.cpp index f6056595..cb9bc534 100644 --- a/src/MetroidPrime/Weapons/CPowerBomb.cpp +++ b/src/MetroidPrime/Weapons/CPowerBomb.cpp @@ -74,11 +74,11 @@ void CPowerBomb::Think(float dt, CStateManager& mgr) { if (x15c_curTime > 7.f) { if (x168_particle->IsSystemDeletable()) - mgr.FreeScriptObject(GetUniqueId()); + mgr.DeleteObjectRequest(GetUniqueId()); } if (x15c_curTime > 30.f) { - mgr.FreeScriptObject(GetUniqueId()); + mgr.DeleteObjectRequest(GetUniqueId()); return; } }