From 1ec5a25fa62a0422a6c3586ede5e959943a91407 Mon Sep 17 00:00:00 2001 From: Phillip Stephens Date: Mon, 23 Dec 2024 18:49:54 -0800 Subject: [PATCH] Don't access SObjectTag::mId directly, remove hack new in TOneStatic --- include/Kyoto/SObjectTag.hpp | 2 +- include/Kyoto/TOneStatic.hpp | 1 - src/MetroidPrime/CCredits.cpp | 2 +- src/MetroidPrime/CMapArea.cpp | 2 +- src/MetroidPrime/Player/CSamusFaceReflection.cpp | 2 +- src/MetroidPrime/ScriptObjects/CScriptSpecialFunction.cpp | 2 +- src/MetroidPrime/Tweaks/CTweaks.cpp | 2 +- src/MetroidPrime/Weapons/WeaponTypes.cpp | 2 +- 8 files changed, 7 insertions(+), 8 deletions(-) diff --git a/include/Kyoto/SObjectTag.hpp b/include/Kyoto/SObjectTag.hpp index 3d7a6ded..d1286795 100644 --- a/include/Kyoto/SObjectTag.hpp +++ b/include/Kyoto/SObjectTag.hpp @@ -18,7 +18,7 @@ class SObjectTag { const FourCC GetType() const { return mType; } static const char* Type2Text(FourCC type); -public: +private: FourCC mType; CAssetId mId; }; diff --git a/include/Kyoto/TOneStatic.hpp b/include/Kyoto/TOneStatic.hpp index f5439672..d413a46a 100644 --- a/include/Kyoto/TOneStatic.hpp +++ b/include/Kyoto/TOneStatic.hpp @@ -8,7 +8,6 @@ template < typename T > class TOneStatic { public: void* operator new(size_t sz, const char*, const char*); - void* operator new(size_t sz) { return operator new(sz, "\?\?(\?\?)", nullptr); } void operator delete(void* ptr); private: diff --git a/src/MetroidPrime/CCredits.cpp b/src/MetroidPrime/CCredits.cpp index 0040a6b7..6d2e237a 100644 --- a/src/MetroidPrime/CCredits.cpp +++ b/src/MetroidPrime/CCredits.cpp @@ -58,7 +58,7 @@ CIOWin::EMessageReturn CCredits::Update(float dt, CArchitectureQueue& queue) { for (int i = 0; i < x18_creditsTable->GetStringCount(); ++i) { x30_text.push_back(rstl::pair< rstl::single_ptr< CGuiTextSupport >, CVector2i >( rs_new CGuiTextSupport( - gpResourceFactory->GetResourceIdByName(gpTweakGui->GetCreditsFont().data())->mId, + gpResourceFactory->GetResourceIdByName(gpTweakGui->GetCreditsFont().data())->GetId(), CGuiTextProperties(true, true, kJustification_Center, kVerticalJustification_Top), gpTweakGui->GetCreditsTextFontColor(), gpTweakGui->GetCreditsTextBorderColor(), CColor::White(), CGraphics::GetViewport().mWidth - 64, 0, gpSimplePool, diff --git a/src/MetroidPrime/CMapArea.cpp b/src/MetroidPrime/CMapArea.cpp index dffd9ec6..b60b800a 100644 --- a/src/MetroidPrime/CMapArea.cpp +++ b/src/MetroidPrime/CMapArea.cpp @@ -238,6 +238,6 @@ const CVector3f& CMapArea::GetAreaPostTranslate(const IWorld& world, TAreaId aid CFactoryFnReturn FMapAreaFactory(const SObjectTag& objTag, CInputStream& in, const CVParamTransfer&) { - gHackAssetId = objTag.mId; + gHackAssetId = objTag.GetId(); return CFactoryFnReturn(rs_new CMapArea(in, gpResourceFactory->ResourceSize(objTag))); } diff --git a/src/MetroidPrime/Player/CSamusFaceReflection.cpp b/src/MetroidPrime/Player/CSamusFaceReflection.cpp index 897fb8c1..45c2e1b8 100644 --- a/src/MetroidPrime/Player/CSamusFaceReflection.cpp +++ b/src/MetroidPrime/Player/CSamusFaceReflection.cpp @@ -23,7 +23,7 @@ static const CTransform4f skFaceModelViewAdjust = CTransform4f::Scale(0.3f) * CTransform4f::Translate(CVector3f(0.f, 0.5f, 0.f)); CSamusFaceReflection::CSamusFaceReflection(const CStateManager& mgr) -: x0_modelData(CModelData(CAnimRes(gpResourceFactory->GetResourceIdByName(skFaceAssetIdName)->mId, +: x0_modelData(CModelData(CAnimRes(gpResourceFactory->GetResourceIdByName(skFaceAssetIdName)->GetId(), CAnimRes::kDefaultCharIdx, CVector3f(1.f, 1.f, 1.f), 0, true))) , x4c_lights(rs_new CActorLights(8, CVector3f::Zero(), 4, 4)) , x50_lookRot(CQuaternion::NoRotation()) diff --git a/src/MetroidPrime/ScriptObjects/CScriptSpecialFunction.cpp b/src/MetroidPrime/ScriptObjects/CScriptSpecialFunction.cpp index 01dda6fb..bb1407ba 100644 --- a/src/MetroidPrime/ScriptObjects/CScriptSpecialFunction.cpp +++ b/src/MetroidPrime/ScriptObjects/CScriptSpecialFunction.cpp @@ -545,7 +545,7 @@ void CScriptSpecialFunction::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId if (msg == kSM_Increment) { const SObjectTag* objectTag = gpResourceFactory->GetResourceIdByName(xec_locatorName.data()); - const CAssetId assetId = objectTag ? objectTag->mId : kInvalidAssetId; + const CAssetId assetId = objectTag ? objectTag->GetId() : kInvalidAssetId; mgr.SetPendingOnScreenTex(assetId, CVector2i(int(x104_float3), int(x108_float4)), CVector2i(int(xfc_float1), int(x100_float2))); diff --git a/src/MetroidPrime/Tweaks/CTweaks.cpp b/src/MetroidPrime/Tweaks/CTweaks.cpp index bf2acbc1..2a7b57f0 100644 --- a/src/MetroidPrime/Tweaks/CTweaks.cpp +++ b/src/MetroidPrime/Tweaks/CTweaks.cpp @@ -38,7 +38,7 @@ CTweakPlayerRes* gpTweakPlayerRes = nullptr; CTweakSlideShow* gpTweakSlideShow = nullptr; CAssetId IDFromFactory(CResFactory& factory, const char* filename) { - return factory.GetResourceIdByName(filename)->mId; + return factory.GetResourceIdByName(filename)->GetId(); } CTweaks::CTweaks() { mTweakObjects.resize(14, rstl::auto_ptr< ITweakObject >()); } diff --git a/src/MetroidPrime/Weapons/WeaponTypes.cpp b/src/MetroidPrime/Weapons/WeaponTypes.cpp index 43727592..d9034aa6 100644 --- a/src/MetroidPrime/Weapons/WeaponTypes.cpp +++ b/src/MetroidPrime/Weapons/WeaponTypes.cpp @@ -23,7 +23,7 @@ CAssetId get_asset_id_from_name(const char* name) { if (!tag) { return kInvalidAssetId; } - return tag->mId; + return tag->GetId(); } void get_token_vector(CAnimData& animData, int animIdx, rstl::vector< CToken >& tokensOut,