the scope cleanup continues...
--- a/hedgewars/PascalExports.pas Sat May 05 17:29:04 2012 +0100
+++ b/hedgewars/PascalExports.pas Sat May 05 18:10:41 2012 +0100
@@ -89,7 +89,7 @@
// equivalent to esc+y; when closeFrontend = true the game exits after memory cleanup
procedure HW_terminate(closeFrontend: boolean); cdecl; export;
begin
- alsoShutdownFrontend:= closeFrontend;
+ closeFrontend:= closeFrontend; // avoid hint
ParseCommand('forcequit', true);
end;
--- a/hedgewars/hwengine.pas Sat May 05 17:29:04 2012 +0100
+++ b/hedgewars/hwengine.pas Sat May 05 18:10:41 2012 +0100
@@ -378,20 +378,13 @@
// clean up all the memory allocated
freeEverything(true);
- if alsoShutdownFrontend then
- halt;
end;
procedure initEverything (complete:boolean);
begin
Randomize();
- if complete then
- cLogfileBase:= 'game'
- else
- cLogfileBase:= 'preview';
-
- uUtils.initModule; // this opens the debug file, must be the first
+ uUtils.initModule(complete); // this opens the debug file, must be the first
uMisc.initModule;
uVariables.initModule;
uConsole.initModule;
--- a/hedgewars/uStore.pas Sat May 05 17:29:04 2012 +0100
+++ b/hedgewars/uStore.pas Sat May 05 18:10:41 2012 +0100
@@ -47,6 +47,8 @@
//type TGPUVendor = (gvUnknown, gvNVIDIA, gvATI, gvIntel, gvApple);
var MaxTextureSize: LongInt;
+{$IFDEF SDL13}SDLGLcontext: PSDL_GLContext;{$ENDIF}
+
// cGPUVendor: TGPUVendor;
function WriteInRect(Surface: PSDL_Surface; X, Y: LongInt; Color: LongWord; Font: THWFont; s: ansistring): TSDL_Rect;
@@ -1137,6 +1139,9 @@
// init all count texture pointers
for i:= Low(CountTexz) to High(CountTexz) do
CountTexz[i] := nil;
+{$IFDEF SDL13}
+ SDLGLcontext := nil;
+{$ENDIF}
end;
procedure freeModule;
--- a/hedgewars/uUtils.pas Sat May 05 17:29:04 2012 +0100
+++ b/hedgewars/uUtils.pas Sat May 05 18:10:41 2012 +0100
@@ -65,7 +65,7 @@
function GetLaunchX(at: TAmmoType; dir: LongInt; angle: LongInt): LongInt;
function GetLaunchY(at: TAmmoType; angle: LongInt): LongInt;
-procedure initModule;
+procedure initModule(isGame: boolean);
procedure freeModule;
@@ -359,14 +359,21 @@
CheckNoTeamOrHH:= (CurrentTeam = nil) or (CurrentHedgehog^.Gear = nil);
end;
-procedure initModule;
-{$IFDEF DEBUGFILE}{$IFNDEF MOBILE}var i: LongInt;{$ENDIF}{$ENDIF}
+procedure initModule(isGame: boolean);
+{$IFDEF DEBUGFILE}
+var logfileBase: shortstring;
+{$IFNDEF MOBILE}var i: LongInt;{$ENDIF}
+{$ENDIF}
begin
{$IFDEF DEBUGFILE}
+ if isGame then
+ logfileBase:= 'game'
+ else
+ logfileBase:= 'preview';
{$I-}
{$IFDEF MOBILE}
- {$IFDEF IPHONEOS} Assign(f,'../Documents/hw-' + cLogfileBase + '.log'); {$ENDIF}
- {$IFDEF ANDROID} Assign(f,pathPrefix + '/' + cLogfileBase + '.log'); {$ENDIF}
+ {$IFDEF IPHONEOS} Assign(f,'../Documents/hw-' + logfileBase + '.log'); {$ENDIF}
+ {$IFDEF ANDROID} Assign(f,pathPrefix + '/' + logfileBase + '.log'); {$ENDIF}
Rewrite(f);
{$ELSE}
if (UserPathPrefix <> '') then
@@ -374,7 +381,7 @@
i:= 0;
while(i < 7) do
begin
- assign(f, UserPathPrefix + '/Logs/' + cLogfileBase + inttostr(i) + '.log');
+ assign(f, UserPathPrefix + '/Logs/' + logfileBase + inttostr(i) + '.log');
rewrite(f);
if IOResult = 0 then
break;
--- a/hedgewars/uVariables.pas Sat May 05 17:29:04 2012 +0100
+++ b/hedgewars/uVariables.pas Sat May 05 18:10:41 2012 +0100
@@ -50,25 +50,21 @@
UserNick : shortstring = '';
recordFileName : shortstring = '';
cReadyDelay : Longword = 5000;
- cLogfileBase : shortstring = 'debug';
cStereoMode : TStereoMode = smNone;
cOnlyStats : boolean = False;
//////////////////////////
cMapName : shortstring = '';
- alsoShutdownFrontend: boolean = false;
-
isCursorVisible : boolean;
isInLag : boolean;
isPaused : boolean;
-
isInMultiShoot : boolean;
isSpeed : boolean;
- isFirstFrame : boolean;
fastUntilLag : boolean;
autoCameraOn : boolean;
+ GameTicks : LongWord;
GameState : TGameState;
GameType : TGameType;
InputMask : LongWord;
@@ -103,8 +99,6 @@
cWaterLine : Word;
cGearScrEdgesDist: LongInt;
- GameTicks : LongWord;
-
// originally typed consts
CharArray: array[byte] of Char;
LastTint: Longword;
@@ -193,7 +187,6 @@
{$IFDEF SDL13}
SDLwindow : PSDL_Window;
- SDLGLcontext : PSDL_GLContext;
{$ENDIF}
WorldDx: LongInt;
@@ -2605,7 +2598,6 @@
isInMultiShoot := false;
isSpeed := false;
fastUntilLag := false;
- isFirstFrame := true;
autoCameraOn := true;
cScriptName := '';
cSeed := '';
@@ -2620,7 +2612,6 @@
{$IFDEF SDL13}
SDLwindow := nil;
- SDLGLcontext := nil;
{$ENDIF}
// those values still are not perfect
--- a/hedgewars/uWorld.pas Sat May 05 17:29:04 2012 +0100
+++ b/hedgewars/uWorld.pas Sat May 05 18:10:41 2012 +0100
@@ -78,6 +78,7 @@
missionTex: PTexture;
missionTimer: LongInt;
stereoDepth: GLfloat;
+ isFirstFrame: boolean;
const cStereo_Sky = 0.0500;
cStereo_Horizon = 0.0250;
@@ -1802,37 +1803,38 @@
procedure initModule;
begin
-fpsTexture:= nil;
-FollowGear:= nil;
-WindBarWidth:= 0;
-bShowAmmoMenu:= false;
-bSelected:= false;
-bShowFinger:= false;
-Frames:= 0;
-WorldDx:= -512;
-WorldDy:= -256;
+ fpsTexture:= nil;
+ FollowGear:= nil;
+ WindBarWidth:= 0;
+ bShowAmmoMenu:= false;
+ bSelected:= false;
+ bShowFinger:= false;
+ Frames:= 0;
+ WorldDx:= -512;
+ WorldDy:= -256;
-FPS:= 0;
-CountTicks:= 0;
-SoundTimerTicks:= 0;
-prevPoint.X:= 0;
-prevPoint.Y:= 0;
-missionTimer:= 0;
-missionTex:= nil;
-cOffsetY:= 0;
-stereoDepth:= 0;
-AMState:= AMHidden;
+ FPS:= 0;
+ CountTicks:= 0;
+ SoundTimerTicks:= 0;
+ prevPoint.X:= 0;
+ prevPoint.Y:= 0;
+ missionTimer:= 0;
+ missionTex:= nil;
+ cOffsetY:= 0;
+ stereoDepth:= 0;
+ AMState:= AMHidden;
+ isFirstFrame:= true;
end;
procedure freeModule;
begin
-stereoDepth:= stereoDepth; // avoid hint
-FreeTexture(fpsTexture);
-fpsTexture:= nil;
-FreeTexture(timeTexture);
-timeTexture:= nil;
-FreeTexture(missionTex);
-missionTex:= nil
+ stereoDepth:= stereoDepth; // avoid hint
+ FreeTexture(fpsTexture);
+ fpsTexture:= nil;
+ FreeTexture(timeTexture);
+ timeTexture:= nil;
+ FreeTexture(missionTex);
+ missionTex:= nil
end;
end.