From b61e1774c15f10d80e4a32a066a73eb0df5bf1aa Mon Sep 17 00:00:00 2001 From: Luke Street Date: Wed, 7 Dec 2022 01:14:03 -0500 Subject: [PATCH] Minor CActor fixes --- asm/MetroidPrime/CActor.s | 2 +- asm/MetroidPrime/CActorParticles.s | 4 ++-- asm/MetroidPrime/Enemies/CPatterned.s | 2 +- include/MetroidPrime/CAnimData.hpp | 7 +++++-- include/MetroidPrime/CModelData.hpp | 14 +++++++------- src/MetroidPrime/CActor.cpp | 6 +++--- src/MetroidPrime/Weapons/CGunWeapon.cpp | 4 ++-- 7 files changed, 21 insertions(+), 18 deletions(-) diff --git a/asm/MetroidPrime/CActor.s b/asm/MetroidPrime/CActor.s index 48cc9573..66b5d4d3 100644 --- a/asm/MetroidPrime/CActor.s +++ b/asm/MetroidPrime/CActor.s @@ -2284,7 +2284,7 @@ lbl_800548D8: /* 800548E8 00051848 80 7F 08 84 */ lwz r3, 0x884(r31) /* 800548EC 0005184C 7F E4 FB 78 */ mr r4, r31 /* 800548F0 00051850 7F C5 F3 78 */ mr r5, r30 -/* 800548F4 00051854 48 18 F5 31 */ bl Render__20CActorModelParticlesCFRC6CActor +/* 800548F4 00051854 48 18 F5 31 */ bl Render__20CActorModelParticlesCFRC13CStateManagerRC6CActor lbl_800548F8: /* 800548F8 00051858 57 A0 06 3F */ clrlwi. r0, r29, 0x18 /* 800548FC 0005185C 41 82 00 14 */ beq lbl_80054910 diff --git a/asm/MetroidPrime/CActorParticles.s b/asm/MetroidPrime/CActorParticles.s index 3da897f7..84b669c5 100644 --- a/asm/MetroidPrime/CActorParticles.s +++ b/asm/MetroidPrime/CActorParticles.s @@ -422,8 +422,8 @@ lbl_801E3E04: /* 801E3E1C 001E0D7C 38 21 00 20 */ addi r1, r1, 0x20 /* 801E3E20 001E0D80 4E 80 00 20 */ blr -.global Render__20CActorModelParticlesCFRC6CActor -Render__20CActorModelParticlesCFRC6CActor: +.global Render__20CActorModelParticlesCFRC13CStateManagerRC6CActor +Render__20CActorModelParticlesCFRC13CStateManagerRC6CActor: /* 801E3E24 001E0D84 94 21 FF A0 */ stwu r1, -0x60(r1) /* 801E3E28 001E0D88 7C 08 02 A6 */ mflr r0 /* 801E3E2C 001E0D8C 3C C0 80 5A */ lis r6, mModelMatrix__9CGraphics@ha diff --git a/asm/MetroidPrime/Enemies/CPatterned.s b/asm/MetroidPrime/Enemies/CPatterned.s index e3de6174..c323c791 100644 --- a/asm/MetroidPrime/Enemies/CPatterned.s +++ b/asm/MetroidPrime/Enemies/CPatterned.s @@ -1618,7 +1618,7 @@ lbl_800781AC: /* 800781DC 0007513C 80 7D 08 84 */ lwz r3, 0x884(r29) /* 800781E0 00075140 7F A4 EB 78 */ mr r4, r29 /* 800781E4 00075144 7F 85 E3 78 */ mr r5, r28 -/* 800781E8 00075148 48 16 BC 3D */ bl Render__20CActorModelParticlesCFRC6CActor +/* 800781E8 00075148 48 16 BC 3D */ bl Render__20CActorModelParticlesCFRC13CStateManagerRC6CActor /* 800781EC 0007514C 48 00 00 20 */ b lbl_8007820C lbl_800781F0: /* 800781F0 00075150 7F 83 E3 78 */ mr r3, r28 diff --git a/include/MetroidPrime/CAnimData.hpp b/include/MetroidPrime/CAnimData.hpp index 03890e60..67d30433 100644 --- a/include/MetroidPrime/CAnimData.hpp +++ b/include/MetroidPrime/CAnimData.hpp @@ -49,7 +49,9 @@ public: const TLockedToken< CSkinnedModel >& GetModelData() const { return xd8_modelData; } void SetIsAnimating(bool v) { x220_24_animating = v; } - void SetParticleEffectState(const rstl::string& name, bool active, CStateManager& mgr); + void SetParticleEffectState(const rstl::string& name, bool active, CStateManager& mgr) { + x120_particleDB.SetParticleEffectState(name, active, mgr); + } int GetCharacterIndex() const { return x204_charIdx; } float GetAverageVelocity(int idx) const; @@ -98,7 +100,8 @@ public: // PreRender__9CAnimDataFv // SetupRender__9CAnimDataCFRC13CSkinnedModelRCQ24rstl37optional_object<18CVertexMorphEffect>PCf // Render__9CAnimDataCFRC13CSkinnedModelRC11CModelFlagsRCQ24rstl37optional_object<18CVertexMorphEffect>PCf - void Render(const CSkinnedModel&, const CModelFlags&, const rstl::optional_object&, const float*) const; + void Render(const CSkinnedModel&, const CModelFlags&, + const rstl::optional_object< CVertexMorphEffect >&, const float*) const; // RenderAuxiliary__9CAnimDataCFRC14CFrustumPlanes // RecalcPoseBuilder__9CAnimDataCFPC13CCharAnimTime float GetAnimationDuration(int animIn) const; diff --git a/include/MetroidPrime/CModelData.hpp b/include/MetroidPrime/CModelData.hpp index a650eb64..da7dbe0e 100644 --- a/include/MetroidPrime/CModelData.hpp +++ b/include/MetroidPrime/CModelData.hpp @@ -51,15 +51,15 @@ public: CStaticRes(CAssetId id, const CVector3f& scale) : x0_cmdlId(id), x4_scale(scale) {} }; -enum EWhichModel { - kWM_Normal, - kWM_XRay, - kWM_Thermal, - kWM_ThermalHot, -}; - class CModelData { public: + enum EWhichModel { + kWM_Normal, + kWM_XRay, + kWM_Thermal, + kWM_ThermalHot, + }; + // TODO these probably aren't real bool HasNormalModel() const { return x1c_normalModel; } diff --git a/src/MetroidPrime/CActor.cpp b/src/MetroidPrime/CActor.cpp index b9ea1f67..d7b7704d 100644 --- a/src/MetroidPrime/CActor.cpp +++ b/src/MetroidPrime/CActor.cpp @@ -296,7 +296,7 @@ void CActor::AddToRenderer(const CFrustumPlanes& planes, const CStateManager& mg void CActor::EnsureRendered(const CStateManager& mgr, const CVector3f& pos, const CAABox& bounds) const { if (GetModelData()) { - const EWhichModel which = CModelData::GetRenderingModel(mgr); + const CModelData::EWhichModel which = CModelData::GetRenderingModel(mgr); GetModelData()->RenderUnsortedParts(which, GetTransform(), GetActorLights(), GetModelFlags()); } mgr.AddDrawableActor(*this, pos, bounds); @@ -354,8 +354,8 @@ void CActor::Render(const CStateManager& mgr) const { } void CActor::RenderInternal(const CStateManager& mgr) const { - EWhichModel which = CModelData::GetRenderingModel(mgr); - if (which == kWM_ThermalHot) { + CModelData::EWhichModel which = CModelData::GetRenderingModel(mgr); + if (which == CModelData::kWM_ThermalHot) { if (GetModelData()->GetSortThermal()) { uchar addMag; uchar mulMag = 255; diff --git a/src/MetroidPrime/Weapons/CGunWeapon.cpp b/src/MetroidPrime/Weapons/CGunWeapon.cpp index b19a47ea..638619f2 100644 --- a/src/MetroidPrime/Weapons/CGunWeapon.cpp +++ b/src/MetroidPrime/Weapons/CGunWeapon.cpp @@ -230,7 +230,7 @@ void CGunWeapon::Update(float dt, CStateManager& mgr) { LoadFxIdle(dt, mgr); if ((x210_loadFlags & 0x1f) == 0x1f) { - CSkinnedModel& model = x10_solidModelData->PickAnimatedModel(kWM_Normal); + CSkinnedModel& model = x10_solidModelData->PickAnimatedModel(CModelData::kWM_Normal); bool flag1 = model.GetModel()->IsLoaded(x20c_shaderIdx); bool flag2 = xb0_suitArmModelData->IsLoaded(0); if (flag1 && flag2) { @@ -358,7 +358,7 @@ void CGunWeapon::DrawHologram(const CStateManager& mgr, const CTransform4f& xf, // TODO if (x218_29_drawHologram) { - x60_holoModelData->FlatDraw(kWM_Normal, xf, false, flags); + x60_holoModelData->FlatDraw(CModelData::kWM_Normal, xf, false, flags); } else { const CVector3f& scale = x10_solidModelData->GetScale(); CTransform4f modelMatrix(xf);