From 7e364e92a5c5dcacbf83671aca7880927f20d0fa Mon Sep 17 00:00:00 2001 From: Luke Street Date: Thu, 12 Oct 2023 17:52:29 -0400 Subject: [PATCH] rs_new migration & link CScriptCameraWaypoint, CScriptActorKeyframe Former-commit-id: 6f33908f35925bdf5807507701c717c5ad69e046 --- config/GM8E01_00/symbols.txt | 46 +++++++------ config/GM8E01_01/symbols.txt | 12 ++-- configure.py | 6 +- include/Kyoto/Alloc/CMemory.hpp | 9 +-- include/Kyoto/IObj.hpp | 1 + .../BodyState/CBodyStateCmdMgr.hpp | 45 ++++++------- include/MetroidPrime/CAnimData.hpp | 5 +- include/MetroidPrime/Enemies/CAmbientAI.hpp | 2 +- include/MetroidPrime/Enemies/CPatterned.hpp | 2 +- include/MetroidPrime/Player/CPlayerState.hpp | 4 +- .../ScriptObjects/CScriptActorKeyframe.hpp | 2 +- .../ScriptObjects/CScriptCameraWaypoint.hpp | 2 +- include/rstl/rmemory_allocator.hpp | 12 +--- include/rstl/single_ptr.hpp | 2 +- include/rstl/string.hpp | 2 +- include/rstl/vector.hpp | 6 +- src/Collision/CCollisionPrimitive.cpp | 2 +- src/Kyoto/Audio/DolphinCAudioGroupSet.cpp | 2 +- src/Kyoto/Audio/DolphinCAudioSys.cpp | 12 ++-- src/Kyoto/Particles/CParticleDataFactory.cpp | 66 +++++++++---------- src/Kyoto/Streams/CZipOutputStream.cpp | 2 +- .../BodyState/CBodyStateCmdMgr.cpp | 2 +- src/MetroidPrime/BodyState/CBodyStateInfo.cpp | 50 +++++++------- src/MetroidPrime/CActor.cpp | 6 +- src/MetroidPrime/CAnimationDatabaseGame.cpp | 4 +- src/MetroidPrime/CCredits.cpp | 6 +- src/MetroidPrime/CGameArea.cpp | 8 +-- src/MetroidPrime/CGameCubeDoll.cpp | 2 +- src/MetroidPrime/CIOWinManager.cpp | 4 +- src/MetroidPrime/CMainFlow.cpp | 12 ++-- src/MetroidPrime/CMapArea.cpp | 4 +- src/MetroidPrime/CMemoryCardDriver.cpp | 10 +-- src/MetroidPrime/CStateManager.cpp | 18 ++--- src/MetroidPrime/CWorldShadow.cpp | 2 +- src/MetroidPrime/Cameras/CBallCamera.cpp | 4 +- src/MetroidPrime/Cameras/CCameraFilter.cpp | 4 +- src/MetroidPrime/Cameras/CCameraManager.cpp | 6 +- src/MetroidPrime/Enemies/CAmbientAI.cpp | 8 +-- src/MetroidPrime/Enemies/CPuffer.cpp | 14 ++-- .../Factories/CScannableObjectInfo.cpp | 2 +- .../Player/CFaceplateDecoration.cpp | 4 +- src/MetroidPrime/Player/CPlayerGun.cpp | 24 +++---- src/MetroidPrime/Player/CPlayerState.cpp | 4 +- .../Player/CSamusFaceReflection.cpp | 2 +- src/MetroidPrime/ScriptLoader.cpp | 44 ++++++------- src/MetroidPrime/ScriptObjects/CFire.cpp | 2 +- .../ScriptObjects/CHUDBillboardEffect.cpp | 4 +- .../ScriptObjects/CScriptActorKeyframe.cpp | 24 +++---- .../ScriptObjects/CScriptCameraWaypoint.cpp | 5 +- .../ScriptObjects/CScriptEMPulse.cpp | 2 +- .../ScriptObjects/CScriptPlatform.cpp | 2 +- .../ScriptObjects/CScriptProjectedShadow.cpp | 2 +- .../ScriptObjects/CScriptSpawnPoint.cpp | 4 +- .../ScriptObjects/CScriptSpecialFunction.cpp | 6 +- .../ScriptObjects/CScriptVisorGoo.cpp | 2 +- src/MetroidPrime/Tweaks/CTweaks.cpp | 28 ++++---- .../Weapons/CElectricBeamProjectile.cpp | 4 +- src/MetroidPrime/Weapons/CGunWeapon.cpp | 12 ++-- src/MetroidPrime/Weapons/CIceBeam.cpp | 6 +- .../Weapons/CTargetableProjectile.cpp | 2 +- src/MetroidPrime/Weapons/CWaveBeam.cpp | 6 +- src/MetroidPrime/main.cpp | 34 +++++----- 62 files changed, 311 insertions(+), 320 deletions(-) diff --git a/config/GM8E01_00/symbols.txt b/config/GM8E01_00/symbols.txt index 67a3daf1..76cd684e 100644 --- a/config/GM8E01_00/symbols.txt +++ b/config/GM8E01_00/symbols.txt @@ -863,11 +863,11 @@ IDFromFactory__FR11CResFactoryPCc = .text:0x80036D58; // type:function size:0x30 __nw__29TOneStatic<15CTweakSlideShow>FUlPCcPCc = .text:0x80036D88; // type:function size:0x30 scope:global GetAllocSpace__29TOneStatic<15CTweakSlideShow>Fv = .text:0x80036DB8; // type:function size:0xC scope:global ReferenceCount__29TOneStatic<15CTweakSlideShow>Fv = .text:0x80036DC4; // type:function size:0x24 scope:global -fn_80036DE8 = .text:0x80036DE8; // type:function size:0x30 -fn_80036E18 = .text:0x80036E18; // type:function size:0xC +__nw__29TOneStatic<15CTweakPlayerRes>FUlPCcPCc = .text:0x80036DE8; // type:function size:0x30 +GetAllocSpace__29TOneStatic<15CTweakPlayerRes>Fv = .text:0x80036E18; // type:function size:0xC ReferenceCount__29TOneStatic<15CTweakPlayerRes>Fv = .text:0x80036E24; // type:function size:0x24 scope:global -fn_80036E48 = .text:0x80036E48; // type:function size:0x30 -fn_80036E78 = .text:0x80036E78; // type:function size:0xC +__nw__26TOneStatic<12CTweakGunRes>FUlPCcPCc = .text:0x80036E48; // type:function size:0x30 +GetAllocSpace__26TOneStatic<12CTweakGunRes>Fv = .text:0x80036E78; // type:function size:0xC ReferenceCount__26TOneStatic<12CTweakGunRes>Fv = .text:0x80036E84; // type:function size:0x24 scope:global __nw__30TOneStatic<16CTweakAutoMapper>FUlPCcPCc = .text:0x80036EA8; // type:function size:0x30 scope:global GetAllocSpace__30TOneStatic<16CTweakAutoMapper>Fv = .text:0x80036ED8; // type:function size:0xC scope:global @@ -2057,7 +2057,7 @@ IncrPickUp__12CPlayerStateFQ212CPlayerState9EItemTypei = .text:0x80091BF0; // ty ResetAndIncrPickUp__12CPlayerStateFQ212CPlayerState9EItemTypei = .text:0x80091D00; // type:function size:0x30 scope:global CalculateHealth__12CPlayerStateFv = .text:0x80091D30; // type:function size:0x38 scope:global InitializePowerUp__12CPlayerStateFQ212CPlayerState9EItemTypei = .text:0x80091D68; // type:function size:0x124 scope:global -ReInitializePowerUp__12CPlayerStateFQ212CPlayerState9EItemTypei = .text:0x80091E8C; // type:function size:0x30 scope:global +SetPowerUp__12CPlayerStateFQ212CPlayerState9EItemTypei = .text:0x80091E8C; // type:function size:0x30 scope:global PutTo__12CPlayerStateFR13COutputStream = .text:0x80091EBC; // type:function size:0x16C scope:global __ct__12CPlayerStateFR12CInputStream = .text:0x80092028; // type:function size:0x2A0 scope:global __ct__12CPlayerStateFv = .text:0x800922C8; // type:function size:0xEC scope:global @@ -5555,7 +5555,7 @@ reserve__Q24rstl71vector,Q24rstl17rmemory_a Accept__21CScriptCameraWaypointFR8IVisitor = .text:0x800B51C8; // type:function size:0x38 scope:global Render__21CScriptCameraWaypointCFRC13CStateManager = .text:0x800B5200; // type:function size:0x4 scope:global AddToRenderer__21CScriptCameraWaypointCFRC14CFrustumPlanesRC13CStateManager = .text:0x800B5204; // type:function size:0x4 scope:global -GetRandomNextWaypointId__21CScriptCameraWaypointCFRC13CStateManager = .text:0x800B5208; // type:function size:0x1B8 scope:global +NextWaypoint__21CScriptCameraWaypointFR13CStateManager = .text:0x800B5208; // type:function size:0x1B8 scope:global AcceptScriptMsg__21CScriptCameraWaypointF20EScriptObjectMessage9TUniqueIdR13CStateManager = .text:0x800B53C0; // type:function size:0x7C scope:global __dt__21CScriptCameraWaypointFv = .text:0x800B543C; // type:function size:0x60 scope:global __ct__21CScriptCameraWaypointF9TUniqueIdRCQ24rstl66basic_string,Q24rstl17rmemory_allocator>RC11CEntityInfoRC12CTransform4fbfUi = .text:0x800B549C; // type:function size:0x104 scope:global @@ -17752,7 +17752,7 @@ lbl_803D69E0 = .rodata:0x803D69E0; // type:object size:0x8 lbl_803D69E8 = .rodata:0x803D69E8; // type:object size:0x18 @stringBase0 = .rodata:0x803D6A00; // type:object size:0x1C scope:local data:string_table lbl_803D6A20 = .rodata:0x803D6A20; // type:object size:0x28 -lbl_803D6A48 = .rodata:0x803D6A48; // type:object size:0x8 +@stringBase0 = .rodata:0x803D6A48; // type:object size:0x7 scope:local data:string_table lbl_803D6A50 = .rodata:0x803D6A50; // type:object size:0xC data:4byte lbl_803D6A5C = .rodata:0x803D6A5C; // type:object size:0xC data:4byte lbl_803D6A68 = .rodata:0x803D6A68; // type:object size:0x10 data:4byte @@ -19216,7 +19216,11 @@ sPlaneObjectBucketHolder$4377 = .bss:0x80479154; // type:object size:0x18 scope: sOptimalPlane$6479 = .bss:0x8047916C; // type:object size:0xC scope:local data:float sAllocSpace$9000 = .bss:0x80479178; // type:object size:0x320 scope:local normalTable = .bss:0x80479498; // type:object size:0x48 scope:local data:float -lbl_804794E0 = .bss:0x804794E0; // type:object size:0x30 +...bss.0 = .bss:0x804794E0; // type:label scope:local +@2493 = .bss:0x804794E0; // type:object size:0xC scope:local +@2494 = .bss:0x804794EC; // type:object size:0xC scope:local +@2495 = .bss:0x804794F8; // type:object size:0xC scope:local +@2496 = .bss:0x80479504; // type:object size:0xC scope:local normalTable = .bss:0x80479510; // type:object size:0x48 scope:local data:float normalTable = .bss:0x80479558; // type:object size:0x48 scope:local data:float stringize_Buffer$11 = .bss:0x804795A0; // type:object size:0x200 scope:local @@ -21798,19 +21802,19 @@ lbl_805A91F8 = .sbss:0x805A91F8; // type:object size:0x8 data:4byte spGuiSys__7CGuiSys = .sbss:0x805A9200; // type:object size:0x4 scope:global data:4byte gpExecBuf__15CGuiTextSupport = .sbss:0x805A9208; // type:object size:0x4 scope:global data:4byte gpTextParser__15CGuiTextSupport = .sbss:0x805A920C; // type:object size:0x4 scope:global data:4byte -lbl_805A9210 = .sbss:0x805A9210; // type:object size:0x4 data:4byte -lbl_805A9214 = .sbss:0x805A9214; // type:object size:0x1 data:byte -lbl_805A9215 = .sbss:0x805A9215; // type:object size:0x1 data:byte -lbl_805A9216 = .sbss:0x805A9216; // type:object size:0x1 data:byte -lbl_805A9217 = .sbss:0x805A9217; // type:object size:0x1 data:byte -lbl_805A9218 = .sbss:0x805A9218; // type:object size:0x1 data:byte -lbl_805A921C = .sbss:0x805A921C; // type:object size:0x4 data:4byte -lbl_805A9220 = .sbss:0x805A9220; // type:object size:0x4 data:4byte -lbl_805A9224 = .sbss:0x805A9224; // type:object size:0x4 data:4byte -lbl_805A9228 = .sbss:0x805A9228; // type:object size:0x4 data:4byte -lbl_805A922C = .sbss:0x805A922C; // type:object size:0x4 data:4byte -lbl_805A9230 = .sbss:0x805A9230; // type:object size:0x4 data:4byte -lbl_805A9234 = .sbss:0x805A9234; // type:object size:0x4 data:4byte +sNumTypes__19CCollisionPrimitive = .sbss:0x805A9210; // type:object size:0x4 scope:global data:4byte +sInitComplete__19CCollisionPrimitive = .sbss:0x805A9214; // type:object size:0x1 scope:global data:byte +sTypesAdded__19CCollisionPrimitive = .sbss:0x805A9215; // type:object size:0x1 scope:global data:byte +sTypesAdding__19CCollisionPrimitive = .sbss:0x805A9216; // type:object size:0x1 scope:global data:byte +sCollidersAdded__19CCollisionPrimitive = .sbss:0x805A9217; // type:object size:0x1 scope:global data:byte +sCollidersAdding__19CCollisionPrimitive = .sbss:0x805A9218; // type:object size:0x1 scope:global data:byte +sCollisionTypeList__19CCollisionPrimitive = .sbss:0x805A921C; // type:object size:0x4 scope:global data:4byte +sTableOfCollidables__19CCollisionPrimitive = .sbss:0x805A9220; // type:object size:0x4 scope:global data:4byte +sTableOfBooleanCollidables__19CCollisionPrimitive = .sbss:0x805A9224; // type:object size:0x4 scope:global data:4byte +sTableOfMovingCollidables__19CCollisionPrimitive = .sbss:0x805A9228; // type:object size:0x4 scope:global data:4byte +sNullCollider = .sbss:0x805A922C; // type:object size:0x4 scope:local data:4byte +sNullBooleanCollider = .sbss:0x805A9230; // type:object size:0x4 scope:local data:4byte +sNullMovingCollider = .sbss:0x805A9234; // type:object size:0x4 scope:local data:4byte mGlobalTimer__10CStopwatch = .sbss:0x805A9238; // type:object size:0x8 scope:global data:4byte gInitialized = .sbss:0x805A9240; // type:object size:0x1 scope:local data:byte CallFatal = .sbss:0x805A9248; // type:object size:0x1 scope:local data:byte diff --git a/config/GM8E01_01/symbols.txt b/config/GM8E01_01/symbols.txt index 7a8cd5f9..ea62e251 100644 --- a/config/GM8E01_01/symbols.txt +++ b/config/GM8E01_01/symbols.txt @@ -863,11 +863,11 @@ IDFromFactory__FR11CResFactoryPCc = .text:0x80036DD4; // type:function size:0x30 __nw__29TOneStatic<15CTweakSlideShow>FUlPCcPCc = .text:0x80036E04; // type:function size:0x30 scope:global GetAllocSpace__29TOneStatic<15CTweakSlideShow>FUlPCcPCc = .text:0x80036E34; // type:function size:0xC scope:global ReferenceCount__29TOneStatic<15CTweakSlideShow>Fv = .text:0x80036E40; // type:function size:0x24 scope:global -fn_80036DE8 = .text:0x80036E64; // type:function size:0x30 scope:global -fn_80036E18 = .text:0x80036E94; // type:function size:0xC scope:global +__nw__29TOneStatic<15CTweakPlayerRes>FUlPCcPCc = .text:0x80036E64; // type:function size:0x30 scope:global +GetAllocSpace__29TOneStatic<15CTweakPlayerRes>Fv = .text:0x80036E94; // type:function size:0xC scope:global ReferenceCount__29TOneStatic<15CTweakPlayerRes>Fv = .text:0x80036EA0; // type:function size:0x24 scope:global -fn_80036E48 = .text:0x80036EC4; // type:function size:0x30 scope:global -fn_80036E78 = .text:0x80036EF4; // type:function size:0xC scope:global +__nw__26TOneStatic<12CTweakGunRes>FUlPCcPCc = .text:0x80036EC4; // type:function size:0x30 scope:global +GetAllocSpace__26TOneStatic<12CTweakGunRes>Fv = .text:0x80036EF4; // type:function size:0xC scope:global ReferenceCount__26TOneStatic<12CTweakGunRes>Fv = .text:0x80036F00; // type:function size:0x24 scope:global __nw__30TOneStatic<16CTweakAutoMapper>FUlPCcPCc = .text:0x80036F24; // type:function size:0x30 scope:global GetAllocSpace__30TOneStatic<16CTweakAutoMapper>Fv = .text:0x80036F54; // type:function size:0xC scope:global @@ -2057,7 +2057,7 @@ IncrPickUp__12CPlayerStateFQ212CPlayerState9EItemTypei = .text:0x80091C6C; // ty ResetAndIncrPickUp__12CPlayerStateFQ212CPlayerState9EItemTypei = .text:0x80091D7C; // type:function size:0x30 scope:global CalculateHealth__12CPlayerStateFv = .text:0x80091DAC; // type:function size:0x38 scope:global InitializePowerUp__12CPlayerStateFQ212CPlayerState9EItemTypei = .text:0x80091DE4; // type:function size:0x124 scope:global -ReInitializePowerUp__12CPlayerStateFQ212CPlayerState9EItemTypei = .text:0x80091F08; // type:function size:0x30 scope:global +SetPowerUp__12CPlayerStateFQ212CPlayerState9EItemTypei = .text:0x80091F08; // type:function size:0x30 scope:global PutTo__12CPlayerStateFR13COutputStream = .text:0x80091F38; // type:function size:0x16C scope:global __ct__12CPlayerStateFR12CInputStream = .text:0x800920A4; // type:function size:0x2A0 scope:global __ct__12CPlayerStateFv = .text:0x80092344; // type:function size:0xEC scope:global @@ -5557,7 +5557,7 @@ reserve__Q24rstl71vector,Q24rstl17rmemory_a Accept__21CScriptCameraWaypointFR8IVisitor = .text:0x800B5244; // type:function size:0x38 scope:global Render__21CScriptCameraWaypointCFRC13CStateManager = .text:0x800B527C; // type:function size:0x4 scope:global AddToRenderer__21CScriptCameraWaypointCFRC14CFrustumPlanesRC13CStateManager = .text:0x800B5280; // type:function size:0x4 scope:global -GetRandomNextWaypointId__21CScriptCameraWaypointCFRC13CStateManager = .text:0x800B5284; // type:function size:0x1B8 scope:global +NextWaypoint__21CScriptCameraWaypointFR13CStateManager = .text:0x800B5284; // type:function size:0x1B8 scope:global AcceptScriptMsg__21CScriptCameraWaypointF20EScriptObjectMessage9TUniqueIdR13CStateManager = .text:0x800B543C; // type:function size:0x7C scope:global __dt__21CScriptCameraWaypointFv = .text:0x800B54B8; // type:function size:0x60 scope:global __ct__21CScriptCameraWaypointF9TUniqueIdRCQ24rstl66basic_string,Q24rstl17rmemory_allocator>RC11CEntityInfoRC12CTransform4fbfUi = .text:0x800B5518; // type:function size:0x104 scope:global diff --git a/configure.py b/configure.py index 598456b0..f395903d 100755 --- a/configure.py +++ b/configure.py @@ -334,7 +334,7 @@ config.libs = [ Object(NonMatching, "MetroidPrime/ScriptObjects/CScriptPlatform.cpp"), Object(Matching, "MetroidPrime/UserNames.cpp"), Object(NonMatching, "MetroidPrime/ScriptObjects/CScriptGenerator.cpp"), - Object(NonMatching, "MetroidPrime/ScriptObjects/CScriptCameraWaypoint.cpp"), + Object(Matching, "MetroidPrime/ScriptObjects/CScriptCameraWaypoint.cpp"), Object(Matching, "MetroidPrime/CGameLight.cpp"), Object(NonMatching, "MetroidPrime/Tweaks/CTweakTargeting.cpp"), Object(Matching, "MetroidPrime/Tweaks/CTweakAutoMapper.cpp"), @@ -378,7 +378,7 @@ config.libs = [ ), Object(NonMatching, "MetroidPrime/ScriptObjects/CScriptDebris.cpp"), Object(Matching, "MetroidPrime/ScriptObjects/CScriptCameraShaker.cpp"), - Object(NonMatching, "MetroidPrime/ScriptObjects/CScriptActorKeyframe.cpp"), + Object(Matching, "MetroidPrime/ScriptObjects/CScriptActorKeyframe.cpp"), Object(NonMatching, "MetroidPrime/CConsoleOutputWindow.cpp"), Object(NonMatching, "MetroidPrime/ScriptObjects/CScriptWater.cpp"), Object(NonMatching, "MetroidPrime/Weapons/CWeapon.cpp"), @@ -413,7 +413,7 @@ config.libs = [ Object(Matching, "MetroidPrime/ScriptObjects/CScriptGrapplePoint.cpp"), Object(NonMatching, "MetroidPrime/ScriptObjects/CHUDBillboardEffect.cpp"), Object(NonMatching, "MetroidPrime/Enemies/CFlickerBat.cpp"), - Object(NonMatching, "MetroidPrime/BodyState/CBodyStateCmdMgr.cpp"), + Object(NonMatching, "MetroidPrime/BodyState/CBodyStateCmdMgr.cpp", cflags=[*cflags_retro, "-inline auto"]), Object(NonMatching, "MetroidPrime/BodyState/CBodyStateInfo.cpp"), Object(NonMatching, "MetroidPrime/BodyState/CBSAttack.cpp"), Object(Matching, "MetroidPrime/BodyState/CBSDie.cpp"), diff --git a/include/Kyoto/Alloc/CMemory.hpp b/include/Kyoto/Alloc/CMemory.hpp index e61df860..f627fafb 100644 --- a/include/Kyoto/Alloc/CMemory.hpp +++ b/include/Kyoto/Alloc/CMemory.hpp @@ -24,21 +24,16 @@ public: static void OffsetFakeStatics(int); }; -#ifdef __MWERKS__ -void* operator new(size_t sz, const char*, const char*); -void* operator new[](size_t sz, const char*, const char*); -#endif - // placement new inline void* operator new(size_t n, void* ptr) { return ptr; }; #ifdef __MWERKS__ +void* operator new(size_t sz, const char*, const char*); +void* operator new[](size_t sz, const char*, const char*); inline void operator delete(void* ptr) { CMemory::Free(ptr); } inline void operator delete[](void* ptr) { CMemory::Free(ptr); } #define rs_new new ("??(??)", nullptr) #else -__attribute__((weak)) void operator delete(void* ptr) { CMemory::Free(ptr); } -__attribute__((weak)) void operator delete[](void* ptr) { CMemory::Free(ptr); } #define rs_new new #endif diff --git a/include/Kyoto/IObj.hpp b/include/Kyoto/IObj.hpp index 5cf8eb8b..f14fc475 100644 --- a/include/Kyoto/IObj.hpp +++ b/include/Kyoto/IObj.hpp @@ -3,6 +3,7 @@ #include "types.h" +#include "Kyoto/Alloc/CMemory.hpp" #include "Kyoto/SObjectTag.hpp" #include "rstl/auto_ptr.hpp" diff --git a/include/MetroidPrime/BodyState/CBodyStateCmdMgr.hpp b/include/MetroidPrime/BodyState/CBodyStateCmdMgr.hpp index c69e4ab3..e57402b1 100644 --- a/include/MetroidPrime/BodyState/CBodyStateCmdMgr.hpp +++ b/include/MetroidPrime/BodyState/CBodyStateCmdMgr.hpp @@ -30,7 +30,7 @@ private: class CBCAdditiveFlinchCmd : public CBodyStateCmd { public: - CBCAdditiveFlinchCmd(float f) : CBodyStateCmd(kBSC_AdditiveFlinch), x8_weight(f) {} + CBCAdditiveFlinchCmd(float weight) : CBodyStateCmd(kBSC_AdditiveFlinch), x8_weight(weight) {} float GetWeight() const { return x8_weight; } @@ -74,23 +74,23 @@ private: class CBCScriptedCmd : public CBodyStateCmd { public: - CBCScriptedCmd(int i, bool b1, bool b2, float f) + CBCScriptedCmd(int animId, bool isLooped, bool useLoopDuration, float loopDuration) : CBodyStateCmd(kBSC_Scripted) - , x8_anim(i) - , xc_24_loopAnim(b1) - , xc_25_timedLoop(b2) - , x10_loopDur(f) {} + , x8_animId(animId) + , xc_24_isLooped(isLooped) + , xc_25_useLoopDuration(useLoopDuration) + , x10_loopDuration(loopDuration) {} - int GetAnimId() const { return x8_anim; } - bool IsLooped() const { return xc_24_loopAnim; } - bool GetUseLoopDuration() const { return xc_25_timedLoop; } - float GetLoopDuration() const { return x10_loopDur; } + int GetAnimId() const { return x8_animId; } + bool IsLooped() const { return xc_24_isLooped; } + bool GetUseLoopDuration() const { return xc_25_useLoopDuration; } + float GetLoopDuration() const { return x10_loopDuration; } private: - int x8_anim; - bool xc_24_loopAnim : 1; - bool xc_25_timedLoop : 1; - float x10_loopDur; + int x8_animId; + bool xc_24_isLooped : 1; + bool xc_25_useLoopDuration : 1; + float x10_loopDuration; }; // @@ -399,29 +399,25 @@ public: void ClearLocomotionCmds(); void DeliverCmd(const CBCLocomotionCmd& cmd); void DeliverCmd(EBodyStateCmd cmd); - void DeliverCmd2(EBodyStateCmd cmd) { - xb4_deliveredCmdMask |= 1 << cmd; - } void DeliverCmd(const CBodyStateCmd& cmd); void DeliverCmd(const CBCGenerateCmd& cmd) { - DeliverCmd(kBSC_Generate); + DeliverCmd(cmd.GetCommandId()); x18c_generate = cmd; } void DeliverCmd(const CBCKnockDownCmd& cmd) { - DeliverCmd(kBSC_KnockDown); + DeliverCmd(cmd.GetCommandId()); xdc_knockDown = cmd; } - void DeliverCmd(const CBCScriptedCmd& cmd) { - DeliverCmd(kBSC_Scripted); - x21c_scripted = cmd; - } void DeliverCmd(const CBCSlideCmd& cmd) { DeliverCmd(cmd.GetCommandId()); x1f8_slide = cmd; } - + void DeliverCmd(const CBCScriptedCmd& cmd) { + DeliverCmd(cmd.GetCommandId()); + x21c_scripted = cmd; + } void DeliverCmd(const CBCAdditiveReactionCmd& cmd) { DeliverCmd(cmd.GetCommandId()); x284_additiveReaction = cmd; @@ -437,6 +433,7 @@ public: const CVector3f& GetFaceVector() const { return xc_face; } const CVector3f& GetTargetVector() const { return x18_target; } const CVector3f& GetAdditiveTargetVector() const { return x24_additiveTarget; } + private: CVector3f x0_move; CVector3f xc_face; diff --git a/include/MetroidPrime/CAnimData.hpp b/include/MetroidPrime/CAnimData.hpp index 6019ae7b..b54268ac 100644 --- a/include/MetroidPrime/CAnimData.hpp +++ b/include/MetroidPrime/CAnimData.hpp @@ -140,7 +140,7 @@ public: float GetAdditiveAnimationWeight(uint idx); - short GetDefaultAnimation() const { return x208_defaultAnim; } + short GetCurrentAnimation() const { return x208_currentAnim; } const CCharacterInfo& GetCharacterInfo() const { return xc_charInfo; } // GetCharLayoutInfo__9CAnimDataCFv // GetDeltaRotation__9CAnimDataCFv @@ -165,7 +165,6 @@ public: // GetIceModel__9CAnimDataCFv const CPASDatabase& GetPASDatabase() const { return xc_charInfo.GetPASDatabase(); } // EnableLooping__9CAnimDataFb - // GetCurrentAnimation__9CAnimDataCFv // GetSkinnedModel__9CAnimDataCFv // GetXRayModel__9CAnimDataCFv // GetInfraModel__9CAnimDataCFv @@ -203,7 +202,7 @@ private: rstl::rc_ptr< CTransitionManager > x1fc_transMgr; float x200_speedScale; int x204_charIdx; - short x208_defaultAnim; + short x208_currentAnim; short x20a_padding; int x20c_passedBoolCount; int x210_passedIntCount; diff --git a/include/MetroidPrime/Enemies/CAmbientAI.hpp b/include/MetroidPrime/Enemies/CAmbientAI.hpp index dd803f19..fe3ec1ce 100644 --- a/include/MetroidPrime/Enemies/CAmbientAI.hpp +++ b/include/MetroidPrime/Enemies/CAmbientAI.hpp @@ -41,7 +41,7 @@ private: EAnimationState x2d0_animState; float x2d4_alertRange; float x2d8_impactRange; - s32 x2dc_defaultAnim; + s32 x2dc_currentAnim; s32 x2e0_alertAnim; s32 x2e4_impactAnim; bool x2e8_24_dead : 1; diff --git a/include/MetroidPrime/Enemies/CPatterned.hpp b/include/MetroidPrime/Enemies/CPatterned.hpp index ab406a6f..188e4849 100644 --- a/include/MetroidPrime/Enemies/CPatterned.hpp +++ b/include/MetroidPrime/Enemies/CPatterned.hpp @@ -250,7 +250,7 @@ public: bool IsAlive() const { return x400_25_alive; } void SetWasHit(bool v) { x400_24_hitByPlayerProjectile = v; } void SetPendingDeath(bool v) { x401_30_pendingDeath = v; } - CBodyController* GetBodyCtrl() { return x450_bodyController.get(); } + CBodyController* BodyCtrl() { return x450_bodyController.get(); } const CBodyController* GetBodyCtrl() const { return x450_bodyController.get(); } CKnockBackController& GetKnockBackCtrl() { return x460_knockBackController; } const CKnockBackController& GetKnockBackCtrl() const { return x460_knockBackController; } diff --git a/include/MetroidPrime/Player/CPlayerState.hpp b/include/MetroidPrime/Player/CPlayerState.hpp index 737c38ea..757dcd1a 100644 --- a/include/MetroidPrime/Player/CPlayerState.hpp +++ b/include/MetroidPrime/Player/CPlayerState.hpp @@ -134,12 +134,12 @@ public: int GetItemAmount(EItemType type) const; void DecrPickUp(EItemType type, int amount); void IncrPickUp(EItemType type, int amount); - void ResetAndIncrPickUp(EItemType type, int amount); + void SetPickup(EItemType type, int amount); static float GetEnergyTankCapacity(); static float GetBaseHealthCapacity(); float CalculateHealth(); void InitializePowerUp(CPlayerState::EItemType type, int capacity); - void ReInitializePowerUp(CPlayerState::EItemType type, int capacity); + void SetPowerUp(CPlayerState::EItemType type, int capacity); void InitializeScanTimes(); diff --git a/include/MetroidPrime/ScriptObjects/CScriptActorKeyframe.hpp b/include/MetroidPrime/ScriptObjects/CScriptActorKeyframe.hpp index efc013f2..45783470 100644 --- a/include/MetroidPrime/ScriptObjects/CScriptActorKeyframe.hpp +++ b/include/MetroidPrime/ScriptObjects/CScriptActorKeyframe.hpp @@ -22,7 +22,7 @@ private: float x38_initialLifetime; float x3c_playbackRate; float x40_lifetime; - bool x44_24_looping : 1; + bool x44_24_isLooped : 1; bool x44_25_isPassive : 1; bool x44_26_fadeOut : 1; bool x44_27_timedLoop : 1; diff --git a/include/MetroidPrime/ScriptObjects/CScriptCameraWaypoint.hpp b/include/MetroidPrime/ScriptObjects/CScriptCameraWaypoint.hpp index adcd02b1..27fa48f9 100644 --- a/include/MetroidPrime/ScriptObjects/CScriptCameraWaypoint.hpp +++ b/include/MetroidPrime/ScriptObjects/CScriptCameraWaypoint.hpp @@ -17,7 +17,7 @@ public: void AddToRenderer(const CFrustumPlanes&, const CStateManager&) const override; void Render(const CStateManager&) const override; - TUniqueId GetRandomNextWaypointId(const CStateManager& mgr) const; + TUniqueId NextWaypoint(CStateManager& mgr); float GetHFov() const { return xe8_hfov; } }; diff --git a/include/rstl/rmemory_allocator.hpp b/include/rstl/rmemory_allocator.hpp index a23ffbe1..c42d4e64 100644 --- a/include/rstl/rmemory_allocator.hpp +++ b/include/rstl/rmemory_allocator.hpp @@ -9,6 +9,7 @@ namespace rstl { struct rmemory_allocator { rmemory_allocator() {} rmemory_allocator(const rmemory_allocator&) {} + template < typename T > static void allocate(T*& out, int count) { int size = count * sizeof(T); @@ -18,16 +19,7 @@ struct rmemory_allocator { out = reinterpret_cast< T* >(rs_new uchar[size]); } } - // TODO: this fixes a regswap in vector::reserve - template < typename T > - static T* allocate2(int count) { - int size = count * sizeof(T); - if (size == 0) { - return nullptr; - } else { - return reinterpret_cast< T* >(rs_new uchar[size]); - } - } + template < typename T > static void deallocate(T* ptr) { if (ptr != nullptr) { diff --git a/include/rstl/single_ptr.hpp b/include/rstl/single_ptr.hpp index 0b3536b6..357489de 100644 --- a/include/rstl/single_ptr.hpp +++ b/include/rstl/single_ptr.hpp @@ -17,7 +17,7 @@ public: T* operator->() { return x0_ptr; } const T* operator->() const { return x0_ptr; } single_ptr(const single_ptr& other) : x0_ptr(other.x0_ptr) { other.x0_ptr = nullptr; } - single_ptr& operator=(T* ptr) { + single_ptr& operator=(T* const ptr) { delete x0_ptr; x0_ptr = ptr; return *this; diff --git a/include/rstl/string.hpp b/include/rstl/string.hpp index 3294f408..c3eac0ee 100644 --- a/include/rstl/string.hpp +++ b/include/rstl/string.hpp @@ -29,7 +29,7 @@ class basic_string { void internal_prepare_to_write(int len, bool); void internal_allocate(int size); // { - // x4_cow = reinterpret_cast(new uchar[size * sizeof(_CharTp) + + // x4_cow = reinterpret_cast(rs_new uchar[size * sizeof(_CharTp) + // 8]); x0_ptr = x4_cow->x8_data; x4_cow->x0_capacity = uint(size); // x4_cow->x4_refCount = 1; // } diff --git a/include/rstl/vector.hpp b/include/rstl/vector.hpp index 074d822b..63b3db21 100644 --- a/include/rstl/vector.hpp +++ b/include/rstl/vector.hpp @@ -42,7 +42,8 @@ public: const_iterator begin() const { return const_iterator(xc_items); } iterator end() { return iterator(xc_items + x4_count); } const_iterator end() const { return const_iterator(xc_items + x4_count); } - vector() : x4_count(0), x8_capacity(0), xc_items(NULL) {} + vector(const Alloc& alloc = Alloc()) + : x0_allocator(alloc), x4_count(0), x8_capacity(0), xc_items(nullptr) {} vector(int count) : x4_count(0), x8_capacity(0), xc_items(0) { reserve(count); } vector(int count, const T& v) : x4_count(count), x8_capacity(count) { x0_allocator.allocate(xc_items, x4_count); @@ -127,7 +128,8 @@ void vector< T, Alloc >::reserve(int newSize) { if (newSize <= x8_capacity) { return; } - T* newData = x0_allocator.template allocate2< T >(newSize); + T* newData; + x0_allocator.allocate(newData, newSize); uninitialized_copy(begin(), end(), newData); destroy(xc_items, xc_items + x4_count); x0_allocator.deallocate(xc_items); diff --git a/src/Collision/CCollisionPrimitive.cpp b/src/Collision/CCollisionPrimitive.cpp index aa5601a7..45081409 100644 --- a/src/Collision/CCollisionPrimitive.cpp +++ b/src/Collision/CCollisionPrimitive.cpp @@ -17,7 +17,7 @@ rstl::single_ptr< MovingComparisonFunc > CCollisionPrimitive::sTableOfMovingColl CCollisionPrimitive::CCollisionPrimitive(const CMaterialList& list) : x8_material(list) {} void CCollisionPrimitive::InitBeginTypes() { - sCollisionTypeList = new rstl::vector< Type >(); + sCollisionTypeList = rs_new rstl::vector< Type >(); sCollisionTypeList->reserve(3); sTypesAdding = true; InternalColliders::AddTypes(); diff --git a/src/Kyoto/Audio/DolphinCAudioGroupSet.cpp b/src/Kyoto/Audio/DolphinCAudioGroupSet.cpp index 956d0634..0a46de8b 100644 --- a/src/Kyoto/Audio/DolphinCAudioGroupSet.cpp +++ b/src/Kyoto/Audio/DolphinCAudioGroupSet.cpp @@ -36,5 +36,5 @@ CFactoryFnReturn::CFactoryFnReturn(CAudioGrpSetLoc* ptr) CFactoryFnReturn FAudioGroupSetLocDataFactory(const SObjectTag& tag, const rstl::auto_ptr< uchar >& data, int length, const CVParamTransfer& xfer) { - return new CAudioGrpSetLoc(data, length); + return rs_new CAudioGrpSetLoc(data, length); } diff --git a/src/Kyoto/Audio/DolphinCAudioSys.cpp b/src/Kyoto/Audio/DolphinCAudioSys.cpp index d359d844..2b687c04 100644 --- a/src/Kyoto/Audio/DolphinCAudioSys.cpp +++ b/src/Kyoto/Audio/DolphinCAudioSys.cpp @@ -22,7 +22,7 @@ bool CAudioSys::mProLogic2 = true; const rstl::string CAudioSys::mpDefaultInvalidString(rstl::string_l("NULL")); -void* DoMalloc(u32 len) { return new char[len]; } +void* DoMalloc(u32 len) { return rs_new char[len]; } void DoFree(void* ptr) { if (!ptr) { @@ -44,11 +44,11 @@ CAudioSys::CAudioSys(char numVoices, char numMusic, char numSfx, char maxNumEmit } DTKInit(); - mpGroupSetDB = new rstl::map< rstl::string, rstl::ncrc_ptr< CAudioGroupSet > >(); - mpGroupSetResNameDB = new rstl::map< uint, rstl::string >(); - mpDVDTrackDB = new rstl::map< rstl::string, rstl::ncrc_ptr< CTrkData > >(); - mpEmitterDB = new rstl::vector< CEmitterData >(maxNumEmitters, CEmitterData()); - mpListener = new u8[0x90]; // TODO: Add actual listener allocation + mpGroupSetDB = rs_new rstl::map< rstl::string, rstl::ncrc_ptr< CAudioGroupSet > >(); + mpGroupSetResNameDB = rs_new rstl::map< uint, rstl::string >(); + mpDVDTrackDB = rs_new rstl::map< rstl::string, rstl::ncrc_ptr< CTrkData > >(); + mpEmitterDB = rs_new rstl::vector< CEmitterData >(maxNumEmitters, CEmitterData()); + mpListener = rs_new u8[0x90]; // TODO: Add actual listener allocation mIsListenerActive = false; mMaxNumEmitters = maxNumEmitters; diff --git a/src/Kyoto/Particles/CParticleDataFactory.cpp b/src/Kyoto/Particles/CParticleDataFactory.cpp index 22b834dd..0c8e5ba5 100644 --- a/src/Kyoto/Particles/CParticleDataFactory.cpp +++ b/src/Kyoto/Particles/CParticleDataFactory.cpp @@ -21,75 +21,75 @@ CIntElement* CParticleDataFactory::GetIntElement(CInputStream& in) { FourCC clsId = GetClassID(in); switch (clsId) { case SBIG('CNST'): { - return new CIEConstant(GetInt(in)); + return rs_new CIEConstant(GetInt(in)); } case SBIG('KEYE'): case SBIG('KEYP'): { - return new CIEKeyframeEmitter(in); + return rs_new CIEKeyframeEmitter(in); } case SBIG('TSCL'): { - return new CIETimescale(GetRealElement(in)); + return rs_new CIETimescale(GetRealElement(in)); } case SBIG('DETH'): { CIntElement* a = GetIntElement(in); CIntElement* b = GetIntElement(in); - return new CIEDeath(a, b); + return rs_new CIEDeath(a, b); } case SBIG('CHAN'): { CIntElement* a = GetIntElement(in); CIntElement* b = GetIntElement(in); CIntElement* c = GetIntElement(in); - return new CIETimeChain(a, b, c); + return rs_new CIETimeChain(a, b, c); } case SBIG('ADD_'): { CIntElement* a = GetIntElement(in); CIntElement* b = GetIntElement(in); - return new CIEAdd(a, b); + return rs_new CIEAdd(a, b); } case SBIG('MULT'): { CIntElement* a = GetIntElement(in); CIntElement* b = GetIntElement(in); - return new CIEMultiply(a, b); + return rs_new CIEMultiply(a, b); } case SBIG('MODU'): { CIntElement* a = GetIntElement(in); CIntElement* b = GetIntElement(in); - return new CIEModulo(a, b); + return rs_new CIEModulo(a, b); } case SBIG('RAND'): { CIntElement* a = GetIntElement(in); CIntElement* b = GetIntElement(in); - return new CIERandom(a, b); + return rs_new CIERandom(a, b); } case SBIG('IMPL'): { - return new CIEImpulse(GetIntElement(in)); + return rs_new CIEImpulse(GetIntElement(in)); } case SBIG('ILPT'): { - return new CIELifetimePercent(GetIntElement(in)); + return rs_new CIELifetimePercent(GetIntElement(in)); } case SBIG('SPAH'): { CIntElement* a = GetIntElement(in); CIntElement* b = GetIntElement(in); CIntElement* c = GetIntElement(in); - return new CIESampleAndHold(c, a, b); + return rs_new CIESampleAndHold(c, a, b); } case SBIG('IRND'): { CIntElement* a = GetIntElement(in); CIntElement* b = GetIntElement(in); - return new CIEInitialRandom(a, b); + return rs_new CIEInitialRandom(a, b); } case SBIG('CLMP'): { CIntElement* a = GetIntElement(in); CIntElement* b = GetIntElement(in); CIntElement* c = GetIntElement(in); - return new CIEClamp(a, b, c); + return rs_new CIEClamp(a, b, c); } case SBIG('PULS'): { CIntElement* a = GetIntElement(in); CIntElement* b = GetIntElement(in); CIntElement* c = GetIntElement(in); CIntElement* d = GetIntElement(in); - return new CIEPulse(a, b, c, d); + return rs_new CIEPulse(a, b, c, d); } case SBIG('NONE'): { return nullptr; @@ -97,21 +97,21 @@ CIntElement* CParticleDataFactory::GetIntElement(CInputStream& in) { case SBIG('RTOI'): { CRealElement* a = GetRealElement(in); CRealElement* b = GetRealElement(in); - return new CIERealToInt(a, b); + return rs_new CIERealToInt(a, b); } case SBIG('SUB_'): { CIntElement* a = GetIntElement(in); CIntElement* b = GetIntElement(in); - return new CIESubtract(a, b); + return rs_new CIESubtract(a, b); } case SBIG('GTCP'): { - return new CIEGetCumulativeParticleCount(); + return rs_new CIEGetCumulativeParticleCount(); } case SBIG('GAPC'): { - return new CIEGetActiveParticleCount(); + return rs_new CIEGetActiveParticleCount(); } case SBIG('GEMT'): { - return new CIEGetEmitterTime(); + return rs_new CIEGetEmitterTime(); } } return nullptr; @@ -139,40 +139,40 @@ CModVectorElement* CParticleDataFactory::GetModVectorElement(CInputStream& in) { a->GetValue(0, bf); a->GetValue(0, cf); #endif - CModVectorElement* result = new CMVEFastConstant(af, bf, cf); + CModVectorElement* result = rs_new CMVEFastConstant(af, bf, cf); delete a; delete b; delete c; return result; } else { - return new CMVEConstant(a, b, c); + return rs_new CMVEConstant(a, b, c); } } case SBIG('GRAV'): { - return new CMVEGravity(GetVectorElement(in)); + return rs_new CMVEGravity(GetVectorElement(in)); } case SBIG('WIND'): { CVectorElement* a = GetVectorElement(in); CRealElement* b = GetRealElement(in); - return new CMVEWind(a, b); + return rs_new CMVEWind(a, b); } case SBIG('EXPL'): { CRealElement* a = GetRealElement(in); CRealElement* b = GetRealElement(in); - return new CMVEExplode(a, b); + return rs_new CMVEExplode(a, b); } case SBIG('CHAN'): { CModVectorElement* a = GetModVectorElement(in); CModVectorElement* b = GetModVectorElement(in); CIntElement* c = GetIntElement(in); - return new CMVETimeChain(a, b, c); + return rs_new CMVETimeChain(a, b, c); } case SBIG('PULS'): { CIntElement* a = GetIntElement(in); CIntElement* b = GetIntElement(in); CModVectorElement* c = GetModVectorElement(in); CModVectorElement* d = GetModVectorElement(in); - return new CMVEPulse(a, b, c, d); + return rs_new CMVEPulse(a, b, c, d); } case SBIG('IMPL'): { CVectorElement* a = GetVectorElement(in); @@ -180,7 +180,7 @@ CModVectorElement* CParticleDataFactory::GetModVectorElement(CInputStream& in) { CRealElement* c = GetRealElement(in); CRealElement* d = GetRealElement(in); bool e = GetBool(in); - return new CMVEImplosion(a, b, c, d, e); + return rs_new CMVEImplosion(a, b, c, d, e); } case SBIG('LMPL'): { CVectorElement* a = GetVectorElement(in); @@ -188,7 +188,7 @@ CModVectorElement* CParticleDataFactory::GetModVectorElement(CInputStream& in) { CRealElement* c = GetRealElement(in); CRealElement* d = GetRealElement(in); bool e = GetBool(in); - return new CMVELinearImplosion(a, b, c, d, e); + return rs_new CMVELinearImplosion(a, b, c, d, e); } case SBIG('EMPL'): { CVectorElement* a = GetVectorElement(in); @@ -196,14 +196,14 @@ CModVectorElement* CParticleDataFactory::GetModVectorElement(CInputStream& in) { CRealElement* c = GetRealElement(in); CRealElement* d = GetRealElement(in); bool e = GetBool(in); - return new CMVEExponentialImplosion(a, b, c, d, e); + return rs_new CMVEExponentialImplosion(a, b, c, d, e); } case SBIG('SWRL'): { CVectorElement* a = GetVectorElement(in); CVectorElement* b = GetVectorElement(in); CRealElement* c = GetRealElement(in); CRealElement* d = GetRealElement(in); - return new CMVESwirl(a, b, c, d); + return rs_new CMVESwirl(a, b, c, d); } case SBIG('BNCE'): { CVectorElement* a = GetVectorElement(in); @@ -211,10 +211,10 @@ CModVectorElement* CParticleDataFactory::GetModVectorElement(CInputStream& in) { CRealElement* c = GetRealElement(in); CRealElement* d = GetRealElement(in); bool e = GetBool(in); - return new CMVEBounce(a, b, c, d, e); + return rs_new CMVEBounce(a, b, c, d, e); } case SBIG('SPOS'): { - return new CMVESetPosition(GetVectorElement(in)); + return rs_new CMVESetPosition(GetVectorElement(in)); } } return nullptr; diff --git a/src/Kyoto/Streams/CZipOutputStream.cpp b/src/Kyoto/Streams/CZipOutputStream.cpp index b89f1825..40bbf070 100644 --- a/src/Kyoto/Streams/CZipOutputStream.cpp +++ b/src/Kyoto/Streams/CZipOutputStream.cpp @@ -9,7 +9,7 @@ CZipOutputStream::CZipOutputStream(COutputStream* out, int level) : COutputStream(1024) , mOutput(out) , mCompressedBytesWritten(0) -, mZStream(new z_stream) +, mZStream(rs_new z_stream) , mUnk(0) { mZStream->zalloc = CZipSupport::Alloc; mZStream->zfree = CZipSupport::Free; diff --git a/src/MetroidPrime/BodyState/CBodyStateCmdMgr.cpp b/src/MetroidPrime/BodyState/CBodyStateCmdMgr.cpp index 4abe0741..2dbc6790 100644 --- a/src/MetroidPrime/BodyState/CBodyStateCmdMgr.cpp +++ b/src/MetroidPrime/BodyState/CBodyStateCmdMgr.cpp @@ -53,7 +53,7 @@ void CBodyStateCmdMgr::SetSteeringSpeedRange(float rmin, float rmax) { } void CBodyStateCmdMgr::DeliverCmd(const CBodyStateCmd& cmd) { - DeliverCmd2(cmd.GetCommandId()); + DeliverCmd(cmd.GetCommandId()); *x40_commandTable[(uint)cmd.GetCommandId()] = cmd; } diff --git a/src/MetroidPrime/BodyState/CBodyStateInfo.cpp b/src/MetroidPrime/BodyState/CBodyStateInfo.cpp index 3e468414..be9aa149 100644 --- a/src/MetroidPrime/BodyState/CBodyStateInfo.cpp +++ b/src/MetroidPrime/BodyState/CBodyStateInfo.cpp @@ -60,13 +60,13 @@ CBodyStateInfo::CBodyStateInfo(CActor& actor, EBodyType type) x1c_additiveStates.reserve(4); x1c_additiveStates.push_back(rstl::pair< int, rstl::auto_ptr< CAdditiveBodyState > >( - pas::kAS_AdditiveIdle, new CABSIdle())); + pas::kAS_AdditiveIdle, rs_new CABSIdle())); x1c_additiveStates.push_back( - rstl::pair< int, rstl::auto_ptr< CAdditiveBodyState > >(pas::kAS_AdditiveAim, new CABSAim())); + rstl::pair< int, rstl::auto_ptr< CAdditiveBodyState > >(pas::kAS_AdditiveAim, rs_new CABSAim())); x1c_additiveStates.push_back(rstl::pair< int, rstl::auto_ptr< CAdditiveBodyState > >( - pas::kAS_AdditiveIdle, new CABSFlinch())); + pas::kAS_AdditiveIdle, rs_new CABSFlinch())); x1c_additiveStates.push_back(rstl::pair< int, rstl::auto_ptr< CAdditiveBodyState > >( - pas::kAS_AdditiveReaction, new CABSReaction())); + pas::kAS_AdditiveReaction, rs_new CABSReaction())); } CBodyStateInfo::~CBodyStateInfo() { @@ -148,47 +148,47 @@ float CBodyStateInfo::GetLocomotionSpeed(pas::ELocomotionAnim anim) const { CBodyState* CBodyStateInfo::SetupBiPedalBodyStates(int stateId, CActor& actor) { switch (stateId) { // case pas::kAS_Fall: - // return new CBSFall(); + // return rs_new CBSFall(); // case pas::kAS_Getup: - // return new CBSGetup(); + // return rs_new CBSGetup(); // case pas::kAS_LieOnGround: - // return new CBSLieOnGround(actor); + // return rs_new CBSLieOnGround(actor); // case pas::kAS_Step: - // return new CBSStep(); + // return rs_new CBSStep(); // case pas::kAS_Death: - // return new CBSDie(); + // return rs_new CBSDie(); // case pas::kAS_Locomotion: - // return new CBSBiPedLocomotion(actor); + // return rs_new CBSBiPedLocomotion(actor); // case pas::kAS_KnockBack: - // return new CBSKnockBack(); + // return rs_new CBSKnockBack(); // case pas::kAS_MeleeAttack: - // return new CBSAttack(); + // return rs_new CBSAttack(); // case pas::kAS_ProjectileAttack: - // return new CBSProjectileAttack(); + // return rs_new CBSProjectileAttack(); // case pas::kAS_LoopAttack: - // return new CBSLoopAttack(); + // return rs_new CBSLoopAttack(); // case pas::kAS_Turn: - // return new CBSTurn(); + // return rs_new CBSTurn(); // case pas::kAS_LoopReaction: - // return new CBSLoopReaction(); + // return rs_new CBSLoopReaction(); // case pas::kAS_GroundHit: - // return new CBSGroundHit(); + // return rs_new CBSGroundHit(); // case pas::kAS_Generate: - // return new CBSGenerate(); + // return rs_new CBSGenerate(); // case pas::kAS_Jump: - // return new CBSJump(); + // return rs_new CBSJump(); // case pas::kAS_Hurled: - // return new CBSHurled(); + // return rs_new CBSHurled(); case pas::kAS_Slide: - return new CBSSlide(); + return rs_new CBSSlide(); // case pas::kAS_Taunt: - // return new CBSTaunt(); + // return rs_new CBSTaunt(); // case pas::kAS_Scripted: - // return new CBSScripted(); + // return rs_new CBSScripted(); // case pas::kAS_Cover: - // return new CBSCover(); + // return rs_new CBSCover(); // case pas::kAS_WallHang: - // return new CBSWallHang(); + // return rs_new CBSWallHang(); default: return nullptr; } diff --git a/src/MetroidPrime/CActor.cpp b/src/MetroidPrime/CActor.cpp index d7b7704d..bd2b8cce 100644 --- a/src/MetroidPrime/CActor.cpp +++ b/src/MetroidPrime/CActor.cpp @@ -40,7 +40,7 @@ CActor::CActor(TUniqueId uid, bool active, const rstl::string& name, const CEnti const CActorParameters& params, TUniqueId nextDrawNode) : CEntity(uid, info, active, name) , x34_transform(xf) -, x64_modelData(mData.IsNull() ? nullptr : new CModelData(mData)) +, x64_modelData(mData.IsNull() ? nullptr : rs_new CModelData(mData)) , x68_material(MakeActorMaterialList(list, params)) , x70_materialFilter( CMaterialFilter::MakeIncludeExclude(CMaterialList(SolidMaterial), CMaterialList())) @@ -97,7 +97,7 @@ CActor::CActor(TUniqueId uid, bool active, const rstl::string& name, const CEnti const CAssetId scanId = params.GetScannable().GetScannableObject0(); if (scanId != kInvalidAssetId) { x98_scanObjectInfo = - new TCachedToken< CScannableObjectInfo >(gpSimplePool->GetObj(SObjectTag('SCAN', scanId))); + rs_new TCachedToken< CScannableObjectInfo >(gpSimplePool->GetObj(SObjectTag('SCAN', scanId))); x98_scanObjectInfo->Lock(); } } @@ -205,7 +205,7 @@ void CActor::CalculateRenderBounds() { } void CActor::SetModelData(const CModelData& modelData) { - x64_modelData = modelData.IsNull() ? nullptr : new CModelData(modelData); + x64_modelData = modelData.IsNull() ? nullptr : rs_new CModelData(modelData); } // TODO nonmatching diff --git a/src/MetroidPrime/CAnimationDatabaseGame.cpp b/src/MetroidPrime/CAnimationDatabaseGame.cpp index a422839b..47b67e47 100644 --- a/src/MetroidPrime/CAnimationDatabaseGame.cpp +++ b/src/MetroidPrime/CAnimationDatabaseGame.cpp @@ -33,4 +33,6 @@ void CAnimationDatabaseGame::GetAllUniquePrimitives(rstl::vector< CPrimitive >& } void CAnimationDatabaseGame::GetUniquePrimitivesFromMetaAnim(rstl::set< CPrimitive >& primsOut, - const rstl::string& name) const {} + const rstl::string& name) const { + // Non-matching +} diff --git a/src/MetroidPrime/CCredits.cpp b/src/MetroidPrime/CCredits.cpp index e980f5c6..b423d6de 100644 --- a/src/MetroidPrime/CCredits.cpp +++ b/src/MetroidPrime/CCredits.cpp @@ -57,7 +57,7 @@ CIOWin::EMessageReturn CCredits::Update(float dt, CArchitectureQueue& queue) { if (x30_text.empty()) { for (int i = 0; i < x18_creditsTable->GetStringCount(); ++i) { x30_text.push_back(rstl::pair< rstl::single_ptr< CGuiTextSupport >, CVector2i >( - new CGuiTextSupport( + rs_new CGuiTextSupport( gpResourceFactory->GetResourceIdByName(gpTweakGui->GetCreditsFont().data())->id, CGuiTextProperties(true, true, kJustification_Center, kVerticalJustification_Top), gpTweakGui->GetCreditsTextFontColor(), gpTweakGui->GetCreditsTextBorderColor(), @@ -113,14 +113,14 @@ CIOWin::EMessageReturn CCredits::Update(float dt, CArchitectureQueue& queue) { } case 1: { if (x28_moviePlayer.null()) { - x28_moviePlayer = new CMoviePlayer("Video/creditBG.thp", 0.f, true, true); + x28_moviePlayer = rs_new CMoviePlayer("Video/creditBG.thp", 0.f, true, true); } x14_ = 2; break; } case 2: { // if (x2c_.null()) { - // x2c_ = new CStaticAudioPlayer("Audio/ending3.rsf", 0, 0x5d7c00); + // x2c_ = rs_new CStaticAudioPlayer("Audio/ending3.rsf", 0, 0x5d7c00); // } // if (!x2c_->IsReady()) { // return kMR_Exit; diff --git a/src/MetroidPrime/CGameArea.cpp b/src/MetroidPrime/CGameArea.cpp index e9cb5762..9832bb0e 100644 --- a/src/MetroidPrime/CGameArea.cpp +++ b/src/MetroidPrime/CGameArea.cpp @@ -3,14 +3,14 @@ #include "Kyoto/CDvdRequest.hpp" #include "Kyoto/CResFactory.hpp" - #define ROUND_UP_32(val) (((val) + 31) & ~31) rstl::pair< rstl::auto_ptr< uchar >, int > GetScriptingMemoryAlways(const IGameArea& area) { SObjectTag tag('MREA', area.IGetAreaAssetId()); - rstl::auto_ptr< char > buf = new char[0x60]; - CInputStream* resource = gpResourceFactory->GetResLoader().LoadNewResourceSync(tag, 0, 0x60, buf.get()); + rstl::auto_ptr< char > buf = rs_new char[0x60]; + CInputStream* resource = + gpResourceFactory->GetResLoader().LoadNewResourceSync(tag, 0, 0x60, buf.get()); if (!resource || *(uint*)(buf.get()) != 0xdeadbeef) { return rstl::pair< rstl::auto_ptr< uchar >, int >(nullptr, 0); } @@ -45,7 +45,7 @@ bool CGameArea::StartStreamingMainArea() { case kP_LoadHeader: { x110_mreaSecBufs.reserve(3); AllocNewAreaData(0, 96); - x12c_postConstructed.Set(new CPostConstructed()); + x12c_postConstructed.Set(rs_new CPostConstructed()); xf4_phase = kP_LoadSecSizes; break; } diff --git a/src/MetroidPrime/CGameCubeDoll.cpp b/src/MetroidPrime/CGameCubeDoll.cpp index d7a91951..b73bfef2 100644 --- a/src/MetroidPrime/CGameCubeDoll.cpp +++ b/src/MetroidPrime/CGameCubeDoll.cpp @@ -15,7 +15,7 @@ CGameCubeDoll::CGameCubeDoll() : x0_model(gpSimplePool->GetObj("CMDL_GameCube")) , x8_lights(1, CLight::BuildDirectional(CVector3f::Forward(), CColor(0xFFFFFFFF)), rstl::rmemory_allocator()) -, x18_actorLights(new CActorLights(8, CVector3f::Zero(), 4, 4, 0.1f, false, false, false)) +, x18_actorLights(rs_new CActorLights(8, CVector3f::Zero(), 4, 4, 0.1f, false, false, false)) , x1c_fader(0.0f) , x20_24_loaded(false) { x0_model.Lock(); diff --git a/src/MetroidPrime/CIOWinManager.cpp b/src/MetroidPrime/CIOWinManager.cpp index 0d141a03..8b739ec4 100644 --- a/src/MetroidPrime/CIOWinManager.cpp +++ b/src/MetroidPrime/CIOWinManager.cpp @@ -19,7 +19,7 @@ void CIOWinManager::AddIOWin(rstl::ncrc_ptr< CIOWin > chIow, int pumpPrio, int d IOWinPQNode* prevNode = nullptr; for (node = x4_pumpRoot; node && node->x4_prio > pumpPrio; node = node->x8_next) prevNode = node; - IOWinPQNode* newNode = new IOWinPQNode(chIow, pumpPrio, node); + IOWinPQNode* newNode = rs_new IOWinPQNode(chIow, pumpPrio, node); if (prevNode) prevNode->x8_next = newNode; else @@ -28,7 +28,7 @@ void CIOWinManager::AddIOWin(rstl::ncrc_ptr< CIOWin > chIow, int pumpPrio, int d prevNode = nullptr; for (node = x0_drawRoot; node && drawPrio < node->x4_prio; node = node->x8_next) prevNode = node; - newNode = new IOWinPQNode(chIow, drawPrio, node); + newNode = rs_new IOWinPQNode(chIow, drawPrio, node); if (prevNode) prevNode->x8_next = newNode; else diff --git a/src/MetroidPrime/CMainFlow.cpp b/src/MetroidPrime/CMainFlow.cpp index 391dd128..cf3feafd 100644 --- a/src/MetroidPrime/CMainFlow.cpp +++ b/src/MetroidPrime/CMainFlow.cpp @@ -76,12 +76,12 @@ void CMainFlow::SetGameState(EClientFlowStates state, CArchitectureQueue& queue) case CMain::kRM_WinGood: case CMain::kRM_WinBest: queue.Push(MakeMsg::CreateCreateIOWin(kAMT_IOWinManager, kFrontEndUIMsgPriority, - kFrontEndUIDrawPriority, new CCredits())); + kFrontEndUIDrawPriority, rs_new CCredits())); break; default: queue.Push(MakeMsg::CreateCreateIOWin(kAMT_IOWinManager, kFrontEndUIMsgPriority, kFrontEndUIDrawPriority, - new CPlayMovie(CPlayMovie::kWM_LoseGame))); + rs_new CPlayMovie(CPlayMovie::kWM_LoseGame))); break; } break; @@ -94,7 +94,7 @@ void CMainFlow::SetGameState(EClientFlowStates state, CArchitectureQueue& queue) } queue.Push(MakeMsg::CreateCreateIOWin(kAMT_IOWinManager, kFrontEndUIMsgPriority, - kFrontEndUIDrawPriority, new CPreFrontEnd())); + kFrontEndUIDrawPriority, rs_new CPreFrontEnd())); break; } case kCFS_FrontEnd: @@ -103,16 +103,16 @@ void CMainFlow::SetGameState(EClientFlowStates state, CArchitectureQueue& queue) } CIOWin* ioWin; if (gpMain->GetRestartMode() == CMain::kRM_StateSetter) { - ioWin = new CStateSetterFlow(); + ioWin = rs_new CStateSetterFlow(); } else { - ioWin = new CFrontEndUI(); + ioWin = rs_new CFrontEndUI(); } queue.Push(MakeMsg::CreateCreateIOWin(kAMT_IOWinManager, kFrontEndUIMsgPriority, kFrontEndUIDrawPriority, ioWin)); break; case kCFS_Game: gpGameState->GameOptions().EnsureOptions(); - CIOWin* gameFlow = new CMFGameLoader(); + CIOWin* gameFlow = rs_new CMFGameLoader(); gpMain->SetRestartMode(CMain::kRM_Default); queue.Push(MakeMsg::CreateCreateIOWin(kAMT_IOWinManager, kMFGameMsgPriority, kMFGameDrawPriority, gameFlow)); diff --git a/src/MetroidPrime/CMapArea.cpp b/src/MetroidPrime/CMapArea.cpp index 33c988b6..f6ba0f0a 100644 --- a/src/MetroidPrime/CMapArea.cpp +++ b/src/MetroidPrime/CMapArea.cpp @@ -78,7 +78,7 @@ CMapArea::CMapArea(CInputStream& in, uint size) , x2c_vertexCount(in.ReadLong()) , x30_surfaceCount(in.ReadLong()) , x34_size(size - 52) { - x44_buf = NEW u8[x34_size]; + x44_buf = rs_new u8[x34_size]; in.Get(x44_buf.get(), x34_size); PostConstruct(); @@ -239,5 +239,5 @@ const CVector3f& CMapArea::GetAreaPostTranslate(const IWorld& world, TAreaId aid CFactoryFnReturn FMapAreaFactory(const SObjectTag& objTag, CInputStream& in, const CVParamTransfer&) { gHackAssetId = objTag.id; - return CFactoryFnReturn(new CMapArea(in, gpResourceFactory->ResourceSize(objTag))); + return CFactoryFnReturn(rs_new CMapArea(in, gpResourceFactory->ResourceSize(objTag))); } diff --git a/src/MetroidPrime/CMemoryCardDriver.cpp b/src/MetroidPrime/CMemoryCardDriver.cpp index c753e740..0e7d6a84 100644 --- a/src/MetroidPrime/CMemoryCardDriver.cpp +++ b/src/MetroidPrime/CMemoryCardDriver.cpp @@ -583,7 +583,7 @@ void CMemoryCardDriver::StartFileCreate() { x194_fileIdx = 0; x198_fileInfo = - new CMemoryCardSys::CCardFileInfo(x0_cardPort, rstl::string_l(skSaveFileNames[x194_fileIdx])); + rs_new CMemoryCardSys::CCardFileInfo(x0_cardPort, rstl::string_l(skSaveFileNames[x194_fileIdx])); InitializeFileInfo(); ECardResult result = x198_fileInfo->CreateFile(); if (result != kCR_READY) @@ -617,7 +617,7 @@ void CMemoryCardDriver::StartFileCreateTransactional() { x194_fileIdx = altFileIdx; x198_fileInfo = - new CMemoryCardSys::CCardFileInfo(x0_cardPort, rstl::string_l(skSaveFileNames[x194_fileIdx])); + rs_new CMemoryCardSys::CCardFileInfo(x0_cardPort, rstl::string_l(skSaveFileNames[x194_fileIdx])); InitializeFileInfo(); ECardResult result = x198_fileInfo->CreateFile(); if (result != kCR_READY) @@ -708,7 +708,7 @@ void CMemoryCardDriver::ReadFinished() { for (int i = 0; i < xe4_fileSlots.capacity(); ++i) { if (header.x4_savePresent[i]) { - xe4_fileSlots[i] = new SGameFileSlot(r); + xe4_fileSlots[i] = rs_new SGameFileSlot(r); } else { xe4_fileSlots[i] = nullptr; } @@ -727,7 +727,7 @@ void CMemoryCardDriver::BuildNewFileSlot(int saveIdx) { rstl::auto_ptr< SGameFileSlot >& slot = xe4_fileSlots[saveIdx]; if (slot.null()) - slot = new SGameFileSlot(); + slot = rs_new SGameFileSlot(); slot->LoadGameState(saveIdx); @@ -746,7 +746,7 @@ void CMemoryCardDriver::BuildExistingFileSlot(int saveIdx) { rstl::auto_ptr< SGameFileSlot >& slot = xe4_fileSlots[saveIdx]; if (slot.null()) - slot = new SGameFileSlot(); + slot = rs_new SGameFileSlot(); else slot->InitializeFromGameState(); diff --git a/src/MetroidPrime/CStateManager.cpp b/src/MetroidPrime/CStateManager.cpp index 0ea2b480..19206403 100644 --- a/src/MetroidPrime/CStateManager.cpp +++ b/src/MetroidPrime/CStateManager.cpp @@ -84,7 +84,7 @@ CStateManager::CStateManager(const rstl::ncrc_ptr< CScriptMailbox >& mailbox, , x4_objectIndexArray(0) , x808_objectLists(rstl::auto_ptr< CObjectList >()) -, x86c_stateManagerContainer(new CStateManagerContainer()) +, x86c_stateManagerContainer(rs_new CStateManagerContainer()) , x870_cameraManager(&x86c_stateManagerContainer->x0_cameraManager) , x874_sortedListManager(&x86c_stateManagerContainer->x3c0_sortedListManager) @@ -160,14 +160,14 @@ CStateManager::CStateManager(const rstl::ncrc_ptr< CScriptMailbox >& mailbox, , xf94_30_fullThreat(false) { - x808_objectLists[0] = new CObjectList(kOL_All); - x808_objectLists[1] = new CActorList(); - x808_objectLists[2] = new CPhysicsActorList(); - x808_objectLists[3] = new CGameCameraList(); - x808_objectLists[4] = new CGameLightList(); - x808_objectLists[5] = new CListeningAiList(); - x808_objectLists[6] = new CAiWaypointList(); - x808_objectLists[7] = new CPlatformAndDoorList(); + x808_objectLists[0] = rs_new CObjectList(kOL_All); + x808_objectLists[1] = rs_new CActorList(); + x808_objectLists[2] = rs_new CPhysicsActorList(); + x808_objectLists[3] = rs_new CGameCameraList(); + x808_objectLists[4] = rs_new CGameLightList(); + x808_objectLists[5] = rs_new CListeningAiList(); + x808_objectLists[6] = rs_new CAiWaypointList(); + x808_objectLists[7] = rs_new CPlatformAndDoorList(); gpRender->SetDrawableCallback(RendererDrawCallback, this); CMemory::SetOutOfMemoryCallback(MemoryAllocatorAllocationFailedCallback, this); diff --git a/src/MetroidPrime/CWorldShadow.cpp b/src/MetroidPrime/CWorldShadow.cpp index 1f8b49ce..4d5c901c 100644 --- a/src/MetroidPrime/CWorldShadow.cpp +++ b/src/MetroidPrime/CWorldShadow.cpp @@ -16,7 +16,7 @@ static int kUnknownValue = 1; CWorldShadow::CWorldShadow(uint w, uint h, bool rgba8) -: x0_texture(NEW CTexture(rgba8 ? kTF_RGBA8 : kTF_RGB565, w, h, 1)) +: x0_texture(rs_new CTexture(rgba8 ? kTF_RGBA8 : kTF_RGB565, w, h, 1)) , x4_view(CTransform4f::Identity()) , x34_model(CTransform4f::Identity()) , x64_objHalfExtent(1.f) diff --git a/src/MetroidPrime/Cameras/CBallCamera.cpp b/src/MetroidPrime/Cameras/CBallCamera.cpp index 27452725..5e1d5c31 100644 --- a/src/MetroidPrime/Cameras/CBallCamera.cpp +++ b/src/MetroidPrime/Cameras/CBallCamera.cpp @@ -141,8 +141,8 @@ CBallCamera::CBallCamera(TUniqueId uid, TUniqueId watchedId, const CTransform4f& , x470_clampVelTimer(0.f) , x474_clampVelRange(0.f) , x478_shortMoveCount(0) -, x47c_failsafeState(new SFailsafeState) -, x480_(new SUnknown) { +, x47c_failsafeState(rs_new SFailsafeState) +, x480_(rs_new SUnknown) { SetupColliders(x264_smallColliders, 2.31f, 2.31f, 0.1f, 3, 2.f, 0.5f, -M_PIF / 2.f); SetupColliders(x274_mediumColliders, 4.62f, 4.62f, 0.1f, 6, 2.f, 0.5f, -M_PIF / 2.f); SetupColliders(x284_largeColliders, 7.f, 7.f, 0.1f, 12, 2.f, 0.5f, -M_PIF / 2.f); diff --git a/src/MetroidPrime/Cameras/CCameraFilter.cpp b/src/MetroidPrime/Cameras/CCameraFilter.cpp index 1d71983f..8acf2535 100644 --- a/src/MetroidPrime/Cameras/CCameraFilter.cpp +++ b/src/MetroidPrime/Cameras/CCameraFilter.cpp @@ -37,7 +37,7 @@ void CCameraFilterPass::SetFilter(EFilterType type, EFilterShape shape, float ti if (txtr != kInvalidAssetId) { x24_texObj = - new TLockedToken< CTexture >(gpSimplePool->GetObj(SObjectTag(SBig('TXTR'), txtr))); + rs_new TLockedToken< CTexture >(gpSimplePool->GetObj(SObjectTag(SBig('TXTR'), txtr))); } } else { x1c_nextColor = color; @@ -47,7 +47,7 @@ void CCameraFilterPass::SetFilter(EFilterType type, EFilterShape shape, float ti if (txtr != kInvalidAssetId) { x24_texObj = - new TLockedToken< CTexture >(gpSimplePool->GetObj(SObjectTag(SBig('TXTR'), txtr))); + rs_new TLockedToken< CTexture >(gpSimplePool->GetObj(SObjectTag(SBig('TXTR'), txtr))); } x10_remTime = time; diff --git a/src/MetroidPrime/Cameras/CCameraManager.cpp b/src/MetroidPrime/Cameras/CCameraManager.cpp index 6aaaeec7..17c9ac80 100644 --- a/src/MetroidPrime/Cameras/CCameraManager.cpp +++ b/src/MetroidPrime/Cameras/CCameraManager.cpp @@ -70,19 +70,19 @@ void CCameraManager::CreateStandardCameras(CStateManager& mgr) { xf.SetTranslation(mgr.GetPlayer()->GetEyePosition()); TUniqueId fpId = mgr.AllocateUniqueId(); - x7c_fpCamera = new CFirstPersonCamera(fpId, xf, plId, gpTweakPlayer->GetOrbitCameraSpeed(), + x7c_fpCamera = rs_new CFirstPersonCamera(fpId, xf, plId, gpTweakPlayer->GetOrbitCameraSpeed(), DefaultFirstPersonFov(), DefaultNearPlane(), DefaultFarPlane(), DefaultAspect()); mgr.AddObject(x7c_fpCamera); mgr.Player()->SetCameraState(CPlayer::kCS_FirstPerson, mgr); SetCurrentCameraId(fpId); TUniqueId ballId = mgr.AllocateUniqueId(); - x80_ballCamera = new CBallCamera(ballId, plId, xf, DefaultThirdPersonFov(), DefaultNearPlane(), + x80_ballCamera = rs_new CBallCamera(ballId, plId, xf, DefaultThirdPersonFov(), DefaultNearPlane(), DefaultFarPlane(), DefaultAspect()); mgr.AddObject(x80_ballCamera); TUniqueId interpId = mgr.AllocateUniqueId(); - x88_interpCamera = new CInterpolationCamera(interpId, xf); + x88_interpCamera = rs_new CInterpolationCamera(interpId, xf); mgr.AddObject(x88_interpCamera); } diff --git a/src/MetroidPrime/Enemies/CAmbientAI.cpp b/src/MetroidPrime/Enemies/CAmbientAI.cpp index 83bd814b..6d651f52 100644 --- a/src/MetroidPrime/Enemies/CAmbientAI.cpp +++ b/src/MetroidPrime/Enemies/CAmbientAI.cpp @@ -22,7 +22,7 @@ CAmbientAI::CAmbientAI(TUniqueId uid, const rstl::string& name, const CEntityInf , x2d0_animState(kAS_Ready) , x2d4_alertRange(alertRange) , x2d8_impactRange(impactRange) -, x2dc_defaultAnim(GetModelData()->GetAnimationData()->GetDefaultAnimation()) +, x2dc_currentAnim(GetModelData()->GetAnimationData()->GetCurrentAnimation()) , x2e0_alertAnim(alertAnim) , x2e4_impactAnim(impactAnim) , x2e8_24_dead(false) @@ -90,7 +90,7 @@ void CAmbientAI::Think(float dt, CStateManager& mgr) { if (!inAlertRange) { x2d0_animState = kAS_Ready; ModelData()->AnimationData()->SetAnimation( - CAnimPlaybackParms(x2dc_defaultAnim, -1, 1.f, true), false); + CAnimPlaybackParms(x2dc_currentAnim, -1, 1.f, true), false); ModelData()->EnableLooping(true); RandomizePlaybackRate(mgr); } else if (inImpactRange) { @@ -104,7 +104,7 @@ void CAmbientAI::Think(float dt, CStateManager& mgr) { if (!x2e8_25_animating) { x2d0_animState = kAS_Ready; ModelData()->AnimationData()->SetAnimation( - CAnimPlaybackParms(x2dc_defaultAnim, -1, 1.f, true), false); + CAnimPlaybackParms(x2dc_currentAnim, -1, 1.f, true), false); ModelData()->EnableLooping(true); RandomizePlaybackRate(mgr); } @@ -130,7 +130,7 @@ void CAmbientAI::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId uid, CState if (!GetActive()) SetActive(true); x2d0_animState = kAS_Ready; - ModelData()->AnimationData()->SetAnimation(CAnimPlaybackParms(x2dc_defaultAnim, -1, 1.f, true), + ModelData()->AnimationData()->SetAnimation(CAnimPlaybackParms(x2dc_currentAnim, -1, 1.f, true), false); ModelData()->EnableLooping(true); RandomizePlaybackRate(mgr); diff --git a/src/MetroidPrime/Enemies/CPuffer.cpp b/src/MetroidPrime/Enemies/CPuffer.cpp index c1d5784e..4255b26c 100644 --- a/src/MetroidPrime/Enemies/CPuffer.cpp +++ b/src/MetroidPrime/Enemies/CPuffer.cpp @@ -41,7 +41,7 @@ CPuffer::CPuffer(TUniqueId uid, const rstl::string& name, const CEntityInfo& inf CreateShadow(false); GetKnockBackCtrl().SetImpulseDurationIdx(1); x574_cloudEffect.Lock(); - GetBodyCtrl()->SetRestrictedFlyerMoveSpeed(hoverSpeed); + BodyCtrl()->SetRestrictedFlyerMoveSpeed(hoverSpeed); } CPuffer::~CPuffer() {} @@ -53,7 +53,7 @@ void CPuffer::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId uid, CStateMan switch (msg) { case kSM_Registered: - GetBodyCtrl()->Activate(mgr); + BodyCtrl()->Activate(mgr); SetMaterialFilter(CMaterialFilter::MakeIncludeExclude(CMaterialList(kMT_Player), CMaterialList(kMT_NoStaticCollision))); break; @@ -97,7 +97,7 @@ void CPuffer::Death(CStateManager& mgr, const CVector3f& vec, EScriptObjectState CAABox aabb = CAABox(CVector3f(-1.f, -1.f, -1.f), CVector3f(1.f, 1.f, 1.f)) .GetTransformedAABox(GetTransform() * CTransform4f::Scale(x57c_cloudDamage.GetRadius())); - mgr.AddObject(new CFire(x574_cloudEffect, uid, GetCurrentAreaId(), true, GetUniqueId(), + mgr.AddObject(rs_new CFire(x574_cloudEffect, uid, GetCurrentAreaId(), true, GetUniqueId(), GetTransform(), x57c_cloudDamage, aabb, CVector3f(1.f, 1.f, 1.f), true, x5bc_cloudSteam, x598_24_, x598_26_, x598_25_, 1.f, x5b8_, 1.f, 1.f)); } @@ -106,22 +106,22 @@ void CPuffer::Think(float dt, CStateManager& mgr) { CPatterned::Think(dt, mgr); sub8025bfa4(mgr); - CVector3f moveVector = GetBodyCtrl()->GetCommandMgr().GetMoveVector(); + CVector3f moveVector = BodyCtrl()->GetCommandMgr().GetMoveVector(); if (x5cc_ != GetDestObj()) { x5cc_ = GetDestObj(); CSfxManager::AddEmitter(x59a_, GetTranslation(), CVector3f::Zero(), true, false); } - GetBodyCtrl()->CommandMgr().ClearLocomotionCmds(); + BodyCtrl()->CommandMgr().ClearLocomotionCmds(); if (moveVector.CanBeNormalized()) { x5c0_move = CVector3f::Lerp(x5c0_move, moveVector, dt / 0.5f).AsNormalized(); - GetBodyCtrl()->CommandMgr().DeliverCmd(CBCLocomotionCmd(x5c0_move, x568_face, 1.f)); + BodyCtrl()->CommandMgr().DeliverCmd(CBCLocomotionCmd(x5c0_move, x568_face, 1.f)); } } void CPuffer::sub8025bfa4(CStateManager& mgr) { - CVector3f moveVector = GetBodyCtrl()->GetCommandMgr().GetMoveVector(); + CVector3f moveVector = BodyCtrl()->GetCommandMgr().GetMoveVector(); if (x5d4_gasLocators.empty()) { for (int i = 0; i < ARRAY_SIZE(skGasLocators); ++i) { diff --git a/src/MetroidPrime/Factories/CScannableObjectInfo.cpp b/src/MetroidPrime/Factories/CScannableObjectInfo.cpp index fe0301ba..14eed36a 100644 --- a/src/MetroidPrime/Factories/CScannableObjectInfo.cpp +++ b/src/MetroidPrime/Factories/CScannableObjectInfo.cpp @@ -20,5 +20,5 @@ inline CFactoryFnReturn::CFactoryFnReturn(CScannableObjectInfo* ptr) CFactoryFnReturn FScannableObjectInfoFactory(const SObjectTag& tag, CInputStream& in, const CVParamTransfer& xfer) { - return new CScannableObjectInfo(in, in.GetBlockOffset()); + return rs_new CScannableObjectInfo(in, in.GetBlockOffset()); } diff --git a/src/MetroidPrime/Player/CFaceplateDecoration.cpp b/src/MetroidPrime/Player/CFaceplateDecoration.cpp index 46517c2e..8ccadf2d 100644 --- a/src/MetroidPrime/Player/CFaceplateDecoration.cpp +++ b/src/MetroidPrime/Player/CFaceplateDecoration.cpp @@ -8,8 +8,8 @@ CFaceplateDecoration::CFaceplateDecoration(CStateManager& stateMgr) : x0_id(kInvalidAssetId) {} -void CFaceplateDecoration::Update(float dt, const CStateManager& stateMgr) { - CAssetId txtrId = stateMgr.GetPlayer()->GetVisorSteam().GetTextureId(); +void CFaceplateDecoration::Update(float dt, const CStateManager& mgr) { + CAssetId txtrId = mgr.GetPlayer()->GetVisorSteam().GetTextureId(); if (txtrId == kInvalidAssetId && x4_tex.valid()) { x4_tex->Unlock(); x0_id = txtrId; diff --git a/src/MetroidPrime/Player/CPlayerGun.cpp b/src/MetroidPrime/Player/CPlayerGun.cpp index 6050ffab..30381b96 100644 --- a/src/MetroidPrime/Player/CPlayerGun.cpp +++ b/src/MetroidPrime/Player/CPlayerGun.cpp @@ -235,24 +235,24 @@ CPlayerGun::CPlayerGun(TUniqueId playerId) , x730_outgoingBeam(nullptr) , x734_loadingBeam(nullptr) , x738_nextBeam(nullptr) -, x73c_gunMotion(new CGunMotion(gpTweakGunRes->x4_gunMotion, kScaleVector)) -, x740_grappleArm(new CGrappleArm(kScaleVector)) -, x744_auxWeapon(new CAuxWeapon(playerId)) -, x748_rainSplashGenerator(new CRainSplashGenerator(kScaleVector, 20, 2, 0.f, 0.125f)) +, x73c_gunMotion(rs_new CGunMotion(gpTweakGunRes->x4_gunMotion, kScaleVector)) +, x740_grappleArm(rs_new CGrappleArm(kScaleVector)) +, x744_auxWeapon(rs_new CAuxWeapon(playerId)) +, x748_rainSplashGenerator(rs_new CRainSplashGenerator(kScaleVector, 20, 2, 0.f, 0.125f)) , x74c_powerBeam( - new CPowerBeam(gpTweakGunRes->x10_powerBeam, kWT_Power, playerId, kMT_Player, kScaleVector)) + rs_new CPowerBeam(gpTweakGunRes->x10_powerBeam, kWT_Power, playerId, kMT_Player, kScaleVector)) , x750_iceBeam( - new CIceBeam(gpTweakGunRes->x14_iceBeam, kWT_Ice, playerId, kMT_Player, kScaleVector)) + rs_new CIceBeam(gpTweakGunRes->x14_iceBeam, kWT_Ice, playerId, kMT_Player, kScaleVector)) , x754_waveBeam( - new CWaveBeam(gpTweakGunRes->x18_waveBeam, kWT_Wave, playerId, kMT_Player, kScaleVector)) -, x758_plasmaBeam(new CPlasmaBeam(gpTweakGunRes->x1c_plasmaBeam, kWT_Plasma, playerId, kMT_Player, + rs_new CWaveBeam(gpTweakGunRes->x18_waveBeam, kWT_Wave, playerId, kMT_Player, kScaleVector)) +, x758_plasmaBeam(rs_new CPlasmaBeam(gpTweakGunRes->x1c_plasmaBeam, kWT_Plasma, playerId, kMT_Player, kScaleVector)) -, x75c_phazonBeam(new CPhazonBeam(gpTweakGunRes->x20_phazonBeam, kWT_Phazon, playerId, kMT_Player, +, x75c_phazonBeam(rs_new CPhazonBeam(gpTweakGunRes->x20_phazonBeam, kWT_Phazon, playerId, kMT_Player, kScaleVector)) , x760_selectableBeams(nullptr) , x774_holoTransitionGen( - new CElementGen(gpSimplePool->GetObj(SObjectTag('PART', gpTweakGunRes->x24_holoTransition)))) -, x82c_shadow(new CWorldShadow(32, 32, true)) + rs_new CElementGen(gpSimplePool->GetObj(SObjectTag('PART', gpTweakGunRes->x24_holoTransition)))) +, x82c_shadow(rs_new CWorldShadow(32, 32, true)) , x830_chargeRumbleHandle(-1) , x832_24_coolingCharge(false) , x832_25_chargeEffectVisible(false) @@ -587,7 +587,7 @@ void CPlayerGun::InitMuzzleData() { SObjectTag tag('PART', (i < 0 || 4 < i) ? kInvalidAssetId : gpTweakGunRes->xa4_auxMuzzle[i]); x7c0_auxMuzzleEffects.push_back(gpSimplePool->GetObj(tag)); // TODO: not likely correct, maybe need improvements to auto_ptr - x800_auxMuzzleGenerators.push_back(new CElementGen(x7c0_auxMuzzleEffects.back())); + x800_auxMuzzleGenerators.push_back(rs_new CElementGen(x7c0_auxMuzzleEffects.back())); x800_auxMuzzleGenerators.back()->SetParticleEmission(false); } } diff --git a/src/MetroidPrime/Player/CPlayerState.cpp b/src/MetroidPrime/Player/CPlayerState.cpp index 792877b6..fc6c9b43 100644 --- a/src/MetroidPrime/Player/CPlayerState.cpp +++ b/src/MetroidPrime/Player/CPlayerState.cpp @@ -155,7 +155,7 @@ void CPlayerState::PutTo(COutputStream& stream) { stream.WriteBits(x184_scanCompletionRateSecond, GetBitCount(0x100)); } -void CPlayerState::ReInitializePowerUp(CPlayerState::EItemType type, int capacity) { +void CPlayerState::SetPowerUp(CPlayerState::EItemType type, int capacity) { x24_powerups[uint(type)].x4_capacity = 0; InitializePowerUp(type, capacity); } @@ -183,7 +183,7 @@ float CPlayerState::CalculateHealth() { return (kEnergyTankCapacity * x24_powerups[kIT_EnergyTanks].x0_amount) + kBaseHealthCapacity; } -void CPlayerState::ResetAndIncrPickUp(CPlayerState::EItemType type, int amount) { +void CPlayerState::SetPickup(CPlayerState::EItemType type, int amount) { x24_powerups[uint(type)].x0_amount = 0; IncrPickUp(type, amount); } diff --git a/src/MetroidPrime/Player/CSamusFaceReflection.cpp b/src/MetroidPrime/Player/CSamusFaceReflection.cpp index bc5619a4..3681f382 100644 --- a/src/MetroidPrime/Player/CSamusFaceReflection.cpp +++ b/src/MetroidPrime/Player/CSamusFaceReflection.cpp @@ -25,7 +25,7 @@ static const CTransform4f skFaceModelViewAdjust = CSamusFaceReflection::CSamusFaceReflection(const CStateManager& mgr) : x0_modelData(CModelData(CAnimRes(gpResourceFactory->GetResourceIdByName(skFaceAssetIdName)->id, CAnimRes::kDefaultCharIdx, CVector3f(1.f, 1.f, 1.f), 0, true))) -, x4c_lights(new CActorLights(8, CVector3f::Zero(), 4, 4)) +, x4c_lights(rs_new CActorLights(8, CVector3f::Zero(), 4, 4)) , x50_lookRot(CQuaternion::NoRotation()) , x60_lookDir(CVector3f::Forward()) , x6c_(0) diff --git a/src/MetroidPrime/ScriptLoader.cpp b/src/MetroidPrime/ScriptLoader.cpp index 82a96e35..d2e1ae43 100644 --- a/src/MetroidPrime/ScriptLoader.cpp +++ b/src/MetroidPrime/ScriptLoader.cpp @@ -18,7 +18,6 @@ #include "MetroidPrime/ScriptObjects/CScriptSpawnPoint.hpp" #include "MetroidPrime/ScriptObjects/CScriptTrigger.hpp" - #include "Kyoto/Alloc/CMemory.hpp" #include "Kyoto/CResFactory.hpp" #include "Kyoto/Math/CQuaternion.hpp" @@ -193,8 +192,8 @@ CEntity* ScriptLoader::LoadTrigger(CStateManager& mgr, CInputStream& in, int pro CVector3f orientedForce = mgr.GetWorld()->GetAreaAlways(info.GetAreaId()).GetTM().Rotate(forceVec); - return new CScriptTrigger(mgr.AllocateUniqueId(), name, info, position, box, dInfo, orientedForce, - flags, active, b2, b3); + return rs_new CScriptTrigger(mgr.AllocateUniqueId(), name, info, position, box, dInfo, + orientedForce, flags, active, b2, b3); } CEntity* ScriptLoader::LoadCameraHintTrigger(CStateManager& mgr, CInputStream& in, int propCount, @@ -211,13 +210,14 @@ CEntity* ScriptLoader::LoadCameraHintTrigger(CStateManager& mgr, CInputStream& i if (aHead.x10_transform.GetRotation() == CTransform4f::Identity()) { CAABox box(CVector3f(-(scale.GetX()), -(scale.GetY()), -(scale.GetZ())), CVector3f((scale.GetX()), (scale.GetY()), (scale.GetZ()))); - return new CScriptTrigger(mgr.AllocateUniqueId(), aHead.x0_name, info, - aHead.x10_transform.GetTranslation(), box, CDamageInfo(), - CVector3f::Zero(), kTFL_DetectPlayer, active, deactivateOnEnter, - deactivateOnExit); + return rs_new CScriptTrigger(mgr.AllocateUniqueId(), aHead.x0_name, info, + aHead.x10_transform.GetTranslation(), box, CDamageInfo(), + CVector3f::Zero(), kTFL_DetectPlayer, active, deactivateOnEnter, + deactivateOnExit); } else { - return new CScriptCameraHintTrigger(mgr.AllocateUniqueId(), active, aHead.x0_name, info, scale, - aHead.x10_transform, deactivateOnEnter, deactivateOnExit); + return rs_new CScriptCameraHintTrigger(mgr.AllocateUniqueId(), active, aHead.x0_name, info, + scale, aHead.x10_transform, deactivateOnEnter, + deactivateOnExit); } } @@ -276,9 +276,9 @@ CEntity* ScriptLoader::LoadDamageableTrigger(CStateManager& mgr, CInputStream& i CScriptDamageableTrigger::ECanOrbit(in.Get< bool >()); bool active = in.Get< bool >(); CVisorParameters vParms = LoadVisorParameters(in); - return new CScriptDamageableTrigger(mgr.AllocateUniqueId(), name, info, position, volume, hInfo, - dVuln, triggerFlags, patternTex1, patternTex2, colorTex, - canOrbit, active, vParms); + return rs_new CScriptDamageableTrigger(mgr.AllocateUniqueId(), name, info, position, volume, + hInfo, dVuln, triggerFlags, patternTex1, patternTex2, + colorTex, canOrbit, active, vParms); } // static CFluidUVMotion LoadFluidUVMotion(CInputStream&) {} @@ -306,10 +306,10 @@ CEntity* ScriptLoader::LoadSpawnPoint(CStateManager& mgr, CInputStream& in, int if (propCount >= 35) morphed = in.Get< bool >(); - return new CScriptSpawnPoint(mgr.AllocateUniqueId(), name, info, - ConvertEditorEulerToTransform4f(rotation, position), - rstl::reserved_vector< int, int(CPlayerState::kIT_Max) >(itemCounts), - defaultSpawn, active, morphed); + return rs_new CScriptSpawnPoint( + mgr.AllocateUniqueId(), name, info, ConvertEditorEulerToTransform4f(rotation, position), + rstl::reserved_vector< int, int(CPlayerState::kIT_Max) >(itemCounts), defaultSpawn, active, + morphed); } CEntity* ScriptLoader::LoadDock(CStateManager& mgr, CInputStream& in, int propCount, @@ -324,8 +324,8 @@ CEntity* ScriptLoader::LoadDock(CStateManager& mgr, CInputStream& in, int propCo int dock = in.Get< int >(); TAreaId area = in.Get< int >(); bool loadConnected = in.Get< bool >(); - return new CScriptDock(mgr.AllocateUniqueId(), name, info, position, scale, dock, area, active, 0, - loadConnected); + return rs_new CScriptDock(mgr.AllocateUniqueId(), name, info, position, scale, dock, area, active, + 0, loadConnected); } static CAABox GetCollisionBox(CStateManager& stateMgr, TAreaId id, const CVector3f& extent, @@ -398,8 +398,8 @@ CEntity* ScriptLoader::LoadActor(CStateManager& mgr, CInputStream& in, int propC if (collisionExtent == CVector3f::Zero() || negativeCollisionExtent) aabb = data.GetBounds(head.x0_actorHead.x10_transform.GetRotation()); - return new CScriptActor(mgr.AllocateUniqueId(), head.x0_actorHead.x0_name, info, - head.x0_actorHead.x10_transform, data, aabb, list, mass, zMomentum, hInfo, - dVuln, actParms, looping, active, shaderIdx, xrayAlpha, noThermalHotZ, - castsShadow, scaleAdvancementDelta, materialFlag54); + return rs_new CScriptActor(mgr.AllocateUniqueId(), head.x0_actorHead.x0_name, info, + head.x0_actorHead.x10_transform, data, aabb, list, mass, zMomentum, + hInfo, dVuln, actParms, looping, active, shaderIdx, xrayAlpha, + noThermalHotZ, castsShadow, scaleAdvancementDelta, materialFlag54); } diff --git a/src/MetroidPrime/ScriptObjects/CFire.cpp b/src/MetroidPrime/ScriptObjects/CFire.cpp index 8803cab0..a651e0c4 100644 --- a/src/MetroidPrime/ScriptObjects/CFire.cpp +++ b/src/MetroidPrime/ScriptObjects/CFire.cpp @@ -10,7 +10,7 @@ CFire::CFire(const TToken< CGenDescription >& effect, TUniqueId uid, TAreaId are : CActor(uid, active, "Fire", CEntityInfo(area, NullConnectionList), xf, CModelData::CModelDataNull(), MakeMaterialList(), CActorParameters::None(), kInvalidUniqueId) -, xe8_(new CElementGen(effect)) +, xe8_(rs_new CElementGen(effect)) , xec_owner(owner) , xf0_damageInfo1(dInfo) , x10c_damageInfo2(dInfo) diff --git a/src/MetroidPrime/ScriptObjects/CHUDBillboardEffect.cpp b/src/MetroidPrime/ScriptObjects/CHUDBillboardEffect.cpp index 65dc42a7..ae68f64b 100644 --- a/src/MetroidPrime/ScriptObjects/CHUDBillboardEffect.cpp +++ b/src/MetroidPrime/ScriptObjects/CHUDBillboardEffect.cpp @@ -50,11 +50,11 @@ CHUDBillboardEffect::CHUDBillboardEffect( if (particle) { x104_26_isElementGen = true; - xe8_generator = new CElementGen(*particle); + xe8_generator = rs_new CElementGen(*particle); if (static_cast< CElementGen& >(*xe8_generator).IsIndirectTextured()) ++g_IndirectTexturedBillboardCount; } else { - xe8_generator = new CParticleElectric(TToken< CElectricDescription >(*electric)); + xe8_generator = rs_new CParticleElectric(TToken< CElectricDescription >(*electric)); } ++g_BillboardCount; xe8_generator->SetModulationColor(color); diff --git a/src/MetroidPrime/ScriptObjects/CScriptActorKeyframe.cpp b/src/MetroidPrime/ScriptObjects/CScriptActorKeyframe.cpp index 16ce6916..00d053ea 100644 --- a/src/MetroidPrime/ScriptObjects/CScriptActorKeyframe.cpp +++ b/src/MetroidPrime/ScriptObjects/CScriptActorKeyframe.cpp @@ -17,7 +17,7 @@ CScriptActorKeyframe::CScriptActorKeyframe(TUniqueId uid, const rstl::string& na , x38_initialLifetime(lifetime) , x3c_playbackRate(totalPlayback) , x40_lifetime(lifetime) -, x44_24_looping(looping) +, x44_24_isLooped(looping) , x44_25_isPassive(isPassive) , x44_26_fadeOut((fadeOut << 5) & 0x20) , x44_27_timedLoop((fadeOut << 3) & 0x10) @@ -74,28 +74,29 @@ void CScriptActorKeyframe::UpdateEntity(TUniqueId uid, CStateManager& mgr) { act->SetModelFlags(CModelFlags::Normal()); if (act->HasAnimation()) { if (act->AnimationData()->IsAdditiveAnimation(x34_animationId)) { - act->AnimationData()->AddAdditiveAnimation(x34_animationId, 1.f, x44_24_looping, + act->AnimationData()->AddAdditiveAnimation(x34_animationId, 1.f, x44_24_isLooped, x44_26_fadeOut); } else { act->AnimationData()->SetAnimation(CAnimPlaybackParms(x34_animationId, -1, 1.f, true), false); - act->ModelData()->EnableLooping(x44_24_looping); + act->ModelData()->EnableLooping(x44_24_isLooped); act->AnimationData()->MultiplyPlaybackRate(x3c_playbackRate); } } } else if (CPatterned* ai = TCastToPtr< CPatterned >(ent)) { if (ai->AnimationData()->IsAdditiveAnimation(x34_animationId)) { - ai->AnimationData()->AddAdditiveAnimation(x34_animationId, 1.f, x44_24_looping, + ai->AnimationData()->AddAdditiveAnimation(x34_animationId, 1.f, x44_24_isLooped, x44_26_fadeOut); } else { - ai->GetBodyCtrl()->CommandMgr().DeliverCmd( - CBCScriptedCmd(x34_animationId, x44_24_looping, x44_27_timedLoop, x38_initialLifetime)); + CBodyStateCmdMgr& cmdMgr = ai->BodyCtrl()->CommandMgr(); + cmdMgr.DeliverCmd( + CBCScriptedCmd(x34_animationId, x44_24_isLooped, x44_27_timedLoop, x38_initialLifetime)); } } } void CScriptActorKeyframe::Think(float dt, CStateManager& mgr) { - if (!x44_25_isPassive && x44_24_looping && x44_27_timedLoop && x44_28_playing && + if (!x44_25_isPassive && x44_24_isLooped && x44_27_timedLoop && x44_28_playing && x40_lifetime > 0.f) { x40_lifetime -= dt; @@ -113,7 +114,7 @@ void CScriptActorKeyframe::Think(float dt, CStateManager& mgr) { if (act->HasAnimation()) { if (act->AnimationData()->IsAdditiveAnimation(x34_animationId)) { act->AnimationData()->DelAdditiveAnimation(x34_animationId); - } else if (act->AnimationData()->GetDefaultAnimation() == x34_animationId) { + } else if (act->AnimationData()->GetCurrentAnimation() == x34_animationId) { act->ModelData()->EnableLooping(false); } } @@ -121,10 +122,9 @@ void CScriptActorKeyframe::Think(float dt, CStateManager& mgr) { if (ai->AnimationData()->IsAdditiveAnimation(x34_animationId)) { ai->AnimationData()->DelAdditiveAnimation(x34_animationId); - } else if (ai->GetBodyCtrl()->GetBodyStateInfo().GetCurrentStateId() == - pas::kAS_Scripted && - ai->AnimationData()->GetDefaultAnimation() == x34_animationId) { - ai->GetBodyCtrl()->CommandMgr().DeliverCmd(CBodyStateCmd(kBSC_ExitState)); + } else if (ai->BodyCtrl()->GetBodyStateInfo().GetCurrentStateId() == pas::kAS_Scripted && + ai->AnimationData()->GetCurrentAnimation() == x34_animationId) { + ai->BodyCtrl()->CommandMgr().DeliverCmd(CBodyStateCmd(kBSC_ExitState)); } } } diff --git a/src/MetroidPrime/ScriptObjects/CScriptCameraWaypoint.cpp b/src/MetroidPrime/ScriptObjects/CScriptCameraWaypoint.cpp index de42c183..2063f6ae 100644 --- a/src/MetroidPrime/ScriptObjects/CScriptCameraWaypoint.cpp +++ b/src/MetroidPrime/ScriptObjects/CScriptCameraWaypoint.cpp @@ -26,7 +26,7 @@ void CScriptCameraWaypoint::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId } } -TUniqueId CScriptCameraWaypoint::GetRandomNextWaypointId(const CStateManager& mgr) const { +TUniqueId CScriptCameraWaypoint::NextWaypoint(CStateManager& mgr) { rstl::vector< TUniqueId > candidateIds; rstl::vector< SConnection >::const_iterator conn = GetConnectionList().begin(); @@ -47,8 +47,7 @@ TUniqueId CScriptCameraWaypoint::GetRandomNextWaypointId(const CStateManager& mg return candidateIds[mgr.Random()->Range(0, s32(candidateIds.size() - 1))]; } -void CScriptCameraWaypoint::AddToRenderer(const CFrustumPlanes&, - const CStateManager&) const {} +void CScriptCameraWaypoint::AddToRenderer(const CFrustumPlanes&, const CStateManager&) const {} void CScriptCameraWaypoint::Render(const CStateManager&) const {} diff --git a/src/MetroidPrime/ScriptObjects/CScriptEMPulse.cpp b/src/MetroidPrime/ScriptObjects/CScriptEMPulse.cpp index feaba972..e8cc6ca0 100644 --- a/src/MetroidPrime/ScriptObjects/CScriptEMPulse.cpp +++ b/src/MetroidPrime/ScriptObjects/CScriptEMPulse.cpp @@ -33,7 +33,7 @@ void CScriptEMPulse::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId uid, CS case kSM_Activate: x114_particleGen = - new CElementGen(x108_particleDesc, CElementGen::kMOT_Normal, CElementGen::kOSF_One); + rs_new CElementGen(x108_particleDesc, CElementGen::kMOT_Normal, CElementGen::kOSF_One); x114_particleGen->SetOrientation(GetTransform().GetRotation()); x114_particleGen->SetGlobalTranslation(GetTranslation()); diff --git a/src/MetroidPrime/ScriptObjects/CScriptPlatform.cpp b/src/MetroidPrime/ScriptObjects/CScriptPlatform.cpp index 686e95cf..8d4d691e 100644 --- a/src/MetroidPrime/ScriptObjects/CScriptPlatform.cpp +++ b/src/MetroidPrime/ScriptObjects/CScriptPlatform.cpp @@ -98,7 +98,7 @@ CScriptPlatform::CScriptPlatform( AnimationData()->SetIsAnimating(true); } if (x304_treeGroupContainer) { - x314_treeGroup = new CCollidableOBBTreeGroup(**x304_treeGroupContainer, GetMaterialList()); + x314_treeGroup = rs_new CCollidableOBBTreeGroup(**x304_treeGroupContainer, GetMaterialList()); } } diff --git a/src/MetroidPrime/ScriptObjects/CScriptProjectedShadow.cpp b/src/MetroidPrime/ScriptObjects/CScriptProjectedShadow.cpp index b00f6e60..439d9f53 100644 --- a/src/MetroidPrime/ScriptObjects/CScriptProjectedShadow.cpp +++ b/src/MetroidPrime/ScriptObjects/CScriptProjectedShadow.cpp @@ -53,7 +53,7 @@ void CScriptShadowProjector::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId case kSM_Activate: if (GetActive() && x104_target != kInvalidUniqueId && xfc_opacity > 0.f) { x108_projectedShadow = - new CProjectedShadow(x10c_textureSize, x10c_textureSize, GetPersistent()); + rs_new CProjectedShadow(x10c_textureSize, x10c_textureSize, GetPersistent()); } else { x108_projectedShadow = nullptr; } diff --git a/src/MetroidPrime/ScriptObjects/CScriptSpawnPoint.cpp b/src/MetroidPrime/ScriptObjects/CScriptSpawnPoint.cpp index c4ca5897..8eeb8236 100644 --- a/src/MetroidPrime/ScriptObjects/CScriptSpawnPoint.cpp +++ b/src/MetroidPrime/ScriptObjects/CScriptSpawnPoint.cpp @@ -34,8 +34,8 @@ void CScriptSpawnPoint::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId objI case kSM_Reset: for (int i = 0; i < CPlayerState::kIT_Max; ++i) { const CPlayerState::EItemType e = CPlayerState::EItemType(i); - stateMgr.PlayerState()->ReInitializePowerUp(e, GetPowerup(e)); - stateMgr.PlayerState()->ResetAndIncrPickUp(e, GetPowerup(e)); + stateMgr.PlayerState()->SetPowerUp(e, GetPowerup(e)); + stateMgr.PlayerState()->SetPickup(e, GetPowerup(e)); } case kSM_SetToZero: diff --git a/src/MetroidPrime/ScriptObjects/CScriptSpecialFunction.cpp b/src/MetroidPrime/ScriptObjects/CScriptSpecialFunction.cpp index 4acef1ef..7f2f3ef8 100644 --- a/src/MetroidPrime/ScriptObjects/CScriptSpecialFunction.cpp +++ b/src/MetroidPrime/ScriptObjects/CScriptSpecialFunction.cpp @@ -302,7 +302,7 @@ void CScriptSpecialFunction::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId case kSF_MissileStation: { if (msg == kSM_Action) { CPlayerState& pState = *mgr.PlayerState(); - pState.ResetAndIncrPickUp(CPlayerState::kIT_Missiles, + pState.SetPickup(CPlayerState::kIT_Missiles, pState.GetItemCapacity(CPlayerState::kIT_Missiles)); } break; @@ -310,7 +310,7 @@ void CScriptSpecialFunction::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId case kSF_PowerBombStation: { if (msg == kSM_Action) { CPlayerState& pState = *mgr.PlayerState(); - pState.ResetAndIncrPickUp(CPlayerState::kIT_PowerBombs, + pState.SetPickup(CPlayerState::kIT_PowerBombs, pState.GetItemCapacity(CPlayerState::kIT_PowerBombs)); } break; @@ -875,7 +875,7 @@ void CScriptSpecialFunction::ThinkSpinnerController(float dt, CStateManager& mgr } const CAnimData* animData = plat->GetAnimationData(); - const float dur = animData->GetAnimationDuration(animData->GetDefaultAnimation()) * x138_; + const float dur = animData->GetAnimationDuration(animData->GetCurrentAnimation()) * x138_; plat->AnimationData()->SetPhase(0.f); plat->AnimationData()->SetPlaybackRate(1.f); CAdvancementDeltas deltas = plat->UpdateAnimation(dur, mgr, true); diff --git a/src/MetroidPrime/ScriptObjects/CScriptVisorGoo.cpp b/src/MetroidPrime/ScriptObjects/CScriptVisorGoo.cpp index 0c2e1e42..c8c04ce4 100644 --- a/src/MetroidPrime/ScriptObjects/CScriptVisorGoo.cpp +++ b/src/MetroidPrime/ScriptObjects/CScriptVisorGoo.cpp @@ -85,7 +85,7 @@ void CScriptVisorGoo::Think(float, CStateManager& mgr) { const float t = (x108_maxDist - eyeToGooDist) / (x108_maxDist - x104_minDist); float prob = t * x10c_nearProb + (1.0f - t) * x110_farProb; if (mgr.Random()->Float() * 100.f <= prob) { - mgr.AddObject(new CHUDBillboardEffect( + mgr.AddObject(rs_new CHUDBillboardEffect( xfc_particleId != kInvalidAssetId ? rstl::optional_object< TToken< CGenDescription > >(xe8_particleDesc) : rstl::optional_object_null(), diff --git a/src/MetroidPrime/Tweaks/CTweaks.cpp b/src/MetroidPrime/Tweaks/CTweaks.cpp index 47860496..acb5a7c1 100644 --- a/src/MetroidPrime/Tweaks/CTweaks.cpp +++ b/src/MetroidPrime/Tweaks/CTweaks.cpp @@ -64,13 +64,13 @@ void CTweaks::RegisterTweaks() { { rstl::auto_ptr< CInputStream > stream = resFactory->GetResLoader().LoadNewResourceSync( SObjectTag('CTWK', IDFromFactory(*resFactory, "Particle")), nullptr); - gpTweakParticle = new CTweakParticle(*stream); + gpTweakParticle = rs_new CTweakParticle(*stream); mTweakObjects[2] = gpTweakParticle; } { rstl::auto_ptr< CInputStream > stream = resFactory->GetResLoader().LoadNewResourceSync( SObjectTag('CTWK', IDFromFactory(*resFactory, "Player")), nullptr); - gpTweakPlayer = new CTweakPlayer(*stream); + gpTweakPlayer = rs_new CTweakPlayer(*stream); mTweakObjects[0] = gpTweakPlayer; } { @@ -82,67 +82,67 @@ void CTweaks::RegisterTweaks() { { rstl::auto_ptr< CInputStream > stream = resFactory->GetResLoader().LoadNewResourceSync( SObjectTag('CTWK', IDFromFactory(*resFactory, "Ball")), nullptr); - gpTweakBall = new CTweakBall(*stream); + gpTweakBall = rs_new CTweakBall(*stream); mTweakObjects[7] = gpTweakBall; } { rstl::auto_ptr< CInputStream > stream = resFactory->GetResLoader().LoadNewResourceSync( SObjectTag('CTWK', IDFromFactory(*resFactory, "PlayerGun")), nullptr); - gpTweakPlayerGun = new CTweakPlayerGun(*stream); + gpTweakPlayerGun = rs_new CTweakPlayerGun(*stream); mTweakObjects[4] = gpTweakPlayerGun; } { rstl::auto_ptr< CInputStream > stream = resFactory->GetResLoader().LoadNewResourceSync( SObjectTag('CTWK', IDFromFactory(*resFactory, "Targeting")), nullptr); - gpTweakTargeting = new CTweakTargeting(*stream); + gpTweakTargeting = rs_new CTweakTargeting(*stream); mTweakObjects[8] = gpTweakTargeting; } { rstl::auto_ptr< CInputStream > stream = resFactory->GetResLoader().LoadNewResourceSync( SObjectTag('CTWK', IDFromFactory(*resFactory, "Game")), nullptr); - gpTweakGame = new CTweakGame(*stream); + gpTweakGame = rs_new CTweakGame(*stream); mTweakObjects[1] = gpTweakGame; } { rstl::auto_ptr< CInputStream > stream = resFactory->GetResLoader().LoadNewResourceSync( SObjectTag('CTWK', IDFromFactory(*resFactory, "GuiColors")), nullptr); - gpTweakGuiColors = new CTweakGuiColors(*stream); + gpTweakGuiColors = rs_new CTweakGuiColors(*stream); mTweakObjects[6] = gpTweakGuiColors; } { rstl::auto_ptr< CInputStream > stream = resFactory->GetResLoader().LoadNewResourceSync( SObjectTag('CTWK', IDFromFactory(*resFactory, "AutoMapper")), nullptr); - gpTweakAutoMapper = new CTweakAutoMapper(*stream); + gpTweakAutoMapper = rs_new CTweakAutoMapper(*stream); mTweakObjects[2] = gpTweakAutoMapper; CMappableObject::ReadAutomapperTweaks(*gpTweakAutoMapper); } { rstl::auto_ptr< CInputStream > stream = resFactory->GetResLoader().LoadNewResourceSync( SObjectTag('CTWK', IDFromFactory(*resFactory, "Gui")), nullptr); - gpTweakGui = new CTweakGui(*stream); + gpTweakGui = rs_new CTweakGui(*stream); mTweakObjects[5] = gpTweakGui; } { rstl::auto_ptr< CInputStream > stream = resFactory->GetResLoader().LoadNewResourceSync( SObjectTag('CTWK', IDFromFactory(*resFactory, "PlayerControls")), nullptr); - gpTweakPlayerControlCurrent = new CTweakPlayerControl(*stream); + gpTweakPlayerControlCurrent = rs_new CTweakPlayerControl(*stream); mTweakObjects[3] = gpTweakPlayerControlCurrent; gpTweakPlayerControl1 = gpTweakPlayerControlCurrent; } { rstl::auto_ptr< CInputStream > stream = resFactory->GetResLoader().LoadNewResourceSync( SObjectTag('CTWK', IDFromFactory(*resFactory, "PlayerControls2")), nullptr); - gpTweakPlayerControl2 = new CTweakPlayerControl(*stream); + gpTweakPlayerControl2 = rs_new CTweakPlayerControl(*stream); mTweakObjects[13] = gpTweakPlayerControl2; } { rstl::auto_ptr< CInputStream > stream = resFactory->GetResLoader().LoadNewResourceSync( SObjectTag('CTWK', IDFromFactory(*resFactory, "SlideShow")), nullptr); - gpTweakSlideShow = new CTweakSlideShow(*stream); + gpTweakSlideShow = rs_new CTweakSlideShow(*stream); mTweakObjects[12] = gpTweakSlideShow; } } @@ -152,14 +152,14 @@ void CTweaks::RegisterResourceTweaks() { if (gpTweakGunRes == nullptr) { rstl::auto_ptr< CInputStream > stream = resFactory->GetResLoader().LoadNewResourceSync( SObjectTag('CTWK', IDFromFactory(*resFactory, "GunRes")), nullptr); - gpTweakGunRes = new CTweakGunRes(*stream); + gpTweakGunRes = rs_new CTweakGunRes(*stream); mTweakObjects[10] = gpTweakGunRes; } if (gpTweakPlayerRes == nullptr) { rstl::auto_ptr< CInputStream > stream = resFactory->GetResLoader().LoadNewResourceSync( SObjectTag('CTWK', IDFromFactory(*resFactory, "PlayerRes")), nullptr); - gpTweakPlayerRes = new CTweakPlayerRes(*stream); + gpTweakPlayerRes = rs_new CTweakPlayerRes(*stream); mTweakObjects[11] = gpTweakPlayerRes; } } diff --git a/src/MetroidPrime/Weapons/CElectricBeamProjectile.cpp b/src/MetroidPrime/Weapons/CElectricBeamProjectile.cpp index b1388625..79701af9 100644 --- a/src/MetroidPrime/Weapons/CElectricBeamProjectile.cpp +++ b/src/MetroidPrime/Weapons/CElectricBeamProjectile.cpp @@ -18,9 +18,9 @@ CElectricBeamProjectile::CElectricBeamProjectile(const TToken< CWeaponDescriptio : CBeamProjectile(wDesc, rstl::string_l("ElectricBeamProjectile"), wType, xf, elec.x8_maxLength, elec.xc_radius, elec.x10_travelSpeed, matTypes, dInfo, uid, areaId, owner, attribs, false) -, x468_electric(new CParticleElectric(elec.x0_electricDescription)) +, x468_electric(rs_new CParticleElectric(elec.x0_electricDescription)) , x46c_genDescription(gpSimplePool->GetObj(SObjectTag('PART', elec.x14_particleId))) -, x478_elementGen(new CElementGen(x46c_genDescription)) +, x478_elementGen(rs_new CElementGen(x46c_genDescription)) , x47c_fadeSpeed(elec.x18_fadeSpeed) , x484_damageTimer(0.f) , x488_damageInterval(elec.x1c_damageInterval) diff --git a/src/MetroidPrime/Weapons/CGunWeapon.cpp b/src/MetroidPrime/Weapons/CGunWeapon.cpp index c6eec6ba..94bb8b11 100644 --- a/src/MetroidPrime/Weapons/CGunWeapon.cpp +++ b/src/MetroidPrime/Weapons/CGunWeapon.cpp @@ -111,7 +111,7 @@ const SWeaponInfo& CGunWeapon::GetWeaponInfo() const { void CGunWeapon::LoadMuzzleFx(float dt) { for (int i = 0; i < x16c_muzzleEffects.capacity(); ++i) { - CElementGen* newElement = new CElementGen(x16c_muzzleEffects[i]); + CElementGen* newElement = rs_new CElementGen(x16c_muzzleEffects[i]); newElement->SetParticleEmission(false); newElement->Update(dt); x1a4_muzzleGenerators.push_back(newElement); @@ -130,7 +130,7 @@ void CGunWeapon::LoadGunModels(CStateManager& mgr) { LoadSuitArm(mgr); x10_solidModelData->SetSortThermal(true); x60_holoModelData->SetSortThermal(true); - x100_gunController = new CGunController(*x10_solidModelData); + x100_gunController = rs_new CGunController(*x10_solidModelData); } void CGunWeapon::LoadProjectileData(CStateManager& mgr) { @@ -299,7 +299,7 @@ void CGunWeapon::ActivateCharge(bool enable, bool resetEffect) { x208_muzzleEffectIdx = !!enable; if (enable || resetEffect) { x1a4_muzzleGenerators[x208_muzzleEffectIdx] = - new CElementGen(x16c_muzzleEffects[x208_muzzleEffectIdx]); + rs_new CElementGen(x16c_muzzleEffects[x208_muzzleEffectIdx]); } } @@ -406,7 +406,7 @@ void CGunWeapon::Fire(bool underwater, float dt, CPlayerState::EChargeStage char if (chargeState != CPlayerState::kCS_Normal) attribs = kPA_ArmCannon | kPA_Charged; - CEnergyProjectile* proj = new CEnergyProjectile( + CEnergyProjectile* proj = rs_new CEnergyProjectile( true, x144_weapons[chargeState], x1c0_weaponType, xf, x1c8_playerMaterial, dInfo, mgr.AllocateUniqueId(), kInvalidAreaId, GetPlayerId(), homingTarget, particleChargeAttribs | attribs, underwater, scale, rstl::optional_object_null(), @@ -672,13 +672,13 @@ void CGunWeapon::EnableFrozenEffect(EFrozenFxType type) { case kFFT_Thawed: if (x204_frozenEffect == kFFT_Thawed) break; - x1b8_frozenGenerator = new CElementGen(x188_frozenEffects[1]); + x1b8_frozenGenerator = rs_new CElementGen(x188_frozenEffects[1]); x1b8_frozenGenerator->SetGlobalScale(x4_scale); break; case kFFT_Frozen: if (x204_frozenEffect == kFFT_Frozen) break; - x1b8_frozenGenerator = new CElementGen(x188_frozenEffects[0]); + x1b8_frozenGenerator = rs_new CElementGen(x188_frozenEffects[0]); x1b8_frozenGenerator->SetGlobalScale(x4_scale); break; default: diff --git a/src/MetroidPrime/Weapons/CIceBeam.cpp b/src/MetroidPrime/Weapons/CIceBeam.cpp index be709155..79de448a 100644 --- a/src/MetroidPrime/Weapons/CIceBeam.cpp +++ b/src/MetroidPrime/Weapons/CIceBeam.cpp @@ -80,7 +80,7 @@ void CIceBeam::Update(float dt, CStateManager& mgr) { if (!x248_24_loaded) { x248_24_loaded = x21c_iceSmoke.IsLoaded() && x228_ice2nd1.IsLoaded() && x234_ice2nd2.IsLoaded(); if (x248_24_loaded) { - x240_smokeGen = new CElementGen(x21c_iceSmoke); + x240_smokeGen = rs_new CElementGen(x21c_iceSmoke); x240_smokeGen->SetGlobalScale(x4_scale); x240_smokeGen->SetParticleEmission(false); } @@ -127,14 +127,14 @@ void CIceBeam::EnableSecondaryFx(ESecondaryFxType type) { case kSFT_ToCombo: case kSFT_CancelCharge: if (!x248_25_inEndFx) { - x244_chargeFx = new CElementGen(x234_ice2nd2); + x244_chargeFx = rs_new CElementGen(x234_ice2nd2); x244_chargeFx->SetGlobalScale(x4_scale); x248_25_inEndFx = true; x1cc_enabledSecondaryEffect = kSFT_CancelCharge; } break; case kSFT_Charge: - x244_chargeFx = new CElementGen(x228_ice2nd1); + x244_chargeFx = rs_new CElementGen(x228_ice2nd1); x244_chargeFx->SetGlobalScale(x4_scale); x1cc_enabledSecondaryEffect = type; x248_25_inEndFx = false; diff --git a/src/MetroidPrime/Weapons/CTargetableProjectile.cpp b/src/MetroidPrime/Weapons/CTargetableProjectile.cpp index e1a22ca9..3cb1adb7 100644 --- a/src/MetroidPrime/Weapons/CTargetableProjectile.cpp +++ b/src/MetroidPrime/Weapons/CTargetableProjectile.cpp @@ -35,7 +35,7 @@ bool CTargetableProjectile::Explode(const CVector3f& pos, const CVector3f& norma TUniqueId uid = mgr.AllocateUniqueId(); CVector3f aimPosition = act->GetAimPosition(mgr, 0.f); - CEnergyProjectile* projectile = new CEnergyProjectile( + CEnergyProjectile* projectile = rs_new CEnergyProjectile( true, x3d8_weaponDesc, GetWeaponType(), CTransform4f::LookAt(x170_projectile.GetTranslation(), aimPosition, CVector3f::Up()), kMT_Player, x3e0_damage, uid, GetCurrentAreaId(), GetHitProjectileOwner(), GetOwnerId(), diff --git a/src/MetroidPrime/Weapons/CWaveBeam.cpp b/src/MetroidPrime/Weapons/CWaveBeam.cpp index f166297e..21d8d89d 100644 --- a/src/MetroidPrime/Weapons/CWaveBeam.cpp +++ b/src/MetroidPrime/Weapons/CWaveBeam.cpp @@ -101,7 +101,7 @@ void CWaveBeam::Fire(bool underwater, float dt, CPlayerState::EChargeStage charg for (int i = 0; i < 3; ++i) { CTransform4f shotXf = xf * CTransform4f::RotateY(CRelAngle::FromDegrees((randAng + i) * skShotAnglePitch)); - CEnergyProjectile* proj = new CEnergyProjectile( + CEnergyProjectile* proj = rs_new CEnergyProjectile( true, x144_weapons[chargeState], GetWeaponType(), shotXf, GetPlayerMaterial(), GetDamageInfo(mgr, chargeState, chargeFactor1), mgr.AllocateUniqueId(), kInvalidAreaId, GetPlayerId(), homingTarget, kPA_ArmCannon, underwater, CVector3f(1.f, 1.f, 1.f), @@ -151,7 +151,7 @@ void CWaveBeam::EnableSecondaryFx(ESecondaryFxType type) { default: if (x1cc_enabledSecondaryEffect != kSFT_ToCombo) { CToken fx = type == kSFT_Charge ? x228_wave2nd1 : x234_wave2nd2; - x250_chargeElec = new CParticleElectric(fx); + x250_chargeElec = rs_new CParticleElectric(fx); x250_chargeElec->SetGlobalScale(x4_scale); } switch (type) { @@ -167,7 +167,7 @@ void CWaveBeam::EnableSecondaryFx(ESecondaryFxType type) { } break; case kSFT_ToCombo: - x254_chargeFx = new CElementGen(x240_wave2nd3); + x254_chargeFx = rs_new CElementGen(x240_wave2nd3); x254_chargeFx->SetGlobalScale(x4_scale); x24c_effectTimer = 0.f; x258_25_effectTimerActive = true; diff --git a/src/MetroidPrime/main.cpp b/src/MetroidPrime/main.cpp index eb189a75..f10f40db 100644 --- a/src/MetroidPrime/main.cpp +++ b/src/MetroidPrime/main.cpp @@ -209,8 +209,8 @@ void CMain::ShutdownSubsystems() { CGameGlobalObjects::CGameGlobalObjects(COsContext& osContext, CMemorySys& memorySys) : xcc_simplePool(x4_resFactory) , x130_graphicsSys(osContext, memorySys, GRAPHICS_FIFO_SIZE, sGraphicsFifo) -, x134_gameState(new CGameState()) -, x150_inGameTweakManager(new CInGameTweakManager()) +, x134_gameState(rs_new CGameState()) +, x150_inGameTweakManager(rs_new CInGameTweakManager()) , x154_defaultFont(LoadDefaultFont()) { gpResourceFactory = &x4_resFactory; gpSimplePool = &xcc_simplePool; @@ -397,11 +397,11 @@ const uchar sDefaultFontTexture[] = { }; CRasterFont* CGameGlobalObjects::LoadDefaultFont() { - CZipInputStream fontDataStream(new CMemoryInStream(sDefaultFontData, sizeof(sDefaultFontData))); - CRasterFont* font = new CRasterFont(fontDataStream, nullptr); + CZipInputStream fontDataStream(rs_new CMemoryInStream(sDefaultFontData, sizeof(sDefaultFontData))); + CRasterFont* font = rs_new CRasterFont(fontDataStream, nullptr); CZipInputStream fontTextureStream( - new CMemoryInStream(sDefaultFontTexture, sizeof(sDefaultFontTexture))); - font->SetTexture(new CTexture(fontTextureStream, CTexture::kAM_Zero, CTexture::kBK_Zero)); + rs_new CMemoryInStream(sDefaultFontTexture, sizeof(sDefaultFontTexture))); + font->SetTexture(rs_new CTexture(fontTextureStream, CTexture::kAM_Zero, CTexture::kBK_Zero)); return font; } @@ -450,12 +450,12 @@ CGameArchitectureSupport::CGameArchitectureSupport(COsContext& osContext) gpMain->SetMaxSpeed(false); gpMain->ResetGameState(); if (!gpTweakGame->GetSplashScreensDisabled()) { - x58_ioWinMgr.AddIOWin(new CSplashScreen(CSplashScreen::Nintendo), 1000, 10000); + x58_ioWinMgr.AddIOWin(rs_new CSplashScreen(CSplashScreen::Nintendo), 1000, 10000); } - x58_ioWinMgr.AddIOWin(new CMainFlow(), 0, 0); - x58_ioWinMgr.AddIOWin(new CConsoleOutputWindow(8, 5.f, 0.75f), 100, 0); - x58_ioWinMgr.AddIOWin(new CAudioStateWin(), 100, -1); - x58_ioWinMgr.AddIOWin(new CErrorOutputWindow(false), 10000, 100000); + x58_ioWinMgr.AddIOWin(rs_new CMainFlow(), 0, 0); + x58_ioWinMgr.AddIOWin(rs_new CConsoleOutputWindow(8, 5.f, 0.75f), 100, 0); + x58_ioWinMgr.AddIOWin(rs_new CAudioStateWin(), 100, -1); + x58_ioWinMgr.AddIOWin(rs_new CErrorOutputWindow(false), 10000, 100000); InitializeApplicationUI(x44_guiSys); CGuiSys::SetGlobalGuiSys(&x44_guiSys); gpController = x30_inputGenerator.GetController(); @@ -481,7 +481,7 @@ void CMain::StreamNewGameState(CInputStream& in, int saveIdx) { bool hasFusion = gpGameState->SystemOptions().GetHasFusion(); x128_gameGlobalObjects->GameState() = nullptr; gpGameState = nullptr; - x128_gameGlobalObjects->GameState() = new CGameState(in, saveIdx); + x128_gameGlobalObjects->GameState() = rs_new CGameState(in, saveIdx); gpGameState = x128_gameGlobalObjects->GameState().get(); gpGameState->SystemOptions().SetHasFusion(hasFusion); gpGameState->PlayerState()->SetIsFusionEnabled(gpGameState->SystemOptions().GetHasFusion()); @@ -499,7 +499,7 @@ void CMain::RefreshGameState() { gpGameState = nullptr; { CMemoryInStream stream(backupBuf.data(), backupBuf.size(), CMemoryInStream::kOS_Owned); - x128_gameGlobalObjects->GameState() = new CGameState(stream, saveIdx); + x128_gameGlobalObjects->GameState() = rs_new CGameState(stream, saveIdx); } gpGameState = x128_gameGlobalObjects->GameState().get(); gpGameState->SystemOptions() = systemOptions; @@ -564,7 +564,7 @@ int CMain::RsMain(int argc, const char* const* argv) { LCEnable(); rstl::single_ptr< CGameGlobalObjects > gameGlobalObjects( - new CGameGlobalObjects(x0_osContext, x6d_memorySys)); + rs_new CGameGlobalObjects(x0_osContext, x6d_memorySys)); x128_gameGlobalObjects = gameGlobalObjects.get(); for (int i = 0; i < 4; ++i) { @@ -593,7 +593,7 @@ int CMain::RsMain(int argc, const char* const* argv) { FillInAssetIDs(); rstl::single_ptr< CGameArchitectureSupport > archSupport( - new CGameArchitectureSupport(x0_osContext)); + rs_new CGameArchitectureSupport(x0_osContext)); x164_ = archSupport.get(); archSupport->PreloadAudio(); @@ -680,7 +680,7 @@ int CMain::RsMain(int argc, const char* const* argv) { sub_8036ccfc(); archSupport = nullptr; - CGameArchitectureSupport* tmp = new CGameArchitectureSupport(x0_osContext); + CGameArchitectureSupport* tmp = rs_new CGameArchitectureSupport(x0_osContext); archSupport = tmp; x164_ = archSupport.get(); tmp->PreloadAudio(); @@ -724,7 +724,7 @@ void CMain::ResetGameState() { CGameOptions gameOptions = gpGameState->GameOptions(); x128_gameGlobalObjects->GameState() = nullptr; gpGameState = nullptr; - x128_gameGlobalObjects->GameState() = new CGameState(); + x128_gameGlobalObjects->GameState() = rs_new CGameState(); gpGameState = x128_gameGlobalObjects->GameState().get(); gpGameState->SystemOptions() = persistentOptions; gpGameState->GameOptions() = gameOptions;