set flake to non critical, no touches until game is starding, moved some variables to be initialized in the right place
authorkoda
Wed, 25 Aug 2010 00:17:51 +0200
changeset 3765 ebfe7c9b3085
parent 3764 eb91c02f2d84
child 3766 36b625111609
set flake to non critical, no touches until game is starding, moved some variables to be initialized in the right place
hedgewars/hwengine.pas
hedgewars/uMisc.pas
hedgewars/uStore.pas
project_files/HedgewarsMobile/Classes/OverlayViewController.m
--- a/hedgewars/hwengine.pas	Tue Aug 24 17:03:44 2010 +0200
+++ b/hedgewars/hwengine.pas	Wed Aug 25 00:17:51 2010 +0200
@@ -263,11 +263,6 @@
     ShowMainWindow();
 {$ENDIF}
 
-    // those values still aren't perfect
-    cLeftScreenBorder:= round(-cMinZoomLevel * cScreenWidth);
-    cRightScreenBorder:= round(cMinZoomLevel * cScreenWidth + LAND_WIDTH);
-    cScreenSpace:= cRightScreenBorder - cLeftScreenBorder;
-
     AddProgress();
 
     ControllerInit(); // has to happen before InitKbdKeyTable to map keys
--- a/hedgewars/uMisc.pas	Tue Aug 24 17:03:44 2010 +0200
+++ b/hedgewars/uMisc.pas	Wed Aug 25 00:17:51 2010 +0200
@@ -74,11 +74,11 @@
     // originally from uConsts
     Pathz: array[TPathType] of shortstring;
     CountTexz: array[1..Pred(AMMO_INFINITE)] of PTexture;
-    LAND_WIDTH  :longint;
-    LAND_HEIGHT :longint;
-    LAND_WIDTH_MASK  :longWord;
-    LAND_HEIGHT_MASK :longWord;
-    cMaxCaptions : LongInt;
+    LAND_WIDTH       : LongInt;
+    LAND_HEIGHT      : LongInt;
+    LAND_WIDTH_MASK  : LongWord;
+    LAND_HEIGHT_MASK : LongWord;
+    cMaxCaptions     : LongInt;
 
     // init flags
     cScreenWidth    : LongInt = 1024;
@@ -98,9 +98,9 @@
     //userNick is in uChat
     recordFileName  : shortstring = '';
 
-    cLeftScreenBorder     : LongInt = 0;
-    cRightScreenBorder    : LongInt = 0;
-    cScreenSpace          : LongInt = 0;
+    cLeftScreenBorder     : LongInt;
+    cRightScreenBorder    : LongInt;
+    cScreenSpace          : LongInt;
 
     cCaseFactor     : Longword;
     cLandAdditions  : Longword;
@@ -786,6 +786,11 @@
 
     ScreenFade      := sfNone;
 
+    // those values still aren't perfect
+    cLeftScreenBorder:= round(-cMinZoomLevel * cScreenWidth);
+    cRightScreenBorder:= round(cMinZoomLevel * cScreenWidth + LAND_WIDTH);
+    cScreenSpace:= cRightScreenBorder - cLeftScreenBorder;
+
 {$IFDEF IPHONEOS}
     if isPhone() then
         cMaxCaptions:= 3
--- a/hedgewars/uStore.pas	Tue Aug 24 17:03:44 2010 +0200
+++ b/hedgewars/uStore.pas	Wed Aug 25 00:17:51 2010 +0200
@@ -393,7 +393,7 @@
         if ((cReducedQuality and rqNoBackground) = 0) or (not (ii in [sprSky, sprSkyL, sprSkyR, sprHorizont, sprHorizontL, sprHorizontR, sprFlake, sprSplash, sprDroplet])) then // FIXME: hack
         begin
             if AltPath = ptNone then
-                if ii in [sprHorizontL, sprHorizontR, sprSkyL, sprSkyR] then // FIXME: hack
+                if ii in [sprHorizontL, sprHorizontR, sprSkyL, sprSkyR, sprFlake] then // FIXME: hack
                     tmpsurf:= LoadImage(Pathz[Path] + '/' + FileName, ifAlpha or ifTransparent)
                 else
                     tmpsurf:= LoadImage(Pathz[Path] + '/' + FileName, ifAlpha or ifTransparent or ifCritical)
@@ -406,30 +406,29 @@
             if tmpsurf <> nil then
             begin
                 if getImageDimensions then
