Link CScriptActor

This commit is contained in:
Luke Street 2024-10-29 23:38:26 -06:00
parent c9a3995d35
commit 82e6475300
3 changed files with 11 additions and 7 deletions

View File

@ -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"),

View File

@ -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) {

View File

@ -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);
}