diff --git a/src/server/game/Entities/Object/Object.cpp b/src/server/game/Entities/Object/Object.cpp index 7a763cef6..d2cbc7e12 100644 --- a/src/server/game/Entities/Object/Object.cpp +++ b/src/server/game/Entities/Object/Object.cpp @@ -370,11 +370,7 @@ void Object::BuildMovementUpdate(ByteBuffer* data, uint16 flags) const // 0x08000000 if (unit->m_movementInfo.GetMovementFlags() & MOVEMENTFLAG_SPLINE_ENABLED) { - const G3D::Vector3* p = &unit->movespline->_Spline().getPoints(true)[0]; - if (unit->movespline->_Spline().getPoints(true).empty() || (!unit->movespline->_Spline().getPoints(true).empty() && !p)) - const_cast(unit)->DisableSpline(); - else - Movement::PacketBuilder::WriteCreate(*unit->movespline, *data); + Movement::PacketBuilder::WriteCreate(*unit->movespline, *data); } } else diff --git a/src/server/game/Movement/Spline/MoveSpline.cpp b/src/server/game/Movement/Spline/MoveSpline.cpp index 65ad59ad1..27fb52288 100644 --- a/src/server/game/Movement/Spline/MoveSpline.cpp +++ b/src/server/game/Movement/Spline/MoveSpline.cpp @@ -80,7 +80,7 @@ namespace Movement void MoveSpline::computeFallElevation(float& el) const { - float z_now = spline.getPoint(spline.first(), false).z - Movement::computeFallElevation(MSToSec(time_passed), false); + float z_now = spline.getPoint(spline.first()).z - Movement::computeFallElevation(MSToSec(time_passed), false); float final_z = FinalDestination().z; el = std::max(z_now, final_z); } @@ -96,7 +96,7 @@ namespace Movement float start_elevation; inline int32 operator()(Spline& s, int32 i) { - return Movement::computeFallTime(start_elevation - s.getPoint(i + 1, false).z, false) * 1000.f; + return Movement::computeFallTime(start_elevation - s.getPoint(i + 1).z, false) * 1000.f; } }; @@ -138,7 +138,7 @@ namespace Movement // init spline timestamps if (splineflags.falling) { - FallInitializer init(spline.getPoint(spline.first(), false).z); + FallInitializer init(spline.getPoint(spline.first()).z); spline.initLengths(init); } else diff --git a/src/server/game/Movement/Spline/MoveSpline.h b/src/server/game/Movement/Spline/MoveSpline.h index 1c0931abf..d713ba9f3 100644 --- a/src/server/game/Movement/Spline/MoveSpline.h +++ b/src/server/game/Movement/Spline/MoveSpline.h @@ -71,7 +71,7 @@ namespace Movement void init_spline(const MoveSplineInitArgs& args); protected: - [[nodiscard]] const MySpline::ControlArray& getPath(bool visual) const { return spline.getPoints(visual); } + [[nodiscard]] const MySpline::ControlArray& getPath() const { return spline.getPoints(); } void computeParabolicElevation(float& el) const; void computeFallElevation(float& el) const; @@ -117,8 +117,8 @@ namespace Movement [[nodiscard]] bool isCyclic() const { return splineflags.cyclic; } [[nodiscard]] bool isFalling() const { return splineflags.falling; } [[nodiscard]] bool isWalking() const { return splineflags.walkmode; } - [[nodiscard]] Vector3 FinalDestination() const { return Initialized() ? spline.getPoint(spline.last(), false) : Vector3(); } - [[nodiscard]] Vector3 CurrentDestination() const { return Initialized() ? spline.getPoint(point_Idx + 1, false) : Vector3(); } + [[nodiscard]] Vector3 FinalDestination() const { return Initialized() ? spline.getPoint(spline.last()) : Vector3(); } + [[nodiscard]] Vector3 CurrentDestination() const { return Initialized() ? spline.getPoint(point_Idx + 1) : Vector3(); } [[nodiscard]] int32 currentPathIdx() const; [[nodiscard]] bool HasAnimation() const { return splineflags.animation; } diff --git a/src/server/game/Movement/Spline/MoveSplineInit.cpp b/src/server/game/Movement/Spline/MoveSplineInit.cpp index 3a6084e21..faf6cd203 100644 --- a/src/server/game/Movement/Spline/MoveSplineInit.cpp +++ b/src/server/game/Movement/Spline/MoveSplineInit.cpp @@ -135,11 +135,6 @@ namespace Movement data << int8(unit->GetTransSeat()); } - Movement::SplineBase::ControlArray* visualPoints = const_cast(move_spline._Spline().allocateVisualPoints()); - visualPoints->resize(move_spline._Spline().getPointCount()); - // Xinef: Apply hover in creature movement packet - std::copy(move_spline._Spline().getPoints(false).begin(), move_spline._Spline().getPoints(false).end(), visualPoints->begin()); - PacketBuilder::WriteMonsterMove(move_spline, data); unit->SendMessageToSet(&data, true); diff --git a/src/server/game/Movement/Spline/MovementPacketBuilder.cpp b/src/server/game/Movement/Spline/MovementPacketBuilder.cpp index a624b0766..b7ccda009 100644 --- a/src/server/game/Movement/Spline/MovementPacketBuilder.cpp +++ b/src/server/game/Movement/Spline/MovementPacketBuilder.cpp @@ -45,7 +45,7 @@ namespace Movement MoveSplineFlag splineflags = move_spline.splineflags; data << uint8(0); // sets/unsets MOVEMENTFLAG2_UNK7 (0x40) - data << move_spline.spline.getPoint(move_spline.spline.first(), true); + data << move_spline.spline.getPoint(move_spline.spline.first()); data << move_spline.GetId(); switch (splineflags & MoveSplineFlag::Mask_Final_Facing) @@ -99,7 +99,7 @@ namespace Movement void WriteLinearPath(const Spline& spline, ByteBuffer& data) { uint32 last_idx = spline.getPointCount() - 3; - const Vector3* real_path = &spline.getPoint(1, true); + const Vector3* real_path = &spline.getPoint(1); data << last_idx; data << real_path[last_idx]; // destination @@ -120,7 +120,7 @@ namespace Movement { uint32 count = spline.getPointCount() - 3; data << count; - data.append(&spline.getPoint(2, true), count); + data.append(&spline.getPoint(2), count); } void WriteCatmullRomCyclicPath(const Spline& spline, ByteBuffer& data, bool flying) @@ -129,12 +129,12 @@ namespace Movement data << uint32(count + 1); if (flying) { - data << spline.getPoint(1, true); // fake point, client will erase it from the spline after first cycle done - data.append(&spline.getPoint(2, true), count); + data << spline.getPoint(1); // fake point, client will erase it from the spline after first cycle done + data.append(&spline.getPoint(2), count); } else { - data.append(&spline.getPoint(2, true), count); + data.append(&spline.getPoint(2), count); data << Vector3::zero(); //Xinef: fake point } } @@ -189,9 +189,9 @@ namespace Movement data << move_spline.vertical_acceleration; // added in 3.1 data << move_spline.effect_start_time; // added in 3.1 - uint32 nodes = move_spline.getPath(true).size(); + uint32 nodes = move_spline.getPath().size(); data << nodes; - data.append(&move_spline.getPath(true)[0], nodes); + data.append(&move_spline.getPath()[0], nodes); data << uint8(move_spline.spline.mode()); // added in 3.1 data << (move_spline.isCyclic() ? Vector3::zero() : move_spline.FinalDestination()); } diff --git a/src/server/game/Movement/Spline/Spline.cpp b/src/server/game/Movement/Spline/Spline.cpp index 15169f63c..601951a20 100644 --- a/src/server/game/Movement/Spline/Spline.cpp +++ b/src/server/game/Movement/Spline/Spline.cpp @@ -286,7 +286,6 @@ namespace Movement index_lo = 0; index_hi = 0; points.clear(); - pointsVisual.clear(); } std::string SplineBase::ToString() const diff --git a/src/server/game/Movement/Spline/Spline.h b/src/server/game/Movement/Spline/Spline.h index c0ea4899c..98896d931 100644 --- a/src/server/game/Movement/Spline/Spline.h +++ b/src/server/game/Movement/Spline/Spline.h @@ -42,7 +42,6 @@ namespace Movement protected: ControlArray points; - ControlArray pointsVisual; index_type index_lo{0}; index_type index_hi{0}; @@ -112,10 +111,9 @@ namespace Movement [[nodiscard]] bool isCyclic() const { return cyclic;} // Xinef: DO NOT USE EXCEPT FOR SPLINE INITIALIZATION!!!!!! - [[nodiscard]] const ControlArray* allocateVisualPoints() const { return &pointsVisual; } - [[nodiscard]] const ControlArray& getPoints(bool visual) const { return visual ? pointsVisual : points;} + [[nodiscard]] const ControlArray& getPoints() const { return points;} [[nodiscard]] index_type getPointCount() const { return points.size();} - [[nodiscard]] const Vector3& getPoint(index_type i, bool visual) const { return visual ? pointsVisual[i] : points[i];} + [[nodiscard]] const Vector3& getPoint(index_type i) const { return points[i];} /** Initializes spline. Don't call other methods while spline not initialized. */ void init_spline(const Vector3* controls, index_type count, EvaluationMode m);