From 41589cec2af6aa5a8f265405dfc44ed61071b759 Mon Sep 17 00:00:00 2001 From: Phillip Stephens Date: Thu, 19 Oct 2023 10:07:37 -0700 Subject: [PATCH] Minor fixes, NES symbols Former-commit-id: 2d11927a261d8187dd00ce005f68a115614d6882 --- config/GM8E01_00/NESemu/symbols.txt | 46 ++++++++-------- config/GM8E01_00/symbols.txt | 4 +- config/GM8E01_01/symbols.txt | 2 +- configure.py | 2 +- include/Kyoto/Math/CVector3f.hpp | 6 +-- include/MetroidPrime/CAnimData.hpp | 4 +- include/MetroidPrime/Enemies/CPatterned.hpp | 60 ++++++++++----------- include/MetroidPrime/Enemies/CPuffer.hpp | 2 +- include/rstl/optional_object.hpp | 2 +- src/Kyoto/Math/RMathUtils.cpp | 13 +++-- src/MetroidPrime/Enemies/CMetaree.cpp | 34 +++++++----- src/MetroidPrime/Enemies/CPuffer.cpp | 9 ++-- 12 files changed, 94 insertions(+), 90 deletions(-) diff --git a/config/GM8E01_00/NESemu/symbols.txt b/config/GM8E01_00/NESemu/symbols.txt index dfdf68a3..5010d01c 100644 --- a/config/GM8E01_00/NESemu/symbols.txt +++ b/config/GM8E01_00/NESemu/symbols.txt @@ -2,16 +2,16 @@ _prolog = .text:0x00000000; // type:function size:0x50 scope:global _epilog = .text:0x00000050; // type:function size:0x4C scope:global _unresolved = .text:0x0000009C; // type:function size:0x38 scope:global fn_1_D4 = .text:0x000000D4; // type:function size:0x5E4 -fn_1_6B8 = .text:0x000006B8; // type:function size:0x184 +ksNesConvertChrToI8__FP18ksNesCommonWorkObjPCUcUl = .text:0x000006B8; // type:function size:0x184 fn_1_83C = .text:0x0000083C; // type:function size:0x4 -fn_1_840 = .text:0x00000840; // type:function size:0x9C -fn_1_8DC = .text:0x000008DC; // type:function size:0x2F8 -fn_1_BD4 = .text:0x00000BD4; // type:function size:0x2D8 -fn_1_EAC = .text:0x00000EAC; // type:function size:0x78 -fn_1_F24 = .text:0x00000F24; // type:function size:0xAD8 -fn_1_19FC = .text:0x000019FC; // type:function size:0xF0 +ksNesQDSoundSync__Fv = .text:0x00000840; // type:function size:0x9C +ksNesQDFastLoad__FP18ksNesCommonWorkObjP13ksNesStateObj = .text:0x000008DC; // type:function size:0x2F8 +ksNesQDFastSave__FP18ksNesCommonWorkObjP13ksNesStateObj = .text:0x00000BD4; // type:function size:0x2D8 +ksNesPushResetButton__FP13ksNesStateObj = .text:0x00000EAC; // type:function size:0x78 +ksNesReset__FP18ksNesCommonWorkObjP13ksNesStateObjUlPUcPUc = .text:0x00000F24; // type:function size:0xAD8 +ksNesEmuFrame__FP18ksNesCommonWorkObjP13ksNesStateObjUl = .text:0x000019FC; // type:function size:0xF0 fn_1_1AEC = .text:0x00001AEC; // type:function size:0xD8 -fn_1_1BC4 = .text:0x00001BC4; // type:function +ksNesEmuFrameAsm__FP18ksNesCommonWorkObjP13ksNesStateObj = .text:0x00001BC4; // type:function lbl_1_text_1C60 = .text:0x00001C60; // type:label lbl_1_text_1C68 = .text:0x00001C68; // type:label lbl_1_text_2134 = .text:0x00002134; // type:label @@ -132,19 +132,19 @@ lbl_1_text_3174 = .text:0x00003174; // type:label lbl_1_text_31A0 = .text:0x000031A0; // type:label lbl_1_text_3244 = .text:0x00003244; // type:label lbl_1_text_324C = .text:0x0000324C; // type:label -fn_1_33F4 = .text:0x000033F4; // type:function +ksNesInitAudio__Fv = .text:0x000033F4; // type:function fn_1_3418 = .text:0x00003418; // type:function -fn_1_3438 = .text:0x00003438; // type:function size:0x8C -fn_1_34C4 = .text:0x000034C4; // type:function size:0x17C -fn_1_3640 = .text:0x00003640; // type:function size:0x1DC -fn_1_381C = .text:0x0000381C; // type:function size:0x8B8 -fn_1_40D4 = .text:0x000040D4; // type:function size:0xC98 -fn_1_4D6C = .text:0x00004D6C; // type:function size:0x3C4 -fn_1_5130 = .text:0x00005130; // type:function size:0x9C0 -fn_1_5AF0 = .text:0x00005AF0; // type:function size:0x4C0 +ksNesInitModule__Fv = .text:0x00003438; // type:function size:0x8C +ksNesDrawInit__FP18ksNesCommonWorkObj = .text:0x000034C4; // type:function size:0x17C +ksNesDrawMakeBGIndTex__FP18ksNesCommonWorkObjUl = .text:0x00003640; // type:function size:0x1DC +ksNesDrawBG__FP18ksNesCommonWorkObjP13ksNesStateObj = .text:0x0000381C; // type:function size:0x8B8 +ksNesDrawOBJ__FP18ksNesCommonWorkObjP13ksNesStateObjUl = .text:0x000040D4; // type:function size:0xC98 +ksNesDrawOBJI8ToEFB__FP18ksNesCommonWorkObjPUc = .text:0x00004D6C; // type:function size:0x3C4 +ksNesDrawEmuResult__FP18ksNesCommonWorkObj = .text:0x00005130; // type:function size:0x9C0 +ksNesDraw__FP18ksNesCommonWorkObjP13ksNesStateObj = .text:0x00005AF0; // type:function size:0x4C0 fn_1_5FC0 = .text:0x00005FC0; // type:function size:0x84 -fn_1_6060 = .text:0x00006060; // type:function size:0xF8 -fn_1_6160 = .text:0x00006160; // type:function size:0x94 +ksNesAudioUpdateCallback__FPvUlPvUlPv = .text:0x00006060; // type:function size:0xF8 +ksNesAudioAlloc__Fv = .text:0x00006160; // type:function size:0x94 fn_1_6200 = .text:0x00006200; // type:function size:0x38 fn_1_6240 = .text:0x00006240; // type:function size:0x10 fn_1_6260 = .text:0x00006260; // type:function size:0x10 @@ -217,10 +217,10 @@ kRomData = .data:0x00000030; // type:object size:0x1D940 scope:local data:byte lbl_1_data_1D970 = .data:0x0001D970; // type:object size:0x160 lbl_1_data_1DAD0 = .data:0x0001DAD0; // type:object size:0x28 lbl_1_data_1DAF8 = .data:0x0001DAF8; // type:object size:0x1030 -lbl_1_data_1EB28 = .data:0x0001EB28; // type:object size:0x80 -lbl_1_data_1EBA8 = .data:0x0001EBA8; // type:object size:0x18 -lbl_1_data_1EBC0 = .data:0x0001EBC0; // type:object size:0x18 data:float -lbl_1_data_1EBD8 = .data:0x0001EBD8; // type:object size:0x18 +ksNesPaletteNormal = .data:0x0001EB28; // type:object size:0x80 data:byte +indtexmtx_screen$477 = .data:0x0001EBA8; // type:object size:0x18 data:float +indtexmtx_obj$626 = .data:0x0001EBC0; // type:object size:0x18 data:float +indtexmtx$1004 = .data:0x0001EBD8; // type:object size:0x18 data:float lbl_1_data_1EBF0 = .data:0x0001EBF0; // type:object size:0x8 data:4byte lbl_1_data_1EBF8 = .data:0x0001EBF8; // type:object size:0x60 data:4byte lbl_1_data_1EC58 = .data:0x0001EC58; // type:object size:0x100 data:byte diff --git a/config/GM8E01_00/symbols.txt b/config/GM8E01_00/symbols.txt index 6d2bb95a..33ace6c6 100644 --- a/config/GM8E01_00/symbols.txt +++ b/config/GM8E01_00/symbols.txt @@ -10765,7 +10765,7 @@ Accept__7CRidleyFR8IVisitor = .text:0x80259CF0; // type:function size:0x38 scope __ct__7CRidleyF9TUniqueIdRCQ24rstl66basic_string,Q24rstl17rmemory_allocator>RC11CEntityInfoRC6CAABoxRC10CModelDataRC14CPatternedInfoRC16CActorParametersRC12CInputStreamUi = .text:0x80259D28; // type:function size:0x9CC scope:global fn_8025A6F4 = .text:0x8025A6F4; // type:function size:0x378 __sinit_CRidley_cpp = .text:0x8025AA6C; // type:function size:0x1538 scope:local -sub8025bfa4__7CPufferFR13CStateManager = .text:0x8025BFA4; // type:function size:0x298 scope:global +UpdateJets__7CPufferFR13CStateManager = .text:0x8025BFA4; // type:function size:0x298 scope:global Think__7CPufferFfR13CStateManager = .text:0x8025C23C; // type:function size:0x19C scope:global Death__7CPufferFR13CStateManagerRC9CVector3f18EScriptObjectState = .text:0x8025C3D8; // type:function size:0x208 scope:global GetTouchBounds__7CPufferCFv = .text:0x8025C5E0; // type:function size:0x1AC scope:global @@ -21769,7 +21769,7 @@ lbl_805A9150 = .sbss:0x805A9150; // type:object size:0x4 data:4byte lbl_805A9154 = .sbss:0x805A9154; // type:object size:0x4 data:4byte lbl_805A9158 = .sbss:0x805A9158; // type:object size:0x4 data:4byte lbl_805A915C = .sbss:0x805A915C; // type:object size:0x4 data:4byte -lbl_805A9160 = .sbss:0x805A9160; // type:object size:0x8 data:4byte +sNesModule = .sbss:0x805A9160; // type:object size:0x8 scope:global data:4byte lbl_805A9168 = .sbss:0x805A9168; // type:object size:0x8 data:float lbl_805A9170 = .sbss:0x805A9170; // type:object size:0x1 data:byte lbl_805A9174 = .sbss:0x805A9174; // type:object size:0x1 data:byte diff --git a/config/GM8E01_01/symbols.txt b/config/GM8E01_01/symbols.txt index 7d279ee3..ea90971f 100644 --- a/config/GM8E01_01/symbols.txt +++ b/config/GM8E01_01/symbols.txt @@ -10775,7 +10775,7 @@ Accept__7CRidleyFR8IVisitor = .text:0x80259D6C; // type:function size:0x38 scope __ct__7CRidleyF9TUniqueIdRCQ24rstl66basic_string,Q24rstl17rmemory_allocator>RC11CEntityInfoRC6CAABoxRC10CModelDataRC14CPatternedInfoRC16CActorParametersRC12CInputStreamUi = .text:0x80259DA4; // type:function size:0x9CC scope:global fn_8025A6F4 = .text:0x8025A770; // type:function size:0x378 scope:global __sinit_CRidley_cpp = .text:0x8025AAE8; // type:function size:0x1538 scope:global -sub8025bfa4__7CPufferFR13CStateManager = .text:0x8025C020; // type:function size:0x298 scope:global +UpdateJets__7CPufferFR13CStateManager = .text:0x8025C020; // type:function size:0x298 scope:global Think__7CPufferFfR13CStateManager = .text:0x8025C2B8; // type:function size:0x19C scope:global Death__7CPufferFR13CStateManagerRC9CVector3f18EScriptObjectState = .text:0x8025C454; // type:function size:0x208 scope:global GetTouchBounds__7CPufferCFv = .text:0x8025C65C; // type:function size:0x1AC scope:global diff --git a/configure.py b/configure.py index 2b030db9..e09c7800 100755 --- a/configure.py +++ b/configure.py @@ -1219,7 +1219,7 @@ config.libs = [ ], "host": False, "objects": [ - Object(NonMatching, "musyx/txwin/txwin"), + Object(NonMatching, "musyx/txwin/txwin.c"), ], }, DolphinLib( diff --git a/include/Kyoto/Math/CVector3f.hpp b/include/Kyoto/Math/CVector3f.hpp index e0563772..6181716f 100644 --- a/include/Kyoto/Math/CVector3f.hpp +++ b/include/Kyoto/Math/CVector3f.hpp @@ -48,9 +48,9 @@ public: bool IsEqu(const CVector3f& other, float epsilon = FLT_EPSILON) const; static CVector3f Lerp(const CVector3f& a, const CVector3f& b, float v) { float inv = 1.f - v; - float x = inv * a.GetX() + v * b.GetX(); - float y = inv * a.GetY() + v * b.GetY(); - float z = inv * a.GetZ() + v * b.GetZ(); + float x = a.mX * inv + b.mX * v; + float y = a.mY * inv + b.mY * v; + float z = a.mZ * inv + b.mZ * v; return CVector3f(x, y, z); } inline float MagSquared() const { return GetX() * GetX() + GetY() * GetY() + GetZ() * GetZ(); } diff --git a/include/MetroidPrime/CAnimData.hpp b/include/MetroidPrime/CAnimData.hpp index b54268ac..77533473 100644 --- a/include/MetroidPrime/CAnimData.hpp +++ b/include/MetroidPrime/CAnimData.hpp @@ -52,9 +52,7 @@ 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) { - x120_particleDB.SetParticleEffectState(name, active, mgr); - } + void SetParticleEffectState(const rstl::string& name, const bool active, CStateManager& mgr); int GetCharacterIndex() const { return x204_charIdx; } float GetAverageVelocity(int idx) const; diff --git a/include/MetroidPrime/Enemies/CPatterned.hpp b/include/MetroidPrime/Enemies/CPatterned.hpp index 188e4849..efa7afa0 100644 --- a/include/MetroidPrime/Enemies/CPatterned.hpp +++ b/include/MetroidPrime/Enemies/CPatterned.hpp @@ -162,7 +162,7 @@ public: void AddToRenderer(const CFrustumPlanes&, const CStateManager&) const override; void Render(const CStateManager&) const override; bool CanRenderUnsorted(const CStateManager&) const override; - rstl::optional_object< CAABox > GetTouchBounds() const override; + const rstl::optional_object< CAABox > GetTouchBounds() const override; void Touch(CActor&, CStateManager&) override; CVector3f GetOrbitPosition(const CStateManager&) const override; CVector3f GetAimPosition(const CStateManager&, float) const override; @@ -247,9 +247,9 @@ public: CStateMachineState& StateMachineState() { return x330_stateMachineState; } const CStateMachineState& GetStateMachineState() const { return x330_stateMachineState; } ECharacter GetCharacterType() const { return x34c_characterType; } - bool IsAlive() const { return x400_25_alive; } - void SetWasHit(bool v) { x400_24_hitByPlayerProjectile = v; } - void SetPendingDeath(bool v) { x401_30_pendingDeath = v; } + const bool IsAlive() const { return x400_25_alive; } + void SetWasHit(const bool v) { x400_24_hitByPlayerProjectile = v; } + void SetPendingDeath(const bool v) { x401_30_pendingDeath = v; } CBodyController* BodyCtrl() { return x450_bodyController.get(); } const CBodyController* GetBodyCtrl() const { return x450_bodyController.get(); } CKnockBackController& GetKnockBackCtrl() { return x460_knockBackController; } @@ -316,32 +316,32 @@ private: float x3f4_burnThinkRateTimer; EMoveState x3f8_moveState; EFlavorType x3fc_flavor; - uint x400_24_hitByPlayerProjectile : 1; - uint x400_25_alive : 1; - uint x400_26_ : 1; - uint x400_27_fadeToDeath : 1; - uint x400_28_pendingMassiveDeath : 1; - uint x400_29_pendingMassiveFrozenDeath : 1; - uint x400_30_patternShagged : 1; - uint x400_31_isFlyer : 1; - uint x401_24_pathOverCount : 2; - uint x401_26_disableMove : 1; - uint x401_27_phazingOut : 1; - uint x401_28_burning : 1; - uint x401_29_laggedBurnDeath : 1; - uint x401_30_pendingDeath : 1; - uint x401_31_nextPendingShock : 1; - uint x402_24_pendingShock : 1; - uint x402_25_lostMassiveFrozenHP : 1; - uint x402_26_dieIf80PercFrozen : 1; - uint x402_27_noXrayModel : 1; - uint x402_28_isMakingBigStrike : 1; - uint x402_29_drawParticles : 1; - uint x402_30_updateThermalFrozenState : 1; - uint x402_31_thawed : 1; - uint x403_24_keepThermalVisorState : 1; - uint x403_25_enableStateMachine : 1; - uint x403_26_stateControlledMassiveDeath : 1; + bool x400_24_hitByPlayerProjectile : 1; + bool x400_25_alive : 1; + bool x400_26_ : 1; + bool x400_27_fadeToDeath : 1; + bool x400_28_pendingMassiveDeath : 1; + bool x400_29_pendingMassiveFrozenDeath : 1; + bool x400_30_patternShagged : 1; + bool x400_31_isFlyer : 1; + bool x401_24_pathOverCount : 2; + bool x401_26_disableMove : 1; + bool x401_27_phazingOut : 1; + bool x401_28_burning : 1; + bool x401_29_laggedBurnDeath : 1; + bool x401_30_pendingDeath : 1; + bool x401_31_nextPendingShock : 1; + bool x402_24_pendingShock : 1; + bool x402_25_lostMassiveFrozenHP : 1; + bool x402_26_dieIf80PercFrozen : 1; + bool x402_27_noXrayModel : 1; + bool x402_28_isMakingBigStrike : 1; + bool x402_29_drawParticles : 1; + bool x402_30_updateThermalFrozenState : 1; + bool x402_31_thawed : 1; + bool x403_24_keepThermalVisorState : 1; + bool x403_25_enableStateMachine : 1; + bool x403_26_stateControlledMassiveDeath : 1; CDamageInfo x404_contactDamage; float x420_curDamageRemTime; float x424_damageWaitTime; diff --git a/include/MetroidPrime/Enemies/CPuffer.hpp b/include/MetroidPrime/Enemies/CPuffer.hpp index d8c1585a..8a5c485c 100644 --- a/include/MetroidPrime/Enemies/CPuffer.hpp +++ b/include/MetroidPrime/Enemies/CPuffer.hpp @@ -41,7 +41,7 @@ private: int x5d0_enabledParticles; rstl::reserved_vector< CVector3f, 14 > x5d4_gasLocators; - void sub8025bfa4(CStateManager&); + void UpdateJets(CStateManager&); }; #endif // _CPUFFER diff --git a/include/rstl/optional_object.hpp b/include/rstl/optional_object.hpp index 429271e0..8748d39c 100644 --- a/include/rstl/optional_object.hpp +++ b/include/rstl/optional_object.hpp @@ -40,7 +40,7 @@ public: const T& data() const { return *get_ptr(); } T* get_ptr() { return reinterpret_cast< T* >(m_data); } const T* get_ptr() const { return reinterpret_cast< const T* >(m_data); } - bool valid() const { return m_valid; } + const bool valid() const { return m_valid; } operator bool() const { return m_valid; } // replace with valid()? void clear() { if (m_valid) { diff --git a/src/Kyoto/Math/RMathUtils.cpp b/src/Kyoto/Math/RMathUtils.cpp index 6e083475..62fc7e91 100644 --- a/src/Kyoto/Math/RMathUtils.cpp +++ b/src/Kyoto/Math/RMathUtils.cpp @@ -57,13 +57,12 @@ float CMath::GetCatmullRomSplinePoint(float a, float b, float c, float d, float } CVector3f CMath::GetBezierPoint(const CVector3f& a, const CVector3f& b, const CVector3f& c, - const CVector3f& d, const float t) { - const CVector3f ab = Lerp(a, b, t); - const CVector3f bc = Lerp(b, c, t); - const CVector3f cd = Lerp(c, d, t); - const CVector3f abbc = Lerp(ab, bc, t); - const CVector3f bccd = Lerp(bc, cd, t); - return Lerp(abbc, bccd, t); + const CVector3f& d, float t) { + CVector3f ab = CVector3f::Lerp(a, b, t); + CVector3f bc = CVector3f::Lerp(b, c, t); + CVector3f cd = CVector3f::Lerp(c, d, t); + + return CVector3f::Lerp(CVector3f::Lerp(ab, bc, t), CVector3f::Lerp(bc, cd, t), t); } CVector3f CMath::BaryToWorld(const CVector3f& p0, const CVector3f& p1, const CVector3f& p2, diff --git a/src/MetroidPrime/Enemies/CMetaree.cpp b/src/MetroidPrime/Enemies/CMetaree.cpp index e150a586..dd9d5756 100644 --- a/src/MetroidPrime/Enemies/CMetaree.cpp +++ b/src/MetroidPrime/Enemies/CMetaree.cpp @@ -3,6 +3,7 @@ #include "MetroidPrime/BodyState/CBodyController.hpp" #include "MetroidPrime/Player/CPlayer.hpp" #include "MetroidPrime/SFX/Metaree.h" +#include "MetroidPrime/TCastTo.hpp" #include "MetroidPrime/Weapons/CGameProjectile.hpp" #include "Kyoto/Audio/CSfxManager.hpp" @@ -39,7 +40,7 @@ void CMetaree::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId uid, CStateMa switch (msg) { break; case kSM_Registered: - GetBodyCtrl()->Activate(mgr); + BodyCtrl()->Activate(mgr); break; case kSM_Start: x5ca_25_started = true; @@ -89,9 +90,9 @@ void CMetaree::InActive(CStateManager&, EStateMsg msg, float) { switch (msg) { case kStateMsg_Activate: if (!x5ca_26_deactivated) { - GetBodyCtrl()->SetLocomotionType(pas::kLT_Relaxed); + BodyCtrl()->SetLocomotionType(pas::kLT_Relaxed); } else { - GetBodyCtrl()->SetLocomotionType(pas::kLT_Crouch); + BodyCtrl()->SetLocomotionType(pas::kLT_Crouch); } break; case kStateMsg_Update: @@ -107,11 +108,11 @@ void CMetaree::Active(CStateManager& mgr, EStateMsg msg, float) { case kStateMsg_Activate: SetWasHit(false); x584_lookPos = GetTranslation() - CVector3f(0.f, 0.f, x570_dropHeight); - GetBodyCtrl()->CommandMgr().DeliverCmd(CBCGenerateCmd(pas::kGType_Zero, x584_lookPos)); + BodyCtrl()->CommandMgr().DeliverCmd(CBCGenerateCmd(pas::kGType_Zero, x584_lookPos)); SetMomentumWR(CVector3f(0.f, 0.f, -GetGravityConstant() * GetMass())); break; case kStateMsg_Update: - GetBodyCtrl()->CommandMgr().DeliverTargetVector( + BodyCtrl()->CommandMgr().DeliverTargetVector( (mgr.GetPlayer()->GetTranslation() - GetTranslation()).AsNormalized()); break; case kStateMsg_Deactivate: @@ -126,7 +127,7 @@ void CMetaree::Halt(CStateManager& mgr, EStateMsg msg, float) { Stop(); SetVelocityWR(CVector3f::Zero()); SetMomentumWR(CVector3f::Zero()); - GetBodyCtrl()->SetLocomotionType(pas::kLT_Lurk); + BodyCtrl()->SetLocomotionType(pas::kLT_Lurk); x584_lookPos = mgr.GetPlayer()->GetTranslation() + x574_offset; SetTransform(CTransform4f::LookAt(GetTranslation(), x584_lookPos)); StateMachineState().SetDelay(x56c_haltDelay); @@ -145,7 +146,7 @@ void CMetaree::Attack(CStateManager&, EStateMsg msg, float) { CVector3f dir = (x584_lookPos - GetTranslation()).AsNormalized(); SetVelocityWR(x580_attackSpeed * dir); CSfxManager::AddEmitter(x5c8_attackSfx, GetTranslation(), CVector3f::Zero(), true, false); - GetBodyCtrl()->SetLocomotionType(pas::kLT_Combat); + BodyCtrl()->SetLocomotionType(pas::kLT_Combat); x59c_velocity = x580_attackSpeed * dir; break; } @@ -188,19 +189,19 @@ void CMetaree::Flee(CStateManager& mgr, EStateMsg msg, float) { break; } case kStateMsg_Update: { - switch(x5a8_) { - case 0: + switch (x5a8_) { + case 0: if (GetBodyCtrl()->GetBodyStateInfo().GetCurrentStateId() == pas::kAS_LieOnGround) { x5a8_ = 1; } else { - GetBodyCtrl()->CommandMgr().DeliverCmd( + BodyCtrl()->CommandMgr().DeliverCmd( CBCKnockDownCmd(CVector3f(0.f, 1.f, 0.f), pas::kS_Zero)); } break; - default: + default: break; } - + break; } case kStateMsg_Deactivate: @@ -222,9 +223,14 @@ void CMetaree::Explode(CStateManager& mgr, EStateMsg msg, float) { } void CMetaree::Think(float dt, CStateManager& mgr) { - bool target = true; + bool target, b; + target = true; + b = target; CPlayerState::EPlayerVisor visor = mgr.GetPlayerState()->GetCurrentVisor(); - bool b = visor != CPlayerState::kPV_Thermal && visor != CPlayerState::kPV_Scan; + if (visor != CPlayerState::kPV_Thermal && visor != CPlayerState::kPV_Scan) { + b = false; + } + if (!b && !x5ca_26_deactivated) { target = false; } diff --git a/src/MetroidPrime/Enemies/CPuffer.cpp b/src/MetroidPrime/Enemies/CPuffer.cpp index 4255b26c..cebe2c59 100644 --- a/src/MetroidPrime/Enemies/CPuffer.cpp +++ b/src/MetroidPrime/Enemies/CPuffer.cpp @@ -105,7 +105,7 @@ void CPuffer::Death(CStateManager& mgr, const CVector3f& vec, EScriptObjectState void CPuffer::Think(float dt, CStateManager& mgr) { CPatterned::Think(dt, mgr); - sub8025bfa4(mgr); + UpdateJets(mgr); CVector3f moveVector = BodyCtrl()->GetCommandMgr().GetMoveVector(); if (x5cc_ != GetDestObj()) { @@ -120,7 +120,7 @@ void CPuffer::Think(float dt, CStateManager& mgr) { } } -void CPuffer::sub8025bfa4(CStateManager& mgr) { +void CPuffer::UpdateJets(CStateManager& mgr) { CVector3f moveVector = BodyCtrl()->GetCommandMgr().GetMoveVector(); if (x5d4_gasLocators.empty()) { @@ -135,8 +135,9 @@ void CPuffer::sub8025bfa4(CStateManager& mgr) { for (int i = 0; i < ARRAY_SIZE(skGasJetLocators); ++i) { CVector3f tmp = GetTransform().Rotate(x5d4_gasLocators[i]); float ang = CMath::FastCosR(CMath::Deg2Rad(45.f)); - bool enable = CVector3f::Dot(moveNorm, tmp) > ang; - bool enabledCur = bool(x5d0_enabledParticles & (1 << i)); + float ourAng = CVector3f::Dot(moveNorm, tmp); + const bool enable = ourAng > ang; + const bool enabledCur = bool(x5d0_enabledParticles & (1 << i)); if (enabledCur != enable) { AnimationData()->SetParticleEffectState(rstl::string_l(skGasJetLocators[i]), enable, mgr);