this should prevent sliding when game clock isn't running. sorry unc0rr, not going to bother encapsulating. maybe later. short on time right now/lazy
authornemo
Sun, 03 Nov 2013 14:45:07 -0500
changeset 9672 8663d299ba62
parent 9670 1954f692e8c6
child 9673 5be4de0eb4b0
this should prevent sliding when game clock isn't running. sorry unc0rr, not going to bother encapsulating. maybe later. short on time right now/lazy
hedgewars/uGears.pas
hedgewars/uGearsHedgehog.pas
hedgewars/uVariables.pas
--- a/hedgewars/uGears.pas	Sun Nov 03 22:39:00 2013 +0400
+++ b/hedgewars/uGears.pas	Sun Nov 03 14:45:07 2013 -0500
@@ -167,7 +167,9 @@
 var t: PGear;
     i, AliveCount: LongInt;
     s: shortstring;
+    prevtime: LongWord;
 begin
+prevtime:= TurnTimeLeft;
 ScriptCall('onGameTick');
 if GameTicks mod 20 = 0 then ScriptCall('onGameTick20');
 if GameTicks = NewTurnTick then
@@ -463,7 +465,7 @@
         inc(hiTicks) // we do not recieve a message for this
     end;
 AddRandomness(CheckSum);
-
+TurnClockActive:= prevtime <> TurnTimeLeft;
 inc(GameTicks)
 end;
 
--- a/hedgewars/uGearsHedgehog.pas	Sun Nov 03 22:39:00 2013 +0400
+++ b/hedgewars/uGearsHedgehog.pas	Sun Nov 03 14:45:07 2013 -0500
@@ -1266,7 +1266,7 @@
     if (Gear^.Message and (gmAllStoppable or gmLJump or gmHJump) = 0)
     and (Gear^.State and (gstHHJumping or gstHHHJump or gstAttacking) = 0)
     and ((Gear^.Hedgehog = nil) or ((Gear^.Hedgehog^.Effects[heFrozen] = 0) or (Gear^.Hedgehog^.Effects[heFrozen] > 255)))
-    and (not Gear^.dY.isNegative) and (TurnTimeLeft > 0) and (TestCollisionYwithGear(Gear, 1) and lfIce <> 0) then
+    and (not Gear^.dY.isNegative) and TurnClockActive and (TestCollisionYwithGear(Gear, 1) and lfIce <> 0) then
         begin
         slope:= CalcSlopeBelowGear(Gear);
         if slope.QWordValue > 730144440 then // ignore mild slopes
--- a/hedgewars/uVariables.pas	Sun Nov 03 22:39:00 2013 +0400
+++ b/hedgewars/uVariables.pas	Sun Nov 03 14:45:07 2013 -0500
@@ -87,6 +87,7 @@
     LeftImpactTimer : LongWord;
     RightImpactTimer: LongWord;
     TurnTimeLeft    : Longword;
+    TurnClockActive : boolean;
     TagTurnTimeLeft : Longword;
     ReadyTimeLeft   : Longword;
     cSuddenDTurns   : LongInt;
@@ -2461,6 +2462,7 @@
     LeftImpactTimer     := 0;
     RightImpactTimer    := 0;
     TurnTimeLeft        := 0;
+    TurnClockActive     := true;
     TagTurnTimeLeft     := 0;
     cSuddenDTurns       := 15;
     cDamagePercent      := 100;