Core/Refactor: Part 3

This commit is contained in:
hondacrx
2018-05-16 19:57:48 -04:00
parent 225a5d27f7
commit 5dacd669b5
112 changed files with 564 additions and 561 deletions
@@ -740,7 +740,7 @@ namespace Game.Entities
public bool HasSplines() { return !_spline.empty(); }
public Spline GetSpline() { return _spline; }
public uint GetElapsedTimeForMovement() { return GetTimeSinceCreated(); } /// @todo: research the right value, in sniffs both timers are nearly identical
public uint GetElapsedTimeForMovement() { return GetTimeSinceCreated(); } // @todo: research the right value, in sniffs both timers are nearly identical
ObjectGuid _targetGuid;
@@ -121,41 +121,39 @@ namespace Game.Entities
switch (TriggerType)
{
case AreaTriggerTypes.Sphere:
{
MaxSearchRadius = Math.Max(SphereDatas.Radius, SphereDatas.RadiusTarget);
break;
}
{
MaxSearchRadius = Math.Max(SphereDatas.Radius, SphereDatas.RadiusTarget);
break;
}
case AreaTriggerTypes.Box:
{
fixed (float* ptr = BoxDatas.Extents)
{
unsafe
{
fixed (float* ptr = BoxDatas.Extents)
{
MaxSearchRadius = (float)Math.Sqrt(ptr[0] * ptr[0] / 4 + ptr[1] * ptr[1] / 4);
}
}
break;
MaxSearchRadius = (float) Math.Sqrt(ptr[0] * ptr[0] / 4 + ptr[1] * ptr[1] / 4);
}
break;
}
case AreaTriggerTypes.Polygon:
{
if (PolygonDatas.Height <= 0.0f)
PolygonDatas.Height = 1.0f;
foreach (Vector2 vertice in PolygonVertices)
{
if (PolygonDatas.Height <= 0.0f)
PolygonDatas.Height = 1.0f;
float pointDist = vertice.GetLength();
foreach (Vector2 vertice in PolygonVertices)
{
float pointDist = vertice.GetLength();
if (pointDist > MaxSearchRadius)
MaxSearchRadius = pointDist;
}
break;
if (pointDist > MaxSearchRadius)
MaxSearchRadius = pointDist;
}
break;
}
case AreaTriggerTypes.Cylinder:
{
MaxSearchRadius = CylinderDatas.Radius;
break;
}
{
MaxSearchRadius = CylinderDatas.Radius;
break;
}
default:
break;
}