From 3ea32bf3ea43cbccfc729fdacd774f67749db87d Mon Sep 17 00:00:00 2001 From: Headpenguin Date: Thu, 29 Jun 2023 20:20:25 -0400 Subject: [PATCH] Match MarioActor::updateRotationInfo --- libs/JSystem/include/JSystem/JGeometry/TVec.h | 10 ++++--- source/Game/Player/MarioActor.cpp | 29 +++++++++++++++++++ 2 files changed, 35 insertions(+), 4 deletions(-) diff --git a/libs/JSystem/include/JSystem/JGeometry/TVec.h b/libs/JSystem/include/JSystem/JGeometry/TVec.h index 8cc993a5..daa134f6 100644 --- a/libs/JSystem/include/JSystem/JGeometry/TVec.h +++ b/libs/JSystem/include/JSystem/JGeometry/TVec.h @@ -249,10 +249,6 @@ namespace JGeometry { return f; } - Vec multToVec(T scalar) { - - } - TVec3 operator/(T) const; bool operator==(const TVec3 &); @@ -669,6 +665,12 @@ namespace JGeometry { } } + inline void multAssignInline(T scalar) { + x *= scalar; + y *= scalar; + z *= scalar; + } + T x, y, z; }; diff --git a/source/Game/Player/MarioActor.cpp b/source/Game/Player/MarioActor.cpp index 43f11ea4..b3b176e3 100644 --- a/source/Game/Player/MarioActor.cpp +++ b/source/Game/Player/MarioActor.cpp @@ -210,3 +210,32 @@ XjointTransform* MarioActor::getJointCtrl(const char *name) const { XanimeCore *core = _234 -> _c -> mCore; return core -> getJointTransform(MR::getJointIndex(this, name)); } + +void MarioActor::updateRotationInfo() { + TRot3f stack_44; + PSMTXConcat(getBaseMtx(), _e3c.toMtxPtr(), stack_44.toMtxPtr()); + MR::makeRTFromMtxPtr(NULL, &mRotation, stack_44.toMtxPtr(), true); + if(mRotation.z > 90f && mRotation.x > 90f) { + f32 diff = 180f - mRotation.y; + mRotation.z = 0f; + mRotation.y = diff; + mRotation.x = 0f; + } + stack_44.getEuler(_318); + _318.multAssignInline(57.2957763672f); + stack_44.getEuler(_324); + _324.multAssignInline(57.2957763672f); + if(MR::isSameDirection(_240, _230 -> _208, .01f)) _a18 = mRotation; + else { + TPos3f stack_14; + TVec3f stack_8 = -_240; + MR::makeMtxUpFront(&stack_14, stack_8, _230 -> _208); + MR::makeRTFromMtxPtr(NULL, &_a18, stack_14.toMtxPtr(), true); + if(_a18.z > 90f && _a18.x > 90f) { + f32 diff = 180f - _a18.y; + _a18.z = 0f; + _a18.y = diff; + _a18.x = 0f; + } + } +}