hedgewars/uStore.pas
changeset 5906 ed9676dc8cb4
parent 5883 a6d764786905
child 5932 5164d17b6374
child 6021 652a199d4f38
--- a/hedgewars/uStore.pas	Wed Sep 14 22:27:22 2011 +0200
+++ b/hedgewars/uStore.pas	Wed Sep 14 22:39:39 2011 +0200
@@ -259,18 +259,20 @@
     tmpsurf: PSDL_Surface;
     i: LongInt;
 begin
+AddFileLog('StoreLoad()');
 
-for fi:= Low(THWFont) to High(THWFont) do
-    with Fontz[fi] do
-        begin
-        s:= UserPathz[ptFonts] + '/' + Name;
-        if not FileExists(s) then s:= Pathz[ptFonts] + '/' + Name;
-        WriteToConsole(msgLoading + s + ' (' + inttostr(Height) + 'pt)... ');
-        Handle:= TTF_OpenFont(Str2PChar(s), Height);
-        SDLTry(Handle <> nil, true);
-        TTF_SetFontStyle(Handle, style);
-        WriteLnToConsole(msgOK)
-        end;
+if not reload then
+    for fi:= Low(THWFont) to High(THWFont) do
+        with Fontz[fi] do
+            begin
+            s:= UserPathz[ptFonts] + '/' + Name;
+            if not FileExists(s) then s:= Pathz[ptFonts] + '/' + Name;
+            WriteToConsole(msgLoading + s + ' (' + inttostr(Height) + 'pt)... ');
+            Handle:= TTF_OpenFont(Str2PChar(s), Height);
+            SDLTry(Handle <> nil, true);
+            TTF_SetFontStyle(Handle, style);
+            WriteLnToConsole(msgOK)
+            end;
 
 WriteNames(fnt16);
 MakeCrossHairs;
@@ -345,10 +347,10 @@
 // This should maybe be flagged. It wastes quite a bit of memory.
                 if not reload then
                     begin
-{$IFNDEF DARWIN & WIN32}
+{$IF DEFINED(DARWIN) OR DEFINED(WIN32)}
+                    Surface:= tmpsurf 
+{$ELSE}
                     if saveSurf then Surface:= tmpsurf else SDL_FreeSurface(tmpsurf)
-{$ELSE}
-                    Surface:= tmpsurf 
 {$ENDIF}
                     end
                 end
@@ -756,7 +758,6 @@
     SDL_GL_SwapBuffers();
 {$ENDIF}
     inc(Step);
-
 end;
 
 procedure FinishProgress;
@@ -764,6 +765,7 @@
     WriteLnToConsole('Freeing progress surface... ');
     FreeTexture(ProgrTex);
     uMobile.GameLoaded();
+    Step:= 0
 end;
 
 function RenderHelpWindow(caption, subcaption, description, extra: ansistring; extracolor: LongInt; iconsurf: PSDL_Surface; iconrect: PSDL_Rect): PTexture;
@@ -948,7 +950,6 @@
     reinit: boolean;
     {$IFDEF SDL13}x, y: LongInt;{$ENDIF}
 begin
-    s:= s; // avoid compiler hint
     if Length(s) = 0 then cFullScreen:= not cFullScreen
     else cFullScreen:= s = '1';
 
@@ -981,7 +982,8 @@
         end
     else
         begin
-{$IFDEF DARWIN | WIN32}
+        SetScale(cDefaultZoomLevel);
+{$IF DEFINED(DARWIN) OR DEFINED(WIN32)}
         reinit:= true;
 {$ENDIF}
         AddFileLog('Freeing old primary surface...');
@@ -990,7 +992,13 @@
         end;
 
     // these attributes must be set up before creating the sdl window
+{$IFNDEF WIN32}
+(* On a large number of testers machines, SDL default to software rendering when opengl attributes were set.
+   These attributes were "set" after CreateWindow in .15, which probably did nothing.
+   IMO we should rely on the gl_config defaults from SDL, and use SDL_GL_GetAttribute to possibly post warnings if any
+   bad values are set.  *)
     SetupOpenGLAttributes();
+{$ENDIF}
 {$IFDEF SDL13}
     // these values in x and y make the window appear in the center
     x:= SDL_WINDOWPOS_CENTERED_MASK;
@@ -1038,7 +1046,9 @@
 
         StoreRelease(true);
         StoreLoad(true);
+
         ResetLand;
+
         UpdateLandTexture(0, LAND_WIDTH, 0, LAND_HEIGHT)
         end;
 end;