Core/AreaTriggers: Update areatrigger scalecurve handling with latest research
Port From (https://github.com/TrinityCore/TrinityCore/commit/361fe56bc87456b63e685a53ffc63ca1694d336a)
This commit is contained in:
@@ -2,7 +2,6 @@
|
||||
// Licensed under the GNU GENERAL PUBLIC LICENSE. See LICENSE file in the project root for full license information.
|
||||
|
||||
using Framework.Constants;
|
||||
using Framework.Dynamic;
|
||||
using Game.Maps;
|
||||
using Game.Networking;
|
||||
using System;
|
||||
@@ -92,61 +91,17 @@ namespace Game.Entities
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Scale array definition
|
||||
/// 0 - time offset from creation for starting of scaling
|
||||
/// 1+2,3+4 are values for curve points Vector2[2]
|
||||
// 5 is packed curve information (has_no_data & 1) | ((interpolation_mode & 0x7) << 1) | ((first_point_offset & 0x7FFFFF) << 4) | ((point_count & 0x1F) << 27)
|
||||
/// 6 bool is_override, only valid for AREATRIGGER_OVERRIDE_SCALE_CURVE, if true then use data from AREATRIGGER_OVERRIDE_SCALE_CURVE instead of ScaleCurveId from CreateObject
|
||||
/// </summary>
|
||||
[StructLayout(LayoutKind.Explicit)]
|
||||
public class AreaTriggerScaleInfo
|
||||
public class AreaTriggerScaleCurvePointsTemplate
|
||||
{
|
||||
[FieldOffset(0)]
|
||||
public StructuredData Structured;
|
||||
public CurveInterpolationMode Mode = CurveInterpolationMode.Linear;
|
||||
public Vector2[] Points = new Vector2[2];
|
||||
}
|
||||
|
||||
[FieldOffset(0)]
|
||||
public RawData Raw;
|
||||
|
||||
[StructLayout(LayoutKind.Explicit)]
|
||||
public struct StructuredData
|
||||
{
|
||||
[FieldOffset(0)]
|
||||
public uint StartTimeOffset;
|
||||
|
||||
[FieldOffset(4)]
|
||||
public float X;
|
||||
|
||||
[FieldOffset(8)]
|
||||
public float Y;
|
||||
|
||||
[FieldOffset(12)]
|
||||
public float Z;
|
||||
|
||||
[FieldOffset(16)]
|
||||
public float W;
|
||||
|
||||
[FieldOffset(20)]
|
||||
public uint CurveParameters;
|
||||
|
||||
[FieldOffset(24)]
|
||||
public uint OverrideActive;
|
||||
|
||||
public struct curveparameters
|
||||
{
|
||||
public uint Raw;
|
||||
|
||||
public uint NoData { get { return Raw & 1; } }
|
||||
public uint InterpolationMode { get { return (Raw & 0x7) << 1; } }
|
||||
public uint FirstPointOffset { get { return (Raw & 0x7FFFFF) << 4; } }
|
||||
public uint PointCount { get { return (Raw & 0x1F) << 27; } }
|
||||
}
|
||||
}
|
||||
|
||||
public unsafe struct RawData
|
||||
{
|
||||
public fixed uint Data[SharedConst.MaxAreatriggerScale];
|
||||
}
|
||||
public class AreaTriggerScaleCurveTemplate
|
||||
{
|
||||
public uint StartTimeOffset;
|
||||
public float Curve = 1.0f;
|
||||
public AreaTriggerScaleCurvePointsTemplate CurveTemplate;
|
||||
}
|
||||
|
||||
public struct AreaTriggerMovementScriptInfo
|
||||
@@ -279,10 +234,7 @@ namespace Game.Entities
|
||||
{
|
||||
public AreaTriggerCreateProperties()
|
||||
{
|
||||
// legacy code from before it was known what each curve field does
|
||||
ExtraScale.Raw.Data[5] = 1065353217;
|
||||
// also OverrideActive does nothing on ExtraScale
|
||||
ExtraScale.Structured.OverrideActive = 1;
|
||||
ExtraScale = new();
|
||||
}
|
||||
|
||||
public bool HasSplines() { return SplinePoints.Count >= 2; }
|
||||
@@ -324,8 +276,8 @@ namespace Game.Entities
|
||||
public uint TimeToTarget;
|
||||
public uint TimeToTargetScale;
|
||||
|
||||
public AreaTriggerScaleInfo OverrideScale = new();
|
||||
public AreaTriggerScaleInfo ExtraScale = new();
|
||||
public AreaTriggerScaleCurveTemplate OverrideScale;
|
||||
public AreaTriggerScaleCurveTemplate ExtraScale;
|
||||
|
||||
public AreaTriggerShapeInfo Shape = new();
|
||||
public List<Vector2> PolygonVertices = new();
|
||||
|
||||
Reference in New Issue
Block a user