interpret parameters before initializing everything
authorkoda
Sat, 03 Jul 2010 00:11:23 +0200 (2010-07-02)
changeset 3611 ed00aa2b339e
parent 3610 8590424bdfb0
child 3612 b50215a8a43d
interpret parameters before initializing everything make flake disabling really works code cleanup and fixes
hedgewars/CCHandlers.inc
hedgewars/VGSHandlers.inc
hedgewars/hwengine.pas
hedgewars/options.inc
hedgewars/uConsts.pas
hedgewars/uIO.pas
hedgewars/uMisc.pas
hedgewars/uStore.pas
hedgewars/uVisualGears.pas
hedgewars/uWorld.pas
project_files/HedgewarsMobile/Hedgewars.xcodeproj/project.pbxproj
--- a/hedgewars/CCHandlers.inc	Fri Jul 02 17:46:53 2010 +0200
+++ b/hedgewars/CCHandlers.inc	Sat Jul 03 00:11:23 2010 +0200
@@ -695,11 +695,7 @@
     flags:= SDL_OPENGL;// or SDL_RESIZABLE;
 
     if cFullScreen then
-    begin
         flags:= flags or SDL_FULLSCREEN;
-        cScreenWidth:= cInitWidth;
-        cScreenHeight:= cInitHeight
-    end;
 
 {$IFDEF SDL_IMAGE_NEWER}
     WriteToConsole('Init SDL_image... ');
--- a/hedgewars/VGSHandlers.inc	Fri Jul 02 17:46:53 2010 +0200
+++ b/hedgewars/VGSHandlers.inc	Sat Jul 03 00:11:23 2010 +0200
@@ -18,6 +18,8 @@
 procedure doStepFlake(Gear: PVisualGear; Steps: Longword);
 var sign: float;
 begin
+if ((cReducedQuality and rqkillFlakes) <> 0) then exit;
+
 sign:= 1;
 with Gear^ do
     begin
--- a/hedgewars/hwengine.pas	Fri Jul 02 17:46:53 2010 +0200
+++ b/hedgewars/hwengine.pas	Sat Jul 03 00:11:23 2010 +0200
@@ -81,6 +81,7 @@
 implementation
 {$ELSE}
 procedure OnDestroy; forward;
+procedure initEverything(complete:boolean); forward;
 procedure freeEverything(complete:boolean); forward;
 {$ENDIF}
 
@@ -245,10 +246,11 @@
 {$ENDIF}
 var p: TPathType;
     s: shortstring;
+{$IFDEF DEBUGFILE}
+    i: LongInt;
+{$ENDIF}
 begin
 {$IFDEF HWLIBRARY}
-    initEverything(true);
-
     cBits:= 32;
     cFullScreen:= false;
     cVSyncInUse:= true;
@@ -266,10 +268,15 @@
     cAltDamage:= gameArgs[5] = '1';
     val(gameArgs[6], cScreenHeight);
     val(gameArgs[7], cScreenWidth);
-    cInitHeight:= cScreenHeight;
-    cInitWidth:= cScreenWidth;
     recordFileName:= gameArgs[8];
 {$ENDIF}
+    initEverything(true);
+    WriteLnToConsole('Hedgewars ' + cVersionString + ' engine (network protocol: ' + inttostr(cNetProtoVersion) + ')');
+{$IFDEF DEBUGFILE}
+    AddFileLog('Prefix: "' + PathPrefix +'"');
+    for i:= 0 to ParamCount do
+        AddFileLog(inttostr(i) + ': ' + ParamStr(i));
+{$ENDIF}
 
     for p:= Succ(Low(TPathType)) to High(TPathType) do
         if p <> ptMapCurrent then Pathz[p]:= PathPrefix + '/' + Pathz[p];
@@ -335,7 +342,7 @@
 
     MainLoop();
     OnDestroy();
-{$IFDEF HWLIBRARY}freeEverything(true);{$ENDIF}
+    freeEverything(true);
     if alsoShutdownFrontend then halt;
 end;
 
@@ -423,8 +430,8 @@
 procedure GenLandPreview{$IFDEF HWLIBRARY}(port: LongInt); cdecl; export{$ENDIF};
 var Preview: TPreview;
 begin
