From b6cbd70533fe89d5d01368ffc3d4912b03ed437f Mon Sep 17 00:00:00 2001 From: Ovahlord Date: Sat, 6 Jul 2019 23:09:13 +0200 Subject: [PATCH] Core/Movement: added a velocity argument for MoveSmoothPath motion master --- src/server/game/Movement/MotionMaster.cpp | 5 ++++- src/server/game/Movement/MotionMaster.h | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/server/game/Movement/MotionMaster.cpp b/src/server/game/Movement/MotionMaster.cpp index 28833459655..8304a771c6c 100644 --- a/src/server/game/Movement/MotionMaster.cpp +++ b/src/server/game/Movement/MotionMaster.cpp @@ -509,7 +509,7 @@ void MotionMaster::MoveCirclePath(float x, float y, float z, float radius, bool init.Launch(); } -void MotionMaster::MoveSmoothPath(uint32 pointId, Position const* pathPoints, size_t pathSize, bool walk /*= false*/, bool fly /*= false*/) +void MotionMaster::MoveSmoothPath(uint32 pointId, Position const* pathPoints, size_t pathSize, bool walk /*= false*/, bool fly /*= false*/, float velocity /*= 0.0f*/) { Movement::MoveSplineInit init(_owner); Movement::PointsArray path; @@ -525,6 +525,9 @@ void MotionMaster::MoveSmoothPath(uint32 pointId, Position const* pathPoints, si init.SetUncompressed(); } + if (velocity > 0.0f) + init.SetVelocity(velocity); + init.MovebyPath(path); init.SetSmooth(); init.SetWalk(walk); diff --git a/src/server/game/Movement/MotionMaster.h b/src/server/game/Movement/MotionMaster.h index 95cfe53dcb9..b9ec6dbb2f8 100644 --- a/src/server/game/Movement/MotionMaster.h +++ b/src/server/game/Movement/MotionMaster.h @@ -185,7 +185,7 @@ class TC_GAME_API MotionMaster } void MoveJump(float x, float y, float z, float o, float speedXY, float speedZ, uint32 id = EVENT_JUMP, bool hasOrientation = false); void MoveCirclePath(float x, float y, float z, float radius, bool clockwise, uint8 stepCount); - void MoveSmoothPath(uint32 pointId, Position const* pathPoints, size_t pathSize, bool walk = false, bool fly = false); + void MoveSmoothPath(uint32 pointId, Position const* pathPoints, size_t pathSize, bool walk = false, bool fly = false, float velocity = 0.0f); // Walk along spline chain stored in DB (script_spline_chain_meta and script_spline_chain_waypoints) void MoveAlongSplineChain(uint32 pointId, uint16 dbChainId, bool walk); void MoveAlongSplineChain(uint32 pointId, std::vector const& chain, bool walk);