diff options
author | Rat <gmstreetrat@gmail.com> | 2015-03-24 20:01:02 +0100 |
---|---|---|
committer | Rat <gmstreetrat@gmail.com> | 2015-03-24 20:01:02 +0100 |
commit | eebc468e628acc801a6426e03815150c8cfd9172 (patch) | |
tree | 2f269f7b97bd7fe83b8bfeb3240820521110f9aa /src/server/game/Movement/MotionMaster.cpp | |
parent | bc5ebe3d0599a08e93fd6d0a8c63c7e7cc43c35f (diff) | |
parent | 3ad7776d5061308d3e2b4ff9e3cbf67d48bffdd6 (diff) |
Merge branch '6.x' of https://github.com/TrinityCore/TrinityCore into 6.x
Conflicts:
src/server/collision/Management/MMapManager.cpp
src/server/game/Conditions/ConditionMgr.cpp
src/server/game/Conditions/ConditionMgr.h
Diffstat (limited to 'src/server/game/Movement/MotionMaster.cpp')
-rw-r--r-- | src/server/game/Movement/MotionMaster.cpp | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/src/server/game/Movement/MotionMaster.cpp b/src/server/game/Movement/MotionMaster.cpp index 7eb38f3e637..5177bf5c9de 100644 --- a/src/server/game/Movement/MotionMaster.cpp +++ b/src/server/game/Movement/MotionMaster.cpp @@ -381,6 +381,43 @@ void MotionMaster::MoveJump(float x, float y, float z, float speedXY, float spee Mutate(new EffectMovementGenerator(id), MOTION_SLOT_CONTROLLED); } +void MotionMaster::MoveCirclePath(float x, float y, float z, float radius, bool clockwise, uint8 stepCount) +{ + float step = 2 * float(M_PI) / stepCount * (clockwise ? -1.0f : 1.0f); + Position const& pos = { x, y, z, 0.0f }; + float angle = pos.GetAngle(_owner->GetPositionX(), _owner->GetPositionY()); + + Movement::MoveSplineInit init(_owner); + + for (uint8 i = 0; i < stepCount; angle += step, ++i) + { + G3D::Vector3 point; + point.x = x + radius * cosf(angle); + point.y = y + radius * sinf(angle); + + if (_owner->IsFlying()) + point.z = z; + else + point.z = _owner->GetMap()->GetHeight(_owner->GetPhaseMask(), point.x, point.y, z); + + init.Path().push_back(point); + } + + if (_owner->IsFlying()) + { + init.SetFly(); + init.SetCyclic(); + init.SetAnimation(Movement::ToFly); + } + else + { + init.SetWalk(true); + init.SetCyclic(); + } + + init.Launch(); +} + void MotionMaster::MoveFall(uint32 id /*=0*/) { // use larger distance for vmap height search than in most other cases |