From 82e64753008395eec928743db879cb11706f7fe2 Mon Sep 17 00:00:00 2001 From: Luke Street Date: Tue, 29 Oct 2024 23:38:26 -0600 Subject: [PATCH] Link CScriptActor --- configure.py | 2 +- src/MetroidPrime/Player/CPlayer.cpp | 3 +++ src/MetroidPrime/ScriptObjects/CScriptActor.cpp | 13 +++++++------ 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/configure.py b/configure.py index 19562e8e..718ee05a 100755 --- a/configure.py +++ b/configure.py @@ -420,7 +420,7 @@ config.libs = [ Object(NonMatching, "MetroidPrime/Tweaks/CTweakPlayerGun.cpp"), Object(NonMatching, "MetroidPrime/CPauseScreen.cpp"), Object(NonMatching, "MetroidPrime/Tweaks/CTweakGui.cpp"), - Object(NonMatching, "MetroidPrime/ScriptObjects/CScriptActor.cpp"), + Object(Matching, "MetroidPrime/ScriptObjects/CScriptActor.cpp"), Object(NonMatching, "MetroidPrime/ScriptObjects/CScriptTrigger.cpp"), Object(Matching, "MetroidPrime/ScriptObjects/CScriptWaypoint.cpp"), Object(NonMatching, "MetroidPrime/Enemies/CPatterned.cpp"), diff --git a/src/MetroidPrime/Player/CPlayer.cpp b/src/MetroidPrime/Player/CPlayer.cpp index 2c1ee74f..39502fd4 100644 --- a/src/MetroidPrime/Player/CPlayer.cpp +++ b/src/MetroidPrime/Player/CPlayer.cpp @@ -1995,6 +1995,9 @@ CVector3f CPlayer::CalculateLeftStickEdgePosition(float strafeInput, float forwa float f4 = CMath::Limit(f1 / (M_PIF / 4.f), 1.f); return CVector3f(f31, 0.f, 0.f) + CVector3f(f4, f4, f4) * (CVector3f(f30, f29, 0.f) - CVector3f(f31, 0.f, 0.f)); + // or: + // CVector3f d = CVector3f(f30, f29, 0.f) - CVector3f(f31, 0.f, 0.f); + // return CVector3f(f31, 0.f, 0.f) + CVector3f(f4 * d.GetX(), f4 * d.GetY(), f4 * d.GetZ()); } bool CPlayer::AttachActorToPlayer(TUniqueId id, bool disableGun) { diff --git a/src/MetroidPrime/ScriptObjects/CScriptActor.cpp b/src/MetroidPrime/ScriptObjects/CScriptActor.cpp index 925b373b..8e4b218b 100644 --- a/src/MetroidPrime/ScriptObjects/CScriptActor.cpp +++ b/src/MetroidPrime/ScriptObjects/CScriptActor.cpp @@ -8,6 +8,7 @@ #include "MetroidPrime/ScriptObjects/CScriptColorModulate.hpp" #include "MetroidPrime/ScriptObjects/CScriptTrigger.hpp" +#include "Kyoto/Math/CVector3f.hpp" #include "Kyoto/Math/CloseEnough.hpp" CScriptActor::CScriptActor(TUniqueId uid, const rstl::string& name, const CEntityInfo& info, @@ -77,18 +78,18 @@ void CScriptActor::Think(float dt, CStateManager& mgr) { GetAnimationData()->IsAnimTimeRemaining(dt - FLT_EPSILON, rstl::string_l("Whole Body")); const bool loop = GetModelData()->GetIsLoop(); - const CAdvancementDeltas deltas = CActor::UpdateAnimation(dt, mgr, true); + CAdvancementDeltas deltas = CActor::UpdateAnimation(dt, mgr, true); if (timeRemaining || loop) { x2e2_26_animating = true; if (x2e2_30_scaleAdvancementDelta) { - CVector3f rot = GetTransform().TransposeRotate(deltas.GetOffsetDelta()); + CVector3f pos = GetTransform().TransposeRotate(deltas.GetOffsetDelta()); CVector3f scale = GetModelData()->GetScale(); - // CVector3f ret = GetTransform().Rotate(scale * rot); - CVector3f ret = GetTransform().Rotate(CVector3f( - scale.GetX() * rot.GetX(), scale.GetY() * rot.GetY(), scale.GetZ() * rot.GetZ())); - MoveToOR(ret, dt); + pos = CVector3f(scale.GetX() * pos.GetX(), scale.GetY() * pos.GetY(), + scale.GetZ() * pos.GetZ()); + pos = GetTransform().Rotate(pos); + MoveToOR(pos, dt); } else { MoveToOR(deltas.GetOffsetDelta(), dt); }