+    initEverything(false);
 {$IFDEF HWLIBRARY}
-    initEverything(false);
     WriteLnToConsole('Preview connecting on port ' + inttostr(port));
     ipcPort:= port;
 {$ENDIF}
@@ -438,9 +445,7 @@
     SendIPCRaw(@MaxHedgehogs, sizeof(byte));
     WriteLnToConsole('Preview sent, disconnect');
     CloseIPC();
-{$IFDEF HWLIBRARY}
     freeEverything(false);
-{$ENDIF}
 end;
 
 {$IFNDEF HWLIBRARY}
@@ -468,16 +473,11 @@
 
 ////////////////////
 procedure GetParams;
-{$IFDEF DEBUGFILE}
-var i: LongInt;
-{$ENDIF}
 begin
     case ParamCount of
         18: begin
             val(ParamStr(2), cScreenWidth);
             val(ParamStr(3), cScreenHeight);
-            cInitWidth:= cScreenWidth;
-            cInitHeight:= cScreenHeight;
             cBitsStr:= ParamStr(4);
             val(cBitsStr, cBits);
             val(ParamStr(5), ipcPort);
@@ -517,8 +517,6 @@
             begin
                 val(ParamStr(4), cScreenWidth);
                 val(ParamStr(5), cScreenHeight);
-                cInitWidth:= cScreenWidth;
-                cInitHeight:= cScreenHeight;
                 cBitsStr:= ParamStr(6);
                 val(cBitsStr, cBits);
             end
@@ -550,8 +548,6 @@
             begin
                 val(ParamStr(4), cScreenWidth);
                 val(ParamStr(5), cScreenHeight);
-                cInitWidth:= cScreenWidth;
-                cInitHeight:= cScreenHeight;
                 cBitsStr:= ParamStr(6);
                 val(cBitsStr, cBits);
                 val(ParamStr(7), cInitVolume);
@@ -569,8 +565,6 @@
             begin
                 val(ParamStr(4), cScreenWidth);
                 val(ParamStr(5), cScreenHeight);
-                cInitWidth:= cScreenWidth;
-                cInitHeight:= cScreenHeight;
                 cBitsStr:= ParamStr(6);
                 val(cBitsStr, cBits);
                 val(ParamStr(7), cInitVolume);
@@ -590,28 +584,18 @@
         end;
         else GameType:= gmtSyntax;
     end;
-
-{$IFDEF DEBUGFILE}
-    AddFileLog('Prefix: "' + PathPrefix +'"');
-    for i:= 0 to ParamCount do
-        AddFileLog(inttostr(i) + ': ' + ParamStr(i));
-{$ENDIF}
 end;
 
 ////////////////////////////////////////////////////////////////////////////////
 /////////////////////////////// m a i n ////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////////////////
 begin
-    initEverything(true);
-    WriteLnToConsole('Hedgewars ' + cVersionString + ' engine (network protocol: ' + inttostr(cNetProtoVersion) + ')');
-    
     GetParams();
 
     if GameType = gmtLandPreview then GenLandPreview()
     else if GameType = gmtSyntax then DisplayUsage()
     else Game();
     
-    freeEverything(true);
     if GameType = gmtSyntax then
         ExitCode:= 1
     else
--- a/hedgewars/options.inc	Fri Jul 02 17:46:53 2010 +0200
+++ b/hedgewars/options.inc	Sat Jul 03 00:11:23 2010 +0200
@@ -34,6 +34,7 @@
   {$DEFINE HWLIBRARY}
   {$DEFINE GLunit:=gles11}
   {$DEFINE DOWNSCALE}
+//  {$DEFINE LOWRES}
 {$ENDIF}
 
 {$IFNDEF DARWIN}
--- a/hedgewars/uConsts.pas	Fri Jul 02 17:46:53 2010 +0200
+++ b/hedgewars/uConsts.pas	Sat Jul 03 00:11:23 2010 +0200
@@ -225,6 +225,7 @@
     rqKillFlakes  = $00000040;  // no flakes
     rqSlowMenu    = $00000080;  // ammomenu appears with no animation
     rqPlainSplash = $00000100;  // no droplets
