Fixing all source build

Former-commit-id: 07c1053008
This commit is contained in:
Henrique Gemignani Passos Lima 2022-11-04 11:24:42 +02:00
parent caa46fc392
commit 7f947e6442
8 changed files with 37 additions and 31 deletions

View File

@ -325,6 +325,7 @@ public:
void SetDrawShadow(bool b) { xe5_24_shadowEnabled = b; } void SetDrawShadow(bool b) { xe5_24_shadowEnabled = b; }
void SetShadowDirty(bool b) { xe5_25_shadowDirty = b; } void SetShadowDirty(bool b) { xe5_25_shadowDirty = b; }
void SetMuted(bool b) { xe5_26_muted = 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 SetRenderParticleDatabaseInside(bool b) { xe6_29_renderParticleDBInside = b; }
void SetTargetable(bool b) { xe7_31_targetable = b; } void SetTargetable(bool b) { xe7_31_targetable = b; }

View File

@ -112,9 +112,9 @@ CAdvancementDeltas CActor::UpdateAnimation(float dt, CStateManager& mgr, bool ad
ushort maxVol = xd4_maxVol; ushort maxVol = xd4_maxVol;
int aid = GetCurrentAreaId().Value(); int aid = GetCurrentAreaId().Value();
const CGameCamera* camera = mgr.GetCameraManager()->GetCurrentCamera(mgr); const CGameCamera& camera = mgr.GetCameraManager()->GetCurrentCamera(mgr);
const CVector3f origin = GetTranslation(); const CVector3f origin = GetTranslation();
const CVector3f toCamera = camera->GetTranslation() - origin; const CVector3f toCamera = camera.GetTranslation() - origin;
const CInt32POINode* intNode; const CInt32POINode* intNode;
const CSoundPOINode* soundNode; const CSoundPOINode* soundNode;

View File

@ -66,20 +66,20 @@ void CPhysicsActor::ApplyForceWR(const CVector3f& force, const CAxisAngle& torqu
} }
void CPhysicsActor::ApplyImpulseOR(const CVector3f& impulse, const CAxisAngle& angle) { void CPhysicsActor::ApplyImpulseOR(const CVector3f& impulse, const CAxisAngle& angle) {
x168_impulse = x168_impulse + x34_transform.Rotate(impulse); x168_impulse = x168_impulse + GetTransform().Rotate(impulse);
CAxisAngle rotatedAngle(x34_transform.Rotate(angle.GetVector())); CAxisAngle rotatedAngle(GetTransform().Rotate(angle.GetVector()));
x180_angularImpulse = x180_angularImpulse + rotatedAngle; x180_angularImpulse = x180_angularImpulse + rotatedAngle;
} }
void CPhysicsActor::ApplyForceOR(const CVector3f& force, const CAxisAngle& torque) { void CPhysicsActor::ApplyForceOR(const CVector3f& force, const CAxisAngle& torque) {
x15c_force = x15c_force + x34_transform.Rotate(force); x15c_force = x15c_force + GetTransform().Rotate(force);
CAxisAngle rotatedTorque(x34_transform.Rotate(torque.GetVector())); CAxisAngle rotatedTorque(GetTransform().Rotate(torque.GetVector()));
x174_torque = x174_torque + rotatedTorque; x174_torque = x174_torque + rotatedTorque;
} }
void CPhysicsActor::ComputeDerivedQuantities() { void CPhysicsActor::ComputeDerivedQuantities() {
x138_velocity = xfc_constantForce * xec_massRecip; x138_velocity = xfc_constantForce * xec_massRecip;
x114_ = x34_transform.BuildMatrix3f(); x114_ = GetTransform().BuildMatrix3f();
x144_angularVelocity = CAxisAngle(x108_angularMomentum.GetVector() * xf4_inertiaTensorRecip); 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) { void CPhysicsActor::SetMotionState(const CMotionState& state) {
const CQuaternion& q = CQuaternion::FromNUQuaternion(state.GetOrientation()); const CQuaternion& q = CQuaternion::FromNUQuaternion(state.GetOrientation());
SetTransform(q.BuildTransform4f(x34_transform.GetTranslation())); SetTransform(q.BuildTransform4f(GetTransform().GetTranslation()));
SetTranslation(state.GetTranslation()); SetTranslation(state.GetTranslation());
xfc_constantForce = state.GetVelocity(); 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 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); return (GetMass() * impulse) * (1.f / d);
} }

View File

@ -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)) && if ((visor == CPlayerState::kPV_Combat || (x2c_w1 != 1 && visor == CPlayerState::kPV_Thermal)) &&
mgr.GetPlayer()->GetMorphballTransitionState() == CPlayer::kMS_Unmorphed) { mgr.GetPlayer()->GetMorphballTransitionState() == CPlayer::kMS_Unmorphed) {
CVector3f camPos = mgr.GetCameraManager()->GetCurrentCamera(mgr)->GetTranslation(); CVector3f camPos = mgr.GetCameraManager()->GetCurrentCamera(mgr).GetTranslation();
CVector3f camDiff = pos - camPos; CVector3f camDiff = pos - camPos;
float mag = camDiff.Magnitude(); float mag = camDiff.Magnitude();
camDiff *= (1.f / mag); 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); x28_ = rstl::max_val(rstl::max_val(0.f, x28_), x18_f1);
const CGameCamera* curCam = mgr.GetCameraManager()->GetCurrentCamera(mgr); const CGameCamera& curCam = mgr.GetCameraManager()->GetCurrentCamera(mgr);
CVector3f cameraForward = curCam->GetTransform().GetColumn(kDY); CVector3f cameraForward = curCam.GetTransform().GetColumn(kDY);
CVector3f dir = pos - curCam->GetTranslation(); CVector3f dir = pos - curCam.GetTranslation();
x24_ = 1.f - x28_ / x18_f1; x24_ = 1.f - x28_ / x18_f1;
float dot = CVector3f::Dot(dir.AsNormalized(), cameraForward); float dot = CVector3f::Dot(dir.AsNormalized(), cameraForward);
@ -120,14 +120,14 @@ void CVisorFlare::Render(const CVector3f& inPos, const CStateManager& mgr) const
CGraphics::DisableAllLights(); CGraphics::DisableAllLights();
gpRender->SetDepthReadWrite(false, false); gpRender->SetDepthReadWrite(false, false);
const CGameCamera* cam = mgr.GetCameraManager()->GetCurrentCamera(mgr); const CGameCamera& cam = mgr.GetCameraManager()->GetCurrentCamera(mgr);
CVector3f camPos = cam->GetTranslation(); CVector3f camPos = cam.GetTranslation();
CVector3f inPosCopy = inPos; CVector3f inPosCopy = inPos;
CTransform4f viewMatrix = CGraphics::GetViewMatrix(); CTransform4f viewMatrix = CGraphics::GetViewMatrix();
const CVector3f invPos = viewMatrix.GetInverse() * inPosCopy; const CVector3f invPos = viewMatrix.GetInverse() * inPosCopy;
const CVector3f invPos2 = viewMatrix * CVector3f(-invPos.GetX(), invPos.GetY(), -invPos.GetZ()); 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)) { if (!close_enough(x24_, 0.f)) {
float acos = 0.f; float acos = 0.f;
if (!close_enough(x20_f3, 0.f)) { if (!close_enough(x20_f3, 0.f)) {

View File

@ -223,7 +223,7 @@ void CMetaree::Think(float dt, CStateManager& mgr) {
if (!b && !x5ca_26_deactivated) { if (!b && !x5ca_26_deactivated) {
target = false; target = false;
} }
xe7_31_targetable = target; SetTargetable(target);
CPatterned::Think(dt, mgr); CPatterned::Think(dt, mgr);
} }

View File

@ -397,7 +397,7 @@ void CPlayerState::UpdateStaticInterference(CStateManager& stateMgr, const float
CPlayerState::EPlayerVisor CPlayerState::GetActiveVisor(const CStateManager& stateMgr) const { CPlayerState::EPlayerVisor CPlayerState::GetActiveVisor(const CStateManager& stateMgr) const {
const CFirstPersonCamera* cam = TCastToConstPtr< CFirstPersonCamera >( const CFirstPersonCamera* cam = TCastToConstPtr< CFirstPersonCamera >(
*stateMgr.GetCameraManager()->GetCurrentCamera(stateMgr)); stateMgr.GetCameraManager()->GetCurrentCamera(stateMgr));
return (cam ? x14_currentVisor : kPV_Combat); return (cam ? x14_currentVisor : kPV_Combat);
} }

View File

@ -42,7 +42,7 @@ void CScriptTrigger::Touch(CActor& act, CStateManager& mgr) {
uint testFlags = kTFL_None; uint testFlags = kTFL_None;
CPlayer* pl = TCastToPtr< CPlayer >(act); CPlayer* pl = TCastToPtr< CPlayer >(act);
if (pl) { 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) { if (mgr.GetLastTriggerId() != kInvalidUniqueId) {
return; return;
} }
@ -201,7 +201,7 @@ void CScriptTrigger::UpdateInhabitants(float dt, CStateManager& mgr) {
if (CActor* act = TCastToPtr< CActor >(mgr.ObjectById(it->GetObjectId()))) { if (CActor* act = TCastToPtr< CActor >(mgr.ObjectById(it->GetObjectId()))) {
bool playerValid = true; bool playerValid = true;
if (it->GetObjectId() == mgr.GetPlayer()->GetUniqueId()) { if (it->GetObjectId() == mgr.GetPlayer()->GetUniqueId()) {
if ((x12c_flags & kTFL_DetectPlayer == 0) && if (((x12c_flags & kTFL_DetectPlayer) == 0) &&
((mgr.GetPlayer()->GetMorphballTransitionState() == CPlayer::kMS_Morphed && ((mgr.GetPlayer()->GetMorphballTransitionState() == CPlayer::kMS_Morphed &&
(x12c_flags & kTFL_DetectUnmorphedPlayer)) || (x12c_flags & kTFL_DetectUnmorphedPlayer)) ||
(mgr.GetPlayer()->GetMorphballTransitionState() == CPlayer::kMS_Unmorphed && (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) { if ((x12c_flags & kTFL_DetectCamera) || x148_24_detectCamera) {
CGameCamera* cam = mgr.GetCameraManager()->GetCurrentCamera(mgr); CGameCamera& cam = mgr.CameraManager()->CurrentCamera(mgr);
const bool camInTrigger = GetTriggerBoundsWR().PointInside(cam->GetTranslation()); const bool camInTrigger = GetTriggerBoundsWR().PointInside(cam.GetTranslation());
if (x148_25_camSubmerged) { if (x148_25_camSubmerged) {
if (!camInTrigger) { if (!camInTrigger) {
x148_25_camSubmerged = false; x148_25_camSubmerged = false;
if ((x12c_flags & kTFL_DetectCamera)) { if ((x12c_flags & kTFL_DetectCamera)) {
sendExited = true; sendExited = true;
InhabitantExited(*cam, mgr); InhabitantExited(cam, mgr);
} }
} else { } else {
if ((x12c_flags & kTFL_DetectCamera)) { if ((x12c_flags & kTFL_DetectCamera)) {
InhabitantIdle(*cam, mgr); InhabitantIdle(cam, mgr);
sendInside = true; sendInside = true;
} }
} }
@ -312,7 +312,7 @@ void CScriptTrigger::UpdateInhabitants(float dt, CStateManager& mgr) {
if (camInTrigger) { if (camInTrigger) {
x148_25_camSubmerged = true; x148_25_camSubmerged = true;
if ((x12c_flags & kTFL_DetectCamera)) { if ((x12c_flags & kTFL_DetectCamera)) {
InhabitantAdded(*cam, mgr); InhabitantAdded(cam, mgr);
SendScriptMsgs(kSS_Entered, mgr, kSM_None); SendScriptMsgs(kSS_Entered, mgr, kSM_None);
} }
} }

View File

@ -4,14 +4,16 @@
#include "MetroidPrime/CStateManager.hpp" #include "MetroidPrime/CStateManager.hpp"
#include "MetroidPrime/Player/CPlayer.hpp" #include "MetroidPrime/Player/CPlayer.hpp"
CScriptVisorFlare::CScriptVisorFlare(TUniqueId uid, const rstl::string& name, const CEntityInfo& info, bool active, CScriptVisorFlare::CScriptVisorFlare(TUniqueId uid, const rstl::string& name,
const CVector3f& pos, CVisorFlare::EBlendMode blendMode, bool b1, float f1, const CEntityInfo& info, bool active, const CVector3f& pos,
float f2, float f3, uint w1, uint w2, const rstl::vector<CVisorFlare::CFlareDef>& flares) 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(), : CActor(uid, active, name, info, CTransform4f::Translate(pos), CModelData::CModelDataNull(),
CMaterialList(kMT_NoStepLogic), CActorParameters::None(), kInvalidUniqueId) CMaterialList(kMT_NoStepLogic), CActorParameters::None(), kInvalidUniqueId)
, xe8_flare(blendMode, b1, f1, f2, f3, w1, w2, flares) , xe8_flare(blendMode, b1, f1, f2, f3, w1, w2, flares)
, x11c_notInRenderLast(true) { , x11c_notInRenderLast(true) {
xe6_27_thermalVisorFlags = kTF_Hot; SetThermalFlags(kTF_Hot);
} }
CScriptVisorFlare::~CScriptVisorFlare() {} 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); 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);
}