hedgewars/uGears.pas
changeset 14786 ba8dd081359d
parent 14780 c6b7f4a4122c
child 14789 185f07ec4d12
--- a/hedgewars/uGears.pas	Mon Apr 08 02:22:51 2019 +0200
+++ b/hedgewars/uGears.pas	Mon Apr 08 03:15:34 2019 +0200
@@ -46,6 +46,7 @@
 procedure FreeGearsList;
 procedure AddMiscGears;
 procedure AssignHHCoords;
+procedure RandomizeHHAnim;
 procedure StartSuddenDeath;
 function  GearByUID(uid : Longword) : PGear;
 function  IsClockRunning() : boolean;
@@ -1064,6 +1065,18 @@
     SortHHsByClan();
 end;
 
+// Set random pos for all hogs so their animations have different starting points
+procedure RandomizeHHAnim;
+var i, j, p: LongInt;
+begin
+    for p:= 0 to (ClansCount - 1) do
+        with SpawnClansArray[p]^ do
+            for j:= 0 to Pred(TeamsNumber) do
+                with Teams[j]^ do
+                    for i:= 0 to cMaxHHIndex do
+                        if (Hedgehogs[i].Gear <> nil) then
+                            Hedgehogs[i].Gear^.Pos:= GetRandom(19);
+end;
 
 {procedure AmmoFlameWork(Ammo: PGear);
 var t: PGear;