+    rqClampLess   = $00000200;  // don't clamp textures
 
     // image flags (for LoadImage())
     ifNone        = $00000000;  // nothing special
@@ -442,7 +443,29 @@
     cThemeCFGFilename = 'theme.cfg';
     
     FontBorder = 2;
-var PathPrefix: shortstring;
+    cPathz: array[TPathType] of shortstring = (
+        '',                              // ptNone
+        '',                              // ptData
+        'Graphics',                      // ptGraphics
+        'Themes',                        // ptThemes
+        'Themes/avematan',               // ptCurrTheme
+        'Teams',                         // ptTeams
+        'Maps',                          // ptMaps
+        '',                              // ptMapCurrent
+        'Demos',                         // ptDemos
+        'Sounds',                        // ptSounds
+        'Graphics/Graves',               // ptGraves
+        'Fonts',                         // ptFonts
+        'Forts',                         // ptForts
+        'Locale',                        // ptLocale
+        'Graphics/AmmoMenu',             // ptAmmoMenu
+        'Graphics/Hedgehog',             // ptHedgehog
+        'Sounds/voices',                 // ptVoices
+        'Graphics/Hats',                 // ptHats
+        'Graphics/Flags'                 // ptFlags
+    );
+    
+var PathPrefix: shortstring = './';
     Pathz: array[TPathType] of shortstring;
     CountTexz: array[1..Pred(AMMO_INFINITE)] of PTexture;
 
@@ -2158,43 +2181,22 @@
         colorkey: 0;
         alpha : 255
     );
-            
-
+    
 procedure initModule;
 procedure freeModule;
 
 implementation
 
 procedure initModule;
-var cPathz: array[TPathType] of shortstring = (
-        '',                              // ptNone
-        '',                              // ptData
-        'Graphics',                      // ptGraphics
-        'Themes',                        // ptThemes
-        'Themes/avematan',               // ptCurrTheme
-        'Teams',                         // ptTeams
-        'Maps',                          // ptMaps
-        '',                              // ptMapCurrent
-        'Demos',                         // ptDemos
-        'Sounds',                        // ptSounds
-        'Graphics/Graves',               // ptGraves
-        'Fonts',                         // ptFonts
-        'Forts',                         // ptForts
-        'Locale',                        // ptLocale
-        'Graphics/AmmoMenu',             // ptAmmoMenu
-        'Graphics/Hedgehog',             // ptHedgehog
-        'Sounds/voices',                 // ptVoices
-        'Graphics/Hats',                 // ptHats
-        'Graphics/Flags'                 // ptFlags
-    );
+
 begin
-    PathPrefix := './';
     Pathz:= cPathz;
+
 end;
 
 procedure freeModule;
 begin
-
+    PathPrefix := './';
 end;
 
 end.
--- a/hedgewars/uIO.pas	Fri Jul 02 17:46:53 2010 +0200
+++ b/hedgewars/uIO.pas	Sat Jul 03 00:11:23 2010 +0200
@@ -22,7 +22,7 @@
 interface
 uses SDLh;
 
-var ipcPort: Word;
+var ipcPort: Word = 0;
     hiTicks: Word;
 
 procedure initModule;
@@ -361,11 +361,11 @@
 
     hiTicks:= 0;
     SendEmptyPacketTicks:= 0;
-    ipcPort:= 0;
 end;
 
 procedure freeModule;
 begin
+    ipcPort:= 0;
 
 end;
 
--- a/hedgewars/uMisc.pas	Fri Jul 02 17:46:53 2010 +0200
+++ b/hedgewars/uMisc.pas	Sat Jul 03 00:11:23 2010 +0200
@@ -29,8 +29,7 @@
     isTerminated    : boolean;
     isInLag         : boolean;
     isPaused        : boolean;
-    isSoundEnabled  : boolean;
-    isMusicEnabled  : boolean;
+
     isSEBackup      : boolean;
     isInMultiShoot  : boolean;
     isSpeed         : boolean;
@@ -38,9 +37,9 @@
 
     fastUntilLag    : boolean;
 
