hedgewars/uGearsUtils.pas
changeset 14999 d9de740e194c
parent 14931 60340c8a6fae
child 15057 1a754860b0e5
--- a/hedgewars/uGearsUtils.pas	Fri May 17 19:15:03 2019 +0200
+++ b/hedgewars/uGearsUtils.pas	Fri May 17 22:23:40 2019 +0200
@@ -67,6 +67,7 @@
 function WorldWrap(var Gear: PGear): boolean;
 function HomingWrap(var Gear: PGear): boolean;
 
+function IsHogFacingLeft(Gear: PGear): boolean;
 function IsHogLocal(HH: PHedgehog): boolean;
 
 
@@ -1856,6 +1857,16 @@
     PlaySound(sndMelonImpact, true)
 end;
 
+function IsHogFacingLeft(Gear: PGear): boolean;
+var sign: LongInt;
+begin
+    sign:= hwSign(Gear^.dX);
+    if ((Gear^.State and gstHHHJump) <> 0) and (Gear^.Hedgehog^.Effects[heArtillery] = 0) then
+        IsHogFacingLeft:= sign > 0
+    else
+        IsHogFacingLeft:= sign < 0;
+end;
+
 function IsHogLocal(HH: PHedgehog): boolean;
 begin
     IsHogLocal:= (not (HH^.Team^.ExtDriven or (HH^.BotLevel > 0))) or (HH^.Team^.Clan^.ClanIndex = LocalClan) or (GameType = gmtDemo);