diff options
| author | Shauren <shauren.trinity@gmail.com> | 2024-04-25 00:42:16 +0200 |
|---|---|---|
| committer | Shauren <shauren.trinity@gmail.com> | 2024-04-25 00:42:16 +0200 |
| commit | dad976beb4f1a865e5df5d6f03da1d00d266e1fc (patch) | |
| tree | 165190844b4094fd023d67f70529e0b002121647 /src/server/game/Movement | |
| parent | e0e1b6a4098badb6f48ba1d5cb1cc1739e310959 (diff) | |
Core/Movement: Migrate scripts using GetMotionMaster()->MoveSmoothPath to GetMotionMaster()->MovePath and kill it (they now have the same capabilities)
Diffstat (limited to 'src/server/game/Movement')
| -rw-r--r-- | src/server/game/Movement/MotionMaster.cpp | 26 | ||||
| -rw-r--r-- | src/server/game/Movement/MotionMaster.h | 1 | ||||
| -rw-r--r-- | src/server/game/Movement/Spline/MoveSpline.cpp | 3 | ||||
| -rw-r--r-- | src/server/game/Movement/Waypoints/WaypointDefines.h | 6 |
4 files changed, 4 insertions, 32 deletions
diff --git a/src/server/game/Movement/MotionMaster.cpp b/src/server/game/Movement/MotionMaster.cpp index e60f30741b6..c1f042111cc 100644 --- a/src/server/game/Movement/MotionMaster.cpp +++ b/src/server/game/Movement/MotionMaster.cpp @@ -990,32 +990,6 @@ void MotionMaster::MoveCirclePath(float x, float y, float z, float radius, bool Add(new GenericMovementGenerator(std::move(initializer), EFFECT_MOTION_TYPE, 0, { .Duration = duration, .ScriptResult = std::move(scriptResult) })); } -void MotionMaster::MoveSmoothPath(uint32 pointId, Position const* pathPoints, size_t pathSize, bool walk, bool fly) -{ - Movement::PointsArray path; - path.reserve(pathSize); - std::transform(pathPoints, pathPoints + pathSize, std::back_inserter(path), [](Position const& point) - { - return G3D::Vector3(point.GetPositionX(), point.GetPositionY(), point.GetPositionZ()); - }); - std::function<void(Movement::MoveSplineInit&)> initializer = [=](Movement::MoveSplineInit& init) - { - init.MovebyPath(path); - init.SetWalk(walk); - if (fly) - { - init.SetFly(); - init.SetUncompressed(); - init.SetSmooth(); - } - }; - - // This code is not correct - // GenericMovementGenerator does not affect UNIT_STATE_ROAMING_MOVE - // need to call PointMovementGenerator with various pointIds - Add(new GenericMovementGenerator(std::move(initializer), EFFECT_MOTION_TYPE, pointId)); -} - void MotionMaster::MoveAlongSplineChain(uint32 pointId, uint16 dbChainId, bool walk) { Creature* owner = _owner->ToCreature(); diff --git a/src/server/game/Movement/MotionMaster.h b/src/server/game/Movement/MotionMaster.h index 4fed7e9ea07..e7db6694429 100644 --- a/src/server/game/Movement/MotionMaster.h +++ b/src/server/game/Movement/MotionMaster.h @@ -201,7 +201,6 @@ class TC_GAME_API MotionMaster Optional<Milliseconds> duration = {}, Optional<float> speed = {}, MovementWalkRunSpeedSelectionMode speedSelectionMode = MovementWalkRunSpeedSelectionMode::Default, Optional<Scripting::v2::ActionResultSetter<MovementStopReason>>&& scriptResult = {}); - void MoveSmoothPath(uint32 pointId, Position const* pathPoints, size_t pathSize, bool walk = false, bool fly = false); // 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<SplineChainLink> const& chain, bool walk); diff --git a/src/server/game/Movement/Spline/MoveSpline.cpp b/src/server/game/Movement/Spline/MoveSpline.cpp index 45ebc48ebe5..1a5f1c8f4fa 100644 --- a/src/server/game/Movement/Spline/MoveSpline.cpp +++ b/src/server/game/Movement/Spline/MoveSpline.cpp @@ -277,9 +277,6 @@ bool MoveSplineInitArgs::_checkPathLengths() if (path.size() > 2) { - if ((path[2] - path[1]).length() < 0.1f) - return false; - Vector3 middle = (path.front() + path.back()) / 2; for (uint32 i = 1; i < path.size() - 1; ++i) { diff --git a/src/server/game/Movement/Waypoints/WaypointDefines.h b/src/server/game/Movement/Waypoints/WaypointDefines.h index b49ebc8a1d2..68225a7e8b5 100644 --- a/src/server/game/Movement/Waypoints/WaypointDefines.h +++ b/src/server/game/Movement/Waypoints/WaypointDefines.h @@ -41,14 +41,16 @@ enum class WaypointPathFlags : uint8 None = 0x00, FollowPathBackwardsFromEndToStart = 0x01, ExactSplinePath = 0x02, // Points are going to be merged into single packets and pathfinding is disabled + + FlyingPath = ExactSplinePath // flying paths are always exact splines }; DEFINE_ENUM_FLAG(WaypointPathFlags); struct WaypointNode { - WaypointNode() : Id(0), X(0.f), Y(0.f), Z(0.f), MoveType(WaypointMoveType::Walk) { } - WaypointNode(uint32 id, float x, float y, float z, Optional<float> orientation = { }, Optional<Milliseconds> delay = {}) + constexpr WaypointNode() : Id(0), X(0.f), Y(0.f), Z(0.f), MoveType(WaypointMoveType::Walk) { } + constexpr WaypointNode(uint32 id, float x, float y, float z, Optional<float> orientation = { }, Optional<Milliseconds> delay = {}) { Id = id; X = x; |
