From 581183123cb1eaf80a740d8195b458ffe1be4337 Mon Sep 17 00:00:00 2001 From: Shauren Date: Mon, 9 Feb 2026 18:18:40 +0100 Subject: [PATCH] Core/Movement: Improve Turning spline handling --- src/server/game/Movement/Spline/MoveSpline.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/server/game/Movement/Spline/MoveSpline.cpp b/src/server/game/Movement/Spline/MoveSpline.cpp index 598b7702b2..f512910075 100644 --- a/src/server/game/Movement/Spline/MoveSpline.cpp +++ b/src/server/game/Movement/Spline/MoveSpline.cpp @@ -54,7 +54,7 @@ Location MoveSpline::computePosition(int32 time_point, int32 point_index) const } else if (splineflags.Turning) { - c.orientation = Position::NormalizeOrientation(turn->StartFacing + float(time_point) / float(IN_MILLISECONDS) * turn->RadsPerSec); + c.orientation = Position::NormalizeOrientation(turn->StartFacing + std::copysign(float(time_point) / float(IN_MILLISECONDS) * turn->RadsPerSec, turn->TotalTurnRads)); } else { @@ -192,7 +192,7 @@ void MoveSpline::init_spline(MoveSplineInitArgs const& args) if (turn) { - MySpline::LengthType totalTurnTime = static_cast(turn->TotalTurnRads / turn->RadsPerSec * float(IN_MILLISECONDS)); + MySpline::LengthType totalTurnTime = std::abs(static_cast(turn->TotalTurnRads / turn->RadsPerSec * float(IN_MILLISECONDS))); spline.set_length(spline.last(), std::max(spline.length(), totalTurnTime)); } @@ -272,6 +272,11 @@ bool MoveSplineInitArgs::Validate(Unit const* unit) CHECK(!spellEffectExtra->ProgressCurveId || sCurveStore.LookupEntry(spellEffectExtra->ProgressCurveId), unit->GetDebugInfo()); CHECK(!spellEffectExtra->ParabolicCurveId || sCurveStore.LookupEntry(spellEffectExtra->ParabolicCurveId), unit->GetDebugInfo()); } + if (turnData) + { + CHECK(G3D::fuzzyNe(turnData->TotalTurnRads, 0.0f), unit->GetDebugInfo()); + CHECK(turnData->RadsPerSec > 0.0f, unit->GetDebugInfo()); + } return true; #undef CHECK }