diff --git a/include/Kyoto/Alloc/CMemory.hpp b/include/Kyoto/Alloc/CMemory.hpp index 6f649688..aa2cb55b 100644 --- a/include/Kyoto/Alloc/CMemory.hpp +++ b/include/Kyoto/Alloc/CMemory.hpp @@ -29,8 +29,7 @@ void* operator new(size_t sz, const char*, const char*); void* operator new[](size_t sz, const char*, const char*); // TODO remove -inline void* operator new(size_t sz) { return operator new(sz, "??(??)", nullptr); } -inline void* operator new[](size_t sz) { return operator new[](sz, "??(??)", nullptr); } +//inline void* operator new(size_t sz) { return operator new(sz, "??(??)", nullptr); } #else /*__attribute__((weak)) void* operator new(size_t sz) { return operator new(sz, "??(??)", nullptr); } __attribute__((weak)) void* operator new[](size_t sz) { @@ -44,7 +43,7 @@ inline void* operator new(size_t n, void* ptr) { return ptr; }; #ifdef __MWERKS__ inline void operator delete(void* ptr) { CMemory::Free(ptr); } inline void operator delete[](void* ptr) { CMemory::Free(ptr); } -#define NEW new ("??(??)", nullptr) +#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); } diff --git a/include/Kyoto/IObj.hpp b/include/Kyoto/IObj.hpp index 8209e97d..5cf8eb8b 100644 --- a/include/Kyoto/IObj.hpp +++ b/include/Kyoto/IObj.hpp @@ -38,11 +38,11 @@ public: T* Owned() { return static_cast< T* >(m_objPtr); } static rstl::auto_ptr< TObjOwnerDerivedFromIObj< T > > GetNewDerivedObject(T* obj) { - return new TObjOwnerDerivedFromIObj< T >(obj); + return rs_new TObjOwnerDerivedFromIObj< T >(obj); } static rstl::auto_ptr< TObjOwnerDerivedFromIObj< T > > GetNewDerivedObject(const rstl::auto_ptr< T >& obj) { - return new TObjOwnerDerivedFromIObj< T >(obj); + return rs_new TObjOwnerDerivedFromIObj< T >(obj); } private: diff --git a/include/rstl/rc_ptr.hpp b/include/rstl/rc_ptr.hpp index 707d79fb..5c7c2281 100644 --- a/include/rstl/rc_ptr.hpp +++ b/include/rstl/rc_ptr.hpp @@ -2,6 +2,7 @@ #define _RSTL_RC_PTR #include "types.h" +#include "rstl/rmemory_allocator.hpp" namespace rstl { class CRefData { @@ -25,7 +26,7 @@ template < typename T > class rc_ptr { public: rc_ptr() : x0_refData(&CRefData::sNull) { x0_refData->AddRef(); } - rc_ptr(const T* ptr) : x0_refData(new CRefData(ptr)) {} + rc_ptr(const T* ptr) : x0_refData(rs_new CRefData(ptr)) {} rc_ptr(const rc_ptr& other) : x0_refData(other.x0_refData) { x0_refData->AddRef(); } ~rc_ptr() { ReleaseData(); } T* GetPtr() const { return static_cast< T* >(x0_refData->GetPtr()); } diff --git a/include/rstl/rmemory_allocator.hpp b/include/rstl/rmemory_allocator.hpp index e8a72fe5..a23ffbe1 100644 --- a/include/rstl/rmemory_allocator.hpp +++ b/include/rstl/rmemory_allocator.hpp @@ -15,7 +15,7 @@ struct rmemory_allocator { if (size == 0) { out = nullptr; } else { - out = reinterpret_cast< T* >(NEW uchar[size]); + out = reinterpret_cast< T* >(rs_new uchar[size]); } } // TODO: this fixes a regswap in vector::reserve @@ -25,7 +25,7 @@ struct rmemory_allocator { if (size == 0) { return nullptr; } else { - return reinterpret_cast< T* >(NEW uchar[size]); + return reinterpret_cast< T* >(rs_new uchar[size]); } } template < typename T > diff --git a/src/GuiSys/CGuiLight.cpp b/src/GuiSys/CGuiLight.cpp index a25b6d39..524add73 100644 --- a/src/GuiSys/CGuiLight.cpp +++ b/src/GuiSys/CGuiLight.cpp @@ -25,20 +25,20 @@ CGuiLight* CGuiLight::Create(CGuiFrame* parent, CInputStream& in, IObjectStore* lt.SetAngleAttenuation(angC, angL, angQ); lt.SetLightId(lightId); - ret = new CGuiLight(parms, lt); + ret = rs_new CGuiLight(parms, lt); break; } case kLT_Point: { CLight lt = CLight::BuildPoint(CVector3f::Zero(), color); lt.SetAttenuation(distC, distL, distQ); lt.SetLightId(lightId); - ret = new CGuiLight(parms, lt); + ret = rs_new CGuiLight(parms, lt); break; } case kLT_Directional: { CLight lt = CLight::BuildDirectional(CVector3f::Zero(), color); lt.SetLightId(lightId); - ret = new CGuiLight(parms, lt); + ret = rs_new CGuiLight(parms, lt); break; } default: diff --git a/src/GuiSys/CGuiSys.cpp b/src/GuiSys/CGuiSys.cpp index c0b376e9..3d214148 100644 --- a/src/GuiSys/CGuiSys.cpp +++ b/src/GuiSys/CGuiSys.cpp @@ -10,8 +10,8 @@ CGuiSys* CGuiSys::spGuiSys = nullptr; CGuiSys::CGuiSys(IFactory* factory, CSimplePool* pool, EUsageMode mode) : x0_resFactory(factory), x4_resStore(pool), x8_mode(mode) { AddFactories(x8_mode); - xc_textExecuteBuffer = new CTextExecuteBuffer(); - x10_textParser = new CTextParser(*pool); + xc_textExecuteBuffer = rs_new CTextExecuteBuffer(); + x10_textParser = rs_new CTextParser(*pool); CGuiTextSupport::Initialize(xc_textExecuteBuffer.get(), x10_textParser.get()); } diff --git a/src/Kyoto/CDependencyGroup.cpp b/src/Kyoto/CDependencyGroup.cpp index 4ff9624c..0f9559fb 100644 --- a/src/Kyoto/CDependencyGroup.cpp +++ b/src/Kyoto/CDependencyGroup.cpp @@ -36,5 +36,5 @@ CFactoryFnReturn::CFactoryFnReturn(CDependencyGroup* ptr) CFactoryFnReturn FDependencyGroupFactory(const SObjectTag& tag, CInputStream& in, const CVParamTransfer& xfer) { - return new CDependencyGroup(in); + return rs_new CDependencyGroup(in); } diff --git a/src/Kyoto/CToken.cpp b/src/Kyoto/CToken.cpp index 9db836a6..da49dae5 100644 --- a/src/Kyoto/CToken.cpp +++ b/src/Kyoto/CToken.cpp @@ -6,7 +6,7 @@ CToken::CToken(CObjectReference* ref) : x0_objRef(ref), x4_lockHeld(false) { } CToken::CToken(IObj* obj) -: x0_objRef(NEW CObjectReference(obj)), x4_lockHeld(false) { +: x0_objRef(rs_new CObjectReference(obj)), x4_lockHeld(false) { x0_objRef->AddReference(); Lock(); } diff --git a/src/Kyoto/DolphinCDvdFile.cpp b/src/Kyoto/DolphinCDvdFile.cpp index 77d7f61e..1f969bf3 100644 --- a/src/Kyoto/DolphinCDvdFile.cpp +++ b/src/Kyoto/DolphinCDvdFile.cpp @@ -127,7 +127,7 @@ void CDvdFile::TryARAMFile() { if (CARAMManager::GetInvalidAlloc() == x4_) { return; } - xc_ = NEW CDvdFileARAM(); + xc_ = rs_new CDvdFileARAM(); CDvdFileARAM* arfile = xc_.get(); arfile->x5c_file = this; arfile->x78_ = true; @@ -254,10 +254,10 @@ CDvdRequest* CDvdFile::AsyncSeekRead(void* dest, uint len, ESeekOrigin origin, i if (x8_) { int roundedLen = (len + 31) & ~31; DCFlushRange(dest, roundedLen); - request = NEW CARAMDvdRequest( + request = rs_new CARAMDvdRequest( CARAMManager::DMAToMRAM(x4_ + x10_offset, dest, roundedLen, CARAMManager::kDMAPrio_One)); } else { - CRealDvdRequest* req = NEW CRealDvdRequest(); + CRealDvdRequest* req = rs_new CRealDvdRequest(); DVDFileInfo* info = req->FileInfo(); DVDFastOpen(x0_fileEntry, info); DVDReadAsync(info, dest, (len + 31) & ~31, x10_offset, internalCallback); diff --git a/src/Kyoto/Input/DolphinIController.cpp b/src/Kyoto/Input/DolphinIController.cpp index 23e2e0ef..a7587987 100644 --- a/src/Kyoto/Input/DolphinIController.cpp +++ b/src/Kyoto/Input/DolphinIController.cpp @@ -12,7 +12,7 @@ IController::IController() {} IController::~IController() {} IController* IController::Create(const COsContext& ctx) { - CDolphinController* cont = new CDolphinController(); + CDolphinController* cont = rs_new CDolphinController(); cont->Initialize(); return cont; } diff --git a/src/Kyoto/Streams/CInputStream.cpp b/src/Kyoto/Streams/CInputStream.cpp index 9773d2d7..942d6e75 100644 --- a/src/Kyoto/Streams/CInputStream.cpp +++ b/src/Kyoto/Streams/CInputStream.cpp @@ -9,7 +9,7 @@ CInputStream::CInputStream(int len) : x4_blockOffset(0) , x8_blockLen(0) , xc_len(len) -, x10_ptr(new uchar[len]) +, x10_ptr(rs_new uchar[len]) , x14_owned(true) , x18_readPosition(0) , x1c_bitWord(0) diff --git a/src/Kyoto/Streams/COutputStream.cpp b/src/Kyoto/Streams/COutputStream.cpp index 1b5d08f8..d5e539da 100644 --- a/src/Kyoto/Streams/COutputStream.cpp +++ b/src/Kyoto/Streams/COutputStream.cpp @@ -11,7 +11,7 @@ COutputStream::COutputStream(int len) : mUnwrittenLen(0) , mBufLen(len) -, mBufPtr(len > 64 ? new uchar[len] : &mScratch[32 - (uintptr_t)(mScratch) % 31]) +, mBufPtr(len > 64 ? rs_new uchar[len] : &mScratch[32 - (uintptr_t)(mScratch) % 31]) , mNumWrites(0) , mShiftRegister(0) , mShiftRegisterOffset(32) {} diff --git a/src/Kyoto/Streams/CZipInputStream.cpp b/src/Kyoto/Streams/CZipInputStream.cpp index bd04d443..6fc3e4d4 100644 --- a/src/Kyoto/Streams/CZipInputStream.cpp +++ b/src/Kyoto/Streams/CZipInputStream.cpp @@ -3,9 +3,9 @@ CZipInputStream::CZipInputStream(rstl::auto_ptr in) : CInputStream(4096) -, mCompBuf(new uchar[4096]) +, mCompBuf(rs_new uchar[4096]) , mStream(in) -, mZStream(new z_stream_s) { +, mZStream(rs_new z_stream_s) { z_stream_s* zs = mZStream.get(); zs->next_in = mCompBuf.get(); mZStream->avail_in = 0; diff --git a/src/Kyoto/Streams/CZipSupport.cpp b/src/Kyoto/Streams/CZipSupport.cpp index 2576fa4a..398a2ec3 100644 --- a/src/Kyoto/Streams/CZipSupport.cpp +++ b/src/Kyoto/Streams/CZipSupport.cpp @@ -7,7 +7,7 @@ static char* hack() { } void* CZipSupport::Alloc(void* ptr1, uint w1, uint w2) { - return new uchar[w1 * w2]; + return rs_new uchar[w1 * w2]; } void CZipSupport::Free(void* ptr1, void* ptr2) { diff --git a/src/Kyoto/Text/CStringTable.cpp b/src/Kyoto/Text/CStringTable.cpp index c99cacbb..1d8fc9a9 100644 --- a/src/Kyoto/Text/CStringTable.cpp +++ b/src/Kyoto/Text/CStringTable.cpp @@ -30,7 +30,7 @@ CStringTable::CStringTable(CInputStream& in) : x0_stringCount(0), x4_data(NULL) } uint dataLen = in.Get(TType< uint >()); - x4_data = new uchar[dataLen]; + x4_data = rs_new uchar[dataLen]; in.ReadBytes(x4_data.get(), dataLen); } @@ -48,5 +48,5 @@ CFactoryFnReturn::CFactoryFnReturn(CStringTable* ptr) CFactoryFnReturn FStringTableFactory(const SObjectTag& tag, CInputStream& in, const CVParamTransfer& xfer) { - return new CStringTable(in); + return rs_new CStringTable(in); } diff --git a/src/MetroidPrime/CActorParameters.cpp b/src/MetroidPrime/CActorParameters.cpp index db85a210..188f24f2 100644 --- a/src/MetroidPrime/CActorParameters.cpp +++ b/src/MetroidPrime/CActorParameters.cpp @@ -118,7 +118,7 @@ uint CLightParameters::GetFramesBetweenRecalculation(ELightRecalculationOptions rstl::auto_ptr< CActorLights > CLightParameters::MakeActorLights() const { rstl::auto_ptr< CActorLights > result; if (x1c_makeLights) { - result = new CActorLights(GetFramesBetweenRecalculation(x24_lightRecalculation), + result = rs_new CActorLights(GetFramesBetweenRecalculation(x24_lightRecalculation), x2c_lightingPositionOffset, x38_maxDynamicLights, x3c_maxAreaLights, CActorLights::kDefaultPositionUpdateThreshold, x1d_ambientChannelOverflow, x28_useLightSet == 1, x20_useWorldLighting == kLO_DisableWorld); diff --git a/src/MetroidPrime/CExplosion.cpp b/src/MetroidPrime/CExplosion.cpp index 0e474281..e88cdd38 100644 --- a/src/MetroidPrime/CExplosion.cpp +++ b/src/MetroidPrime/CExplosion.cpp @@ -16,8 +16,8 @@ CExplosion::CExplosion(const TLockedToken< CGenDescription >& particle, TUniqueI const CEntityInfo& info, const rstl::string& name, const CTransform4f& xf, uint flags, const CVector3f& scale, const CColor& color) : CEffect(uid, info, active, name, xf) -, xe8_particleGen(new CElementGen(TToken< CGenDescription >(particle), CElementGen::kMOT_Normal, - flags & 0x2 ? CElementGen::kOSF_Two : CElementGen::kOSF_One)) +, xe8_particleGen(rs_new CElementGen(TToken< CGenDescription >(particle), CElementGen::kMOT_Normal, + flags & 0x2 ? CElementGen::kOSF_Two : CElementGen::kOSF_One)) , xec_explosionLight(kInvalidUniqueId) , xf0_sourceId(CToken(particle).GetTag().id) , xf4_24_renderThermalHot(flags & 0x4) @@ -36,7 +36,7 @@ CExplosion::CExplosion(const TLockedToken< CElectricDescription >& electric, TUn const CTransform4f& xf, uint flags, const CVector3f& scale, const CColor& color) : CEffect(uid, info, active, name, xf) -, xe8_particleGen(new CParticleElectric(electric)) +, xe8_particleGen(rs_new CParticleElectric(electric)) , xec_explosionLight(kInvalidUniqueId) , xf0_sourceId(CToken(electric).GetTag().id) , xf4_24_renderThermalHot(flags & 0x4) @@ -102,10 +102,10 @@ void CExplosion::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId sender, CSt if (xe8_particleGen->SystemHasLight()) { xec_explosionLight = mgr.AllocateUniqueId(); uint sourceId = xf0_sourceId; - mgr.AddObject(new CGameLight(xec_explosionLight, GetCurrentAreaId(), GetActive(), - rstl::string_l("ExplodePLight_") + GetDebugName(), - GetTransform(), GetUniqueId(), xe8_particleGen->GetLight(), - sourceId, 1, 0.f)); + mgr.AddObject(rs_new CGameLight(xec_explosionLight, GetCurrentAreaId(), GetActive(), + rstl::string_l("ExplodePLight_") + GetDebugName(), + GetTransform(), GetUniqueId(), xe8_particleGen->GetLight(), + sourceId, 1, 0.f)); } break; case kSM_Deleted: diff --git a/src/MetroidPrime/CParticleGenInfo.cpp b/src/MetroidPrime/CParticleGenInfo.cpp index 9ccb12a1..154a2067 100644 --- a/src/MetroidPrime/CParticleGenInfo.cpp +++ b/src/MetroidPrime/CParticleGenInfo.cpp @@ -27,7 +27,7 @@ TUniqueId _initializeLight(const rstl::ncrc_ptr< CParticleGen >& system, CStateM TAreaId areaId, int lightId) { if (system->SystemHasLight()) { TUniqueId ret = stateMgr.AllocateUniqueId(); - stateMgr.AddObject(new CGameLight( + stateMgr.AddObject(rs_new CGameLight( ret, areaId, false, rstl::string_l("ParticleLight"), CTransform4f(system->GetOrientation().BuildMatrix3f(), system->GetTranslation()), kInvalidUniqueId, system->GetLight(), lightId, 0, 0.f)); diff --git a/src/MetroidPrime/Decode.cpp b/src/MetroidPrime/Decode.cpp index fbefd7cb..35eea637 100644 --- a/src/MetroidPrime/Decode.cpp +++ b/src/MetroidPrime/Decode.cpp @@ -9,7 +9,7 @@ CArchitectureMessage MakeMsg::CreateCreateIOWin(EArchMsgTarget target, const int const int& pmax, CIOWin* const& iowin) { return CArchitectureMessage( target, kAM_CreateIOWin, - new CArchMsgParmInt32Int32VoidPtr(pmin, pmax, reinterpret_cast< const void* >(iowin))); + rs_new CArchMsgParmInt32Int32VoidPtr(pmin, pmax, reinterpret_cast< const void* >(iowin))); } const CArchMsgParmInt32Int32VoidPtr& MakeMsg::GetParmCreateIOWin(const CArchitectureMessage& msg) { @@ -22,7 +22,7 @@ MakeMsg::GetParmChangeIOWinPriority(const CArchitectureMessage& msg) { } CArchitectureMessage MakeMsg::CreateTimerTick(EArchMsgTarget target, const float& val) { - return CArchitectureMessage(target, kAM_TimerTick, new CArchMsgParmReal32(val)); + return CArchitectureMessage(target, kAM_TimerTick, rs_new CArchMsgParmReal32(val)); } const CArchMsgParmReal32& MakeMsg::GetParmTimerTick(const CArchitectureMessage& msg) { @@ -30,7 +30,7 @@ const CArchMsgParmReal32& MakeMsg::GetParmTimerTick(const CArchitectureMessage& } CArchitectureMessage MakeMsg::CreateUserInput(EArchMsgTarget target, const CFinalInput& input) { - return CArchitectureMessage(target, kAM_UserInput, new CArchMsgParmUserInput(input)); + return CArchitectureMessage(target, kAM_UserInput, rs_new CArchMsgParmUserInput(input)); } const CArchMsgParmUserInput& MakeMsg::GetParmUserInput(const CArchitectureMessage& msg) { @@ -44,15 +44,15 @@ const CArchMsgParmInt32& MakeMsg::GetParmNewGameflowState(const CArchitectureMes CArchitectureMessage MakeMsg::CreateControllerStatus(EArchMsgTarget target, const short& chan, const bool& connected) { return CArchitectureMessage(target, kAM_ControllerStatus, - new CArchMsgParmControllerStatus(chan, connected)); + rs_new CArchMsgParmControllerStatus(chan, connected)); } CArchitectureMessage MakeMsg::CreateQuitGameplay(EArchMsgTarget target) { - return CArchitectureMessage(target, kAM_QuitGameplay, new CArchMsgParmNull()); + return CArchitectureMessage(target, kAM_QuitGameplay, new("??(??)", nullptr) CArchMsgParmNull()); } CArchitectureMessage MakeMsg::CreateFrameBegin(EArchMsgTarget target, const int& a) { - return CArchitectureMessage(target, kAM_FrameBegin, new CArchMsgParmInt32(a)); + return CArchitectureMessage(target, kAM_FrameBegin, new("??(??)", nullptr) CArchMsgParmInt32(a)); } const CArchMsgParmInt32& MakeMsg::GetParmFrameBegin(const CArchitectureMessage& msg) { @@ -60,5 +60,5 @@ const CArchMsgParmInt32& MakeMsg::GetParmFrameBegin(const CArchitectureMessage& } CArchitectureMessage MakeMsg::CreateFrameEnd(EArchMsgTarget target, const int& a) { - return CArchitectureMessage(target, kAM_FrameEnd, new CArchMsgParmInt32(a)); + return CArchitectureMessage(target, kAM_FrameEnd, new("??(??)", nullptr) CArchMsgParmInt32(a)); } diff --git a/src/MetroidPrime/Enemies/CFlaahgraPlants.cpp b/src/MetroidPrime/Enemies/CFlaahgraPlants.cpp index af577fb6..b2ce5a94 100644 --- a/src/MetroidPrime/Enemies/CFlaahgraPlants.cpp +++ b/src/MetroidPrime/Enemies/CFlaahgraPlants.cpp @@ -12,7 +12,7 @@ CFlaahgraPlants::CFlaahgraPlants(const TToken< CGenDescription >& genDesc, const CVector3f& extents) : CActor(uid, true, "Flaahgra Plants", CEntityInfo(aId, NullConnectionList), xf, CModelData::CModelDataNull(), CMaterialList(kMT_Projectile), actParms, kInvalidUniqueId) -, xe8_elementGen(new CElementGen(genDesc)) +, xe8_elementGen(rs_new CElementGen(genDesc)) , xf0_ownerId(owner) , xf4_damageInfo(dInfo) , x12c_lastDt(0.f) @@ -81,7 +81,7 @@ void CFlaahgraPlants::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId uid, C if (x16c_colAct == kInvalidUniqueId) { x16c_colAct = mgr.AllocateUniqueId(); CVector3f extent = x130_obbox.GetSize() + CVector3f(0.f, 5.f, 10.f); - CCollisionActor* colAct = new CCollisionActor(x16c_colAct, GetCurrentAreaId(), GetUniqueId(), + CCollisionActor* colAct = rs_new CCollisionActor(x16c_colAct, GetCurrentAreaId(), GetUniqueId(), extent, CVector3f::Zero(), true, 0.001f); if (colAct != nullptr) { colAct->SetTransform(GetTransform()); diff --git a/src/MetroidPrime/Enemies/CMetroidPrimeProjectile.cpp b/src/MetroidPrime/Enemies/CMetroidPrimeProjectile.cpp index 00f421e1..16b5ad70 100644 --- a/src/MetroidPrime/Enemies/CMetroidPrimeProjectile.cpp +++ b/src/MetroidPrime/Enemies/CMetroidPrimeProjectile.cpp @@ -32,12 +32,12 @@ bool CMetroidPrimeProjectile::Explode(const CVector3f& pos, const CVector3f& nor .GetTransformedAABox(GetTransform() * CTransform4f::Scale(x3d8_auxData.GetDamageInfo().GetRadius()))); - CFire* fire = - new CFire(x3d8_auxData.x4_particle, newId, GetCurrentAreaId(), true, GetUniqueId(), - GetTransform(), x3d8_auxData.GetDamageInfo(), box, CVector3f(1.f, 1.f, 1.f), - x3d8_auxData.GetFlag_27(), x3d8_auxData.GetTexture(), x3d8_auxData.GetFlag_24(), - x3d8_auxData.GetFlag_25(), x3d8_auxData.GetFlag_26(), 1.0, - x3d8_auxData.Get_0x28(), x3d8_auxData.Get_0x2c(), x3d8_auxData.Get_0x30()); + CFire* fire = rs_new CFire( + x3d8_auxData.x4_particle, newId, GetCurrentAreaId(), true, GetUniqueId(), GetTransform(), + x3d8_auxData.GetDamageInfo(), box, CVector3f(1.f, 1.f, 1.f), x3d8_auxData.GetFlag_27(), + x3d8_auxData.GetTexture(), x3d8_auxData.GetFlag_24(), x3d8_auxData.GetFlag_25(), + x3d8_auxData.GetFlag_26(), 1.0, x3d8_auxData.Get_0x28(), x3d8_auxData.Get_0x2c(), + x3d8_auxData.Get_0x30()); if (fire) { mgr.AddObject(fire); } diff --git a/src/MetroidPrime/ScriptObjects/CScriptBeam.cpp b/src/MetroidPrime/ScriptObjects/CScriptBeam.cpp index 2c1709e5..7de52b98 100644 --- a/src/MetroidPrime/ScriptObjects/CScriptBeam.cpp +++ b/src/MetroidPrime/ScriptObjects/CScriptBeam.cpp @@ -19,7 +19,7 @@ void CScriptBeam::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId objId, CSt case kSM_Registered: { x154_projectileId = mgr.AllocateUniqueId(); - mgr.AddObject(new CPlasmaProjectile( + mgr.AddObject(rs_new CPlasmaProjectile( xe8_weaponDescription, GetDebugName() + rstl::string_l("-Projectile"), x138_damageInfo.GetWeaponMode().GetType(), xf4_beamInfo, GetTransform(), kMT_Projectile, x138_damageInfo, x154_projectileId, GetCurrentAreaId(), GetUniqueId(), diff --git a/src/MetroidPrime/ScriptObjects/CScriptMazeNode.cpp b/src/MetroidPrime/ScriptObjects/CScriptMazeNode.cpp index 4139e9ca..91b13fa6 100644 --- a/src/MetroidPrime/ScriptObjects/CScriptMazeNode.cpp +++ b/src/MetroidPrime/ScriptObjects/CScriptMazeNode.cpp @@ -318,7 +318,7 @@ void CScriptMazeNode::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId uid, C case kSM_InitializedInArea: { if (mgr.CurrentMaze() == nullptr) { rstl::single_ptr< CMazeState > maze = - new CMazeState(skEnterCol, skEnterRow, skTargetCol, skTargetRow); + rs_new CMazeState(skEnterCol, skEnterRow, skTargetCol, skTargetRow); maze->Reset(sMazeSeeds[mgr.Random()->Next() % 300]); maze->Initialize(); maze->GenerateObstacles(); diff --git a/src/MetroidPrime/ScriptObjects/CScriptPickup.cpp b/src/MetroidPrime/ScriptObjects/CScriptPickup.cpp index 085eee5a..f2e3f7b7 100644 --- a/src/MetroidPrime/ScriptObjects/CScriptPickup.cpp +++ b/src/MetroidPrime/ScriptObjects/CScriptPickup.cpp @@ -153,12 +153,11 @@ void CScriptPickup::Touch(CActor& act, CStateManager& mgr) { if (x27c_pickupParticleDesc) { if (mgr.GetPlayerState()->GetActiveVisor(mgr) != CPlayerState::kPV_Thermal) { - mgr.AddObject(new CExplosion( + mgr.AddObject(rs_new CExplosion( TLockedToken< CGenDescription >(*x27c_pickupParticleDesc), mgr.AllocateUniqueId(), true, CEntityInfo(GetCurrentAreaId(), CEntity::NullConnectionList, kInvalidEditorId), rstl::string_l("Explosion - Pickup Effect"), GetTransform(), 0, CVector3f(1.f, 1.f, 1.f), CColor::White())); - } } @@ -198,8 +197,7 @@ rstl::optional_object< CAABox > CScriptPickup::GetTouchBounds() const { return CPhysicsActor::GetBoundingBox(); } -void CScriptPickup::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId uid, - CStateManager& mgr) { +void CScriptPickup::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId uid, CStateManager& mgr) { CPhysicsActor::AcceptScriptMsg(msg, uid, mgr); } diff --git a/src/MetroidPrime/Weapons/CPlasmaBeam.cpp b/src/MetroidPrime/Weapons/CPlasmaBeam.cpp index d769212d..3005008f 100644 --- a/src/MetroidPrime/Weapons/CPlasmaBeam.cpp +++ b/src/MetroidPrime/Weapons/CPlasmaBeam.cpp @@ -161,7 +161,7 @@ void CPlasmaBeam::EnableSecondaryFx(ESecondaryFxType type) { } case kSFT_Charge: - x228_chargeFx = new CElementGen(x21c_plasma2nd1); + x228_chargeFx = rs_new CElementGen(x21c_plasma2nd1); x228_chargeFx->SetGlobalScale(x4_scale); default: diff --git a/src/MetroidPrime/Weapons/CPowerBeam.cpp b/src/MetroidPrime/Weapons/CPowerBeam.cpp index 09c8d8d7..18b0c932 100644 --- a/src/MetroidPrime/Weapons/CPowerBeam.cpp +++ b/src/MetroidPrime/Weapons/CPowerBeam.cpp @@ -96,7 +96,7 @@ void CPowerBeam::Update(float dt, CStateManager& mgr) { if (CGunWeapon::IsLoaded() && !x244_25_loaded) { x244_25_loaded = x21c_shotSmoke.IsLoaded() && x228_power2nd1.IsLoaded(); if (x244_25_loaded) { - x234_shotSmokeGen = NEW CElementGen(x21c_shotSmoke); + x234_shotSmokeGen = rs_new CElementGen(x21c_shotSmoke); x234_shotSmokeGen->SetParticleEmission(false); } } @@ -140,7 +140,7 @@ void CPowerBeam::EnableSecondaryFx(ESecondaryFxType type) { x1cc_enabledSecondaryEffect = kSFT_None; break; case kSFT_Charge: - x238_power2ndGen = NEW CElementGen(x228_power2nd1); + x238_power2ndGen = rs_new CElementGen(x228_power2nd1); x238_power2ndGen->SetGlobalScale(x4_scale); x1cc_enabledSecondaryEffect = type; break; diff --git a/src/MetroidPrime/Weapons/CPowerBomb.cpp b/src/MetroidPrime/Weapons/CPowerBomb.cpp index 10bdb318..f6056595 100644 --- a/src/MetroidPrime/Weapons/CPowerBomb.cpp +++ b/src/MetroidPrime/Weapons/CPowerBomb.cpp @@ -26,7 +26,7 @@ CPowerBomb::CPowerBomb(TToken< CGenDescription > particle, TUniqueId uid, TAreaI , x15c_curTime(0.f) , x160_curRadius(0.f) , x164_radiusIncrement(dInfo.GetRadius() / 2.5f) -, x168_particle(new CElementGen(particle)) +, x168_particle(rs_new CElementGen(particle)) , x16c_radius(dInfo.GetRadius()) { x168_particle->SetGlobalTranslation(xf.GetTranslation()); }