Minor fire tweak for readability and lethalness, remove exit condition that was hanging game (identified by jaylittle)
authornemo
Fri, 02 Jul 2010 21:19:22 -0400
changeset 3609 bc63ed514b70
parent 3608 c509bbc779e7
child 3614 5806f8f614b7
Minor fire tweak for readability and lethalness, remove exit condition that was hanging game (identified by jaylittle)
hedgewars/GSHandlers.inc
hedgewars/uCollisions.pas
--- a/hedgewars/GSHandlers.inc	Thu Jul 01 23:41:10 2010 -0400
+++ b/hedgewars/GSHandlers.inc	Fri Jul 02 21:19:22 2010 -0400
@@ -247,11 +247,7 @@
 
 
 // might need some testing/adjustments - just to avoid projectiles to fly forever (accelerated by wind/skips)
-    if (hwRound(Gear^.X) < LAND_WIDTH div -2) or (hwRound(Gear^.X) > LAND_WIDTH * 3 div 2) then
-    begin
-        Gear^.State := Gear^.State or gstCollision;
-        exit
-    end;
+    if (hwRound(Gear^.X) < LAND_WIDTH div -2) or (hwRound(Gear^.X) > LAND_WIDTH * 3 div 2) then Gear^.State := Gear^.State or gstCollision;
 
     if Gear^.dY.isNegative then
     begin
@@ -1721,8 +1717,10 @@
 procedure doStepFlame(Gear: PGear);
 var 
     gX,gY,i: LongInt;
+    sticky: Boolean;
 begin
-    if (Gear^.State and gsttmpFlag) = 0 then AllInactive := false;
+    sticky:= (Gear^.State and gsttmpFlag) <> 0;
+    if not sticky then AllInactive := false;
 
     if not TestCollisionYwithGear(Gear, 1) then
     begin
@@ -1730,12 +1728,11 @@
         if Gear^.dX.QWordValue > _0_01.QWordValue then
             Gear^.dX := Gear^.dX * _0_995;
         Gear^.dY := Gear^.dY + cGravity;
-        {if (Gear^.State and gsttmpFlag) <> 0 then Gear^.dY := Gear^.dY + cGravity;}
+        // if sticky then Gear^.dY := Gear^.dY + cGravity;
         if Gear^.dY.QWordValue > _0_2.QWordValue then Gear^.dY := Gear^.dY * _0_995;
 
-        {if (Gear^.State and gsttmpFlag) <> 0 then Gear^.X := Gear^.X + Gear^.dX
-        else}
-            Gear^.X := Gear^.X + Gear^.dX + cWindSpeed * 640;
+        //if sticky then Gear^.X := Gear^.X + Gear^.dX else
+        Gear^.X := Gear^.X + Gear^.dX + cWindSpeed * 640;
         Gear^.Y := Gear^.Y + Gear^.dY;
 
         if (hwRound(Gear^.Y) > cWaterLine) then
@@ -1750,7 +1747,7 @@
     end
     else
     begin
-        if (Gear^.State and gsttmpFlag) <> 0 then
+        if sticky then
         begin
             Gear^.Radius := 7;
             AmmoShove(Gear, 2, 30);
@@ -1766,12 +1763,13 @@
             gX := hwRound(Gear^.X);
             gY := hwRound(Gear^.Y);
             // Standard fire
-            if (Gear^.State and gsttmpFlag) = 0 then
+            if not sticky then
             begin
                 Gear^.Radius := 7;
                 AmmoShove(Gear, 4, 100);
                 Gear^.Radius := 1;
-                doMakeExplosion(gX, gY, 4, EXPLNoDamage);
+                doMakeExplosion(gX, gY, 4, 0);//, EXPLNoDamage);
+                //DrawExplosion(gX, gY, 4);
                 if ((GameTicks and $7) = 0) and (Random(2) = 0) then
                     for i:= 1 to Random(2)+1 do
                         AddVisualGear(gX - 3 + Random(6), gY - 2, vgtSmoke);
@@ -1799,7 +1797,7 @@
     begin
         gX := hwRound(Gear^.X);
         gY := hwRound(Gear^.Y);
-        if (Gear^.State and gsttmpFlag) = 0 then
+        if not sticky then
         begin
             if ((GameTicks and $3) = 0) and (Random(1) = 0) then
             begin
--- a/hedgewars/uCollisions.pas	Thu Jul 01 23:41:10 2010 -0400
+++ b/hedgewars/uCollisions.pas	Fri Jul 02 21:19:22 2010 -0400
@@ -94,7 +94,7 @@
 end;
 
 function CheckGearsCollision(Gear: PGear): PGearArray;
-var mx, my: LongInt;
+var mx, my, tr: LongInt;
     i: Longword;
 begin
 CheckGearsCollision:= @ga;
@@ -103,10 +103,12 @@
 mx:= hwRound(Gear^.X);
 my:= hwRound(Gear^.Y);
 
+tr:= Gear^.Radius + 2;
+
 for i:= 0 to Pred(Count) do
     with cinfos[i] do
         if (Gear <> cGear) and
-            (sqr(mx - x) + sqr(my - y) <= sqr(Radius + Gear^.Radius + 2)) then
+            (sqr(mx - x) + sqr(my - y) <= sqr(Radius + tr)) then
                 begin
                 ga.ar[ga.Count]:= cinfos[i].cGear;
                 inc(ga.Count)