aboutsummaryrefslogtreecommitdiff
path: root/src/server/game/Movement/MotionMaster.cpp
diff options
context:
space:
mode:
authorShauren <shauren.trinity@gmail.com>2021-11-27 21:56:00 +0100
committerShauren <shauren.trinity@gmail.com>2021-11-27 21:56:00 +0100
commit684cd9d9681466019dcd06ad6f994890cff8cb2e (patch)
tree16008a4f7ac175468f2aa070a1da231a3bbdf44b /src/server/game/Movement/MotionMaster.cpp
parent1e46fc17eea2d98736fb506ee581c79ce30a3dd9 (diff)
Core/Movement: Implement initializing parabolic splines using jump gravity instead of max parabolic height
Diffstat (limited to 'src/server/game/Movement/MotionMaster.cpp')
-rw-r--r--src/server/game/Movement/MotionMaster.cpp31
1 files changed, 31 insertions, 0 deletions
diff --git a/src/server/game/Movement/MotionMaster.cpp b/src/server/game/Movement/MotionMaster.cpp
index 4f8fd1345ae..2114b94f6a4 100644
--- a/src/server/game/Movement/MotionMaster.cpp
+++ b/src/server/game/Movement/MotionMaster.cpp
@@ -813,6 +813,37 @@ void MotionMaster::MoveJump(float x, float y, float z, float o, float speedXY, f
Add(movement);
}
+void MotionMaster::MoveJumpWithGravity(Position const& pos, float speedXY, float gravity, uint32 id/* = EVENT_JUMP*/, bool hasOrientation/* = false*/,
+ JumpArrivalCastArgs const* arrivalCast /*= nullptr*/, Movement::SpellEffectExtraData const* spellEffectExtraData /*= nullptr*/)
+{
+ TC_LOG_DEBUG("movement.motionmaster", "MotionMaster::MoveJumpWithGravity: '%s', jumps to point Id: %u (%s)", _owner->GetGUID().ToString().c_str(), id, pos.ToString().c_str());
+ if (speedXY < 0.01f)
+ return;
+
+ Movement::MoveSplineInit init(_owner);
+ init.MoveTo(pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ(), false);
+ init.SetParabolicVerticalAcceleration(gravity, 0);
+ init.SetUncompressed();
+ init.SetVelocity(speedXY);
+ if (hasOrientation)
+ init.SetFacing(pos.GetOrientation());
+ if (spellEffectExtraData)
+ init.SetSpellEffectExtraData(*spellEffectExtraData);
+
+ uint32 arrivalSpellId = 0;
+ ObjectGuid arrivalSpellTargetGuid;
+ if (arrivalCast)
+ {
+ arrivalSpellId = arrivalCast->SpellId;
+ arrivalSpellTargetGuid = arrivalCast->Target;
+ }
+
+ GenericMovementGenerator* movement = new GenericMovementGenerator(std::move(init), EFFECT_MOTION_TYPE, id, arrivalSpellId, arrivalSpellTargetGuid);
+ movement->Priority = MOTION_PRIORITY_HIGHEST;
+ movement->BaseUnitState = UNIT_STATE_JUMPING;
+ Add(movement);
+}
+
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);