# HG changeset patch
# User nemo
# Date 1342834253 14400
# Node ID a9f18c66ce34f942a7b9e02035bed1df9496f2e0
# Parent  9e5aa3c8dc62024c5c00a6a31c11f859cc8aba5f
unc0rr, let me know what you think?  Values were chosen semi-arbitrarily.  But I was playing through a lot of large demos.

diff -r 9e5aa3c8dc62 -r a9f18c66ce34 hedgewars/uCommandHandlers.pas
--- a/hedgewars/uCommandHandlers.pas	Fri Jul 20 21:15:38 2012 -0400
+++ b/hedgewars/uCommandHandlers.pas	Fri Jul 20 21:30:53 2012 -0400
@@ -653,6 +653,7 @@
 procedure chSpeedup_p(var s: shortstring);
 begin
 s:= s; // avoid compiler hint
+SpeedStart:= GameTicks;
 isSpeed:= true
 end;
 
diff -r 9e5aa3c8dc62 -r a9f18c66ce34 hedgewars/uGame.pas
--- a/hedgewars/uGame.pas	Fri Jul 20 21:15:38 2012 -0400
+++ b/hedgewars/uGame.pas	Fri Jul 20 21:30:53 2012 -0400
@@ -26,7 +26,7 @@
 ////////////////////
     implementation
 ////////////////////
-uses uInputHandler, uTeams, uIO, uAI, uGears, uSound, uMobile, uVisualGears, uTypes, uVariables{$IFDEF SDL13}, uTouch{$ENDIF};
+uses Math, uInputHandler, uTeams, uIO, uAI, uGears, uSound, uMobile, uVisualGears, uTypes, uVariables{$IFDEF SDL13}, uTouch{$ENDIF};
 
 procedure DoGameTick(Lag: LongInt);
 var i: LongInt;
@@ -46,7 +46,7 @@
 
 if (GameType = gmtDemo) then 
     if isSpeed then
-        Lag:= Lag * 10
+        Lag:= Lag * max(min(round(((GameTicks-SpeedStart)+100)/5000),100),5)
     else
         if cOnlyStats then
             Lag:= High(LongInt);
diff -r 9e5aa3c8dc62 -r a9f18c66ce34 hedgewars/uVariables.pas
--- a/hedgewars/uVariables.pas	Fri Jul 20 21:15:38 2012 -0400
+++ b/hedgewars/uVariables.pas	Fri Jul 20 21:30:53 2012 -0400
@@ -60,6 +60,7 @@
     isPaused        : boolean;
     isInMultiShoot  : boolean;
     isSpeed         : boolean;
+    SpeedStart      : LongWord;
 
     fastUntilLag    : boolean;
     autoCameraOn    : boolean;
@@ -2583,6 +2584,7 @@
     isPaused        := false;
     isInMultiShoot  := false;
     isSpeed         := false;
+    SpeedStart      := 0;
     fastUntilLag    := false;
     autoCameraOn    := true;
     cScriptName     := '';