From 49cb9d1bc1720c70c68d8cddbffdbd61f99c9fe6 Mon Sep 17 00:00:00 2001 From: HeartPiece Date: Thu, 4 Jul 2024 18:33:29 +1000 Subject: [PATCH] nvm playCamera actually equivalent --- docs/recommended_todo.md | 2 +- include/trig.h | 16 ++++++++-------- src/plugProjectNishimuraU/playCamera.cpp | 4 ++-- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/docs/recommended_todo.md b/docs/recommended_todo.md index fdd938e58..d03eeb54d 100644 --- a/docs/recommended_todo.md +++ b/docs/recommended_todo.md @@ -127,7 +127,7 @@ | SaraiState.cpp | 27370 | MarState.cpp | 28356 | | FrogState.cpp | 30811 | SnakeCrowState.cpp | 32065 | | HanachirashiState.cpp | 32837 | KabutoState.cpp | 32923 | -| TankState.cpp | 33069 | playCamera.cpp | 33864 | +| TankState.cpp | 33069 | playCamera.cpp | 33865 | | BombSaraiState.cpp | 36432 | DangoMushi.cpp | 37034 | | RandMapScore.cpp | 37057 | Hanachirashi.cpp | 39560 | | SnakeCrow.cpp | 39754 | Mar.cpp | 41695 | diff --git a/include/trig.h b/include/trig.h index b7e1e9628..b391ae3f1 100644 --- a/include/trig.h +++ b/include/trig.h @@ -127,22 +127,22 @@ inline f32 _normaliseAngle(f32 angle) return normalisedAngle; } -inline f32 _normaliseAngle(f32 start, f32 angle) +inline f32 _normaliseAngle(f32 angle, f32 start) { - // f32 normalisedAngle = start; - if (start >= angle) { - f32 delta = start - angle; + f32 normalisedAngle = start; + if (normalisedAngle >= angle) { + f32 delta = normalisedAngle - angle; if (TAU - delta < delta) { - start -= TAU; + normalisedAngle -= TAU; } } else { - f32 delta = angle - start; + f32 delta = angle - normalisedAngle; if (TAU - delta < delta) { - start += TAU; + normalisedAngle += TAU; } } - return start; + return normalisedAngle; } inline f32 _clampAngle(f32 angle, f32 difference, f32 limit) diff --git a/src/plugProjectNishimuraU/playCamera.cpp b/src/plugProjectNishimuraU/playCamera.cpp index 231fa4f66..bf3a9860f 100644 --- a/src/plugProjectNishimuraU/playCamera.cpp +++ b/src/plugProjectNishimuraU/playCamera.cpp @@ -625,9 +625,9 @@ void PlayCamera::updateParms(int flag) CameraParms* parms = mCameraParms; - f32 targetAngle = _normaliseAngle(mCameraAngleTarget, mCameraAngleCurrent); // this needs fixing + f32 targetAngle = _normaliseAngle(mCameraAngleCurrent, mCameraAngleTarget); // this needs fixing - mCameraAngleCurrent += parms->mRotSpeed.mValue * (targetAngle - mCameraAngleTarget); + mCameraAngleCurrent += parms->mRotSpeed.mValue * (targetAngle - mCameraAngleCurrent); f32 angle = mCameraAngleCurrent; clampAngle(angle);