Prevent flakes from drawing if they spawn in land
authornemo
Sat, 27 Aug 2011 17:53:35 -0400
changeset 5695 f1015857deb8
parent 5694 10501c327907
child 5696 972bf04d4a79
Prevent flakes from drawing if they spawn in land
hedgewars/GSHandlers.inc
hedgewars/uGears.pas
--- a/hedgewars/GSHandlers.inc	Sat Aug 27 16:13:40 2011 -0400
+++ b/hedgewars/GSHandlers.inc	Sat Aug 27 17:53:35 2011 -0400
@@ -586,6 +586,7 @@
     p: PLongwordArray;
     lf: LongWord;
 begin
+inc(Gear^.Pos);
 gun:= (Gear^.State and gstTmpFlag) <> 0;
 move:= false;
 draw:= false;
@@ -666,7 +667,7 @@
         begin
         // we've collided with land. draw some stuff and get back into the clouds
         move:= true;
-        if (GameTicks > 20) and ((CurAmmoGear = nil) or (CurAmmoGear^.Kind <> gtRope)) then
+        if (Pos > 20) and ((CurAmmoGear = nil) or (CurAmmoGear^.Kind <> gtRope)) then
             begin
 ////////////////////////////////// TODO - ASK UNC0RR FOR A GOOD HOME FOR THIS ////////////////////////////////////
             if not gun then
@@ -730,6 +731,7 @@
         DeleteGear(Gear);
         exit
         end;
+    Gear^.Pos:= 0;
     Gear^.X:= int2hwFloat(GetRandom(LAND_WIDTH+1024)-512);
     Gear^.Y:= int2hwFloat(750+(GetRandom(50)-25));
     Gear^.State:= Gear^.State or gstInvisible;
--- a/hedgewars/uGears.pas	Sat Aug 27 16:13:40 2011 -0400
+++ b/hedgewars/uGears.pas	Sat Aug 27 17:53:35 2011 -0400
@@ -289,6 +289,7 @@
      gtFlake: begin
                 with Gear^ do
                     begin
+                    Pos:= 0;
                     Radius:= 1;
                     DirAngle:= random * 360;
                     dx.isNegative:= GetRandom(2) = 0;