call this faller scrambling less often.
authornemo
Wed, 30 Dec 2015 08:50:19 -0500
changeset 11469 26068971a4de
parent 11468 2f6f8baa2a97
child 11470 b8c14f26a2fb
call this faller scrambling less often.
hedgewars/uGears.pas
hedgewars/uGearsHandlersMess.pas
--- a/hedgewars/uGears.pas	Tue Dec 29 14:44:32 2015 -0500
+++ b/hedgewars/uGears.pas	Wed Dec 30 08:50:19 2015 -0500
@@ -168,7 +168,9 @@
     i, AliveCount: LongInt;
     s: ansistring;
     prevtime: LongWord;
+    stirFallers: boolean;
 begin
+stirFallers:= false;
 prevtime:= TurnTimeLeft;
 ScriptCall('onGameTick');
 if GameTicks mod 20 = 0 then ScriptCall('onGameTick20');
@@ -199,6 +201,8 @@
     begin
     curHandledGear:= t;
     t:= curHandledGear^.NextGear;
+    if (GameTicks and $1FFF = 0) and (curHandledGear^.Kind = gtCase) and (curHandledGear^.Pos <> posCaseHealth) then
+        stirFallers := true; 
 
     if curHandledGear^.Message and gmDelete <> 0 then
         DeleteGear(curHandledGear)
@@ -224,6 +228,23 @@
             end
         end
     end;
+if stirFallers then
+    begin
+    t := GearsList;
+    while t <> nil do
+        begin
+        if t^.Kind = gtGenericFaller then
+            begin
+            t^.Active:= true;
+            t^.X:=  int2hwFloat(GetRandom(rightX-leftX)+leftX);
+            t^.Y:=  int2hwFloat(GetRandom(LAND_HEIGHT-topY)+topY);
+            t^.dX:= _90-(GetRandomf*_360);
+            t^.dY:= _90-(GetRandomf*_360)
+            end;
+        t := t^.NextGear
+        end
+    end;
+
 curHandledGear:= nil;
 
 if AllInactive then
--- a/hedgewars/uGearsHandlersMess.pas	Tue Dec 29 14:44:32 2015 -0500
+++ b/hedgewars/uGearsHandlersMess.pas	Wed Dec 30 08:50:19 2015 -0500
@@ -2169,23 +2169,6 @@
         end
     else
         begin
-        if (Gear^.Pos <> posCaseHealth) and (GameTicks and $1FFF = 0) then // stir 'em up periodically
-            begin
-            gi := GearsList;
-            while gi <> nil do
-                begin
-                if gi^.Kind = gtGenericFaller then
-                    begin
-                    gi^.Active:= true;
-                    gi^.X:=  int2hwFloat(GetRandom(rightX-leftX)+leftX);
-                    gi^.Y:=  int2hwFloat(GetRandom(LAND_HEIGHT-topY)+topY);
-                    gi^.dX:= _90-(GetRandomf*_360);
-                    gi^.dY:= _90-(GetRandomf*_360)
-                    end;
-                gi := gi^.NextGear
-                end
-            end;
-
         if Gear^.Timer = 500 then
             begin
 (* Can't make sparkles team coloured without working out what the next team is going to be. This should be solved, really, since it also screws up