From b40b7389756c42fb1e5d7ec74a064f4d31cfffd4 Mon Sep 17 00:00:00 2001 From: Ovahlord Date: Sat, 5 Oct 2019 07:47:29 +0200 Subject: [PATCH] Core/Movement: fixed an issue in the spline synch packet that was causing cyclic splines to get asynch --- src/server/game/Movement/Spline/MoveSpline.cpp | 5 +++-- src/server/game/Movement/Spline/MovementPacketBuilder.cpp | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/server/game/Movement/Spline/MoveSpline.cpp b/src/server/game/Movement/Spline/MoveSpline.cpp index 87b8ff92839..d1787bb7698 100644 --- a/src/server/game/Movement/Spline/MoveSpline.cpp +++ b/src/server/game/Movement/Spline/MoveSpline.cpp @@ -290,8 +290,8 @@ MoveSpline::UpdateResult MoveSpline::_updateState(int32& ms_time_diff) args.flags = splineflags; args.path_Idx_offset = point_Idx_offset; // MoveSplineFlag::Parabolic | MoveSplineFlag::Animation not supported currently - //args.parabolic_amplitude = ?; - //args.time_perc = ?; + //args.parabolic_amplitude = ?; + //args.time_perc = ?; args.splineId = m_Id; args.initialOrientation = initialOrientation; args.velocity = 1.0f; // Calculated below @@ -301,6 +301,7 @@ MoveSpline::UpdateResult MoveSpline::_updateState(int32& ms_time_diff) { // New cycle should preserve previous cycle's duration for some weird reason, even though // the path is really different now. Blizzard is weird. Or this was just a simple oversight. + // Since our splines precalculate length with velocity in mind, if we want to find the desired // velocity, we have to make a fake spline, calculate its duration and then compare it to the // desired duration, thus finding out how much the velocity has to be increased for them to match. diff --git a/src/server/game/Movement/Spline/MovementPacketBuilder.cpp b/src/server/game/Movement/Spline/MovementPacketBuilder.cpp index 90aee795dde..0552487666b 100644 --- a/src/server/game/Movement/Spline/MovementPacketBuilder.cpp +++ b/src/server/game/Movement/Spline/MovementPacketBuilder.cpp @@ -245,6 +245,6 @@ namespace Movement void PacketBuilder::WriteSplineSync(MoveSpline const& moveSpline, ByteBuffer& data) { - data << float(moveSpline.timePassed() / moveSpline.Duration()); + data << (float)moveSpline.timePassed() / moveSpline.Duration(); } }