Call fallers less often. Should hopefully still be about as effective at the intended purpose. Should help loads quite a bit.
authornemo
Wed, 14 Nov 2012 23:23:56 -0500
changeset 8030 165aeaaaf445
parent 8027 e5ba3dd12531
child 8033 4e40503e2b2c
Call fallers less often. Should hopefully still be about as effective at the intended purpose. Should help loads quite a bit.
hedgewars/GSHandlers.inc
hedgewars/uGears.pas
hedgewars/uGearsHedgehog.pas
--- a/hedgewars/GSHandlers.inc	Wed Nov 14 22:27:05 2012 -0500
+++ b/hedgewars/GSHandlers.inc	Wed Nov 14 23:23:56 2012 -0500
@@ -1691,7 +1691,7 @@
         end
     else
         begin 
-        if (Gear^.Pos <> posCaseHealth) and (GameTicks and $3FF = 0) then // stir it up every second or so
+        if (Gear^.Pos <> posCaseHealth) and (GameTicks and $1FFF = 0) then // stir 'em up periodically
             begin
             gi := GearsList;
             while gi <> nil do
@@ -5143,6 +5143,7 @@
         begin
         with gi^ do CheckSum:= CheckSum xor X.round xor X.frac xor dX.round xor dX.frac xor Y.round xor Y.frac xor dY.round xor dY.frac;
         AddRandomness(CheckSum);
+        if gi^.Kind = gtGenericFaller then gi^.State:= gi^.State and not gstTmpFlag;
         gi := gi^.NextGear
         end;
     AddPickup(Gear^.Hedgehog^, a, Gear^.Power, hwRound(Gear^.X), hwRound(Gear^.Y));
@@ -5160,8 +5161,17 @@
         DeleteGear(Gear);
         exit
         end;
-    
-doStepFallingGear(Gear);
+if (Gear^.State and gstTmpFlag <> 0) or (GameTicks and $7 = 0) then
+    begin
+    doStepFallingGear(Gear);
+    if (Gear^.State and gstInvisible <> 0) and (GameTicks and $FF = 0) and ((hwRound(Gear^.X) < leftX) or (hwRound(Gear^.X) > rightX) or (hwRound(Gear^.Y) < topY)) then
+        begin
+        Gear^.X:= int2hwFloat(GetRandom(rightX-leftX)+leftX);
+        Gear^.Y:= int2hwFloat(GetRandom(LAND_HEIGHT-topY)+topY);
+        Gear^.dX:= _90-(GetRandomf*_360);
+        Gear^.dY:= _90-(GetRandomf*_360)
+        end;
+    end
 end;
 
 procedure doStepCreeper(Gear: PGear);
--- a/hedgewars/uGears.pas	Wed Nov 14 22:27:05 2012 -0500
+++ b/hedgewars/uGears.pas	Wed Nov 14 23:23:56 2012 -0500
@@ -643,7 +643,7 @@
 
 if (GameFlags and gfArtillery) <> 0 then
     cArtillery:= true;
-for i:= GetRandom(10)+30 downto 0 do
+for i:= (LAND_WIDTH*LAND_HEIGHT) div 524288+2 downto 0 do
     begin
     rx:= GetRandom(rightX-leftX)+leftX;
     ry:= GetRandom(LAND_HEIGHT-topY)+topY;
--- a/hedgewars/uGearsHedgehog.pas	Wed Nov 14 22:27:05 2012 -0500
+++ b/hedgewars/uGearsHedgehog.pas	Wed Nov 14 23:23:56 2012 -0500
@@ -641,9 +641,10 @@
                         gi := GearsList;
                         while gi <> nil do
                             begin
-                            if gi^.Kind = gtGenericFaller then
+                            if (gi^.Kind = gtGenericFaller) and (gi^.State and gstInvisible <> 0) then
                                 begin
                                 gi^.Active:= true;
+                                gi^.State:= gi^.State or gstTmpFlag;
                                 gi^.X:= int2hwFloat(GetRandom(rightX-leftX)+leftX);
                                 gi^.Y:= int2hwFloat(GetRandom(LAND_HEIGHT-topY)+topY);
                                 gi^.dX:= _90-(GetRandomf*_360);