-                    begin
+                begin
                     imageWidth:= tmpsurf^.w;
                     imageHeight:= tmpsurf^.h
-                    end;
+                end;
                 if getDimensions then
-                    begin
+                begin
                     Width:= tmpsurf^.w;
                     Height:= tmpsurf^.h
-                    end;
+                end;
                 if (ii in [sprSky, sprSkyL, sprSkyR, sprHorizont, sprHorizontL, sprHorizontR]) then
-                    begin
+                begin
                     Texture:= Surface2Tex(tmpsurf, true);
                     Texture^.Scale:= 2
-                    end
+                end
                 else
-                    begin
+                begin
                     Texture:= Surface2Tex(tmpsurf, false);
                     if (ii = sprWater) and ((cReducedQuality and (rq2DWater or rqClampLess)) = 0) then // HACK: We should include some sprite attribute to define the texture wrap directions
-                    begin
                         glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
-                    end;
                 end;
                 glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_PRIORITY, priority);
-                if saveSurf then Surface:= tmpsurf else SDL_FreeSurface(tmpsurf)
+                if saveSurf then
+                    Surface:= tmpsurf else SDL_FreeSurface(tmpsurf)
                 end
             else
                 Surface:= nil
@@ -452,29 +451,24 @@
 // name of weapons in ammo menu
 for ai:= Low(TAmmoType) to High(TAmmoType) do
     with Ammoz[ai] do
-        begin
+    begin
         TryDo(trAmmo[NameId] <> '','No default text/translation found for ammo type #' + intToStr(ord(ai)) + '!',true);
         tmpsurf:= TTF_RenderUTF8_Blended(Fontz[CheckCJKFont(trAmmo[NameId],fnt16)].Handle, Str2PChar(trAmmo[NameId]), cWhiteColorChannels);
         TryDo(tmpsurf <> nil,'Name-texture creation for ammo type #' + intToStr(ord(ai)) + ' failed!',true);
         tmpsurf:= doSurfaceConversion(tmpsurf);
         NameTex:= Surface2Tex(tmpsurf, false);
         SDL_FreeSurface(tmpsurf)
-        end;
+    end;
 
 // number of weapons in ammo menu
 for i:= Low(CountTexz) to High(CountTexz) do
-    begin
+begin
     tmpsurf:= TTF_RenderUTF8_Blended(Fontz[fnt16].Handle, Str2PChar(IntToStr(i) + 'x'), cWhiteColorChannels);
     tmpsurf:= doSurfaceConversion(tmpsurf);
     CountTexz[i]:= Surface2Tex(tmpsurf, false);
     SDL_FreeSurface(tmpsurf)
-    end;
+end;
 
-{$IFDEF DUMP}
-//not working anymore, where are LandSurface and StoreSurface defined?
-//SDL_SaveBMP_RW(LandSurface, SDL_RWFromFile('LandSurface.bmp', 'wb'), 1);
-//SDL_SaveBMP_RW(StoreSurface, SDL_RWFromFile('StoreSurface.bmp', 'wb'), 1);
-{$ENDIF}
 AddProgress;
 
 {$IFDEF SDL_IMAGE_NEWER}
@@ -492,7 +486,7 @@
     _l, _r, _t, _b: real;
     VertexBuffer, TextureBuffer: array [0..3] of TVertex2f;
 begin
-if (SourceTexture^.h = 0) or (SourceTexture^.w = 0) then exit;
+if (SourceTexture = nil) or (SourceTexture^.h = 0) or (SourceTexture^.w = 0) then exit;
 
 // don't draw anything outside the visible screen space (first check fixes some sprite drawing, e.g. hedgehogs)
 if (abs(X) > W) and ((abs(X + W / 2) - W / 2) > cScreenWidth / cScaleFactor) then
--- a/project_files/HedgewarsMobile/Classes/OverlayViewController.m	Tue Aug 24 17:03:44 2010 +0200
+++ b/project_files/HedgewarsMobile/Classes/OverlayViewController.m	Wed Aug 25 00:17:51 2010 +0200
@@ -328,6 +328,9 @@
     NSSet *allTouches = [event allTouches];
     UITouch *first, *second;
 
+    if (isGameRunning == NO)
+        return;
+
     // hide in-game menu
     if (isPopoverVisible)
         [self dismissPopover];