-    GameState   : TGameState;
-    GameType    : TGameType;
-    GameFlags   : Longword;
+    GameState       : TGameState;
+    GameType        : TGameType;
+    GameFlags       : Longword;
     TrainingFlags   : Longword;
     TurnTimeLeft    : Longword;
     cSuddenDTurns   : LongInt;
@@ -55,20 +54,13 @@
     cMaxAIThinkTime  : Longword;
 
     cCloudsNumber    : LongInt;
-    cScreenWidth     : LongInt;
-    cScreenHeight    : LongInt;
-    cInitWidth       : LongInt;
-    cInitHeight      : LongInt;
-    cVSyncInUse      : boolean;
-    cBits            : LongInt;
-    cBitsStr         : string[2];
+
     cTagsMask        : byte;
     zoom             : GLfloat;
     ZoomValue        : GLfloat;
 
     cWaterLine       : LongInt;
     cGearScrEdgesDist: LongInt;
-    cAltDamage       : boolean;
 
     GameTicks   : LongWord;
     TrainingTimeInc : Longword;
@@ -79,20 +71,35 @@
     TimeTrialStartTime: Longword;
     TimeTrialStopTime : Longword;
     
-    recordFileName  : shortstring;
-    cShowFPS    : boolean;
-    cCaseFactor : Longword;
+    // init flags
+    cScreenWidth    : LongInt = 1024;
+    cScreenHeight   : LongInt = 768;
+    cBits           : LongInt = 32;
+    cBitsStr        : string[2] = '32';
+    //ipcPort is in uIO
+    cFullScreen     : boolean = false;
+    isSoundEnabled  : boolean = true;
+    isMusicEnabled  : boolean = false;
+    cVSyncInUse     : boolean = true;    
+    cWeaponTooltips : boolean = true;
+    cLocaleFName    : shortstring = 'en.txt';
+    cInitVolume     : LongInt = 50;
+    cTimerInterval  : LongInt = 8;
+    //pathPrefix is in uConsts
+    cShowFPS        : boolean = false;
+    cAltDamage      : boolean = true;
+    cReducedQuality : LongInt = 0;
+
+    recordFileName  : shortstring = '';
+    
+    cCaseFactor     : Longword;
     cLandAdditions  : Longword;
-    cExplosives : Longword;
-    cFullScreen : boolean;
-    cReducedQuality : LongInt;
-    cLocaleFName    : shortstring;
-    cSeed       : shortstring;
-    cInitVolume : LongInt;
+    cExplosives     : Longword;
+
+    cSeed           : shortstring;
     cVolumeDelta    : LongInt;
-    cTimerInterval  : Longword;
-    cHasFocus   : boolean;
-    cInactDelay : Longword;
+    cHasFocus       : boolean;
+    cInactDelay     : Longword;
 
     bBetweenTurns   : boolean;
     cHealthDecrease : LongWord;
@@ -101,48 +108,47 @@
     ShowCrosshair   : boolean;
     CursorMovementX : LongInt;
     CursorMovementY : LongInt;
-    cDrownSpeed : hwFloat;
-    cDrownSpeedf : float;
+    cDrownSpeed     : hwFloat;
+    cDrownSpeedf    : float;
     cMaxWindSpeed   : hwFloat;
-    cWindSpeed  : hwFloat;
-    cWindSpeedf  : float;
-    cGravity    : hwFloat;
-    cGravityf    : float;
+    cWindSpeed      : hwFloat;
+    cWindSpeedf     : float;
+    cGravity        : hwFloat;
+    cGravityf       : float;
     cDamageModifier : hwFloat;
     cLaserSighting  : boolean;
-    cVampiric   : boolean;
-    cArtillery  : boolean;
+    cVampiric       : boolean;
+    cArtillery      : boolean;
     WeaponTooltipTex : PTexture;
-    cWeaponTooltips: boolean;
 
     flagMakeCapture : boolean;
 
     InitStepsFlags  : Longword;
-    RealTicks   : Longword;
-    AttackBar   : LongInt;
+    RealTicks       : Longword;
+    AttackBar       : LongInt;
 
     WaterColorArray : array[0..3] of HwColor4f;
 
-    CursorPoint : TPoint;
-    TargetPoint : TPoint;
+    CursorPoint     : TPoint;
+    TargetPoint     : TPoint;
 
