Don't draw snow flakes spawned in land, introduce gstInvisible flag
authorunc0rr
Thu, 30 Jun 2011 13:59:57 +0400
changeset 5348 0bc81de36e08
parent 5345 3c5480e91951
child 5351 a4409b50bdc2
Don't draw snow flakes spawned in land, introduce gstInvisible flag
hedgewars/GSHandlers.inc
hedgewars/uConsts.pas
hedgewars/uGears.pas
--- a/hedgewars/GSHandlers.inc	Wed Jun 29 17:32:05 2011 +0400
+++ b/hedgewars/GSHandlers.inc	Thu Jun 30 13:59:57 2011 +0400
@@ -605,6 +605,7 @@
     begin
     with Gear^ do
         begin
+        State:= State and not gstInvisible;
         X:= X + cWindSpeed * 1600 + dX;
         Y:= Y + dY + cGravity * vobFallSpeed * 8;  // using same value as flakes to try and get similar results
         xx:= hwRound(X);
@@ -725,15 +726,14 @@
         end;
 
 if move then
-    begin
     if gun then
+        DeleteGear(Gear)
+    else
         begin
-        DeleteGear(Gear);
-        exit
-        end;
-    Gear^.X:= int2hwFloat(GetRandom(LAND_WIDTH+1024)-512);
-    Gear^.Y:= int2hwFloat(750+(GetRandom(50)-25))
-    end
+        Gear^.X:= int2hwFloat(GetRandom(LAND_WIDTH+1024)-512);
+        Gear^.Y:= int2hwFloat(750+(GetRandom(50)-25));
+        Gear^.State:= Gear^.State or gstInvisible;
+        end
 end;
 
 ////////////////////////////////////////////////////////////////////////////////
--- a/hedgewars/uConsts.pas	Wed Jun 29 17:32:05 2011 +0400
+++ b/hedgewars/uConsts.pas	Thu Jun 30 13:59:57 2011 +0400
@@ -209,6 +209,7 @@
     gstNotKickable    = $00040000;
     gstLoser          = $00080000;
     gstHHGone         = $00100000;
+    gstInvisible      = $00200000;
 
     gmLeft   = $00000001;
     gmRight  = $00000002;
--- a/hedgewars/uGears.pas	Wed Jun 29 17:32:05 2011 +0400
+++ b/hedgewars/uGears.pas	Thu Jun 30 13:59:57 2011 +0400
@@ -341,6 +341,7 @@
                     dx.QWordValue:= GetRandom(100000000);
                     dy.isNegative:= false;
                     dy.QWordValue:= GetRandom(70000000);
+                    State:= State or gstInvisible;
                     if GetRandom(2) = 0 then dx := -dx;
                     Health:= random(vobFrameTicks);
                     Timer:= random(vobFramesCount);
@@ -1175,9 +1176,12 @@
 Gear:= GearsList;
 while Gear <> nil do
     begin
-    x:= hwRound(Gear^.X) + WorldDx;
-    y:= hwRound(Gear^.Y) + WorldDy;
-    RenderGear(Gear, x, y);
+    if Gear^.State and gstInvisible = 0 then
+        begin
+        x:= hwRound(Gear^.X) + WorldDx;
+        y:= hwRound(Gear^.Y) + WorldDy;
+        RenderGear(Gear, x, y);
+        end;
     Gear:= Gear^.NextGear
     end;
 end;