From 45cc86893d40285ef48d7da8107ce9f8011c68f4 Mon Sep 17 00:00:00 2001 From: elijah-thomas774 Date: Sun, 24 May 2026 15:02:22 -0400 Subject: [PATCH] ActorOnRail_Ext getPoint Inline return type change to mVec3_c* instead of Vec* --- include/toBeSorted/d_path.h | 4 ++-- src/REL/d/a/e/d_a_e_ks.cpp | 8 ++++---- src/toBeSorted/d_path.cpp | 3 +-- 3 files changed, 7 insertions(+), 8 deletions(-) diff --git a/include/toBeSorted/d_path.h b/include/toBeSorted/d_path.h index 6337f5b4..9f4e7fbb 100644 --- a/include/toBeSorted/d_path.h +++ b/include/toBeSorted/d_path.h @@ -151,8 +151,8 @@ public: mPath.getDirection(mSegmentIndex, mSegmentTime, result); } - const Vec *getPoint(s32 idx) const { - return mPath.getPoint(idx); + const mVec3_c *getPoint(s32 idx) const { + return reinterpret_cast(mPath.getPoint(idx)); } bool checkFlag(u32 flags) const { diff --git a/src/REL/d/a/e/d_a_e_ks.cpp b/src/REL/d/a/e/d_a_e_ks.cpp index c9f1ca83..8a1d8f36 100644 --- a/src/REL/d/a/e/d_a_e_ks.cpp +++ b/src/REL/d/a/e/d_a_e_ks.cpp @@ -3047,7 +3047,7 @@ void dAcEKs_c::executeState_PathMove() { } field_0xDCA = mRail.getPath().getPointParam(idx, 0); if (checkPathPntParam(field_0xDCA)) { - setStartingPosition(*(const mVec3_c *)mRail.getPath().getPoint(idx)); + setStartingPosition(*mRail.getPoint(idx)); mStartingPos.y = getLineCrossYRange(getStartingPosition(), 300); changeState(StateID_ReturnToWait); return; @@ -3058,10 +3058,10 @@ void dAcEKs_c::executeState_PathMove() { } if (field_0xDC9 == 1) { field_0xDC9 = 2; - mVec3_c pnt; const s32 pntIdx = mRail.getClosestXZPoint(mPosition); - const Vec *pPnt = mRail.getPoint(pntIdx); - pnt.copyFrom(pPnt); + + mVec3_c pnt = *mRail.getPoint(pntIdx); + if (mRail.getPosition().squareDistanceToXZ(mPosition) > pnt.squareDistanceToXZ(mPosition)) { mRail.setSegment(pntIdx, 0.f); setStartingPosition(mRail.getPosition()); diff --git a/src/toBeSorted/d_path.cpp b/src/toBeSorted/d_path.cpp index 6a539796..0003a739 100644 --- a/src/toBeSorted/d_path.cpp +++ b/src/toBeSorted/d_path.cpp @@ -610,8 +610,7 @@ s32 ActorOnRail_Ext::getClosestXZPoint(const mVec3_c &pos) const { s32 best = 0; mVec3_c c; for (s32 i = 0; i < mPath.getNumPoints(); i++) { - const Vec *point = mPath.getPoint(i); - c = *reinterpret_cast(point) - pos; + c = *getPoint(i) - pos; f32 dist = c.squareMagXZ(); if (max > dist) { best = i;