Core: Updated to 11.1.7
Port From (https://github.com/TrinityCore/TrinityCore/commit/ceb8d561b44579118b109a9ff71ba415df53bbdc)
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
|
||||
using Framework.Constants;
|
||||
using Framework.Dynamic;
|
||||
using Game.Entities;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Numerics;
|
||||
@@ -37,6 +38,7 @@ namespace Game.Movement
|
||||
vertical_acceleration = 0.0f;
|
||||
effect_start_time = 0;
|
||||
spell_effect_extra = args.spellEffectExtra;
|
||||
turn = args.turnData;
|
||||
anim_tier = args.animTier;
|
||||
splineIsFacingOnly = args.path.Count == 2 && args.facing.type != MonsterMoveType.Normal && ((args.path[1] - args.path[0]).Length() < 0.1f);
|
||||
|
||||
@@ -108,6 +110,13 @@ namespace Game.Movement
|
||||
Log.outError(LogFilter.Unit, "MoveSpline.init_spline: zero length spline, wrong input data?");
|
||||
spline.Set_length(spline.Last(), spline.IsCyclic() ? 1000 : 1);
|
||||
}
|
||||
|
||||
if (turn != null)
|
||||
{
|
||||
float totalTurnTime = (float)(turn.TotalTurnRads / turn.RadsPerSec * (float)Time.InMilliseconds);
|
||||
spline.Set_length(spline.Last(), MathF.Max(spline.Length(), totalTurnTime));
|
||||
}
|
||||
|
||||
point_Idx = spline.First();
|
||||
}
|
||||
|
||||
@@ -127,18 +136,20 @@ namespace Game.Movement
|
||||
public int CurrentSplineIdx() { return point_Idx; }
|
||||
public uint GetId() { return m_Id; }
|
||||
public bool Finalized() { return splineflags.HasFlag(MoveSplineFlagEnum.Done); }
|
||||
|
||||
void _Finalize()
|
||||
{
|
||||
splineflags.SetUnsetFlag(MoveSplineFlagEnum.Done);
|
||||
point_Idx = spline.Last() - 1;
|
||||
time_passed = Duration();
|
||||
}
|
||||
|
||||
public Vector4 ComputePosition(int time_point, int point_index)
|
||||
{
|
||||
float u = 1.0f;
|
||||
int seg_time = spline.Length(point_index, point_index + 1);
|
||||
float seg_time = (float)spline.Length(point_index, point_index + 1);
|
||||
if (seg_time > 0)
|
||||
u = (time_point - spline.Length(point_index)) / (float)seg_time;
|
||||
u = MathF.Min((time_point - spline.Length(point_index)) / (float)seg_time, 1.0f);
|
||||
|
||||
Vector3 c;
|
||||
float orientation = initialOrientation;
|
||||
@@ -157,6 +168,10 @@ namespace Game.Movement
|
||||
orientation = MathF.Atan2(facing.f.Y - c.Y, facing.f.X - c.X);
|
||||
//nothing to do for MoveSplineFlag.Final_Target flag
|
||||
}
|
||||
else if (splineflags.HasFlag(MoveSplineFlagEnum.Turning))
|
||||
{
|
||||
orientation = Position.NormalizeOrientation(turn.StartFacing + (float)time_point / (float)Time.InMilliseconds * turn.RadsPerSec);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!splineflags.HasFlag(MoveSplineFlagEnum.OrientationFixed | MoveSplineFlagEnum.Falling | MoveSplineFlagEnum.JumpOrientationFixed))
|
||||
@@ -340,6 +355,7 @@ namespace Game.Movement
|
||||
int SegmentTimeElapsed() { return NextTimestamp() - time_passed; }
|
||||
public bool IsCyclic() { return splineflags.HasFlag(MoveSplineFlagEnum.Cyclic); }
|
||||
public bool IsFalling() { return splineflags.HasFlag(MoveSplineFlagEnum.Falling); }
|
||||
public bool IsTurning() { return splineflags.HasFlag(MoveSplineFlagEnum.Turning); }
|
||||
public bool Initialized() { return !spline.Empty(); }
|
||||
public Vector3 FinalDestination() { return Initialized() ? spline.GetPoint(spline.Last()) : Vector3.Zero; }
|
||||
public Vector3 CurrentDestination() { return Initialized() ? spline.GetPoint(point_Idx + 1) : Vector3.Zero; }
|
||||
@@ -362,6 +378,7 @@ namespace Game.Movement
|
||||
public int point_Idx_offset;
|
||||
public float velocity;
|
||||
public SpellEffectExtraData spell_effect_extra;
|
||||
public TurnData turn;
|
||||
public AnimTierTransition anim_tier;
|
||||
#endregion
|
||||
|
||||
|
||||
Reference in New Issue
Block a user