-    TextureList : PTexture;
+    TextureList     : PTexture;
 
-    ScreenFade : TScreenFade;
+    ScreenFade      : TScreenFade;
     ScreenFadeValue : LongInt;
     ScreenFadeSpeed : LongInt;
 
 {$IFDEF SDL13}
-    SDLwindow: PSDL_Window;
+    SDLwindow       : PSDL_Window;
 {$ENDIF}
 
 procedure initModule;
 procedure freeModule;
 procedure SplitBySpace(var a, b: shortstring);
 procedure SplitByChar(var a, b: ansistring; c: char);
-function EnumToStr(const en : TGearType) : shortstring; overload;
-function EnumToStr(const en : TSound) : shortstring; overload;
-function EnumToStr(const en : TAmmoType) : shortstring; overload;
+function  EnumToStr(const en : TGearType) : shortstring; overload;
+function  EnumToStr(const en : TSound) : shortstring; overload;
+function  EnumToStr(const en : TAmmoType) : shortstring; overload;
 procedure movecursor(dx, dy: LongInt);
 function  hwSign(r: hwFloat): LongInt;
 function  Min(a, b: LongInt): LongInt;
@@ -292,7 +298,7 @@
 procedure SetTextureParameters(enableClamp: Boolean);
 begin
     //if enableClamp and not cReducedQuality then
-    if enableClamp and ((cReducedQuality and rqNoBackground) = 0) then
+    if enableClamp and ((cReducedQuality and rqClampLess) = 0) then
     begin
         glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
         glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE)
@@ -718,32 +724,25 @@
     cTemplateFilter     := 0;
     cMapGen             := 0;//MAPGEN_REGULAR
     cMazeSize           := 0;
-
     cHedgehogTurnTime   := 45000;
     cMinesTime          := 3000;
     cMaxAIThinkTime     := 9000;
+    cCloudsNumber       := 9;
 
-    cCloudsNumber       := 9;
-    cScreenWidth        := 1024;
-    cScreenHeight       := 768;
-    cInitWidth      := cScreenWidth;
-    cInitHeight     := cScreenHeight;
-    cBits           := 32;
     cTagsMask       := 0;
     KBnum           := 0;
     InitStepsFlags  := 0;
     RealTicks       := 0;
     AttackBar       := 0; // 0 - none, 1 - just bar at the right-down corner, 2 - like in WWP
-    
-    // tgametype and glfloat and string
+    cCaseFactor     := 5;  {0..9}
+    cLandAdditions  := 4;
+    cExplosives     := 2;
+        
     GameState       := Low(TGameState);
     GameType        := gmtLocal;
     zoom            := 2.0;
     ZoomValue       := 2.0;
-    cBitsStr        := '32';
     WeaponTooltipTex:= nil;
-
-    // booleans
     cLaserSighting  := false;
     cVampiric       := false;
     cArtillery      := false;
@@ -754,31 +753,15 @@
     isTerminated    := false;
     isInLag         := false;
     isPaused        := false;
-    isMusicEnabled  := false;
     isInMultiShoot  := false;
     isSpeed         := false;
     fastUntilLag    := false;
     isFirstFrame    := true;
-    cVSyncInUse     := true;    
-    isSoundEnabled  := true;
     isSEBackup      := true;
-    
-    // init flags
-    recordFileName  := '';
-    cShowFPS        := false;
-    cCaseFactor     := 5;  {0..9}
-    cLandAdditions  := 4;
-    cExplosives     := 2;
-    cFullScreen     := false;
-    cReducedQuality := 0;
-    cLocaleFName    := 'en.txt';
     cSeed           := '';
-    cInitVolume     := 50;
     cVolumeDelta    := 0;
-    cTimerInterval  := 8;
     cHasFocus       := true;
     cInactDelay     := 1250;
-    cAltDamage      := true;
 
     ScreenFade      := sfNone;
     
--- a/hedgewars/uStore.pas	Fri Jul 02 17:46:53 2010 +0200
+++ b/hedgewars/uStore.pas	Sat Jul 03 00:11:23 2010 +0200
@@ -424,7 +424,7 @@
                 else
                     begin
                     Texture:= Surface2Tex(tmpsurf, false);
