Core/Transports: Path generation rewrite v2 (needs testing)

Port From (https://github.com/TrinityCore/TrinityCore/commit/a2c1b699e6e4d30c752b65241bc23191920a86fd)
This commit is contained in:
hondacrx
2022-06-14 00:40:57 -04:00
parent 9c015e71fa
commit bbe99e3be8
10 changed files with 544 additions and 527 deletions
@@ -126,22 +126,12 @@ namespace Game.Entities
dynFlags |= GameObjectDynamicLowFlags.Sparkle | GameObjectDynamicLowFlags.Highlight;
break;
case GameObjectTypes.Transport:
case GameObjectTypes.MapObjTransport:
{
dynFlags = (GameObjectDynamicLowFlags)((int)unitDynFlags & 0xFFFF);
pathProgress = (ushort)((int)unitDynFlags >> 16);
break;
}
case GameObjectTypes.MapObjTransport:
{
Transport transport = gameObject.ToTransport();
uint transportPeriod = transport.GetTransportPeriod();
if (transportPeriod != 0)
{
float timer = (float)(transport.GetTimer() % transportPeriod);
pathProgress = (ushort)(timer / (float)transportPeriod * 65535.0f);
}
break;
}
case GameObjectTypes.CapturePoint:
if (!gameObject.CanInteractWithCapturePoint(receiver))
dynFlags |= GameObjectDynamicLowFlags.NoInterract;
@@ -152,7 +142,7 @@ namespace Game.Entities
break;
}
unitDynFlags = (uint)((pathProgress << 16) | (ushort)dynFlags);
unitDynFlags = ((uint)pathProgress << 16) | (uint)dynFlags;
}
}