# HG changeset patch # User nemo # Date 1352950025 18000 # Node ID e5ba3dd12531e6ec49e98c2d442bcc4a32146abe # Parent 1d5baba66cb6d7d3762417fcf4217265d85a6436 make stats-only mode work headless. also skip a few things to save time/memory. diff -r 1d5baba66cb6 -r e5ba3dd12531 hedgewars/hwengine.pas --- a/hedgewars/hwengine.pas Wed Nov 14 22:08:40 2012 -0500 +++ b/hedgewars/hwengine.pas Wed Nov 14 22:27:05 2012 -0500 @@ -90,15 +90,15 @@ end; gsConfirm, gsGame: begin - DrawWorld(Lag); + if not cOnlyStats then DrawWorld(Lag); DoGameTick(Lag); - ProcessVisualGears(Lag); + if not cOnlyStats then ProcessVisualGears(Lag); end; gsChat: begin - DrawWorld(Lag); + if not cOnlyStats then DrawWorld(Lag); DoGameTick(Lag); - ProcessVisualGears(Lag); + if not cOnlyStats then ProcessVisualGears(Lag); end; gsExit: begin diff -r 1d5baba66cb6 -r e5ba3dd12531 hedgewars/uCaptions.pas --- a/hedgewars/uCaptions.pas Wed Nov 14 22:08:40 2012 -0500 +++ b/hedgewars/uCaptions.pas Wed Nov 14 22:27:05 2012 -0500 @@ -44,6 +44,7 @@ procedure AddCaption(s: shortstring; Color: Longword; Group: TCapGroup); begin + if cOnlyStats then exit; if Captions[Group].Text <> s then begin FreeTexture(Captions[Group].Tex); diff -r 1d5baba66cb6 -r e5ba3dd12531 hedgewars/uGame.pas --- a/hedgewars/uGame.pas Wed Nov 14 22:08:40 2012 -0500 +++ b/hedgewars/uGame.pas Wed Nov 14 22:27:05 2012 -0500 @@ -50,17 +50,16 @@ if (GameType = gmtDemo) then if isSpeed then - begin + begin i:= RealTicks-SpeedStart; if i < 2000 then Lag:= Lag*5 else if i < 4000 then Lag:= Lag*10 else if i < 6000 then Lag:= Lag*20 else if i < 8000 then Lag:= Lag*40 else Lag:= Lag*80; - end - else - if cOnlyStats then - Lag:= High(LongInt); + end + else if cOnlyStats then + Lag:= High(LongInt) end; PlayNextVoice; i:= 1; diff -r 1d5baba66cb6 -r e5ba3dd12531 hedgewars/uLandTexture.pas --- a/hedgewars/uLandTexture.pas Wed Nov 14 22:08:40 2012 -0500 +++ b/hedgewars/uLandTexture.pas Wed Nov 14 22:27:05 2012 -0500 @@ -66,6 +66,7 @@ procedure UpdateLandTexture(X, Width, Y, Height: LongInt; landAdded: boolean); var tx, ty: Longword; begin + if cOnlyStats then exit; if (Width <= 0) or (Height <= 0) then exit; TryDo((X >= 0) and (X < LAND_WIDTH), 'UpdateLandTexture: wrong X parameter', true); @@ -93,6 +94,7 @@ var x, y, ty, tx, lx, ly : LongWord; isEmpty: boolean; begin + if cOnlyStats then exit; (* if LandTextures[0, 0].tex = nil then for x:= 0 to LANDTEXARW -1 do diff -r 1d5baba66cb6 -r e5ba3dd12531 hedgewars/uStore.pas --- a/hedgewars/uStore.pas Wed Nov 14 22:08:40 2012 -0500 +++ b/hedgewars/uStore.pas Wed Nov 14 22:27:05 2012 -0500 @@ -146,6 +146,7 @@ texsurf, flagsurf, iconsurf: PSDL_Surface; foundBot: boolean; begin + if cOnlyStats then exit; r.x:= 0; r.y:= 0; drY:= - 4; @@ -873,6 +874,7 @@ var r: TSDL_Rect; texsurf: PSDL_Surface; begin + if cOnlyStats then exit; if Step = 0 then begin WriteToConsole(msgLoading + 'progress sprite: '); @@ -1127,10 +1129,14 @@ {$IFNDEF DARWIN}ico: PSDL_Surface;{$ENDIF} {$IFDEF SDL13}x, y: LongInt;{$ENDIF} begin + if cOnlyStats then + begin + MaxTextureSize:= 1024; + exit + end; if Length(s) = 0 then - cFullScreen:= (not cFullScreen) - else - cFullScreen:= s = '1'; + cFullScreen:= (not cFullScreen) + else cFullScreen:= s = '1'; AddFileLog('Preparing to change video parameters...'); {$IFDEF SDL13} diff -r 1d5baba66cb6 -r e5ba3dd12531 hedgewars/uTextures.pas --- a/hedgewars/uTextures.pas Wed Nov 14 22:08:40 2012 -0500 +++ b/hedgewars/uTextures.pas Wed Nov 14 22:27:05 2012 -0500 @@ -126,6 +126,7 @@ tmpp: pointer; fromP4, toP4: PLongWordArray; begin +if cOnlyStats then exit(nil); new(Surface2Tex); Surface2Tex^.PrevTexture:= nil; Surface2Tex^.NextTexture:= nil; diff -r 1d5baba66cb6 -r e5ba3dd12531 hedgewars/uVariables.pas --- a/hedgewars/uVariables.pas Wed Nov 14 22:08:40 2012 -0500 +++ b/hedgewars/uVariables.pas Wed Nov 14 22:27:05 2012 -0500 @@ -2562,6 +2562,7 @@ GrayScale := false; PathPrefix := './'; GameType := gmtLocal; + cOnlyStats := False; {$IFDEF USE_VIDEO_RECORDING} RecPrefix := ''; @@ -2582,7 +2583,6 @@ cFlattenFlakes := false; cFlattenClouds := false; - cOnlyStats := False; lastVisualGearByUID := nil; lastGearByUID := nil; cReadyDelay := 5000;