-                    if (ii = sprWater) and ((cReducedQuality and rq2DWater) = 0) then // HACK: We should include some sprite attribute to define the texture wrap directions
+                    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;
--- a/hedgewars/uVisualGears.pas	Fri Jul 02 17:46:53 2010 +0200
+++ b/hedgewars/uVisualGears.pas	Sat Jul 03 00:11:23 2010 +0200
@@ -376,10 +376,11 @@
         begin
         Tint(Gear^.Tint);
         case Gear^.Kind of
-            vgtFlake: if vobVelocity = 0 then
-                        DrawSprite(sprFlake, round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy + SkyOffset, Gear^.Frame)
-                    else
-                        DrawRotatedF(sprFlake, round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy + SkyOffset, Gear^.Frame, 1, Gear^.Angle);
+            vgtFlake: if ((cReducedQuality and rqkillFlakes) <> 0) then
+                        if vobVelocity = 0 then
+                            DrawSprite(sprFlake, round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy + SkyOffset, Gear^.Frame)
+                        else
+                            DrawRotatedF(sprFlake, round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy + SkyOffset, Gear^.Frame, 1, Gear^.Angle);
             vgtCloud: DrawSprite(sprCloud, round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy + SkyOffset, Gear^.Frame);
             end;
         Gear:= Gear^.NextGear
--- a/hedgewars/uWorld.pas	Fri Jul 02 17:46:53 2010 +0200
+++ b/hedgewars/uWorld.pas	Sat Jul 03 00:11:23 2010 +0200
@@ -553,21 +553,20 @@
             zoom:= zoom + 0.002 * Lag;
             if ZoomValue < zoom then
                 zoom:= ZoomValue
+            end
         end
-    end
-else
-    ZoomValue:= zoom;
+    else
+        ZoomValue:= zoom;
 
-// Sky
-glClear(GL_COLOR_BUFFER_BIT);
-//glPushMatrix;
-//glScalef(1.0, 1.0, 1.0);
+    // Sky
+    glClear(GL_COLOR_BUFFER_BIT);
+    //glPushMatrix;
+    //glScalef(1.0, 1.0, 1.0);
 
     if not isPaused then
         MoveCamera;
 
-{if not cReducedQuality then}
-    if (cReducedQuality and (rqNoBackground or rqKillFlakes or rq2DWater)) = 0 then
+    if (cReducedQuality and rqNoBackground) = 0 then
     begin
         // Offsets relative to camera - spare them to wimpier cpus, no bg or flakes for them anyway
         ScreenBottom:= (WorldDy - trunc(cScreenHeight/cScaleFactor) - (cScreenHeight div 2) + cWaterLine);
@@ -580,9 +579,12 @@
         // background
         DrawRepeated(sprSky, sprSkyL, sprSkyR, (WorldDx + LAND_WIDTH div 2) * 3 div 8, SkyOffset);
         DrawRepeated(sprHorizont, sprHorizontL, sprHorizontR, (WorldDx + LAND_WIDTH div 2) * 3 div 5, HorizontOffset);
+    end;
 
-        DrawVisualGears(0);
-        
+    DrawVisualGears(0);
+    
+    if (cReducedQuality and rq2DWater) = 0 then
+    begin
         // Waves
         DrawWater(255, SkyOffset); 
         DrawWaves( 1,  0 - WorldDx div 32, - cWaveHeight + offsetY div 35, 64);
@@ -593,13 +595,13 @@
     else
         DrawWaves(-1, 100, - (cWaveHeight + (cWaveHeight shr 1)), 0);
 
-DrawLand(WorldDx, WorldDy);
+    DrawLand(WorldDx, WorldDy);
 
-DrawWater(255, 0);
+    DrawWater(255, 0);
 
 // Attack bar
