Quick replay round to spectators until current move
authorunc0rr
Fri, 02 Jan 2009 14:22:33 +0000
changeset 1560 e140bc57ff68
parent 1559 71e1f67dcfe7
child 1561 f0af4e5fe880
Quick replay round to spectators until current move
QTfrontend/newnetclient.cpp
hedgewars/uConsole.pas
hedgewars/uGame.pas
hedgewars/uGears.pas
hedgewars/uIO.pas
hedgewars/uMisc.pas
netserver/HWProto.hs
--- a/QTfrontend/newnetclient.cpp	Fri Jan 02 14:10:23 2009 +0000
+++ b/QTfrontend/newnetclient.cpp	Fri Jan 02 14:22:33 2009 +0000
@@ -189,7 +189,7 @@
 
 void HWNewNet::ParseCmd(const QStringList & lst)
 {
-	qDebug() << "Server: " << lst;
+//	qDebug() << "Server: " << lst;
 
 	if(!lst.size())
 	{
--- a/hedgewars/uConsole.pas	Fri Jan 02 14:10:23 2009 +0000
+++ b/hedgewars/uConsole.pas	Fri Jan 02 14:22:33 2009 +0000
@@ -228,6 +228,7 @@
 initialization
 InitConsole;
 RegisterVariable('proto'   , vtCommand, @chCheckProto   , true );
+RegisterVariable('spectate', vtBoolean, @fastUntilLag   , false);
 RegisterVariable('capture' , vtCommand, @chCapture      , true );
 RegisterVariable('rotmask' , vtCommand, @chRotateMask   , true );
 RegisterVariable('addteam' , vtCommand, @chAddTeam      , false);
--- a/hedgewars/uGame.pas	Fri Jan 02 14:10:23 2009 +0000
+++ b/hedgewars/uGame.pas	Fri Jan 02 14:22:33 2009 +0000
@@ -47,7 +47,7 @@
       end
    end;
 if Lag > 100 then Lag:= 100
-else if GameType = gmtSave then Lag:= 2500;
+else if (GameType = gmtSave) or (fastUntilLag and (GameType = gmtNet)) then Lag:= 2500;
 if (GameType = gmtDemo) and isSpeed then Lag:= Lag * 10;
 
 i:= 1;
--- a/hedgewars/uGears.pas	Fri Jan 02 14:10:23 2009 +0000
+++ b/hedgewars/uGears.pas	Fri Jan 02 14:22:33 2009 +0000
@@ -1078,7 +1078,7 @@
         gtDynamite: DrawSprite2(sprDynamite, hwRound(Gear^.X) - 16 + WorldDx, hwRound(Gear^.Y) - 25 + WorldDy, Gear^.Tag and 1, Gear^.Tag shr 1);
      gtClusterBomb: DrawRotated(sprClusterBomb, hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, 0, Gear^.DirAngle);
          gtCluster: DrawSprite(sprClusterParticle, hwRound(Gear^.X) - 8 + WorldDx, hwRound(Gear^.Y) - 8 + WorldDy, 0);
-           gtFlame: DrawSprite(sprFlame, hwRound(Gear^.X) - 8 + WorldDx, hwRound(Gear^.Y) - 8 + WorldDy,(GameTicks div 128 + Gear^.Tag) mod 8);
+           gtFlame: DrawSprite(sprFlame, hwRound(Gear^.X) - 8 + WorldDx, hwRound(Gear^.Y) - 8 + WorldDy, (GameTicks div 128 + LongWord(Gear^.Tag)) mod 8);
        gtParachute: DrawSprite(sprParachute, hwRound(Gear^.X) - 24 + WorldDx, hwRound(Gear^.Y) - 48 + WorldDy, 0);
        gtAirAttack: if Gear^.Tag > 0 then DrawSprite(sprAirplane, hwRound(Gear^.X) - 60 + WorldDx, hwRound(Gear^.Y) - 25 + WorldDy, 0)
                                      else DrawSprite(sprAirplane, hwRound(Gear^.X) - 60 + WorldDx, hwRound(Gear^.Y) - 25 + WorldDy, 1);
--- a/hedgewars/uIO.pas	Fri Jan 02 14:10:23 2009 +0000
+++ b/hedgewars/uIO.pas	Fri Jan 02 14:22:33 2009 +0000
@@ -273,7 +273,8 @@
 			inttostr(headcmd^.Time) + ')',
 			true);
 
-isInLag:= (headcmd = nil) and tmpflag and not CurrentTeam^.hasGone
+isInLag:= (headcmd = nil) and tmpflag and not CurrentTeam^.hasGone;
+if isInLag then fastUntilLag:= false
 end;
 
 end.
--- a/hedgewars/uMisc.pas	Fri Jan 02 14:10:23 2009 +0000
+++ b/hedgewars/uMisc.pas	Fri Jan 02 14:22:33 2009 +0000
@@ -31,6 +31,8 @@
 	isInMultiShoot  : boolean = false;
 	isSpeed         : boolean = false;
 
+	fastUntilLag    : boolean = false;
+
 	GameState     : TGameState = Low(TGameState);
 	GameType      : TGameType = gmtLocal;
 	GameFlags     : Longword = 0;
--- a/netserver/HWProto.hs	Fri Jan 02 14:10:23 2009 +0000
+++ b/netserver/HWProto.hs	Fri Jan 02 14:22:33 2009 +0000
@@ -201,7 +201,8 @@
 		watchRound = if (roomProto clRoom < 20) || (not $ gameinprogress clRoom) then
 					[]
 				else
-					(answerClientOnly  ["RUN_GAME"]) ++ answerClientOnly ("GAMEMSG" : roundMsgs clRoom)
+					(answerClientOnly  ["RUN_GAME"]) ++
+					answerClientOnly ("GAMEMSG" : "DGUkc3BlY3RhdGUgMQ==" : roundMsgs clRoom)
 
 handleCmd_noRoom client clients rooms ["JOIN", roomName] =
 	handleCmd_noRoom client clients rooms ["JOIN", roomName, ""]