From 7f947e6442773f369b0a5be9134b1dc73ff7a958 Mon Sep 17 00:00:00 2001 From: Henrique Gemignani Passos Lima Date: Fri, 4 Nov 2022 11:24:42 +0200 Subject: [PATCH] Fixing all source build Former-commit-id: 07c1053008cdbf7510aaf91468979634467307cc --- include/MetroidPrime/CActor.hpp | 1 + src/MetroidPrime/CActor.cpp | 4 ++-- src/MetroidPrime/CPhysicsActor.cpp | 14 +++++++------- src/MetroidPrime/CVisorFlare.cpp | 14 +++++++------- src/MetroidPrime/Enemies/CMetaree.cpp | 2 +- src/MetroidPrime/Player/CPlayerState.cpp | 2 +- .../ScriptObjects/CScriptTrigger.cpp | 14 +++++++------- .../ScriptObjects/CScriptVisorFlare.cpp | 17 +++++++++++------ 8 files changed, 37 insertions(+), 31 deletions(-) diff --git a/include/MetroidPrime/CActor.hpp b/include/MetroidPrime/CActor.hpp index 65b268bc..05dc43d2 100644 --- a/include/MetroidPrime/CActor.hpp +++ b/include/MetroidPrime/CActor.hpp @@ -325,6 +325,7 @@ public: void SetDrawShadow(bool b) { xe5_24_shadowEnabled = b; } void SetShadowDirty(bool b) { xe5_25_shadowDirty = b; } void SetMuted(bool b) { xe5_26_muted = b; } + void SetThermalFlags(EThermalFlags flags) { xe6_27_thermalVisorFlags = flags; } void SetRenderParticleDatabaseInside(bool b) { xe6_29_renderParticleDBInside = b; } void SetTargetable(bool b) { xe7_31_targetable = b; } diff --git a/src/MetroidPrime/CActor.cpp b/src/MetroidPrime/CActor.cpp index b94cf307..d7b7704d 100644 --- a/src/MetroidPrime/CActor.cpp +++ b/src/MetroidPrime/CActor.cpp @@ -112,9 +112,9 @@ CAdvancementDeltas CActor::UpdateAnimation(float dt, CStateManager& mgr, bool ad ushort maxVol = xd4_maxVol; int aid = GetCurrentAreaId().Value(); - const CGameCamera* camera = mgr.GetCameraManager()->GetCurrentCamera(mgr); + const CGameCamera& camera = mgr.GetCameraManager()->GetCurrentCamera(mgr); const CVector3f origin = GetTranslation(); - const CVector3f toCamera = camera->GetTranslation() - origin; + const CVector3f toCamera = camera.GetTranslation() - origin; const CInt32POINode* intNode; const CSoundPOINode* soundNode; diff --git a/src/MetroidPrime/CPhysicsActor.cpp b/src/MetroidPrime/CPhysicsActor.cpp index 5a9b38a8..bcc243ac 100644 --- a/src/MetroidPrime/CPhysicsActor.cpp +++ b/src/MetroidPrime/CPhysicsActor.cpp @@ -66,20 +66,20 @@ void CPhysicsActor::ApplyForceWR(const CVector3f& force, const CAxisAngle& torqu } void CPhysicsActor::ApplyImpulseOR(const CVector3f& impulse, const CAxisAngle& angle) { - x168_impulse = x168_impulse + x34_transform.Rotate(impulse); - CAxisAngle rotatedAngle(x34_transform.Rotate(angle.GetVector())); + x168_impulse = x168_impulse + GetTransform().Rotate(impulse); + CAxisAngle rotatedAngle(GetTransform().Rotate(angle.GetVector())); x180_angularImpulse = x180_angularImpulse + rotatedAngle; } void CPhysicsActor::ApplyForceOR(const CVector3f& force, const CAxisAngle& torque) { - x15c_force = x15c_force + x34_transform.Rotate(force); - CAxisAngle rotatedTorque(x34_transform.Rotate(torque.GetVector())); + x15c_force = x15c_force + GetTransform().Rotate(force); + CAxisAngle rotatedTorque(GetTransform().Rotate(torque.GetVector())); x174_torque = x174_torque + rotatedTorque; } void CPhysicsActor::ComputeDerivedQuantities() { x138_velocity = xfc_constantForce * xec_massRecip; - x114_ = x34_transform.BuildMatrix3f(); + x114_ = GetTransform().BuildMatrix3f(); x144_angularVelocity = CAxisAngle(x108_angularMomentum.GetVector() * xf4_inertiaTensorRecip); } @@ -160,7 +160,7 @@ CMotionState CPhysicsActor::PredictMotion_Internal(float dt) const { void CPhysicsActor::SetMotionState(const CMotionState& state) { const CQuaternion& q = CQuaternion::FromNUQuaternion(state.GetOrientation()); - SetTransform(q.BuildTransform4f(x34_transform.GetTranslation())); + SetTransform(q.BuildTransform4f(GetTransform().GetTranslation())); SetTranslation(state.GetTranslation()); xfc_constantForce = state.GetVelocity(); @@ -225,7 +225,7 @@ void CPhysicsActor::MoveToInOneFrameWR(const CVector3f& trans, float d) { } CVector3f CPhysicsActor::GetMoveToORImpulseWR(const CVector3f& trans, float d) const { - CVector3f impulse = x34_transform.Rotate(trans); + CVector3f impulse = GetTransform().Rotate(trans); return (GetMass() * impulse) * (1.f / d); } diff --git a/src/MetroidPrime/CVisorFlare.cpp b/src/MetroidPrime/CVisorFlare.cpp index af6bdb3d..9c9374fe 100644 --- a/src/MetroidPrime/CVisorFlare.cpp +++ b/src/MetroidPrime/CVisorFlare.cpp @@ -62,7 +62,7 @@ void CVisorFlare::Update(float dt, const CVector3f& pos, const CActor* act, CSta if ((visor == CPlayerState::kPV_Combat || (x2c_w1 != 1 && visor == CPlayerState::kPV_Thermal)) && mgr.GetPlayer()->GetMorphballTransitionState() == CPlayer::kMS_Unmorphed) { - CVector3f camPos = mgr.GetCameraManager()->GetCurrentCamera(mgr)->GetTranslation(); + CVector3f camPos = mgr.GetCameraManager()->GetCurrentCamera(mgr).GetTranslation(); CVector3f camDiff = pos - camPos; float mag = camDiff.Magnitude(); camDiff *= (1.f / mag); @@ -85,9 +85,9 @@ void CVisorFlare::Update(float dt, const CVector3f& pos, const CActor* act, CSta } x28_ = rstl::max_val(rstl::max_val(0.f, x28_), x18_f1); - const CGameCamera* curCam = mgr.GetCameraManager()->GetCurrentCamera(mgr); - CVector3f cameraForward = curCam->GetTransform().GetColumn(kDY); - CVector3f dir = pos - curCam->GetTranslation(); + const CGameCamera& curCam = mgr.GetCameraManager()->GetCurrentCamera(mgr); + CVector3f cameraForward = curCam.GetTransform().GetColumn(kDY); + CVector3f dir = pos - curCam.GetTranslation(); x24_ = 1.f - x28_ / x18_f1; float dot = CVector3f::Dot(dir.AsNormalized(), cameraForward); @@ -120,14 +120,14 @@ void CVisorFlare::Render(const CVector3f& inPos, const CStateManager& mgr) const CGraphics::DisableAllLights(); gpRender->SetDepthReadWrite(false, false); - const CGameCamera* cam = mgr.GetCameraManager()->GetCurrentCamera(mgr); - CVector3f camPos = cam->GetTranslation(); + const CGameCamera& cam = mgr.GetCameraManager()->GetCurrentCamera(mgr); + CVector3f camPos = cam.GetTranslation(); CVector3f inPosCopy = inPos; CTransform4f viewMatrix = CGraphics::GetViewMatrix(); const CVector3f invPos = viewMatrix.GetInverse() * inPosCopy; const CVector3f invPos2 = viewMatrix * CVector3f(-invPos.GetX(), invPos.GetY(), -invPos.GetZ()); - CVector3f camFront = cam->GetTransform().GetForward(); + CVector3f camFront = cam.GetTransform().GetForward(); if (!close_enough(x24_, 0.f)) { float acos = 0.f; if (!close_enough(x20_f3, 0.f)) { diff --git a/src/MetroidPrime/Enemies/CMetaree.cpp b/src/MetroidPrime/Enemies/CMetaree.cpp index aded05cb..7b64bc87 100644 --- a/src/MetroidPrime/Enemies/CMetaree.cpp +++ b/src/MetroidPrime/Enemies/CMetaree.cpp @@ -223,7 +223,7 @@ void CMetaree::Think(float dt, CStateManager& mgr) { if (!b && !x5ca_26_deactivated) { target = false; } - xe7_31_targetable = target; + SetTargetable(target); CPatterned::Think(dt, mgr); } diff --git a/src/MetroidPrime/Player/CPlayerState.cpp b/src/MetroidPrime/Player/CPlayerState.cpp index b122d9cb..dbb597de 100644 --- a/src/MetroidPrime/Player/CPlayerState.cpp +++ b/src/MetroidPrime/Player/CPlayerState.cpp @@ -397,7 +397,7 @@ void CPlayerState::UpdateStaticInterference(CStateManager& stateMgr, const float CPlayerState::EPlayerVisor CPlayerState::GetActiveVisor(const CStateManager& stateMgr) const { const CFirstPersonCamera* cam = TCastToConstPtr< CFirstPersonCamera >( - *stateMgr.GetCameraManager()->GetCurrentCamera(stateMgr)); + stateMgr.GetCameraManager()->GetCurrentCamera(stateMgr)); return (cam ? x14_currentVisor : kPV_Combat); } diff --git a/src/MetroidPrime/ScriptObjects/CScriptTrigger.cpp b/src/MetroidPrime/ScriptObjects/CScriptTrigger.cpp index 4a198009..c5db9fd0 100644 --- a/src/MetroidPrime/ScriptObjects/CScriptTrigger.cpp +++ b/src/MetroidPrime/ScriptObjects/CScriptTrigger.cpp @@ -42,7 +42,7 @@ void CScriptTrigger::Touch(CActor& act, CStateManager& mgr) { uint testFlags = kTFL_None; CPlayer* pl = TCastToPtr< CPlayer >(act); if (pl) { - if (x128_forceMagnitude > 0.f && (x12c_flags & kTFL_DetectPlayer != 0)) { + if (x128_forceMagnitude > 0.f && ((x12c_flags & kTFL_DetectPlayer) != 0)) { if (mgr.GetLastTriggerId() != kInvalidUniqueId) { return; } @@ -201,7 +201,7 @@ void CScriptTrigger::UpdateInhabitants(float dt, CStateManager& mgr) { if (CActor* act = TCastToPtr< CActor >(mgr.ObjectById(it->GetObjectId()))) { bool playerValid = true; if (it->GetObjectId() == mgr.GetPlayer()->GetUniqueId()) { - if ((x12c_flags & kTFL_DetectPlayer == 0) && + if (((x12c_flags & kTFL_DetectPlayer) == 0) && ((mgr.GetPlayer()->GetMorphballTransitionState() == CPlayer::kMS_Morphed && (x12c_flags & kTFL_DetectUnmorphedPlayer)) || (mgr.GetPlayer()->GetMorphballTransitionState() == CPlayer::kMS_Unmorphed && @@ -293,18 +293,18 @@ void CScriptTrigger::UpdateInhabitants(float dt, CStateManager& mgr) { } if ((x12c_flags & kTFL_DetectCamera) || x148_24_detectCamera) { - CGameCamera* cam = mgr.GetCameraManager()->GetCurrentCamera(mgr); - const bool camInTrigger = GetTriggerBoundsWR().PointInside(cam->GetTranslation()); + CGameCamera& cam = mgr.CameraManager()->CurrentCamera(mgr); + const bool camInTrigger = GetTriggerBoundsWR().PointInside(cam.GetTranslation()); if (x148_25_camSubmerged) { if (!camInTrigger) { x148_25_camSubmerged = false; if ((x12c_flags & kTFL_DetectCamera)) { sendExited = true; - InhabitantExited(*cam, mgr); + InhabitantExited(cam, mgr); } } else { if ((x12c_flags & kTFL_DetectCamera)) { - InhabitantIdle(*cam, mgr); + InhabitantIdle(cam, mgr); sendInside = true; } } @@ -312,7 +312,7 @@ void CScriptTrigger::UpdateInhabitants(float dt, CStateManager& mgr) { if (camInTrigger) { x148_25_camSubmerged = true; if ((x12c_flags & kTFL_DetectCamera)) { - InhabitantAdded(*cam, mgr); + InhabitantAdded(cam, mgr); SendScriptMsgs(kSS_Entered, mgr, kSM_None); } } diff --git a/src/MetroidPrime/ScriptObjects/CScriptVisorFlare.cpp b/src/MetroidPrime/ScriptObjects/CScriptVisorFlare.cpp index c426376a..114a4d89 100644 --- a/src/MetroidPrime/ScriptObjects/CScriptVisorFlare.cpp +++ b/src/MetroidPrime/ScriptObjects/CScriptVisorFlare.cpp @@ -4,14 +4,16 @@ #include "MetroidPrime/CStateManager.hpp" #include "MetroidPrime/Player/CPlayer.hpp" -CScriptVisorFlare::CScriptVisorFlare(TUniqueId uid, const rstl::string& name, const CEntityInfo& info, bool active, - const CVector3f& pos, CVisorFlare::EBlendMode blendMode, bool b1, float f1, - float f2, float f3, uint w1, uint w2, const rstl::vector& flares) +CScriptVisorFlare::CScriptVisorFlare(TUniqueId uid, const rstl::string& name, + const CEntityInfo& info, bool active, const CVector3f& pos, + CVisorFlare::EBlendMode blendMode, bool b1, float f1, float f2, + float f3, uint w1, uint w2, + const rstl::vector< CVisorFlare::CFlareDef >& flares) : CActor(uid, active, name, info, CTransform4f::Translate(pos), CModelData::CModelDataNull(), CMaterialList(kMT_NoStepLogic), CActorParameters::None(), kInvalidUniqueId) , xe8_flare(blendMode, b1, f1, f2, f3, w1, w2, flares) , x11c_notInRenderLast(true) { - xe6_27_thermalVisorFlags = kTF_Hot; + SetThermalFlags(kTF_Hot); } CScriptVisorFlare::~CScriptVisorFlare() {} @@ -24,7 +26,8 @@ void CScriptVisorFlare::Think(float dt, CStateManager& stateMgr) { } } -void CScriptVisorFlare::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId objId, CStateManager& stateMgr) { +void CScriptVisorFlare::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId objId, + CStateManager& stateMgr) { CActor::AcceptScriptMsg(msg, objId, stateMgr); } @@ -38,4 +41,6 @@ void CScriptVisorFlare::AddToRenderer(const CFrustumPlanes&, const CStateManager } } -void CScriptVisorFlare::Render(const CStateManager& stateMgr) const { xe8_flare.Render(GetTranslation(), stateMgr); } +void CScriptVisorFlare::Render(const CStateManager& stateMgr) const { + xe8_flare.Render(GetTranslation(), stateMgr); +}