-if CurrentTeam <> nil then
-    case AttackBar of
+    if CurrentTeam <> nil then
+        case AttackBar of
 (*        1: begin
         r:= StuffPoz[sPowerBar];
         {$WARNINGS OFF}
@@ -619,16 +621,16 @@
                 end
         end;
 
-DrawVisualGears(1);
+    DrawVisualGears(1);
 
-DrawGears;
+    DrawGears;
 
-DrawVisualGears(2);
+    DrawVisualGears(2);
 
-DrawWater(cWaterOpacity, 0);
+    DrawWater(cWaterOpacity, 0);
 
-// Waves
-DrawWaves( 1, 25 - WorldDx div 9, - cWaveHeight, 12);
+    // Waves
+    DrawWaves( 1, 25 - WorldDx div 9, - cWaveHeight, 12);
 
     if (cReducedQuality and rq2DWater) = 0 then
     begin
@@ -639,8 +641,8 @@
         DrawWater(cWaterOpacity, - offsetY div 10);
         DrawWaves( -1, 25 + WorldDx div 3, - cWaveHeight - offsetY div 10, 0);
     end
-else
-    DrawWaves(-1, 50, - (cWaveHeight shr 1), 0);
+    else
+        DrawWaves(-1, 50, - (cWaveHeight shr 1), 0);
 
 
 {$WARNINGS OFF}
--- a/project_files/HedgewarsMobile/Hedgewars.xcodeproj/project.pbxproj	Fri Jul 02 17:46:53 2010 +0200
+++ b/project_files/HedgewarsMobile/Hedgewars.xcodeproj/project.pbxproj	Sat Jul 03 00:11:23 2010 +0200
@@ -246,6 +246,7 @@
 		6132878211D95185006BA39D /* joyButton_forwardjump.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = joyButton_forwardjump.png; path = Resources/joyButton_forwardjump.png; sourceTree = "<group>"; };
 		6132878411D9518B006BA39D /* joyButton_attack.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = joyButton_attack.png; path = Resources/joyButton_attack.png; sourceTree = "<group>"; };
 		61370652117B1D50004EE44A /* Entitlements-Distribution.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "Entitlements-Distribution.plist"; sourceTree = "<group>"; };
+		614E333D11DE9A93009DBA4E /* VGSHandlers.inc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.pascal; name = VGSHandlers.inc; path = ../../hedgewars/VGSHandlers.inc; sourceTree = SOURCE_ROOT; };
 		6151347D116C2803001F16D1 /* Icon-iPad.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "Icon-iPad.png"; path = "Resources/Icon-iPad.png"; sourceTree = "<group>"; };
 		6163EE7C11CC2600001C0453 /* SingleWeaponViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SingleWeaponViewController.h; sourceTree = "<group>"; };
 		6163EE7D11CC2600001C0453 /* SingleWeaponViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SingleWeaponViewController.m; sourceTree = "<group>"; };
@@ -680,6 +681,7 @@
 				617987E1114AA34C00BA94A9 /* CCHandlers.inc */,
 				617987E4114AA34C00BA94A9 /* GSHandlers.inc */,
 				617987E5114AA34C00BA94A9 /* HHHandlers.inc */,
+				614E333D11DE9A93009DBA4E /* VGSHandlers.inc */,
 				617987F0114AA34C00BA94A9 /* SinTable.inc */,
 			);
 			name = inc;
@@ -1240,6 +1242,7 @@
 				SDKROOT = iphoneos3.2;
 				TARGETED_DEVICE_FAMILY = "1,2";
 				VALIDATE_PRODUCT = NO;
+				VALID_ARCHS = "armv7 armv6";
 			};
 			name = Distribution;
 		};
@@ -1354,6 +1357,7 @@
 				SDKROOT = iphoneos3.2;
 				TARGETED_DEVICE_FAMILY = "1,2";
 				VALIDATE_PRODUCT = NO;
+				VALID_ARCHS = "armv7 armv6";
 			};
 			name = Valgrind;
 		};
@@ -1553,6 +1557,7 @@
 				SDKROOT = iphoneos3.2;
 				TARGETED_DEVICE_FAMILY = "1,2";
 				VALIDATE_PRODUCT = NO;
+				VALID_ARCHS = "armv7 armv6";
 			};
 			name = Debug;
 		};
@@ -1594,6 +1599,7 @@
 				SDKROOT = iphoneos3.2;
 				TARGETED_DEVICE_FAMILY = "1,2";
 				VALIDATE_PRODUCT = NO;
+				VALID_ARCHS = "armv7 armv6";
 			};
 			name = Release;
 		};