hedgewars/uGears.pas
branchwebgl
changeset 8444 75db7bb8dce8
parent 8330 aaefa587e277
parent 8425 4f226963faef
child 8833 c13ebed437cb
--- a/hedgewars/uGears.pas	Wed Jan 02 11:11:49 2013 +0100
+++ b/hedgewars/uGears.pas	Sun Jan 27 00:28:57 2013 +0100
@@ -55,7 +55,7 @@
 procedure doStepDrowningGear(Gear: PGear);
 
 implementation
-uses uStore, uSound, uTeams, uRandom, uCollisions, uIO, uLandGraphics,
+uses uStore, uSound, uTeams, uRandom, uCollisions, uIO, uLandGraphics, {$IFDEF SDL13}uTouch,{$ENDIF}
     uLocale, uAI, uAmmos, uStats, uVisualGears, uScript, GLunit, uVariables,
     uCommands, uUtils, uTextures, uRenderUtils, uGearsRender, uCaptions, uDebug, uLandTexture,
     uGearsHedgehog, uGearsUtils, uGearsList, uGearsHandlers, uGearsHandlersRope;
@@ -77,6 +77,7 @@
     stSpawn, stNTurn);
     upd: Longword;
     snowLeft,snowRight: LongInt;
+    NewTurnTick: LongWord;
     //SDMusic: shortstring;
 
 // For better maintainability the step handlers of gears are stored in
@@ -188,6 +189,16 @@
     i, AliveCount: LongInt;
     s: shortstring;
 begin
+ScriptCall('onGameTick');
+if GameTicks mod 20 = 0 then ScriptCall('onGameTick20');
+if GameTicks = NewTurnTick then
+    begin
+    ScriptCall('onNewTurn');
+{$IFDEF SDL13}
+    uTouch.NewTurnBeginning();
+{$ENDIF}
+    end;
+
 PrvInactive:= AllInactive;
 AllInactive:= true;
 
@@ -382,7 +393,8 @@
                 SwitchHedgehog;
 
                 AfterSwitchHedgehog;
-                bBetweenTurns:= false
+                bBetweenTurns:= false;
+                NewTurnTick:= GameTicks + 1
                 end;
             step:= Low(step)
             end;
@@ -469,8 +481,6 @@
         inc(hiTicks) // we do not recieve a message for this
     end;
 AddRandomness(CheckSum);
-ScriptCall('onGameTick');
-if GameTicks mod 20 = 0 then ScriptCall('onGameTick20');
 
 inc(GameTicks)
 end;
@@ -1396,6 +1406,7 @@
     upd:= 0;
 
     //SDMusic:= 'hell.ogg';
+    NewTurnTick:= $FFFFFFFF;
 end;
 
 procedure freeModule;