Merge
authorunc0rr
Mon, 01 Aug 2011 10:08:02 +0400
changeset 5488 fef456439238
parent 5438 d080fb32d703 (current diff)
parent 5487 900b3fe02546 (diff)
child 5489 f7ec6e5ad054
Merge
--- a/.hgtags	Wed Jul 27 11:41:43 2011 +0400
+++ b/.hgtags	Mon Aug 01 10:08:02 2011 +0400
@@ -11,14 +11,34 @@
 ae71dff40ecc405a55647b0f52f628674c1ebb51 0.9.14.1-release
 ae0c6c35414ddc120c8ae94035f287f03a752e78 Hedgewars-iOS-1.2.3
 19ba506ed86b6306f7cd01b2613069391f4e34e6 0.9.13-release
+19ba506ed86b6306f7cd01b2613069391f4e34e6 0.9.13
+0000000000000000000000000000000000000000 0.9.13
 7d8d62a5566ed84688c596b8f55e83cfd171683e 0.9.12-release
+7d8d62a5566ed84688c596b8f55e83cfd171683e 0.9.12
+0000000000000000000000000000000000000000 0.9.12
 89d0fa6734af24e439755b102080cf6268c50aa6 0.9.11-release
+89d0fa6734af24e439755b102080cf6268c50aa6 0.9.11
+0000000000000000000000000000000000000000 0.9.11
 990f341a2332a7bef0822b313854544228375e36 0.9.10-release
+990f341a2332a7bef0822b313854544228375e36 0.9.10
+0000000000000000000000000000000000000000 0.9.10
 8c3e71880f492c61086c2ca2541b52f82a5957b0 0.9.9.2-release
+8c3e71880f492c61086c2ca2541b52f82a5957b0 0.9.9.2
+0000000000000000000000000000000000000000 0.9.9.2
 040cfeac98127d35f22ac8433b06b09e50d5b28f 0.9.8-release
 44cc464de8f320e8018ed9e9cbb7281fd42d0a00 0.9.7-release
 a32f1eed51a6df2513d471cb849eb110545c50b3 0.9.6-release
 6bc4389344c7d7f41bcbc46f986c1dcf88846189 0.9.5-release
 52c7981594f6bc3a7ed1b297b80cb38082015401 0.9.4-release
+52c7981594f6bc3a7ed1b297b80cb38082015401 0.9.4
+0000000000000000000000000000000000000000 0.9.4
 9b2abea1071f83da8fbda70b0bf6cec0ca481b07 0.9.3-release
+9b2abea1071f83da8fbda70b0bf6cec0ca481b07 0.9.3
+0000000000000000000000000000000000000000 0.9.3
 69f1dc50a1faddf1a52080600a3f4771bedd45c1 0.9.2-release
+69f1dc50a1faddf1a52080600a3f4771bedd45c1 0.9.2
+0000000000000000000000000000000000000000 0.9.2
+fee68e3a303998fdfcc69f74775dc84a36f587fb 0.9.9
+0000000000000000000000000000000000000000 0.9.9
+fee68e3a303998fdfcc69f74775dc84a36f587fb 0.9.9.1
+0000000000000000000000000000000000000000 0.9.9.1
--- a/QTfrontend/gamecfgwidget.cpp	Wed Jul 27 11:41:43 2011 +0400
+++ b/QTfrontend/gamecfgwidget.cpp	Mon Aug 01 10:08:02 2011 +0400
@@ -49,10 +49,13 @@
 
     QGridLayout *GBoxOptionsLayout = new QGridLayout(GBoxOptions);
 
-    GBoxOptionsLayout->addWidget(new QLabel(QLabel::tr("Gameplay"), GBoxOptions), 0, 0);
+    QLabel *titleLabel = new QLabel(QLabel::tr("Game Options"), GBoxOptions);
+    titleLabel->setMargin(7);    // TODO: make the text larger/richer!!!!
+    GBoxOptionsLayout->addWidget(titleLabel, 0, 0, 1, 0, Qt::AlignHCenter);
+    GBoxOptionsLayout->addWidget(new QLabel(QLabel::tr("Style"), GBoxOptions), 1, 0);
 
     Scripts = new QComboBox(GBoxOptions);
-    GBoxOptionsLayout->addWidget(Scripts, 0, 1);
+    GBoxOptionsLayout->addWidget(Scripts, 1, 1);
 
     Scripts->addItem("Normal");
     Scripts->insertSeparator(1);
@@ -91,7 +94,7 @@
     connect(Scripts, SIGNAL(currentIndexChanged(int)), this, SLOT(scriptChanged(int)));
 
     QWidget *SchemeWidget = new QWidget(GBoxOptions);
-    GBoxOptionsLayout->addWidget(SchemeWidget, 1, 0, 1, 2);
+    GBoxOptionsLayout->addWidget(SchemeWidget, 2, 0, 1, 2);
 
     QGridLayout *SchemeWidgetLayout = new QGridLayout(SchemeWidget);
     SchemeWidgetLayout->setMargin(0);
@@ -100,7 +103,7 @@
     SchemeWidgetLayout->addWidget(GameSchemes, 0, 2);
     connect(GameSchemes, SIGNAL(currentIndexChanged(int)), this, SLOT(schemeChanged(int)));
 
-    SchemeWidgetLayout->addWidget(new QLabel(QLabel::tr("Game scheme"), SchemeWidget), 0, 0);
+    SchemeWidgetLayout->addWidget(new QLabel(QLabel::tr("Scheme"), SchemeWidget), 0, 0);
 
     QPixmap pmEdit(":/res/edit.png");
     
@@ -127,8 +130,6 @@
     SchemeWidgetLayout->addWidget(goToWeaponPage, 1, 3);
     connect(goToWeaponPage, SIGNAL(clicked()), this, SLOT(jumpToWeapons()));
 
-    //GBoxOptionsLayout->addWidget(new QLabel(QLabel::tr("Bind schemes with weapons"), GBoxOptions), 2, 0);
-
     bindEntries = new QCheckBox(SchemeWidget);
     bindEntries->setToolTip(tr("When this option is enabled selecting a game scheme will auto-select a weapon"));
     bindEntries->setChecked(true);
@@ -136,7 +137,6 @@
     bindEntries->setStyleSheet( "QCheckBox::indicator:checked   { image: url(\":/res/lock.png\"); }"
                                 "QCheckBox::indicator:unchecked { image: url(\":/res/unlock.png\");   }" );
     SchemeWidgetLayout->addWidget(bindEntries, 0, 1, 0, 1, Qt::AlignVCenter);
-    //GBoxOptionsLayout->addWidget(bindEntries, 2, 2);
 
     connect(pMapContainer, SIGNAL(seedChanged(const QString &)), this, SLOT(seedChanged(const QString &)));
     connect(pMapContainer, SIGNAL(mapChanged(const QString &)), this, SLOT(mapChanged(const QString &)));
--- a/QTfrontend/hwconsts.h	Wed Jul 27 11:41:43 2011 +0400
+++ b/QTfrontend/hwconsts.h	Mon Aug 01 10:08:02 2011 +0400
@@ -99,13 +99,24 @@
 
 
 // see http://en.wikipedia.org/wiki/List_of_colors
-#define HW_TEAMCOLOR_ARRAY  { 0xff007fff, /* azure */ \
-                              0xffdd0000, /* classic red */ \
-                              0xff3e9321, /* classic green */ \
-                              0xffa23dbb, /* classic purple */ \
-                              0xffffb347, /* pastel orange */ \
-                              0xffcfcfc4, /* pastel gray */ \
-                              0xffbff000, /* lime */ \
-                              0xffffef00, /* yellow */ \
+/*define HW_TEAMCOLOR_ARRAY  {0xff007fff, /. azure          ./ \
+                              0xffdd0000, /. classic red    ./ \
+                              0xff3e9321, /. classic green  ./ \
+                              0xffa23dbb, /. classic purple ./ \
+                              0xffffb347, /. pastel orange  ./ \
+                              0xffcfcfc4, /. pastel gray    ./ \
+                              0xffbff000, /. lime           ./ \
+                              0xffffef00, /. yellow         ./ \
+                              // add new colors here 
+                              0 }*/
+#define HW_TEAMCOLOR_ARRAY  { 0xffd12b42, /* red    */ \
+                              0xff4980c1, /* blue   */ \
+                              0xff6ab530, /* green  */ \
+                              0xffbc64c4, /* purple */ \
+                              0xffe76d14, /* orange */ \
+                              0xff3fb6e6, /* cyan   */ \
+                              0xffe3e90c, /* yellow */ \
+                              0xff61d4ac, /* mint   */ \
+                              0xfff1c3e1, /* pink   */ \
                               /* add new colors here */ \
                               0 }
--- a/QTfrontend/pageoptions.cpp	Wed Jul 27 11:41:43 2011 +0400
+++ b/QTfrontend/pageoptions.cpp	Mon Aug 01 10:08:02 2011 +0400
@@ -328,6 +328,12 @@
             CBStereoMode->addItem(QComboBox::tr("Side-by-side"));
             CBStereoMode->addItem(QComboBox::tr("Top-Bottom"));
             CBStereoMode->addItem(QComboBox::tr("Wiggle"));
+            CBStereoMode->addItem(QComboBox::tr("Red/Cyan grayscale"));
+            CBStereoMode->addItem(QComboBox::tr("Cyan/Red grayscale"));
+            CBStereoMode->addItem(QComboBox::tr("Red/Blue grayscale"));
+            CBStereoMode->addItem(QComboBox::tr("Blue/Red grayscale"));
+            CBStereoMode->addItem(QComboBox::tr("Red/Green grayscale"));
+            CBStereoMode->addItem(QComboBox::tr("Green/Red grayscale"));
             connect(CBStereoMode, SIGNAL(currentIndexChanged(int)), this, SLOT(forceFullscreen(int)));
 
             GBAstereolayout->addWidget(CBStereoMode);
--- a/hedgewars/ArgParsers.inc	Wed Jul 27 11:41:43 2011 +0400
+++ b/hedgewars/ArgParsers.inc	Mon Aug 01 10:08:02 2011 +0400
@@ -50,7 +50,14 @@
     UserNick:= DecodeBase64(ParamStr(14));
     val(ParamStr(15), cReducedQuality);
     val(ParamStr(16), tmp);
-    cStereoMode:= TStereoMode(max(0, min(ord(high(TStereoMode)), tmp)));
+    cGrayScale:= false;
+    if (tmp > 9) and (tmp < 16) then 
+        begin
+        cGrayScale:= true;
+        cStereoMode:= TStereoMode(max(0, min(ord(high(TStereoMode)), tmp-9)))
+        end
+    else if tmp <= 9 then cStereoMode:= TStereoMode(max(0, min(ord(high(TStereoMode)), tmp)))
+    else cStereoMode:= TStereoMode(max(0, min(ord(high(TStereoMode)), tmp-6)));
     cLocaleFName:= ParamStr(17);
 end;
 
--- a/hedgewars/GSHandlers.inc	Wed Jul 27 11:41:43 2011 +0400
+++ b/hedgewars/GSHandlers.inc	Mon Aug 01 10:08:02 2011 +0400
@@ -156,12 +156,8 @@
                             AddCaption(Format(GetEventString(eidDrowned), Gear^.Hedgehog^.Name), cWhiteColor, capgrpMessage);
                             end
                         end
-                    else if Gear^.Kind = gtFlake then
-                        begin
-                        DeleteGear(Gear);
-                        exit
-                        end
-                    else Gear^.doStep := @doStepDrowningGear
+                    else Gear^.doStep := @doStepDrowningGear;
+                    if Gear^.Kind = gtFlake then exit // skip splashes 
                 end;
             if ((not isSubmersible) and (Y < cWaterLine + 64 + Gear^.Radius)) or
                (isSubmersible and (Y < cWaterLine + 2 + Gear^.Radius) and ((CurAmmoGear^.Pos = 0) and (CurAmmoGear^.dY < _0_01))) then
@@ -361,12 +357,12 @@
     else
         Gear^.State := Gear^.State or      gstMoving;
 
-    if (Gear^.nImpactSounds > 0) then
-        if ((Gear^.Damage <> 0) or ((Gear^.State and (gstCollision or gstMoving)) = (gstCollision or
-           gstMoving))) and
-           ((Gear^.dX.QWordValue > _0_1.QWordValue) or (Gear^.dY.QWordValue > _0_1.QWordValue)) then
-            PlaySound(TSound(ord(Gear^.ImpactSound) + LongInt(GetRandom(Gear^.nImpactSounds))), true
-            );
+    if (Gear^.nImpactSounds > 0) and 
+       ((Gear^.Damage <> 0) or 
+          ((Gear^.State and (gstCollision or gstMoving)) = (gstCollision or gstMoving))) and
+       ((Gear^.dX.QWordValue > _0_1.QWordValue) or 
+          (Gear^.dY.QWordValue > _0_1.QWordValue)) then
+        PlaySound(TSound(ord(Gear^.ImpactSound) + LongInt(GetRandom(Gear^.nImpactSounds))), true);
 end;
 
 ////////////////////////////////////////////////////////////////////////////////
@@ -595,6 +591,7 @@
 draw:= false;
 if gun then
     begin
+    Gear^.State:= Gear^.State and not gstInvisible;
     doStepFallingGear(Gear);
     CheckCollision(Gear);
     if ((Gear^.State and gstCollision) <> 0) or ((Gear^.State and gstMoving) = 0) then draw:= true;
@@ -4494,18 +4491,16 @@
     if Gear^.Timer = 0 then
         begin
         dec(Gear^.Health);
-        if (Gear^.Health mod 5) = 0 then
-            begin
-            rx := rndSign(getRandom * _0_1);
-            ry := rndSign(getRandom * _0_1);
-            speed := (_3 / Gear^.Tag);
-    
-            Flake := AddGear(gx, gy, gtFlake, 0, _0, _0, 0);
-            Flake^.dX:= SignAs(AngleSin(HHGear^.Angle) * speed, HHGear^.dX) + rx;
-            Flake^.dY:= AngleCos(HHGear^.Angle) * ( - speed) + ry;
-            Flake^.State := Flake^.State or gsttmpFlag;
+
+        rx := rndSign(getRandom * _0_1);
+        ry := rndSign(getRandom * _0_1);
+        speed := (_3 / Gear^.Tag);
+
+        Flake := AddGear(gx, gy, gtFlake, 0, _0, _0, 0);
+        Flake^.dX:= SignAs(AngleSin(HHGear^.Angle) * speed, HHGear^.dX) + rx;
+        Flake^.dY:= AngleCos(HHGear^.Angle) * ( - speed) + ry;
+        Flake^.State := Flake^.State or gsttmpFlag;
             
-            end;
         Gear^.Timer:= Gear^.Tag
         end;
 
--- a/hedgewars/HHHandlers.inc	Wed Jul 27 11:41:43 2011 +0400
+++ b/hedgewars/HHHandlers.inc	Mon Aug 01 10:08:02 2011 +0400
@@ -77,7 +77,7 @@
             ammoidx:= -1;
             //TryDo(i < 2, 'Engine bug: no ammo in current slot', true)
             end;
-        until ((Ammo^[slot, ammoidx].Count > 0) and (Team^.Clan^.TurnNumber > Ammoz[Ammo^[slot, ammoidx].AmmoType].SkipTurns)) or (i = 1)
+        until (i = 1) or ((Ammo^[slot, ammoidx].Count > 0) and (Team^.Clan^.TurnNumber > Ammoz[Ammo^[slot, ammoidx].AmmoType].SkipTurns))
         end 
     else
         begin
--- a/hedgewars/SDLh.pas	Wed Jul 27 11:41:43 2011 +0400
+++ b/hedgewars/SDLh.pas	Mon Aug 01 10:08:02 2011 +0400
@@ -287,6 +287,7 @@
     PSDL_Window   = Pointer;
     PSDL_Renderer = Pointer;
     PSDL_Texture  = Pointer;
+    PSDL_GLContext= Pointer;
 {$ENDIF}
 
     PSDL_Rect = ^TSDL_Rect;
@@ -765,11 +766,16 @@
 {$IFDEF SDL13}
 function  SDL_CreateWindow(title: PChar; x,y,w,h, flags: LongInt): PSDL_Window; cdecl; external SDLLibName;
 function  SDL_CreateRenderer(window: PSDL_Window; index, flags: LongInt): PSDL_Renderer; cdecl; external SDLLibName;
+function  SDL_DestroyWindow(window: PSDL_Window): LongInt; cdecl; external SDLLibName;
 function  SDL_DestroyRenderer(renderer: PSDL_Renderer): LongInt; cdecl; external SDLLibName;
-function  SDL_DestroyWindow(window: PSDL_Window): LongInt; cdecl; external SDLLibName;
+
+function  SDL_GL_CreateContext(window: PSDL_Window): PSDL_GLContext; cdecl; external SDLLibName;
+procedure SDL_GL_DeleteContext(context: PSDL_GLContext); cdecl; external SDLLibName;
+function  SDL_GL_SwapWindow(window: PSDL_Window): LongInt; cdecl; external SDLLibName;
 
 procedure SDL_VideoQuit; cdecl; external SDLLibName;
 function  SDL_GetNumVideoDisplays: LongInt; cdecl; external SDLLibName;
+procedure SDL_ShowWindow(window: PSDL_Window); cdecl; external SDLLibName;
 
 function  SDL_SetRenderDrawColor(renderer: PSDL_Renderer; r,g,b,a: byte): LongInt; cdecl; external SDLLibName;
 function  SDL_GetRenderer(window: PSDL_Window): PSDL_Renderer; cdecl; external SDLLibName;
--- a/hedgewars/uConsts.pas	Wed Jul 27 11:41:43 2011 +0400
+++ b/hedgewars/uConsts.pas	Mon Aug 01 10:08:02 2011 +0400
@@ -120,6 +120,16 @@
     cifAllInited = cifRandomize or cifTheme or cifMap;
 
     cTransparentColor: Longword = $00000000;
+    cGrayScale: Boolean = false;
+
+    RGB_LUMINANCE_RED    = 0.212671;
+    RGB_LUMINANCE_GREEN  = 0.715160;
+    RGB_LUMINANCE_BLUE   = 0.072169;
+(*
+    RGB_LUMINANCE_RED    = 0.3333333333;
+    RGB_LUMINANCE_GREEN  = 0.3333333333;
+    RGB_LUMINANCE_BLUE   = 0.3333333333;
+*)
 
     cMaxTeams        = 8;
     cMaxHHIndex      = 7;
--- a/hedgewars/uGears.pas	Wed Jul 27 11:41:43 2011 +0400
+++ b/hedgewars/uGears.pas	Mon Aug 01 10:08:02 2011 +0400
@@ -914,7 +914,7 @@
             CurrentHedgehog^.Gear^.State:= CurrentHedgehog^.Gear^.State and not gstAttacked;
         if delay2 = 0 then
             begin
-            SweepDirty;
+            if (CurrentHedgehog^.Gear <> nil) and (CurrentHedgehog^.Gear^.State and gstAttacked = 0) then SweepDirty;
             CheckNoDamage;
             AliveCount:= 0; // shorter version of check for win to allow typical step activity to proceed
             for i:= 0 to Pred(ClansCount) do
--- a/hedgewars/uGearsRender.pas	Wed Jul 27 11:41:43 2011 +0400
+++ b/hedgewars/uGearsRender.pas	Mon Aug 01 10:08:02 2011 +0400
@@ -1050,15 +1050,15 @@
                     end;
       gtNapalmBomb: DrawRotated(sprNapalmBomb, x, y, 0, DxDy2Angle(Gear^.dY, Gear^.dX));
            gtFlake: if (Gear^.State and gstTmpFlag) <> 0 then
-                        //DrawRotatedTextureF(SpritesData[sprSnowBall].Texture, 1, 0, 0, x, y, 0, 1, 8, 8, Gear^.DirAngle)
                         begin
                         Tint((cExplosionBorderColor shr RShift) and $FF, 
                              (cExplosionBorderColor shr GShift) and $FF, 
                              (cExplosionBorderColor shr BShift) and $FF, 
-                             (cExplosionBorderColor shr AShift) and $FF);
-                        //DrawRotated(sprSnow, x, y, 0, Gear^.DirAngle);
+                             $FF);
                         // Needs a nicer white texture to tint
-                        DrawTexture(x, y, SpritesData[sprVampiric].Texture, 0.1);
+                        DrawRotatedTextureF(SpritesData[sprSnowDust].Texture, 1, 0, 0, x, y, 0, 1, 8, 8, Gear^.DirAngle);
+                        //DrawRotated(sprSnowDust, x, y, 0, Gear^.DirAngle);
+                        //DrawTexture(x, y, SpritesData[sprVampiric].Texture, 0.1);
                         Tint($FF, $FF, $FF, $FF);
                         end
                     else if not isInLag then
--- a/hedgewars/uLand.pas	Wed Jul 27 11:41:43 2011 +0400
+++ b/hedgewars/uLand.pas	Mon Aug 01 10:08:02 2011 +0400
@@ -1096,6 +1096,7 @@
                     end;
                 Land[y,x]:= lfObject
             end;
+
     AddProgress();
 end;
 
@@ -1314,6 +1315,32 @@
 
 FreeLandObjects;
 
+if cGrayScale then
+    begin
+    if (cReducedQuality and rqBlurryLand) = 0 then
+        for x:= leftX to rightX do
+            for y:= topY to LAND_HEIGHT-1 do
+                begin
+                w:= LandPixels[y,x];
+                w:= round(((w shr RShift and $FF) * RGB_LUMINANCE_RED +
+                      (w shr BShift and $FF) * RGB_LUMINANCE_GREEN +
+                      (w shr GShift and $FF) * RGB_LUMINANCE_BLUE));
+                if w > 255 then w:= 255;
+                w:= (w and $FF shl RShift) or (w and $FF shl BShift) or (w and $FF shl GShift) or (LandPixels[y,x] and AMask);
+                LandPixels[y,x]:= w or (LandPixels[y, x] and AMask)
+                end
+    else
+        for x:= leftX div 2 to rightX div 2 do
+            for y:= topY div 2 to LAND_HEIGHT-1 div 2 do
+                begin
+                w:= LandPixels[y div 2,x div 2];
+                w:= ((w shr RShift and $FF) +  (w shr BShift and $FF) + (w shr GShift and $FF)) div 3;
+                if w > 255 then w:= 255;
+               w:= (w and $FF shl RShift) or (w and $FF shl BShift) or (w and $FF shl GShift) or (LandPixels[y div 2,x div 2] and AMask);
+                LandPixels[y,x]:= w or (LandPixels[y div 2, x div 2] and AMask)
+                end
+    end;
+
 UpdateLandTexture(0, LAND_WIDTH, 0, LAND_HEIGHT);
 end;
 
--- a/hedgewars/uLandGraphics.pas	Wed Jul 27 11:41:43 2011 +0400
+++ b/hedgewars/uLandGraphics.pas	Mon Aug 01 10:08:02 2011 +0400
@@ -210,81 +210,93 @@
 end;
 
 function FillLandCircleLinesBG(x, y, dx, dy: LongInt): Longword;
-var i, t: LongInt;
+var i, t, by, bx: LongInt;
     cnt: Longword;
 begin
 cnt:= 0;
 t:= y + dy;
 if (t and LAND_HEIGHT_MASK) = 0 then
    for i:= Max(x - dx, 0) to Min(x + dx, LAND_WIDTH - 1) do
-       if ((Land[t, i] and lfBasic) <> 0) and not disableLandBack then
+       begin
+       if (cReducedQuality and rqBlurryLand) = 0 then
+           begin
+           by:= t; bx:= i;
+           end
+       else
+           begin
+           by:= t div 2; bx:= i div 2;
+           end;
+       if ((Land[t, i] and lfBasic) <> 0) and ((LandPixels[by,bx] and AMask) shr AShift = 255) and not disableLandBack then
            begin
            inc(cnt);
-           if (cReducedQuality and rqBlurryLand) = 0 then
-               LandPixels[t, i]:= LandBackPixel(i, t)
-           else
-               LandPixels[t div 2, i div 2]:= LandBackPixel(i, t)
+           LandPixels[by, bx]:= LandBackPixel(i, t)
            end
        else
-           if ((Land[t, i] and lfObject) <> 0) or (disableLandBack and ((Land[t, i] and lfIndestructible) = 0)) then
-               if (cReducedQuality and rqBlurryLand) = 0 then
-                   LandPixels[t, i]:= 0
-               else
-                   LandPixels[t div 2, i div 2]:= 0;
+           if ((Land[t, i] and lfObject) <> 0) or (disableLandBack and ((Land[t, i] and lfIndestructible) = 0)) or ((LandPixels[by,bx] and AMask) shr AShift < 255) then
+              LandPixels[by, bx]:= 0
+       end;
 
 t:= y - dy;
 if (t and LAND_HEIGHT_MASK) = 0 then
    for i:= Max(x - dx, 0) to Min(x + dx, LAND_WIDTH - 1) do
-       if ((Land[t, i] and lfBasic) <> 0) and not disableLandBack then
+       begin
+       if (cReducedQuality and rqBlurryLand) = 0 then
+           begin
+           by:= t; bx:= i;
+           end
+       else
+           begin
+           by:= t div 2; bx:= i div 2;
+           end;
+       if ((Land[t, i] and lfBasic) <> 0) and ((LandPixels[by,bx] and AMask) shr AShift = 255) and not disableLandBack then
            begin
            inc(cnt);
-           if (cReducedQuality and rqBlurryLand) = 0 then
-               LandPixels[t, i]:= LandBackPixel(i, t)
-           else
-               LandPixels[t div 2, i div 2]:= LandBackPixel(i, t)
+           LandPixels[by, bx]:= LandBackPixel(i, t)
            end
-       else
-           if ((Land[t, i] and lfObject) <> 0) or (disableLandBack and ((Land[t, i] and lfIndestructible) = 0)) then
-               if (cReducedQuality and rqBlurryLand) = 0 then
-                   LandPixels[t, i]:= 0
-               else
-                   LandPixels[t div 2, i div 2]:= 0;
+       else if ((Land[t, i] and lfObject) <> 0) or (disableLandBack and ((Land[t, i] and lfIndestructible) = 0)) or ((LandPixels[by,bx] and AMask) shr AShift < 255) then
+              LandPixels[by, bx]:= 0
+       end;
 
 t:= y + dx;
 if (t and LAND_HEIGHT_MASK) = 0 then
    for i:= Max(x - dy, 0) to Min(x + dy, LAND_WIDTH - 1) do
-       if ((Land[t, i] and lfBasic) <> 0) and not disableLandBack then
+       begin
+       if (cReducedQuality and rqBlurryLand) = 0 then
+           begin
+           by:= t; bx:= i;
+           end
+       else
+           begin
+           by:= t div 2; bx:= i div 2;
+           end;
+       if ((Land[t, i] and lfBasic) <> 0) and ((LandPixels[by,bx] and AMask) shr AShift = 255) and not disableLandBack then
            begin
            inc(cnt);
-           if (cReducedQuality and rqBlurryLand) = 0 then
-               LandPixels[t, i]:= LandBackPixel(i, t)
-           else
-               LandPixels[t div 2, i div 2]:= LandBackPixel(i, t)
+           LandPixels[by, bx]:= LandBackPixel(i, t)
            end
-       else
-           if ((Land[t, i] and lfObject) <> 0) or (disableLandBack and ((Land[t, i] and lfIndestructible) = 0)) then
-               if (cReducedQuality and rqBlurryLand) = 0 then
-                   LandPixels[t, i]:= 0
-               else
-                   LandPixels[t div 2, i div 2]:= 0;
-
+       else if ((Land[t, i] and lfObject) <> 0) or (disableLandBack and ((Land[t, i] and lfIndestructible) = 0)) or ((LandPixels[by,bx] and AMask) shr AShift < 255) then
+           LandPixels[by, bx]:= 0
+       end;
 t:= y - dx;
 if (t and LAND_HEIGHT_MASK) = 0 then
    for i:= Max(x - dy, 0) to Min(x + dy, LAND_WIDTH - 1) do
-       if ((Land[t, i] and lfBasic) <> 0) and not disableLandBack then
+       begin
+       if (cReducedQuality and rqBlurryLand) = 0 then
+           begin
+           by:= t; bx:= i;
+           end
+       else
+           begin
+           by:= t div 2; bx:= i div 2;
+           end;
+       if ((Land[t, i] and lfBasic) <> 0) and ((LandPixels[by,bx] and AMask) shr AShift = 255) and not disableLandBack then
            begin
            inc(cnt);
-           if (cReducedQuality and rqBlurryLand) = 0 then
-               LandPixels[t, i]:= LandBackPixel(i, t)
-           else
-               LandPixels[t div 2, i div 2]:= LandBackPixel(i, t)
+           LandPixels[by, bx]:= LandBackPixel(i, t)
            end
-       else
-           if ((Land[t, i] and lfObject) <> 0) or (disableLandBack and ((Land[t, i] and lfIndestructible) = 0)) then
-              if (cReducedQuality and rqBlurryLand) = 0 then
-                  LandPixels[t, i]:= 0
-              else
-                  LandPixels[t div 2, i div 2]:= 0;
+       else if ((Land[t, i] and lfObject) <> 0) or (disableLandBack and ((Land[t, i] and lfIndestructible) = 0)) or ((LandPixels[by,bx] and AMask) shr AShift < 255) then
+           LandPixels[by, bx]:= 0
+       end;
 FillLandCircleLinesBG:= cnt;
 end;
 
@@ -430,23 +442,26 @@
 end;
 
 procedure DrawHLinesExplosions(ar: PRangeArray; Radius: LongInt; y, dY: LongInt; Count: Byte);
-var tx, ty, i: LongInt;
+var tx, ty, by, bx,  i: LongInt;
 begin
 for i:= 0 to Pred(Count) do
     begin
     for ty:= Max(y - Radius, 0) to Min(y + Radius, LAND_HEIGHT) do
         for tx:= Max(0, ar^[i].Left - Radius) to Min(LAND_WIDTH, ar^[i].Right + Radius) do
-            if ((Land[ty, tx] and lfBasic) <> 0) and not disableLandBack then
-                if (cReducedQuality and rqBlurryLand) = 0 then
-                    LandPixels[ty, tx]:= LandBackPixel(tx, ty)
-                else
-                    LandPixels[ty div 2, tx div 2]:= LandBackPixel(tx, ty)
+            begin
+            if (cReducedQuality and rqBlurryLand) = 0 then
+                begin
+                by:= ty; bx:= tx;
+                end
             else
-                if ((Land[ty, tx] and lfObject) <> 0) or (disableLandBack and ((Land[ty, tx] and lfIndestructible) = 0)) then
-                    if (cReducedQuality and rqBlurryLand) = 0 then
-                        LandPixels[ty, tx]:= 0
-                    else
-                        LandPixels[ty div 2, tx div 2]:= 0;
+                begin
+                by:= ty div 2; bx:= tx div 2;
+                end;
+            if ((Land[ty, tx] and lfBasic) <> 0) and ((LandPixels[by,bx] and AMask) shr AShift = 255) and not disableLandBack then 
+                LandPixels[by, bx]:= LandBackPixel(tx, ty)
+            else if ((Land[ty, tx] and lfObject) <> 0) or (disableLandBack and ((Land[ty, tx] and lfIndestructible) = 0)) or ((LandPixels[by,bx] and AMask) shr AShift < 255) then 
+                LandPixels[by, bx]:= 0
+            end;
     inc(y, dY)
     end;
 
@@ -479,7 +494,7 @@
 //
 procedure DrawTunnel(X, Y, dX, dY: hwFloat; ticks, HalfWidth: LongInt);
 var nx, ny, dX8, dY8: hwFloat;
-    i, t, tx, ty, stX, stY, ddy, ddx: Longint;
+    i, t, tx, ty, by, bx, stX, stY, ddy, ddx: Longint;
     despeckle : Boolean;
 begin  // (-dY, dX) is (dX, dY) rotated by PI/2
 stY:= hwRound(Y);
@@ -550,17 +565,18 @@
         ty:= hwRound(Y);
         if ((ty and LAND_HEIGHT_MASK) = 0) and ((tx and LAND_WIDTH_MASK) = 0) and ((Land[ty, tx] and lfIndestructible) = 0) then
             begin
-            if ((Land[ty, tx] and lfBasic) <> 0) and not disableLandBack then
-                if (cReducedQuality and rqBlurryLand) = 0 then
-                    LandPixels[ty, tx]:= LandBackPixel(tx, ty)
-                else
-                    LandPixels[ty div 2, tx div 2]:= LandBackPixel(tx, ty)
+            if (cReducedQuality and rqBlurryLand) = 0 then
+                begin
+                by:= ty; bx:= tx;
+                end
             else
-              if ((Land[ty, tx] and lfObject) <> 0) or (disableLandBack and ((Land[ty, tx] and lfIndestructible) = 0)) then
-                if (cReducedQuality and rqBlurryLand) = 0 then
-                LandPixels[ty, tx]:= 0
-                else
-                LandPixels[ty div 2, tx div 2]:= 0;
+                begin
+                by:= ty div 2; bx:= tx div 2;
+                end;
+            if ((Land[ty, tx] and lfBasic) <> 0) and ((LandPixels[by,bx] and AMask) shr AShift = 255) and not disableLandBack then
+                    LandPixels[by, bx]:= LandBackPixel(tx, ty)
+            else if ((Land[ty, tx] and lfObject) <> 0) or (disableLandBack and ((Land[ty, tx] and lfIndestructible) = 0)) or ((LandPixels[by,bx] and AMask) shr AShift < 255) then
+                LandPixels[by, bx]:= 0;
 
             Land[ty, tx]:= 0;
             end
@@ -748,7 +764,7 @@
             LandPixels[yy, xx]:= 0;
 
         Land[Y, X]:= 0;
-        if not pixelsweep then exit(1)  // cannot exit true on pixel sweep, or risk desyncs due to inconsistent resweeps
+        if not pixelsweep then exit(1)
         else exit(2)
         end;
     end;
--- a/hedgewars/uLandObjects.pas	Wed Jul 27 11:41:43 2011 +0400
+++ b/hedgewars/uLandObjects.pas	Mon Aug 01 10:08:02 2011 +0400
@@ -372,7 +372,7 @@
 var s, key: shortstring;
     f: textfile;
     i: LongInt;
-    ii: Longword;
+    ii, t: Longword;
     c1, c2: TSDL_Color;
 
     procedure CheckRect(Width, Height, x, y, w, h: LongWord);
@@ -415,6 +415,14 @@
         c1.g:= StrToInt(Trim(Copy(s, 1, Pred(i))));
         Delete(s, 1, i);
         c1.b:= StrToInt(Trim(s));
+        if cGrayScale then
+            begin
+            t:= round(c1.r * RGB_LUMINANCE_RED + c1.g * RGB_LUMINANCE_GREEN + c1.b * RGB_LUMINANCE_BLUE);
+            if t > 255 then t:= 255;
+            c1.r:= t;
+            c1.g:= t;
+            c1.b:= t
+            end;
         glClearColor(c1.r / 255, c1.g / 255, c1.b / 255, 0.99);
         SDSkyColor.r:= byte(c1.r * SDTint div 255);
         SDSkyColor.g:= byte(c1.g * SDTint div 255);
@@ -441,6 +449,14 @@
         Delete(s, 1, i);
         WaterColorArray[0].b:= StrToInt(Trim(s));
         WaterColorArray[0].a := 255;
+        if cGrayScale then
+            begin
+            t:= round(WaterColorArray[0].r * RGB_LUMINANCE_RED + WaterColorArray[0].g * RGB_LUMINANCE_GREEN + WaterColorArray[0].b * RGB_LUMINANCE_BLUE);
+            if t > 255 then t:= 255;
+            WaterColorArray[0].r:= t;
+            WaterColorArray[0].g:= t;
+            WaterColorArray[0].b:= t
+            end;
         WaterColorArray[1]:= WaterColorArray[0];
         end
     else if key = 'water-bottom' then
@@ -453,6 +469,14 @@
         Delete(s, 1, i);
         WaterColorArray[2].b:= StrToInt(Trim(s));
         WaterColorArray[2].a := 255;
+        if cGrayScale then
+            begin
+            t:= round(WaterColorArray[2].r * RGB_LUMINANCE_RED + WaterColorArray[2].g * RGB_LUMINANCE_GREEN + WaterColorArray[2].b * RGB_LUMINANCE_BLUE);
+            if t > 255 then t:= 255;
+            WaterColorArray[2].r:= t;
+            WaterColorArray[2].g:= t;
+            WaterColorArray[2].b:= t
+            end;
         WaterColorArray[3]:= WaterColorArray[2];
         end
     else if key = 'water-opacity' then
@@ -566,6 +590,14 @@
         Delete(s, 1, i);
         SDWaterColorArray[0].b:= StrToInt(Trim(s));
         SDWaterColorArray[0].a := 255;
+        if cGrayScale then
+            begin
+            t:= round(SDWaterColorArray[0].r * RGB_LUMINANCE_RED + SDWaterColorArray[0].g * RGB_LUMINANCE_GREEN + SDWaterColorArray[0].b * RGB_LUMINANCE_BLUE);
+            if t > 255 then t:= 255;
+            SDWaterColorArray[0].r:= t;
+            SDWaterColorArray[0].g:= t;
+            SDWaterColorArray[0].b:= t
+            end;
         SDWaterColorArray[1]:= SDWaterColorArray[0];
         end
     else if key = 'sd-water-bottom' then
@@ -578,6 +610,14 @@
         Delete(s, 1, i);
         SDWaterColorArray[2].b:= StrToInt(Trim(s));
         SDWaterColorArray[2].a := 255;
+        if cGrayScale then
+            begin
+            t:= round(SDWaterColorArray[2].r * RGB_LUMINANCE_RED + SDWaterColorArray[2].g * RGB_LUMINANCE_GREEN + SDWaterColorArray[2].b * RGB_LUMINANCE_BLUE);
+            if t > 255 then t:= 255;
+            SDWaterColorArray[2].r:= t;
+            SDWaterColorArray[2].g:= t;
+            SDWaterColorArray[2].b:= t
+            end;
         SDWaterColorArray[3]:= SDWaterColorArray[2];
         end
     else if key = 'sd-water-opacity' then cSDWaterOpacity:= StrToInt(Trim(s))
@@ -612,6 +652,14 @@
             c1.g:= StrToInt(Trim(Copy(s, 1, Pred(i))));
             Delete(s, 1, i);
             c1.b:= StrToInt(Trim(s));
+            if cGrayScale then
+                begin
+                t:= round(c1.r * RGB_LUMINANCE_RED + c1.g * RGB_LUMINANCE_GREEN + c1.b * RGB_LUMINANCE_BLUE);
+                if t > 255 then t:= 255;
+                c1.r:= t;
+                c1.g:= t;
+                c1.b:= t
+                end;
             glClearColor(c1.r / 255, c1.g / 255, c1.b / 255, 0.99);
             SDSkyColor.r:= byte(c1.r * SDTint div 255);
             SDSkyColor.g:= byte(c1.g * SDTint div 255);
--- a/hedgewars/uRender.pas	Wed Jul 27 11:41:43 2011 +0400
+++ b/hedgewars/uRender.pas	Mon Aug 01 10:08:02 2011 +0400
@@ -22,7 +22,7 @@
 
 interface
 
-uses SDLh, uTypes, GLunit;
+uses SDLh, uTypes, GLunit, uConsts;
 
 procedure DrawSpriteFromRect(Sprite: TSprite; r: TSDL_Rect; X, Y, Height, Position: LongInt);
 procedure DrawFromRect(X, Y, W, H: LongInt; r: PSDL_Rect; SourceTexture: PTexture);
@@ -453,11 +453,20 @@
 
 
 procedure Tint(r, g, b, a: Byte); inline;
-var nc: Longword;
+var nc, tw: Longword;
 begin
 nc:= (a shl 24) or (b shl 16) or (g shl 8) or r;
 if nc = lastTint then
     exit;
+if cGrayScale then
+    begin
+    tw:= round(r * RGB_LUMINANCE_RED + g * RGB_LUMINANCE_GREEN + b * RGB_LUMINANCE_BLUE);
+    if tw > 255 then tw:= 255;
+    r:= tw;
+    g:= tw;
+    b:= tw
+    end;
+
 glColor4ub(r, g, b, a);
 lastTint:= nc;
 end;
--- a/hedgewars/uTextures.pas	Wed Jul 27 11:41:43 2011 +0400
+++ b/hedgewars/uTextures.pas	Mon Aug 01 10:08:02 2011 +0400
@@ -131,6 +131,24 @@
 if SDL_MustLock(surf) then
     SDLTry(SDL_LockSurface(surf) >= 0, true);
 
+fromP4:= Surf^.pixels;
+
+if cGrayScale then
+    for y:= 0 to Pred(Surf^.h) do
+        begin
+        for x:= 0 to Pred(Surf^.w) do 
+            begin
+            tw:= fromP4^[x];
+            tw:= round((tw shr RShift and $FF) * RGB_LUMINANCE_RED +  
+                  (tw shr GShift and $FF) * RGB_LUMINANCE_GREEN + 
+                  (tw shr BShift and $FF) * RGB_LUMINANCE_BLUE);
+            if tw > 255 then tw:= 255;
+            tw:= (tw and $FF shl RShift) or (tw and $FF shl BShift) or (tw and $FF shl GShift) or (fromP4^[x] and AMask);
+            fromP4^[x]:= tw;
+            end;
+        fromP4:= @(fromP4^[Surf^.pitch div 4])
+        end;
+        
 if (not SupportNPOTT) and (not (isPowerOf2(Surf^.w) and isPowerOf2(Surf^.h))) then
     begin
     tw:= toPowerOf2(Surf^.w);
--- a/hedgewars/uWorld.pas	Wed Jul 27 11:41:43 2011 +0400
+++ b/hedgewars/uWorld.pas	Mon Aug 01 10:08:02 2011 +0400
@@ -971,7 +971,7 @@
       end;
 if smallScreenOffset <> 0 then
     begin
-    SetScale(zoom);
+    SetScale(cDefaultZoomLevel);
     if TeamsCount * 20 > cScreenHeight div 5 then Tint($FF,$FF,$FF,$FF);
     end;
 
--- a/project_files/HedgewarsMobile/Classes/Appirater.h	Wed Jul 27 11:41:43 2011 +0400
+++ b/project_files/HedgewarsMobile/Classes/Appirater.h	Mon Aug 01 10:08:02 2011 +0400
@@ -45,7 +45,7 @@
 /*
  Place your Apple generated software id here.
  */
-#define APPIRATER_APP_ID                 391234866
+#define APPIRATER_APP_ID                391234866
 
 /*
  Your app's name.
@@ -82,13 +82,13 @@
  Users will need to have the same version of your app installed for this many
  days before they will be prompted to rate it.
  */
-#define DAYS_UNTIL_PROMPT               5       // double
+#define DAYS_UNTIL_PROMPT               3       // double
 
 /*
  Users will need to launch the same version of the app this many times before
  they will be prompted to rate it.
  */
-#define LAUNCHES_UNTIL_PROMPT           10      // integer
+#define LAUNCHES_UNTIL_PROMPT           5      // integer
 
 /*
  'YES' will show the Appirater alert everytime. Useful for testing how your message
--- a/project_files/HedgewarsMobile/Classes/Appirater.m	Wed Jul 27 11:41:43 2011 +0400
+++ b/project_files/HedgewarsMobile/Classes/Appirater.m	Mon Aug 01 10:08:02 2011 +0400
@@ -37,6 +37,7 @@
 #import "Appirater.h"
 #import <SystemConfiguration/SCNetworkReachability.h>
 #import <netinet/in.h>
+#import "CommodityFunctions.h"
 
 NSString *const kAppiraterLaunchDate            = @"kAppiraterLaunchDate";
 NSString *const kAppiraterLaunchCount           = @"kAppiraterLaunchCount";
@@ -46,47 +47,6 @@
 
 NSString *templateReviewURL = @"itms-apps://itunes.apple.com/WebObjects/MZStore.woa/wa/viewContentsUserReviews?id=APP_ID&onlyLatestVersion=true&pageNumber=0&sortOrdering=1&type=Purple+Software";
 
-@interface Appirater (hidden)
-
--(BOOL) connectedToNetwork;
-
-@end
-
-@implementation Appirater (hidden)
-
--(BOOL) connectedToNetwork {
-    // Create zero addy
-    struct sockaddr_in zeroAddress;
-    bzero(&zeroAddress, sizeof(zeroAddress));
-    zeroAddress.sin_len = sizeof(zeroAddress);
-    zeroAddress.sin_family = AF_INET;
-    
-    // Recover reachability flags
-    SCNetworkReachabilityRef defaultRouteReachability = SCNetworkReachabilityCreateWithAddress(NULL, (struct sockaddr *)&zeroAddress);
-    SCNetworkReachabilityFlags flags;
-    
-    BOOL didRetrieveFlags = SCNetworkReachabilityGetFlags(defaultRouteReachability, &flags);
-    CFRelease(defaultRouteReachability);
-    
-    if (!didRetrieveFlags) {
-        NSLog(@"Error. Could not recover network reachability flags");
-        return NO;
-    }
-    
-    BOOL isReachable = flags & kSCNetworkFlagsReachable;
-    BOOL needsConnection = flags & kSCNetworkFlagsConnectionRequired;
-    BOOL nonWiFi = flags & kSCNetworkReachabilityFlagsTransientConnection;
-    
-    NSURL *testURL = [NSURL URLWithString:@"http://www.apple.com/"];
-    NSURLRequest *testRequest = [NSURLRequest requestWithURL:testURL  cachePolicy:NSURLRequestReloadIgnoringLocalCacheData timeoutInterval:20.0];
-    NSURLConnection *testConnection = [[NSURLConnection alloc] initWithRequest:testRequest delegate:self];
-    
-    return ((isReachable && !needsConnection) || nonWiFi) ? (testConnection ? YES : NO) : NO;
-}
-
-@end
-
-
 @implementation Appirater
 
 +(void) appLaunched {
@@ -146,7 +106,7 @@
              launchCount > LAUNCHES_UNTIL_PROMPT &&
              !declinedToRate &&
              !ratedApp) {
-            if ([self connectedToNetwork]) {	// check if they can reach the app store
+            if (isNetworkReachable()) {	// check if they can reach the app store
                 willShowPrompt = YES;
                 [self performSelectorOnMainThread:@selector(showPrompt) withObject:nil waitUntilDone:NO];
             }
--- a/project_files/HedgewarsMobile/Classes/CommodityFunctions.h	Wed Jul 27 11:41:43 2011 +0400
+++ b/project_files/HedgewarsMobile/Classes/CommodityFunctions.h	Mon Aug 01 10:08:02 2011 +0400
@@ -46,6 +46,7 @@
 #define MAPS_DIRECTORY()        [[[NSBundle mainBundle] resourcePath] stringByAppendingString:@"/Data/Maps/"]
 #define MISSIONS_DIRECTORY()    [[[NSBundle mainBundle] resourcePath] stringByAppendingString:@"/Data/Missions/Maps/"]
 #define LOCALE_DIRECTORY()      [[[NSBundle mainBundle] resourcePath] stringByAppendingString:@"/Data/Locale/"]
+#define SCRIPTS_DIRECTORY()     [[[NSBundle mainBundle] resourcePath] stringByAppendingString:@"/Data/Scripts/plist/"]
 
 #define MSG_MEMCLEAN()          DLog(@"has cleaned up some memory");
 #define MSG_DIDUNLOAD()         DLog(@"unloaded");
@@ -75,6 +76,7 @@
 UILabel *createLabelWithParams (NSString *title, CGRect frame, CGFloat borderWidth, UIColor *borderColor, UIColor *backgroundColor);
 
 CGSize PSPNGSizeFromMetaData (NSString *aFileName);
+BOOL isNetworkReachable (void);
 
 @interface NSString (extra)
 
--- a/project_files/HedgewarsMobile/Classes/CommodityFunctions.m	Wed Jul 27 11:41:43 2011 +0400
+++ b/project_files/HedgewarsMobile/Classes/CommodityFunctions.m	Mon Aug 01 10:08:02 2011 +0400
@@ -27,6 +27,8 @@
 #import <QuartzCore/QuartzCore.h>
 #import <AudioToolbox/AudioToolbox.h>
 #import <CommonCrypto/CommonDigest.h>
+#import <SystemConfiguration/SCNetworkReachability.h>
+#import <netinet/in.h>
 #import "PascalImports.h"
 #import "hwconsts.h"
 
@@ -39,6 +41,7 @@
 
 // by http://landonf.bikemonkey.org/code/iphone/Determining_Available_Memory.20081203.html
 void print_free_memory () {
+#ifdef DEBUG
     mach_port_t host_port;
     mach_msg_type_number_t host_size;
     vm_size_t pagesize;
@@ -57,6 +60,7 @@
     natural_t mem_free = vm_stat.free_count * pagesize;
     natural_t mem_total = mem_used + mem_free;
     DLog(@"used: %u free: %u total: %u", mem_used, mem_free, mem_total);
+#endif
 }
 
 BOOL inline isApplePhone () {
@@ -128,6 +132,40 @@
     return theLabel;
 }
 
+BOOL isNetworkReachable (void) {
+    // Create zero addy
+    struct sockaddr_in zeroAddress;
+    bzero(&zeroAddress, sizeof(zeroAddress));
+    zeroAddress.sin_len = sizeof(zeroAddress);
+    zeroAddress.sin_family = AF_INET;
+
+    // Recover reachability flags
+    SCNetworkReachabilityRef defaultRouteReachability = SCNetworkReachabilityCreateWithAddress(NULL, (struct sockaddr *)&zeroAddress);
+    SCNetworkReachabilityFlags flags;
+
+    BOOL didRetrieveFlags = SCNetworkReachabilityGetFlags(defaultRouteReachability, &flags);
+    CFRelease(defaultRouteReachability);
+
+    if (!didRetrieveFlags) {
+        NSLog(@"Error. Could not recover network reachability flags");
+        return NO;
+    }
+
+    BOOL isReachable = flags & kSCNetworkFlagsReachable;
+    BOOL needsConnection = flags & kSCNetworkFlagsConnectionRequired;
+    BOOL nonWiFi = flags & kSCNetworkReachabilityFlagsTransientConnection;
+
+    NSURL *testURL = [NSURL URLWithString:@"http://www.apple.com/"];
+    NSURLRequest *testRequest = [NSURLRequest requestWithURL:testURL
+                                                 cachePolicy:NSURLRequestReloadIgnoringLocalCacheData
+                                             timeoutInterval:20.0];
+    NSURLConnection *testConnection = [[NSURLConnection alloc] initWithRequest:testRequest delegate:nil];
+    BOOL testResult = testConnection ? YES : NO;
+    [testConnection release];
+
+    return ((isReachable && !needsConnection) || nonWiFi) ? testResult : NO;
+}
+
 // this routine checks for the PNG size without loading it in memory
 // https://github.com/steipete/PSFramework/blob/master/PSFramework%20Version%200.3/PhotoshopFramework/PSMetaDataFunctions.m
 CGSize PSPNGSizeFromMetaData (NSString *aFileName) {
--- a/project_files/HedgewarsMobile/Classes/CreationChamber.m	Wed Jul 27 11:41:43 2011 +0400
+++ b/project_files/HedgewarsMobile/Classes/CreationChamber.m	Mon Aug 01 10:08:02 2011 +0400
@@ -28,8 +28,11 @@
     [settings setObject:[NSNumber numberWithBool:YES] forKey:@"music"];
     [settings setObject:[NSNumber numberWithBool:YES] forKey:@"sound"];
     [settings setObject:[NSNumber numberWithBool:NO] forKey:@"classic_menu"];
-    [settings setObject:[NSNumber numberWithBool:YES] forKey:@"enhanced"];
     [settings setObject:[NSNumber numberWithBool:YES] forKey:@"multitasking"];
+    [settings setObject:[NSNumber numberWithBool:YES] forKey:@"sync_ws"];
+
+    // limit graphic usage on older devices
+    [settings setObject:[NSNumber numberWithBool:IS_VERY_POWERFUL(getModelType())] forKey:@"enhanced"];
 
     // don't overwrite these two strings when present
     if ([settings objectForKey:@"username"] == nil)
--- a/project_files/HedgewarsMobile/Classes/GameConfigViewController.m	Wed Jul 27 11:41:43 2011 +0400
+++ b/project_files/HedgewarsMobile/Classes/GameConfigViewController.m	Mon Aug 01 10:08:02 2011 +0400
@@ -212,6 +212,10 @@
     if ([self isEverythingSet] == NO)
         return;
 
+    NSString *script = self.mapConfigViewController.missionCommand;
+    if ([script isEqualToString:@""])
+        script = self.schemeWeaponConfigViewController.scriptCommand;
+
     // create the configuration file that is going to be sent to engine
     NSDictionary *gameDictionary = [NSDictionary dictionaryWithObjectsAndKeys:
                                     self.mapConfigViewController.seedCommand,@"seed_command",
@@ -220,10 +224,10 @@
                                     self.mapConfigViewController.mazeSizeCommand,@"mazesize_command",
                                     self.mapConfigViewController.themeCommand,@"theme_command",
                                     self.mapConfigViewController.staticMapCommand,@"staticmap_command",
-                                    self.mapConfigViewController.missionCommand,@"mission_command",
                                     self.teamConfigViewController.listOfSelectedTeams,@"teams_list",
                                     self.schemeWeaponConfigViewController.selectedScheme,@"scheme",
                                     self.schemeWeaponConfigViewController.selectedWeapon,@"weapon",
+                                    script,@"mission_command",
                                     nil];
 
     GameInterfaceBridge *bridge = [[GameInterfaceBridge alloc] initWithController:self];
--- a/project_files/HedgewarsMobile/Classes/GeneralSettingsViewController.m	Wed Jul 27 11:41:43 2011 +0400
+++ b/project_files/HedgewarsMobile/Classes/GeneralSettingsViewController.m	Mon Aug 01 10:08:02 2011 +0400
@@ -84,6 +84,9 @@
         case 30:    //alternateSwitch
             [settings setObject:[NSNumber numberWithBool:theSwitch.on] forKey:@"alternate"];
             break;
+        case 90:    //synched weapons/scheme
+            [settings setObject:[NSNumber numberWithBool:theSwitch.on] forKey:@"sync_ws"];
+            break;
         case 70:    //enhanced graphics
             [settings setObject:[NSNumber numberWithBool:theSwitch.on] forKey:@"enhanced"];
             break;
@@ -117,16 +120,13 @@
 -(NSInteger) tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger )section {
     switch (section) {
         case 0:     // user and pass
-            return 1;   // set 2 here for the password field
+            return 1;   // set 2 here to show the password field
             break;
         case 1:     // audio
             return 2;
             break;
-        case 2:     // other stuff
-            if (IS_IPAD() == YES)
-                return 4;
-            else
-                return 3;
+        case 2:     // other options
+            return 5;
             break;
         default:
             DLog(@"Nope");
@@ -225,6 +225,7 @@
             }
             
             switchContent = (UISwitch *)cell.accessoryView;
+            cell.detailTextLabel.adjustsFontSizeToFitWidth = YES;
             switch (row) {
                 case 0:
                     cell.textLabel.text = NSLocalizedString(@"Alternate Damage", @"");
@@ -233,22 +234,34 @@
                     switchContent.tag = 30;
                     break;
                 case 1:
-                    cell.textLabel.text = NSLocalizedString(@"Enanched Graphics Mode", @"");
-                    cell.detailTextLabel.text = NSLocalizedString(@"The game will use more memory so it could crash!", @"");
-                    switchContent.on = [[settings objectForKey:@"enhanced"] boolValue];
-                    switchContent.tag = 70;
+                    cell.textLabel.text = NSLocalizedString(@"Sync Schemes and Weapons", @"");
+                    cell.detailTextLabel.text = NSLocalizedString(@"Choosing a Scheme will select its associated Weapon", @"");
+                    switchContent.on = [[settings objectForKey:@"sync_ws"] boolValue];
+                    switchContent.tag = 90;
                     break;
                 case 2:
-                    cell.textLabel.text = NSLocalizedString(@"Multitasking Enabled", @"");
+                    cell.textLabel.text = NSLocalizedString(@"Multitasking", @"");
                     cell.detailTextLabel.text = NSLocalizedString(@"Disable it in case of issues when returing in game", @"");
                     switchContent.on = [[settings objectForKey:@"multitasking"] boolValue];
                     switchContent.tag = 80;
                     break;
                 case 3:
+                    cell.textLabel.text = NSLocalizedString(@"Enanched Graphics", @"");
+                    cell.detailTextLabel.text = NSLocalizedString(@"Beware that the game will consume more memory", @"");
+                    switchContent.on = [[settings objectForKey:@"enhanced"] boolValue];
+                    switchContent.tag = 70;
+                    // prevent the oldest devices to even think about enabling it
+                    if (IS_NOT_POWERFUL(getModelType()))
+                        switchContent.enabled = NO;
+                    break;
+                case 4:
                     cell.textLabel.text = NSLocalizedString(@"Classic Ammo Menu", @"");
                     cell.detailTextLabel.text = NSLocalizedString(@"Select which style of ammo menu you prefer",@"");
                     switchContent.on = [[settings objectForKey:@"classic_menu"] boolValue];
                     switchContent.tag = 60;
+                    // remove this when classic ammomenu works on iphone as well
+                    if (IS_IPAD() == NO)
+                        switchContent.enabled = NO;
                     break;
                 default:
                     DLog(@"Nope");
--- a/project_files/HedgewarsMobile/Classes/HedgewarsAppDelegate.m	Wed Jul 27 11:41:43 2011 +0400
+++ b/project_files/HedgewarsMobile/Classes/HedgewarsAppDelegate.m	Mon Aug 01 10:08:02 2011 +0400
@@ -25,7 +25,6 @@
 #import "CommodityFunctions.h"
 #import "MainMenuViewController.h"
 #import "AVFoundation/AVAudioPlayer.h"
-#import "Appirater.h"
 #include <unistd.h>
 
 
@@ -97,7 +96,6 @@
 // override the direct execution of SDL_main to allow us to implement our own frontend
 -(void) postFinishLaunch {
     [[UIApplication sharedApplication] setStatusBarHidden:YES];
-    [Appirater appLaunched];
 
     self.uiwindow = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
 
--- a/project_files/HedgewarsMobile/Classes/InGameMenuViewController.m	Wed Jul 27 11:41:43 2011 +0400
+++ b/project_files/HedgewarsMobile/Classes/InGameMenuViewController.m	Mon Aug 01 10:08:02 2011 +0400
@@ -257,7 +257,8 @@
         image = [[UIImage alloc] initWithCGImage:imageRef];
     CGImageRelease(imageRef);
 
-    UIImageWriteToSavedPhotosAlbum(image, self, @selector(image:didFinishSavingWithError:contextInfo:), (void *)alert); // add callback for finish saving
+    // add callback for cleaning memory and removing alert
+    UIImageWriteToSavedPhotosAlbum(image, self, @selector(image:didFinishSavingWithError:contextInfo:), (void *)alert);
 }
 
 
--- a/project_files/HedgewarsMobile/Classes/MainMenuViewController.m	Wed Jul 27 11:41:43 2011 +0400
+++ b/project_files/HedgewarsMobile/Classes/MainMenuViewController.m	Mon Aug 01 10:08:02 2011 +0400
@@ -27,6 +27,7 @@
 #import "AboutViewController.h"
 #import "SavedGamesViewController.h"
 #import "RestoreViewController.h"
+#import "Appirater.h"
 #import "ServerSetup.h"
 
 @implementation MainMenuViewController
@@ -72,7 +73,7 @@
         [[NSFileManager defaultManager] removeItemAtPath:SCHEMES_DIRECTORY() error:NULL];
     NSString *baseSchemesDir = [[NSString alloc] initWithFormat:@"%@/Settings/Schemes/",resourcesDir];
     [[NSFileManager defaultManager] copyItemAtPath:baseSchemesDir toPath:SCHEMES_DIRECTORY() error:NULL];
-    
+    [baseSchemesDir release];
 
     // WEAPONS - always overwrite
     if ([[NSFileManager defaultManager] fileExistsAtPath:WEAPONS_DIRECTORY()] == NO)
@@ -101,31 +102,40 @@
     NSUserDefaults *userDefaults = [NSUserDefaults standardUserDefaults];
     NSString *trackingVersion = [userDefaults stringForKey:@"HedgeVersion"];
 
+    if ([[userDefaults objectForKey:@"music"] boolValue])
+        [HedgewarsAppDelegate playBackgroundMusic];
+
     if (trackingVersion == nil || [trackingVersion isEqualToString:version] == NO) {
+        // remove any reminder of previous games as saves are going to be wiped out
+        [userDefaults setObject:@"" forKey:@"savedGamePath"];
+        // update the tracking version with the new one
         [userDefaults setObject:version forKey:@"HedgeVersion"];
+
         [userDefaults synchronize];
         [self createNecessaryFiles];
     }
 
-    if ([[userDefaults objectForKey:@"music"] boolValue])
-        [HedgewarsAppDelegate playBackgroundMusic];
-
-    NSString *saveString = [[NSUserDefaults standardUserDefaults] objectForKey:@"savedGamePath"];
+    // prompt for restoring any previous game
+    NSString *saveString = [userDefaults objectForKey:@"savedGamePath"];
     if (saveString != nil && [saveString isEqualToString:@""] == NO) {
         if (self.restoreViewController == nil) {
-            NSString *xibName = [@"RestoreViewController-" stringByAppendingString:(IS_IPAD() ? @"iPad" : @"iPhone")]; 
+            NSString *xibName = [@"RestoreViewController-" stringByAppendingString:(IS_IPAD() ? @"iPad" : @"iPhone")];
             RestoreViewController *restored = [[RestoreViewController alloc] initWithNibName:xibName bundle:nil];
             if ([restored respondsToSelector:@selector(setModalPresentationStyle:)])
                 restored.modalPresentationStyle = UIModalPresentationFormSheet;
             self.restoreViewController = restored;
             [restored release];
         }
-        [self performSelector:@selector(presentModalViewController:animated:) withObject:self.restoreViewController afterDelay:0.35];
+        [self performSelector:@selector(presentModalViewController:animated:) withObject:self.restoreViewController afterDelay:0.3];
+    } else {
+        // let's not prompt for rating when app crashed >_>
+        [Appirater appLaunched];
     }
 
+
     /*
     ServerSetup *setup = [[ServerSetup alloc] init];
-    if ([setup isNetworkReachable]) {
+    if (isNetworkReachable()) {
         DLog(@"network is reachable");
         [NSThread detachNewThreadSelector:@selector(serverProtocol)
                                  toTarget:setup
@@ -147,11 +157,8 @@
     switch (button.tag) {
         case 0:
             if (nil == self.gameConfigViewController) {
-                if (IS_IPAD())
-                    xib = nil;
-                else
-                    xib = @"GameConfigViewController";
-                
+                xib = IS_IPAD() ? nil : @"GameConfigViewController";
+
                 GameConfigViewController *gcvc = [[GameConfigViewController alloc] initWithNibName:xib bundle:nil];
                 gcvc.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;
                 self.gameConfigViewController = gcvc;
@@ -172,7 +179,10 @@
             break;
         case 3:
 #ifdef DEBUG
-            debugStr = [[NSString alloc] initWithContentsOfFile:DEBUG_FILE()];
+            if ([[NSFileManager defaultManager] fileExistsAtPath:DEBUG_FILE()])
+                debugStr = [[NSString alloc] initWithContentsOfFile:DEBUG_FILE()];
+            else
+                debugStr = [[NSString alloc] initWithString:@"Here be log"];
             UITextView *scroll = [[UITextView alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.height, self.view.frame.size.width)];
             scroll.text = debugStr;
             [debugStr release];
@@ -186,6 +196,7 @@
             [self.view addSubview:scroll];
             [scroll release];
 #else
+            debugStr = debugStr; // prevent compiler warning
             if (nil == self.aboutViewController) {
                 AboutViewController *about = [[AboutViewController alloc] initWithNibName:@"AboutViewController" bundle:nil];
                 about.modalTransitionStyle = UIModalTransitionStyleCoverVertical;
--- a/project_files/HedgewarsMobile/Classes/MapConfigViewController.m	Wed Jul 27 11:41:43 2011 +0400
+++ b/project_files/HedgewarsMobile/Classes/MapConfigViewController.m	Mon Aug 01 10:08:02 2011 +0400
@@ -387,6 +387,7 @@
         NSString *checkPath = [[NSString alloc] initWithFormat:@"%@/%@/icon.png",THEMES_DIRECTORY(),themeName];
         if ([[NSFileManager defaultManager] fileExistsAtPath:checkPath])
             [themeArray addObject:themeName];
+        [checkPath release];
     }
 
     // remove images that are too big for certain devices without loading the whole image
--- a/project_files/HedgewarsMobile/Classes/SchemeWeaponConfigViewController.h	Wed Jul 27 11:41:43 2011 +0400
+++ b/project_files/HedgewarsMobile/Classes/SchemeWeaponConfigViewController.h	Mon Aug 01 10:08:02 2011 +0400
@@ -25,24 +25,33 @@
 @interface SchemeWeaponConfigViewController : UITableViewController {
     NSArray *listOfSchemes;
     NSArray *listOfWeapons;
+    NSArray *listOfScripts;
 
     NSIndexPath *lastIndexPath_sc;
     NSIndexPath *lastIndexPath_we;
+    NSIndexPath *lastIndexPath_lu;
 
     NSString *selectedScheme;
     NSString *selectedWeapon;
+    NSString *selectedScript;
+    NSString *scriptCommand;
 
-    UISwitch *syncSwitch;
+    UISegmentedControl *topControl;
     BOOL hideSections;
 }
 
 @property (nonatomic,retain) NSArray *listOfSchemes;
 @property (nonatomic,retain) NSArray *listOfWeapons;
+@property (nonatomic,retain) NSArray *listOfScripts;
 @property (nonatomic,retain) NSIndexPath *lastIndexPath_sc;
 @property (nonatomic,retain) NSIndexPath *lastIndexPath_we;
+@property (nonatomic,retain) NSIndexPath *lastIndexPath_lu;
 @property (nonatomic,retain) NSString *selectedScheme;
 @property (nonatomic,retain) NSString *selectedWeapon;
-@property (nonatomic,retain) UISwitch *syncSwitch;
+@property (nonatomic,retain) NSString *selectedScript;
+@property (nonatomic,retain) NSString *scriptCommand;
+@property (nonatomic,retain) UISegmentedControl *topControl;
+@property (assign) BOOL hideSections;
 
 -(void) fillSections;
 -(void) emptySections;
--- a/project_files/HedgewarsMobile/Classes/SchemeWeaponConfigViewController.m	Wed Jul 27 11:41:43 2011 +0400
+++ b/project_files/HedgewarsMobile/Classes/SchemeWeaponConfigViewController.m	Mon Aug 01 10:08:02 2011 +0400
@@ -25,7 +25,8 @@
 #define LABEL_TAG 57423
 
 @implementation SchemeWeaponConfigViewController
-@synthesize listOfSchemes, listOfWeapons, lastIndexPath_sc, lastIndexPath_we, selectedScheme, selectedWeapon, syncSwitch;
+@synthesize listOfSchemes, listOfWeapons, listOfScripts, lastIndexPath_sc, lastIndexPath_we, lastIndexPath_lu,
+            selectedScheme, selectedWeapon, selectedScript, scriptCommand, topControl, hideSections;
 
 -(BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
     return rotationManager(interfaceOrientation);
@@ -41,6 +42,8 @@
 
     self.selectedScheme = nil;
     self.selectedWeapon = nil;
+    self.selectedScript = nil;
+    self.scriptCommand = nil;
 
     if ([self.tableView respondsToSelector:@selector(setBackgroundView:)]) {
         if (IS_IPAD())
@@ -74,7 +77,12 @@
     
     if (self.selectedWeapon == nil && [listOfWeapons containsObject:@"Default.plist"])
         self.selectedWeapon = @"Default.plist";
-    
+
+    contentsOfDir = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:SCRIPTS_DIRECTORY() error:NULL];
+    self.listOfScripts = contentsOfDir;
+    self.selectedScript = @"Normal.plist";
+    self.scriptCommand = @"";
+
     [self.tableView reloadData];
 }
 
@@ -85,30 +93,30 @@
     if (hideSections)
         return 0;
     else
-        return 3;
+        return 1;
 }
 
 -(NSInteger) tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
-    if (section == 0)
+    if (self.topControl.selectedSegmentIndex == 0)
         return [self.listOfSchemes count];
-    else if (section == 1)
+    else if (self.topControl.selectedSegmentIndex == 1)
         return [self.listOfWeapons count];
     else
-        return 1;
+        return [self.listOfScripts count];
 }
 
 // Customize the appearance of table view cells.
 -(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
     static NSString *CellIdentifier = @"Cell";
+    NSInteger index = self.topControl.selectedSegmentIndex;
     NSInteger row = [indexPath row];
-    NSInteger section = [indexPath section];
 
     UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
     if (cell == nil)
         cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:CellIdentifier] autorelease];
 
     cell.accessoryView = nil;
-    if (0 == section) {
+    if (0 == index) {
         cell.textLabel.text = [[self.listOfSchemes objectAtIndex:row] stringByDeletingPathExtension];
         NSString *str = [NSString stringWithFormat:@"%@/%@",SCHEMES_DIRECTORY(),[self.listOfSchemes objectAtIndex:row]];
         NSDictionary *dict = [[NSDictionary alloc] initWithContentsOfFile:str];
@@ -120,7 +128,7 @@
             [checkbox release];
             self.lastIndexPath_sc = indexPath;
         }
-    } else if (1 == section) {
+    } else if (1 == index) {
         cell.textLabel.text = [[self.listOfWeapons objectAtIndex:row] stringByDeletingPathExtension];
         NSString *str = [NSString stringWithFormat:@"%@/%@",WEAPONS_DIRECTORY(),[self.listOfWeapons objectAtIndex:row]];
         NSDictionary *dict = [[NSDictionary alloc] initWithContentsOfFile:str];
@@ -133,44 +141,47 @@
             self.lastIndexPath_we = indexPath;
         }
     } else {
-        if (self.syncSwitch == nil) {
-            UISwitch *theSwitch = [[UISwitch alloc] init];
-            [theSwitch setOn:YES];
-            self.syncSwitch = theSwitch;
-            [theSwitch release];
+        cell.textLabel.text = [[self.listOfScripts objectAtIndex:row] stringByDeletingPathExtension];
+        NSString *str = [NSString stringWithFormat:@"%@/%@",SCRIPTS_DIRECTORY(),[self.listOfScripts objectAtIndex:row]];
+        NSDictionary *dict = [[NSDictionary alloc] initWithContentsOfFile:str];
+        cell.detailTextLabel.text = [dict objectForKey:@"description"];
+        [dict release];
+        if ([[self.listOfScripts objectAtIndex:row] isEqualToString:self.selectedScript]) {
+            UIImageView *checkbox = [[UIImageView alloc] initWithImage:[UIImage imageWithContentsOfFile:@"checkbox.png"]];
+            cell.accessoryView = checkbox;
+            [checkbox release];
+            self.lastIndexPath_lu = indexPath;
         }
-        cell.textLabel.text = IS_IPAD() ? NSLocalizedString(@"Sync Schemes",@"") : NSLocalizedString(@"Sync Schemes and Weapons",@"");
-        cell.detailTextLabel.text = IS_IPAD() ? nil : NSLocalizedString(@"Choosing a Scheme will select its associated Weapon",@"");
-        cell.detailTextLabel.adjustsFontSizeToFitWidth = YES;
-        cell.accessoryView = self.syncSwitch;
     }
 
     cell.backgroundColor = UICOLOR_HW_ALMOSTBLACK;
     cell.textLabel.textColor = UICOLOR_HW_YELLOW_TEXT;
     cell.detailTextLabel.textColor = [UIColor whiteColor];
+    cell.textLabel.adjustsFontSizeToFitWidth = YES;
+    cell.detailTextLabel.adjustsFontSizeToFitWidth = YES;
     return cell;
 }
 
 -(CGFloat) tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section {
-    return 40.0;
+    return 50.0;
 }
 
 -(UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section {
-    CGRect frame = CGRectMake(0, 0, self.view.frame.size.width * 80/100, 30);
-    NSString *text;
-    if (section == 0) 
-        text = NSLocalizedString(@"Schemes",@"");
-    else if (section == 1)
-        text = NSLocalizedString(@"Weapons",@"");
-    else
-        text = NSLocalizedString(@"Options",@"");
-
-    UILabel *theLabel = createBlueLabel(text, frame);
-    theLabel.center = CGPointMake(self.view.frame.size.width/2, 20);
+    if (self.topControl == nil) {
+        NSArray *array = [[NSArray alloc] initWithObjects:NSLocalizedString(@"Scheme",@""),NSLocalizedString(@"Weapon",@""),
+                          NSLocalizedString(@"Style",@""),nil];
+        self.topControl = [[UISegmentedControl alloc] initWithItems:array];
+        [array release];
+        [self.topControl addTarget:self.tableView action:@selector(reloadData) forControlEvents:UIControlEventValueChanged];
+        self.topControl.segmentedControlStyle = UISegmentedControlStyleBar;
+        self.topControl.frame = CGRectMake(0, 0, self.view.frame.size.width * 80/100, 30);
+        self.topControl.center = CGPointMake(self.view.frame.size.width/2, 24);
+        self.topControl.tintColor = [UIColor lightGrayColor];
+        self.topControl.selectedSegmentIndex = 0;
+    }
 
     UIView *theView = [[[UIView alloc] init] autorelease];
-    [theView addSubview:theLabel];
-    [theLabel release];
+    [theView addSubview:self.topControl];
     return theView;
 }
 
@@ -178,10 +189,13 @@
 #pragma mark Table view delegate
 -(void) tableView:(UITableView *)aTableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
     NSIndexPath *lastIndexPath;
-    if ([indexPath section] == 0)
+    NSInteger index = self.topControl.selectedSegmentIndex;
+    if (index == 0)
         lastIndexPath = self.lastIndexPath_sc;
+    else if (index == 1)
+        lastIndexPath = self.lastIndexPath_we;
     else
-        lastIndexPath = self.lastIndexPath_we;
+        lastIndexPath = self.lastIndexPath_lu;
 
     int newRow = [indexPath row];
     int oldRow = (lastIndexPath != nil) ? [lastIndexPath row] : -1;
@@ -195,10 +209,12 @@
         UITableViewCell *oldCell = [aTableView cellForRowAtIndexPath:lastIndexPath];
         oldCell.accessoryView = nil;
 
-        if ([indexPath section] == 0) {
+        if (index == 0) {
             self.lastIndexPath_sc = indexPath;
             self.selectedScheme = [self.listOfSchemes objectAtIndex:newRow];
-            if (self.syncSwitch.on) {
+
+            NSUserDefaults *settings = [NSUserDefaults standardUserDefaults];
+            if ([[settings objectForKey:@"sync_ws"] boolValue]) {
                 for (NSString *str in self.listOfWeapons) {
                     if ([str isEqualToString:self.selectedScheme]) {
                         int index = [self.listOfSchemes indexOfObject:str];
@@ -209,9 +225,36 @@
                     }
                 }
             }
-        } else {
+        } else if (index == 1) {
             self.lastIndexPath_we = indexPath;
             self.selectedWeapon = [self.listOfWeapons objectAtIndex:newRow];
+        } else {
+            self.lastIndexPath_lu = indexPath;
+            self.selectedScript = [self.listOfScripts objectAtIndex:newRow];
+
+            NSString *path = [[NSString alloc] initWithFormat:@"%@/%@",SCRIPTS_DIRECTORY(),selectedScript];
+            NSDictionary *scriptDict = [[NSDictionary alloc] initWithContentsOfFile:path];
+            [path release];
+            self.scriptCommand = [scriptDict objectForKey:@"command"];
+            NSString *scheme = [scriptDict objectForKey:@"scheme"];
+            if ([scheme isEqualToString:@""]) {
+                self.selectedScheme = @"Default.plist";
+                [self.topControl setEnabled:NO forSegmentAtIndex:0];
+            } else {
+                self.selectedScheme = scheme;
+                [self.topControl setEnabled:YES forSegmentAtIndex:0];
+            }
+
+            NSString *weapon = [scriptDict objectForKey:@"weapon"];
+            if ([weapon isEqualToString:@""]) {
+                self.selectedWeapon = @"Default.plist";
+                [self.topControl setEnabled:NO forSegmentAtIndex:1];
+            } else {
+                self.selectedWeapon = weapon;
+                [self.topControl setEnabled:YES forSegmentAtIndex:1];
+            }
+
+            [scriptDict release];
         }
 
         [aTableView selectRowAtIndexPath:indexPath animated:YES scrollPosition:UITableViewScrollPositionNone];
@@ -224,11 +267,12 @@
         hideSections = NO;
         NSRange range;
         range.location = 0;
-        range.length = 3;
+        range.length = 1;
         NSIndexSet *sections = [NSIndexSet indexSetWithIndexesInRange:range];
         [self.tableView insertSections:sections withRowAnimation:UITableViewRowAnimationFade];
         self.selectedScheme = @"Default.plist";
         self.selectedWeapon = @"Default.plist";
+        self.selectedScript = @"Normal.plist";
 
         self.tableView.scrollEnabled = YES;
 
@@ -240,11 +284,12 @@
     hideSections = YES;
     NSRange range;
     range.location = 0;
-    range.length = 3;
+    range.length = 1;
     NSIndexSet *sections = [NSIndexSet indexSetWithIndexesInRange:range];
     [self.tableView deleteSections:sections withRowAnimation:UITableViewRowAnimationFade];
     self.selectedScheme = @"Default.plist";
     self.selectedWeapon = @"Default.plist";
+    self.selectedScript = @"Normal.plist";
 
     self.tableView.scrollEnabled = NO;
 
@@ -264,9 +309,11 @@
     if ([[HedgewarsAppDelegate sharedAppDelegate] isInGame]) {
         self.lastIndexPath_sc = nil;
         self.lastIndexPath_we = nil;
+        self.lastIndexPath_lu = nil;
         self.listOfSchemes = nil;
         self.listOfWeapons = nil;
-        self.syncSwitch = nil;
+        self.listOfScripts = nil;
+        self.topControl = nil;
         MSG_MEMCLEAN();
     }
     [super didReceiveMemoryWarning];
@@ -275,11 +322,15 @@
 -(void) viewDidUnload {
     self.listOfSchemes = nil;
     self.listOfWeapons = nil;
+    self.listOfScripts = nil;
     self.lastIndexPath_sc = nil;
     self.lastIndexPath_we = nil;
+    self.lastIndexPath_lu = nil;
     self.selectedScheme = nil;
     self.selectedWeapon = nil;
-    self.syncSwitch = nil;
+    self.selectedScript = nil;
+    self.scriptCommand = nil;
+    self.topControl = nil;
     MSG_DIDUNLOAD();
     [super viewDidUnload];
 }
@@ -288,11 +339,15 @@
 -(void) dealloc {
     releaseAndNil(listOfSchemes);
     releaseAndNil(listOfWeapons);
+    releaseAndNil(listOfScripts);
     releaseAndNil(lastIndexPath_sc);
     releaseAndNil(lastIndexPath_we);
+    releaseAndNil(lastIndexPath_lu);
     releaseAndNil(selectedScheme);
     releaseAndNil(selectedWeapon);
-    releaseAndNil(syncSwitch);
+    releaseAndNil(selectedScript);
+    releaseAndNil(scriptCommand);
+    releaseAndNil(topControl);
     [super dealloc];
 }
 
--- a/project_files/HedgewarsMobile/Classes/ServerSetup.h	Wed Jul 27 11:41:43 2011 +0400
+++ b/project_files/HedgewarsMobile/Classes/ServerSetup.h	Mon Aug 01 10:08:02 2011 +0400
@@ -30,6 +30,4 @@
 
 @property (nonatomic, retain) NSDictionary *systemSettings;
 
--(BOOL) isNetworkReachable;
-
 @end
--- a/project_files/HedgewarsMobile/Classes/ServerSetup.m	Wed Jul 27 11:41:43 2011 +0400
+++ b/project_files/HedgewarsMobile/Classes/ServerSetup.m	Mon Aug 01 10:08:02 2011 +0400
@@ -22,8 +22,6 @@
 #import "ServerSetup.h"
 #import "PascalImports.h"
 #import "CommodityFunctions.h"
-#import <SystemConfiguration/SCNetworkReachability.h>
-#import <netinet/in.h>
 #import "hwconsts.h"
 
 #define BUFFER_SIZE 256
@@ -43,39 +41,6 @@
     [super dealloc];
 }
 
-// reusing appirater method
--(BOOL) isNetworkReachable {
-    // Create zero addy
-    struct sockaddr_in zeroAddress;
-    bzero(&zeroAddress, sizeof(zeroAddress));
-    zeroAddress.sin_len = sizeof(zeroAddress);
-    zeroAddress.sin_family = AF_INET;
-    
-    // Recover reachability flags
-    SCNetworkReachabilityRef defaultRouteReachability = SCNetworkReachabilityCreateWithAddress(NULL, (struct sockaddr *)&zeroAddress);
-    SCNetworkReachabilityFlags flags;
-    
-    BOOL didRetrieveFlags = SCNetworkReachabilityGetFlags(defaultRouteReachability, &flags);
-    CFRelease(defaultRouteReachability);
-    
-    if (!didRetrieveFlags) {
-        NSLog(@"Error. Could not recover network reachability flags");
-        return NO;
-    }
-    
-    BOOL isReachable = flags & kSCNetworkFlagsReachable;
-    BOOL needsConnection = flags & kSCNetworkFlagsConnectionRequired;
-    BOOL nonWiFi = flags & kSCNetworkReachabilityFlagsTransientConnection;
-    
-    NSURL *testURL = [NSURL URLWithString:@"http://www.apple.com/"];
-    NSURLRequest *testRequest = [NSURLRequest requestWithURL:testURL
-                                                 cachePolicy:NSURLRequestReloadIgnoringLocalCacheData
-                                             timeoutInterval:20.0];
-    NSURLConnection *testConnection = [[NSURLConnection alloc] initWithRequest:testRequest delegate:self];
-    
-    return ((isReachable && !needsConnection) || nonWiFi) ? (testConnection ? YES : NO) : NO;
-}
-
 -(int) sendToServer:(NSString *)command {
     NSString *message = [[NSString alloc] initWithFormat:@"%@\n\n",command];
     int result = SDLNet_TCP_Send(sd, [message UTF8String], [message length]);
--- a/project_files/HedgewarsMobile/Hedgewars.xcodeproj/project.pbxproj	Wed Jul 27 11:41:43 2011 +0400
+++ b/project_files/HedgewarsMobile/Hedgewars.xcodeproj/project.pbxproj	Mon Aug 01 10:08:02 2011 +0400
@@ -1370,7 +1370,7 @@
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 			shellPath = /bin/sh;
-			shellScript = "#copy new stuff over old stuff\nrm -rf ${PROJECT_DIR}/Data\n\n#create config.inc\necho \"Updating config file...\"\nPROTO=`cat ${PROJECT_DIR}/../../CMakeLists.txt | grep HEDGEWARS_PROTO_VER | cut -d ' ' -f 3`\nMAJN=`cat ${PROJECT_DIR}/../../CMakeLists.txt | grep CPACK_PACKAGE_VERSION_MAJOR | xargs | cut -d ' ' -f 3`\nMINN=`cat ${PROJECT_DIR}/../../CMakeLists.txt | grep CPACK_PACKAGE_VERSION_MINOR | xargs | cut -d ' ' -f 3`\nPATN=`cat ${PROJECT_DIR}/../../CMakeLists.txt | grep CPACK_PACKAGE_VERSION_PATCH | xargs | cut -d ' ' -f 3 | cut -d '$' -f 1`\nREVN=-`/usr/local/bin/hg id -n ${PROJECT_DIR}/../../`\necho \"const cNetProtoVersion = $PROTO; const cVersionString = '${MAJN}.${MINN}.${PATN}${REVN}'; const cLuaLibrary = '';\" > ${PROJECT_DIR}/../../hedgewars/config.inc\n\necho \"Copying Data...\"\ncp -R ${PROJECT_DIR}/../../share/hedgewars/Data ${PROJECT_DIR}/Data\n\n#copy some files from QTfrontend/res\necho \"Fetching additional graphics from QTfrontend/res...\"\nmkdir ${PROJECT_DIR}/Data/Graphics/Btn\ncp    ${PROJECT_DIR}/../../QTfrontend/res/btn*.png        ${PROJECT_DIR}/Data/Graphics/Btn/\ncp    ${PROJECT_DIR}/../../QTfrontend/res/icon*.png       ${PROJECT_DIR}/Data/Graphics/Btn/\ncp    ${PROJECT_DIR}/../../QTfrontend/res/StatsMedal*.png ${PROJECT_DIR}/Data/Graphics/Btn/\ncp    ${PROJECT_DIR}/../../QTfrontend/res/StatsR.png      ${PROJECT_DIR}/Data/Graphics/Btn/StatsStar.png\ncp    ${PROJECT_DIR}/../../QTfrontend/res/ammopic.png     ${PROJECT_DIR}/Data/Graphics/Btn/iconAmmo.png\ncp -R ${PROJECT_DIR}/../../QTfrontend/res/botlevels       ${PROJECT_DIR}/Data/Graphics/Hedgehog/botlevels/\n\necho \"Removing text and dummy files...\"\n#delete all CMakeLists.txt and image source files\nfind ${PROJECT_DIR}/Data -name CMakeLists.txt -delete\nfind ${PROJECT_DIR}/Data -name *.svg -delete\nfind ${PROJECT_DIR}/Data -name *.svgz -delete\nfind ${PROJECT_DIR}/Data -name *.sifz -delete\nfind ${PROJECT_DIR}/Data -name *.xcf -delete\nfind ${PROJECT_DIR}/Data -name *.orig -delete\n\n#delete desktop frontend translation\nrm -rf ${PROJECT_DIR}/Data/Locale/hedgewars_*\n\n#delete dummy maps and hats, misc stuff\nrm -rf ${PROJECT_DIR}/Data/Maps/{test*,Ruler}\nrm -rf ${PROJECT_DIR}/Data/Graphics/Hats/{TeamCap,TeamHeadband,TeamHair}\nrm -rf ${PROJECT_DIR}/Data/misc/\n\n#delete forbidden maps\nrm -rf ${PROJECT_DIR}/Data/Maps/{Cheese,FlightJoust}\n\n#delete useless fonts\nrm -rf ${PROJECT_DIR}/Data/Fonts/{wqy-zenhei.ttc,DroidSansFallback.ttf}\n\n#delete all names, reserved hats\nrm -rf ${PROJECT_DIR}/Data/Names/\nrm -rf ${PROJECT_DIR}/Data/Graphics/Hats/Reserved/\n\necho \"Handling audio files...\"\n#delete the Classic voice\nrm -rf ${PROJECT_DIR}/Data/Sounds/voices/Classic\n#delete the main theme file\nrm -rf ${PROJECT_DIR}/Data/Music/main_theme.ogg\n#copy mono audio\ncp -R ${PROJECT_DIR}/Audio/* ${PROJECT_DIR}/Data/\n#remove unused voices\nfor i in {Amazing,Brilliant,Bugger,Bungee,Cutitout,Drat,Excellent,Fire,FlawlessPossibility,Gonnagetyou,Grenade,Hmm,Justyouwait,Leavemealone,Ohdear,Ouch,Perfect,Revenge,Runaway,Solong,Thisoneismine,VictoryPossibility,Watchthis,Whatthe,Whoopsee}; do find Data/Sounds/voices/ -name $i.ogg -delete; done\n\necho \"Tweaking Data contents...\"\n#move Lua maps in Missions\nmkdir ${PROJECT_DIR}/Data/Missions/Maps/\nmv ${PROJECT_DIR}/Data/Maps/{Basketball,Knockball,TrophyRace,CTF_Blizzard,Control} ${PROJECT_DIR}/Data/Missions/Maps/\n#workaround for missing map in CTF_Blizzard\nln -s ../../../Maps/Blizzard/map.png ${PROJECT_DIR}/Data/Missions/Maps/CTF_Blizzard/map.png\n\n#reduce the number of flakes for City\nawk '{if ($1 == 1500) $1=40; print $0}' < ${PROJECT_DIR}/Data/Themes/City/theme.cfg > /tmp/tempfile\nmv /tmp/tempfile ${PROJECT_DIR}/Data/Themes/City/theme.cfg\n\n#remove WIP themes (check they are not used in Maps)\nrm -rf ${PROJECT_DIR}/Data/Themes/{Beach,Digital}\n\necho \"Done\"";
+			shellScript = "#copy new stuff over old stuff\nrm -rf ${PROJECT_DIR}/Data\n\n#create config.inc\necho \"Updating config file...\"\nPROTO=`cat ${PROJECT_DIR}/../../CMakeLists.txt | grep HEDGEWARS_PROTO_VER | cut -d ' ' -f 2 | cut -d ')' -f 1`\nMAJN=`cat ${PROJECT_DIR}/../../CMakeLists.txt | grep CPACK_PACKAGE_VERSION_MAJOR | xargs | cut -d ' ' -f 2 |cut -d ')' -f 1`\nMINN=`cat ${PROJECT_DIR}/../../CMakeLists.txt | grep CPACK_PACKAGE_VERSION_MINOR | xargs | cut -d ' ' -f 2 |cut -d ')' -f 1`\nPATN=`cat ${PROJECT_DIR}/../../CMakeLists.txt | grep CPACK_PACKAGE_VERSION_PATCH | xargs | cut -d ' ' -f 2 | cut -d '$' -f 1`\nREVN=-`/usr/local/bin/hg id -n ${PROJECT_DIR}/../../`\necho \"const cNetProtoVersion = $PROTO; const cVersionString = '${MAJN}.${MINN}.${PATN}${REVN}'; const cLuaLibrary = '';\" > ${PROJECT_DIR}/../../hedgewars/config.inc\n\necho \"Copying Data...\"\ncp -R ${PROJECT_DIR}/../../share/hedgewars/Data ${PROJECT_DIR}/Data\n\n#copy some files from QTfrontend/res\necho \"Fetching additional graphics from QTfrontend/res...\"\nmkdir ${PROJECT_DIR}/Data/Graphics/Btn\ncp    ${PROJECT_DIR}/../../QTfrontend/res/btn*.png        ${PROJECT_DIR}/Data/Graphics/Btn/\ncp    ${PROJECT_DIR}/../../QTfrontend/res/icon*.png       ${PROJECT_DIR}/Data/Graphics/Btn/\ncp    ${PROJECT_DIR}/../../QTfrontend/res/StatsMedal*.png ${PROJECT_DIR}/Data/Graphics/Btn/\ncp    ${PROJECT_DIR}/../../QTfrontend/res/StatsR.png      ${PROJECT_DIR}/Data/Graphics/Btn/StatsStar.png\ncp    ${PROJECT_DIR}/../../QTfrontend/res/ammopic.png     ${PROJECT_DIR}/Data/Graphics/Btn/iconAmmo.png\ncp -R ${PROJECT_DIR}/../../QTfrontend/res/botlevels       ${PROJECT_DIR}/Data/Graphics/Hedgehog/botlevels/\n\necho \"Removing text and dummy files...\"\n#delete all CMakeLists.txt and image source files\nfind ${PROJECT_DIR}/Data -name CMakeLists.txt -delete\nfind ${PROJECT_DIR}/Data -name *.svg -delete\nfind ${PROJECT_DIR}/Data -name *.svgz -delete\nfind ${PROJECT_DIR}/Data -name *.sifz -delete\nfind ${PROJECT_DIR}/Data -name *.xcf -delete\nfind ${PROJECT_DIR}/Data -name *.orig -delete\n\n#delete desktop frontend translation\nrm -rf ${PROJECT_DIR}/Data/Locale/hedgewars_*\n\n#delete dummy maps and hats, misc stuff\nrm -rf ${PROJECT_DIR}/Data/Maps/{test*,Ruler}\nrm -rf ${PROJECT_DIR}/Data/Graphics/Hats/{TeamCap,TeamHeadband,TeamHair}\nrm -rf ${PROJECT_DIR}/Data/misc/\n\n#delete forbidden maps and WIP themes (remember to check that no Map uses them)\nrm -rf ${PROJECT_DIR}/Data/Maps/{Cheese,FlightJoust}\nrm -rf ${PROJECT_DIR}/Data/Themes/{Beach,Digital}\n\n#delete unused fonts\nrm -rf ${PROJECT_DIR}/Data/Fonts/{wqy-zenhei.ttc,DroidSansFallback.ttf}\n\n#delete all names, reserved hats\nrm -rf ${PROJECT_DIR}/Data/Names/\nrm -rf ${PROJECT_DIR}/Data/Graphics/Hats/Reserved/\n\necho \"Handling audio files...\"\n#delete the Classic voice\nrm -rf ${PROJECT_DIR}/Data/Sounds/voices/Classic\n#delete the main theme file\nrm -rf ${PROJECT_DIR}/Data/Music/main_theme.ogg\n#copy mono audio\ncp -R ${PROJECT_DIR}/Audio/* ${PROJECT_DIR}/Data/\n#remove unused voices\nfor i in {Amazing,Brilliant,Bugger,Bungee,Cutitout,Drat,Excellent,Fire,FlawlessPossibility,Gonnagetyou,Grenade,Hmm,Justyouwait,Leavemealone,Ohdear,Ouch,Perfect,Revenge,Runaway,Solong,Thisoneismine,VictoryPossibility,Watchthis,Whatthe,Whoopsee}; do find Data/Sounds/voices/ -name $i.ogg -delete; done\n\necho \"Tweaking Data contents...\"\n#move Lua maps in Missions\nmkdir ${PROJECT_DIR}/Data/Missions/Maps/\nmv ${PROJECT_DIR}/Data/Maps/{Basketball,Knockball,TrophyRace,CTF_Blizzard,Control} ${PROJECT_DIR}/Data/Missions/Maps/\n#workaround for missing map in CTF_Blizzard\nln -s ../../../Maps/Blizzard/map.png ${PROJECT_DIR}/Data/Missions/Maps/CTF_Blizzard/map.png\n#remove cfg files since we have plists\nfind ${PROJECT_DIR}/Data/Scripts -name *.cfg -delete\n\n#reduce the number of flakes for City\nawk '{if ($1 == 1500) $1=40; print $0}' < ${PROJECT_DIR}/Data/Themes/City/theme.cfg > /tmp/tempfile\nmv /tmp/tempfile ${PROJECT_DIR}/Data/Themes/City/theme.cfg\n\necho \"Done\"";
 			showEnvVarsInLog = 0;
 		};
 		9283011B0F10CB2D00CC5A3C /* Build libfpc.a */ = {
@@ -1522,49 +1522,24 @@
 		1D6058940D05DD3E006BFB54 /* Debug */ = {
 			isa = XCBuildConfiguration;
 			buildSettings = {
-				ALWAYS_SEARCH_USER_PATHS = NO;
-				ARCHS = "$(ARCHS_UNIVERSAL_IPHONE_OS)";
-				COPY_PHASE_STRIP = NO;
 				GCC_DYNAMIC_NO_PIC = NO;
 				GCC_GENERATE_TEST_COVERAGE_FILES = YES;
 				GCC_INSTRUMENT_PROGRAM_FLOW_ARCS = YES;
-				GCC_OPTIMIZATION_LEVEL = 0;
 				GCC_PRECOMPILE_PREFIX_HEADER = YES;
 				GCC_PREFIX_HEADER = Hedgewars_Prefix.pch;
 				INFOPLIST_FILE = Info.plist;
-				LIBRARY_SEARCH_PATHS = (
-					"$(inherited)",
-					"\"$(SRCROOT)\"",
-				);
-				OTHER_LDFLAGS = (
-					"$(inherited)",
-					"-lgcov",
-				);
 				PRODUCT_NAME = Hedgewars;
-				TARGETED_DEVICE_FAMILY = "$(inherited)";
 			};
 			name = Debug;
 		};
 		1D6058950D05DD3E006BFB54 /* Release */ = {
 			isa = XCBuildConfiguration;
 			buildSettings = {
-				ALWAYS_SEARCH_USER_PATHS = NO;
-				ARCHS = "$(ARCHS_STANDARD_32_BIT)";
-				CODE_SIGN_ENTITLEMENTS = "Entitlements-Development.plist";
-				CODE_SIGN_IDENTITY = "iPhone Developer";
-				"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
 				COPY_PHASE_STRIP = YES;
 				GCC_PRECOMPILE_PREFIX_HEADER = YES;
 				GCC_PREFIX_HEADER = Hedgewars_Prefix.pch;
 				INFOPLIST_FILE = Info.plist;
-				LIBRARY_SEARCH_PATHS = (
-					"$(inherited)",
-					"\"$(SRCROOT)\"",
-				);
 				PRODUCT_NAME = Hedgewars;
-				PROVISIONING_PROFILE = "";
-				"PROVISIONING_PROFILE[sdk=iphoneos*]" = "";
-				TARGETED_DEVICE_FAMILY = "$(inherited)";
 			};
 			name = Release;
 		};
@@ -1584,7 +1559,7 @@
 				GCC_C_LANGUAGE_STANDARD = c99;
 				GCC_DEBUGGING_SYMBOLS = default;
 				GCC_FAST_MATH = YES;
-				GCC_OPTIMIZATION_LEVEL = 2;
+				GCC_OPTIMIZATION_LEVEL = s;
 				GCC_PREPROCESSOR_DEFINITIONS = "";
 				GCC_STRICT_ALIASING = YES;
 				GCC_THUMB_SUPPORT = NO;
@@ -1599,6 +1574,7 @@
 					"\"$(SRCROOT)/../../../Library/SDL_mixer/\"",
 				);
 				IPHONEOS_DEPLOYMENT_TARGET = 3.1;
+				LLVM_LTO = NO;
 				ONLY_ACTIVE_ARCH = NO;
 				OTHER_CODE_SIGN_FLAGS = "";
 				OTHER_LDFLAGS = (
@@ -1618,30 +1594,17 @@
 		61022D7D12305A2800B08935 /* Distro AppStore */ = {
 			isa = XCBuildConfiguration;
 			buildSettings = {
-				ALWAYS_SEARCH_USER_PATHS = NO;
-				ARCHS = "$(ARCHS_STANDARD_32_BIT)";
-				CODE_SIGN_ENTITLEMENTS = "Entitlements-Distribution.plist";
-				CODE_SIGN_IDENTITY = "iPhone Distribution";
-				"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Distribution";
 				COPY_PHASE_STRIP = YES;
 				GCC_PRECOMPILE_PREFIX_HEADER = YES;
 				GCC_PREFIX_HEADER = Hedgewars_Prefix.pch;
 				INFOPLIST_FILE = Info.plist;
-				LIBRARY_SEARCH_PATHS = (
-					"$(inherited)",
-					"\"$(SRCROOT)\"",
-				);
 				PRODUCT_NAME = Hedgewars;
-				PROVISIONING_PROFILE = "";
-				"PROVISIONING_PROFILE[sdk=iphoneos*]" = "";
-				TARGETED_DEVICE_FAMILY = "$(inherited)";
 			};
 			name = "Distro AppStore";
 		};
 		61022D7E12305A2800B08935 /* Distro AppStore */ = {
 			isa = XCBuildConfiguration;
 			buildSettings = {
-				ALWAYS_SEARCH_USER_PATHS = NO;
 				COPY_PHASE_STRIP = YES;
 				DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
 				GCC_ENABLE_FIX_AND_CONTINUE = NO;
@@ -1674,12 +1637,12 @@
 				FPC_COMPILER_BINARY_DIR = /usr/local/lib/fpc/2.5.1;
 				FPC_MAIN_FILE = "$(PROJECT_DIR)/../../hedgewars/hwLibrary.pas";
 				FPC_RTL_UNITS_BASE = /usr/local/lib/fpc;
-				FPC_SPECIFIC_OPTIONS = "-dDEBUGFILE -Ci- -Cr- -Co- -O-2 -Xs  -Cfvfpv2";
+				FPC_SPECIFIC_OPTIONS = "-dDEBUGFILE -O- -g -gl -gw2 -gt -ghttt -Xs- -Cfvfpv2";
 				FPC_UNITS_PATH = "-Fu\"$(PROJECT_DIR)\"";
 				GCC_C_LANGUAGE_STANDARD = c99;
-				GCC_DEBUGGING_SYMBOLS = default;
+				GCC_DEBUGGING_SYMBOLS = full;
 				GCC_FAST_MATH = YES;
-				GCC_OPTIMIZATION_LEVEL = 2;
+				GCC_OPTIMIZATION_LEVEL = 0;
 				GCC_PREPROCESSOR_DEFINITIONS = DEBUG;
 				GCC_STRICT_ALIASING = YES;
 				GCC_THUMB_SUPPORT = NO;
@@ -1712,28 +1675,17 @@
 		6137064C117B1CB3004EE44A /* Distro Adhoc */ = {
 			isa = XCBuildConfiguration;
 			buildSettings = {
-				ALWAYS_SEARCH_USER_PATHS = NO;
-				ARCHS = "$(ARCHS_UNIVERSAL_IPHONE_OS)";
-				CODE_SIGN_ENTITLEMENTS = "Entitlements-Distribution.plist";
-				"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Distribution";
 				COPY_PHASE_STRIP = YES;
 				GCC_PRECOMPILE_PREFIX_HEADER = YES;
 				GCC_PREFIX_HEADER = Hedgewars_Prefix.pch;
 				INFOPLIST_FILE = Info.plist;
-				LIBRARY_SEARCH_PATHS = (
-					"$(inherited)",
-					"\"$(SRCROOT)\"",
-				);
 				PRODUCT_NAME = Hedgewars;
-				"PROVISIONING_PROFILE[sdk=iphoneos*]" = "";
-				TARGETED_DEVICE_FAMILY = "$(inherited)";
 			};
 			name = "Distro Adhoc";
 		};
 		6137064D117B1CB3004EE44A /* Distro Adhoc */ = {
 			isa = XCBuildConfiguration;
 			buildSettings = {
-				ALWAYS_SEARCH_USER_PATHS = NO;
 				COPY_PHASE_STRIP = YES;
 				DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
 				GCC_ENABLE_FIX_AND_CONTINUE = NO;
@@ -1778,7 +1730,6 @@
 		928301180F10CAFD00CC5A3C /* Debug */ = {
 			isa = XCBuildConfiguration;
 			buildSettings = {
-				ALWAYS_SEARCH_USER_PATHS = NO;
 				COPY_PHASE_STRIP = NO;
 				GCC_DYNAMIC_NO_PIC = NO;
 				GCC_OPTIMIZATION_LEVEL = 0;
@@ -1790,7 +1741,6 @@
 		928301190F10CAFD00CC5A3C /* Release */ = {
 			isa = XCBuildConfiguration;
 			buildSettings = {
-				ALWAYS_SEARCH_USER_PATHS = NO;
 				COPY_PHASE_STRIP = YES;
 				DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
 				GCC_ENABLE_FIX_AND_CONTINUE = NO;
@@ -1816,7 +1766,7 @@
 				FPC_UNITS_PATH = "-Fu\"$(PROJECT_DIR)\"";
 				GCC_C_LANGUAGE_STANDARD = c99;
 				GCC_DEBUGGING_SYMBOLS = full;
-				GCC_FAST_MATH = NO;
+				GCC_FAST_MATH = YES;
 				GCC_OPTIMIZATION_LEVEL = 0;
 				GCC_PREPROCESSOR_DEFINITIONS = DEBUG;
 				GCC_STRICT_ALIASING = YES;
@@ -1863,7 +1813,7 @@
 				GCC_C_LANGUAGE_STANDARD = c99;
 				GCC_DEBUGGING_SYMBOLS = default;
 				GCC_FAST_MATH = YES;
-				GCC_OPTIMIZATION_LEVEL = 2;
+				GCC_OPTIMIZATION_LEVEL = s;
 				GCC_PREPROCESSOR_DEFINITIONS = DEBUG;
 				GCC_STRICT_ALIASING = YES;
 				GCC_THUMB_SUPPORT = NO;
@@ -1878,6 +1828,7 @@
 					"\"$(SRCROOT)/../../../Library/SDL_mixer/\"",
 				);
 				IPHONEOS_DEPLOYMENT_TARGET = 3.1;
+				LLVM_LTO = NO;
 				ONLY_ACTIVE_ARCH = NO;
 				OTHER_LDFLAGS = (
 					"-lz",
--- a/project_files/HedgewarsMobile/Resources/GameConfigViewController.xib	Wed Jul 27 11:41:43 2011 +0400
+++ b/project_files/HedgewarsMobile/Resources/GameConfigViewController.xib	Mon Aug 01 10:08:02 2011 +0400
@@ -2,9 +2,9 @@
 <archive type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="7.10">
 	<data>
 		<int key="IBDocument.SystemTarget">1056</int>
-		<string key="IBDocument.SystemVersion">10H574</string>
+		<string key="IBDocument.SystemVersion">10K540</string>
 		<string key="IBDocument.InterfaceBuilderVersion">823</string>
-		<string key="IBDocument.AppKitVersion">1038.35</string>
+		<string key="IBDocument.AppKitVersion">1038.36</string>
 		<string key="IBDocument.HIToolboxVersion">461.00</string>
 		<object class="NSMutableDictionary" key="IBDocument.PluginVersions">
 			<string key="NS.key.0">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
@@ -50,7 +50,7 @@
 							<object class="IBUISegmentedControl" id="563596142">
 								<reference key="NSNextResponder" ref="836721772"/>
 								<int key="NSvFlags">292</int>
-								<string key="NSFrame">{{96, 8}, {269, 30}}</string>
+								<string key="NSFrame">{{96, 8}, {270, 30}}</string>
 								<reference key="NSSuperview" ref="836721772"/>
 								<bool key="IBUIOpaque">NO</bool>
 								<int key="IBUITag">12345</int>
@@ -94,8 +94,8 @@
 									<reference ref="4"/>
 								</object>
 								<object class="NSColor" key="IBTintColor">
-									<int key="NSColorSpace">2</int>
-									<bytes key="NSRGB">MC4yMzEzNzI1NjUgMCAwLjQ2Mjc0NTEzMDEAA</bytes>
+									<int key="NSColorSpace">1</int>
+									<bytes key="NSRGB">MC42IDAuNiAwLjYAA</bytes>
 								</object>
 							</object>
 						</object>
--- a/project_files/HedgewarsMobile/Resources/MapConfigViewController-iPad.xib	Wed Jul 27 11:41:43 2011 +0400
+++ b/project_files/HedgewarsMobile/Resources/MapConfigViewController-iPad.xib	Mon Aug 01 10:08:02 2011 +0400
@@ -2,9 +2,9 @@
 <archive type="com.apple.InterfaceBuilder3.CocoaTouch.iPad.XIB" version="7.10">
 	<data>
 		<int key="IBDocument.SystemTarget">1056</int>
-		<string key="IBDocument.SystemVersion">10H574</string>
+		<string key="IBDocument.SystemVersion">10K540</string>
 		<string key="IBDocument.InterfaceBuilderVersion">823</string>
-		<string key="IBDocument.AppKitVersion">1038.35</string>
+		<string key="IBDocument.AppKitVersion">1038.36</string>
 		<string key="IBDocument.HIToolboxVersion">461.00</string>
 		<object class="NSMutableDictionary" key="IBDocument.PluginVersions">
 			<string key="NS.key.0">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
@@ -12,7 +12,7 @@
 		</object>
 		<object class="NSMutableArray" key="IBDocument.EditedObjectIDs">
 			<bool key="EncodedWithXMLCoder">YES</bool>
-			<integer value="9"/>
+			<integer value="1"/>
 		</object>
 		<object class="NSArray" key="IBDocument.PluginDependencies">
 			<bool key="EncodedWithXMLCoder">YES</bool>
@@ -58,7 +58,7 @@
 					<object class="IBUISegmentedControl" id="88728219">
 						<reference key="NSNextResponder" ref="191373211"/>
 						<int key="NSvFlags">289</int>
-						<string key="NSFrame">{{725, 166}, {277, 30}}</string>
+						<string key="NSFrame">{{724, 166}, {280, 30}}</string>
 						<reference key="NSSuperview" ref="191373211"/>
 						<bool key="IBUIOpaque">NO</bool>
 						<string key="targetRuntimeIdentifier">IBIPadFramework</string>
@@ -101,8 +101,8 @@
 							<reference ref="4"/>
 						</object>
 						<object class="NSColor" key="IBTintColor">
-							<int key="NSColorSpace">1</int>
-							<bytes key="NSRGB">MCAwIDAAA</bytes>
+							<int key="NSColorSpace">3</int>
+							<bytes key="NSWhite">MC42NjY2NjY2NjY3AA</bytes>
 						</object>
 					</object>
 					<object class="IBUISlider" id="938256702">
@@ -566,6 +566,7 @@
 					<string>57.IBPluginDependency</string>
 					<string>66.IBPluginDependency</string>
 					<string>7.IBPluginDependency</string>
+					<string>7.IBViewBoundsToFrameTransform</string>
 					<string>70.IBPluginDependency</string>
 					<string>72.IBPluginDependency</string>
 					<string>75.IBPluginDependency</string>
@@ -585,6 +586,9 @@
 					<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
 					<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
 					<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
+					<object class="NSAffineTransform">
+						<bytes key="NSTransformStruct">P4AAAL+AAABENUAAw0IAAA</bytes>
+					</object>
 					<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
 					<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
 					<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
--- a/project_files/HedgewarsMobile/Resources/MapConfigViewController-iPhone.xib	Wed Jul 27 11:41:43 2011 +0400
+++ b/project_files/HedgewarsMobile/Resources/MapConfigViewController-iPhone.xib	Mon Aug 01 10:08:02 2011 +0400
@@ -2,9 +2,9 @@
 <archive type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="7.10">
 	<data>
 		<int key="IBDocument.SystemTarget">1056</int>
-		<string key="IBDocument.SystemVersion">10H574</string>
+		<string key="IBDocument.SystemVersion">10K540</string>
 		<string key="IBDocument.InterfaceBuilderVersion">823</string>
-		<string key="IBDocument.AppKitVersion">1038.35</string>
+		<string key="IBDocument.AppKitVersion">1038.36</string>
 		<string key="IBDocument.HIToolboxVersion">461.00</string>
 		<object class="NSMutableDictionary" key="IBDocument.PluginVersions">
 			<string key="NS.key.0">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
@@ -57,7 +57,7 @@
 					<object class="IBUISegmentedControl" id="88728219">
 						<reference key="NSNextResponder" ref="191373211"/>
 						<int key="NSvFlags">292</int>
-						<string key="NSFrame">{{13, 166}, {256, 30}}</string>
+						<string key="NSFrame">{{9, 14}, {270, 30}}</string>
 						<reference key="NSSuperview" ref="191373211"/>
 						<bool key="IBUIOpaque">NO</bool>
 						<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
@@ -100,14 +100,14 @@
 							<reference ref="4"/>
 						</object>
 						<object class="NSColor" key="IBTintColor">
-							<int key="NSColorSpace">2</int>
-							<bytes key="NSRGB">MC4wMjM1Mjk0MTQwOSAwLjM3NjQ3MDYyNTQgMAA</bytes>
+							<int key="NSColorSpace">3</int>
+							<bytes key="NSWhite">MC42NjY2NjY2NjY3AA</bytes>
 						</object>
 					</object>
 					<object class="IBUISlider" id="938256702">
 						<reference key="NSNextResponder" ref="191373211"/>
 						<int key="NSvFlags">292</int>
-						<string key="NSFrame">{{98, 240}, {149, 23}}</string>
+						<string key="NSFrame">{{119, 207}, {149, 23}}</string>
 						<reference key="NSSuperview" ref="191373211"/>
 						<bool key="IBUIOpaque">NO</bool>
 						<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
@@ -119,7 +119,7 @@
 					<object class="IBUIButton" id="326163764">
 						<reference key="NSNextResponder" ref="191373211"/>
 						<int key="NSvFlags">292</int>
-						<string key="NSFrame">{{13, 20}, {256, 128}}</string>
+						<string key="NSFrame">{{16, 58}, {256, 128}}</string>
 						<reference key="NSSuperview" ref="191373211"/>
 						<bool key="IBUIOpaque">NO</bool>
 						<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
@@ -146,7 +146,7 @@
 					<object class="IBUILabel" id="634417433">
 						<reference key="NSNextResponder" ref="191373211"/>
 						<int key="NSvFlags">292</int>
-						<string key="NSFrame">{{20, 221}, {48, 35}}</string>
+						<string key="NSFrame">{{58, 221}, {48, 35}}</string>
 						<reference key="NSSuperview" ref="191373211"/>
 						<bool key="IBUIOpaque">NO</bool>
 						<bool key="IBUIClipsSubviews">YES</bool>
@@ -154,6 +154,11 @@
 						<bool key="IBUIUserInteractionEnabled">NO</bool>
 						<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
 						<string key="IBUIText">...</string>
+						<object class="NSFont" key="IBUIFont">
+							<string key="NSName">Helvetica-Bold</string>
+							<double key="NSSize">17</double>
+							<int key="NSfFlags">16</int>
+						</object>
 						<object class="NSColor" key="IBUITextColor">
 							<int key="NSColorSpace">2</int>
 							<bytes key="NSRGB">MC45NDkwMTk2NzA1IDAuNzY4NjI3NTI0NCAwAA</bytes>
@@ -166,7 +171,7 @@
 					<object class="IBUILabel" id="743202682">
 						<reference key="NSNextResponder" ref="191373211"/>
 						<int key="NSvFlags">292</int>
-						<string key="NSFrame">{{88, 210}, {169, 29}}</string>
+						<string key="NSFrame">{{109, 237}, {169, 29}}</string>
 						<reference key="NSSuperview" ref="191373211"/>
 						<bool key="IBUIOpaque">NO</bool>
 						<bool key="IBUIClipsSubviews">YES</bool>
@@ -210,6 +215,31 @@
 						<float key="IBUISectionHeaderHeight">10</float>
 						<float key="IBUISectionFooterHeight">10</float>
 					</object>
+					<object class="IBUILabel" id="32436512">
+						<reference key="NSNextResponder" ref="191373211"/>
+						<int key="NSvFlags">292</int>
+						<string key="NSFrame">{{-9, 225}, {92, 27}}</string>
+						<reference key="NSSuperview" ref="191373211"/>
+						<bool key="IBUIOpaque">NO</bool>
+						<bool key="IBUIClipsSubviews">YES</bool>
+						<int key="IBUIContentMode">7</int>
+						<bool key="IBUIUserInteractionEnabled">NO</bool>
+						<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
+						<string key="IBUIText">Max</string>
+						<object class="NSFont" key="IBUIFont">
+							<string key="NSName">Helvetica-BoldOblique</string>
+							<double key="NSSize">18</double>
+							<int key="NSfFlags">16</int>
+						</object>
+						<object class="NSColor" key="IBUITextColor">
+							<int key="NSColorSpace">2</int>
+							<bytes key="NSRGB">MC45NDkwMTk2NzA1IDAuNzY4NjI3NTI0NCAwAA</bytes>
+						</object>
+						<reference key="IBUIHighlightedColor" ref="437070330"/>
+						<int key="IBUIBaselineAdjustment">1</int>
+						<float key="IBUIMinimumFontSize">10</float>
+						<int key="IBUITextAlignment">1</int>
+					</object>
 				</object>
 				<string key="NSFrameSize">{480, 276}</string>
 				<reference key="NSSuperview"/>
@@ -358,10 +388,11 @@
 							<reference ref="326163764"/>
 							<reference ref="565214171"/>
 							<reference ref="938256702"/>
-							<reference ref="88728219"/>
+							<reference ref="743202682"/>
 							<reference ref="574494641"/>
-							<reference ref="743202682"/>
+							<reference ref="88728219"/>
 							<reference ref="634417433"/>
+							<reference ref="32436512"/>
 						</object>
 						<reference key="parent" ref="0"/>
 					</object>
@@ -412,6 +443,11 @@
 						<reference key="object" ref="574494641"/>
 						<reference key="parent" ref="191373211"/>
 					</object>
+					<object class="IBObjectRecord">
+						<int key="objectID">36</int>
+						<reference key="object" ref="32436512"/>
+						<reference key="parent" ref="191373211"/>
+					</object>
 				</object>
 			</object>
 			<object class="NSMutableDictionary" key="flattenedProperties">
@@ -430,7 +466,10 @@
 					<string>25.IBViewBoundsToFrameTransform</string>
 					<string>35.IBPluginDependency</string>
 					<string>35.IBViewBoundsToFrameTransform</string>
+					<string>36.IBPluginDependency</string>
+					<string>36.IBViewBoundsToFrameTransform</string>
 					<string>7.IBPluginDependency</string>
+					<string>7.IBViewBoundsToFrameTransform</string>
 					<string>8.IBPluginDependency</string>
 					<string>9.CustomClassName</string>
 					<string>9.IBPluginDependency</string>
@@ -440,11 +479,11 @@
 					<bool key="EncodedWithXMLCoder">YES</bool>
 					<string>MapConfigViewController</string>
 					<string>UIResponder</string>
-					<string>{{507, 233}, {480, 320}}</string>
+					<string>{{790, 298}, {480, 320}}</string>
 					<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
 					<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
 					<object class="NSAffineTransform">
-						<bytes key="NSTransformStruct">P4AAAL+AAABB6AAAw3kAAA</bytes>
+						<bytes key="NSTransformStruct">P4AAAL+AAABB+AAAw4QAAA</bytes>
 					</object>
 					<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
 					<object class="NSAffineTransform">
@@ -456,9 +495,16 @@
 					</object>
 					<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
 					<object class="NSAffineTransform">
-						<bytes key="NSTransformStruct">P4AAAL+AAAAAAAAAw58AAA</bytes>
+						<bytes key="NSTransformStruct">P4AAAL+AAAAAAAAAw4kAAA</bytes>
 					</object>
 					<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
+					<object class="NSAffineTransform">
+						<bytes key="NSTransformStruct">P4AAAL+AAABBMAAAw2gAAA</bytes>
+					</object>
+					<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
+					<object class="NSAffineTransform">
+						<bytes key="NSTransformStruct">P4AAAL+AAABBUAAAwigAAA</bytes>
+					</object>
 					<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
 					<string>MapPreviewButtonView</string>
 					<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
@@ -483,7 +529,7 @@
 				</object>
 			</object>
 			<nil key="sourceID"/>
-			<int key="maxID">35</int>
+			<int key="maxID">36</int>
 		</object>
 		<object class="IBClassDescriber" key="IBDocument.Classes">
 			<object class="NSMutableArray" key="referencedPartialClassDescriptions">
--- a/project_files/HedgewarsMobile/Resources/Settings/Schemes/Barrel Mayhem.plist	Wed Jul 27 11:41:43 2011 +0400
+++ b/project_files/HedgewarsMobile/Resources/Settings/Schemes/Barrel Mayhem.plist	Mon Aug 01 10:08:02 2011 +0400
@@ -44,6 +44,7 @@
 		<false/>
 		<false/>
 		<false/>
+		<false/>
 	</array>
 </dict>
 </plist>
--- a/project_files/HedgewarsMobile/Resources/Settings/Schemes/Clean Slate.plist	Wed Jul 27 11:41:43 2011 +0400
+++ b/project_files/HedgewarsMobile/Resources/Settings/Schemes/Clean Slate.plist	Mon Aug 01 10:08:02 2011 +0400
@@ -44,6 +44,7 @@
 		<false/>
 		<false/>
 		<false/>
+		<false/>
 	</array>
 </dict>
 </plist>
--- a/project_files/HedgewarsMobile/Resources/Settings/Schemes/Default.plist	Wed Jul 27 11:41:43 2011 +0400
+++ b/project_files/HedgewarsMobile/Resources/Settings/Schemes/Default.plist	Mon Aug 01 10:08:02 2011 +0400
@@ -44,6 +44,7 @@
 		<false/>
 		<false/>
 		<false/>
+		<false/>
 	</array>
 </dict>
 </plist>
--- a/project_files/HedgewarsMobile/Resources/Settings/Schemes/Fort Mode.plist	Wed Jul 27 11:41:43 2011 +0400
+++ b/project_files/HedgewarsMobile/Resources/Settings/Schemes/Fort Mode.plist	Mon Aug 01 10:08:02 2011 +0400
@@ -44,6 +44,7 @@
 		<false/>
 		<false/>
 		<false/>
+		<false/>
 	</array>
 </dict>
 </plist>
--- a/project_files/HedgewarsMobile/Resources/Settings/Schemes/King Mode.plist	Wed Jul 27 11:41:43 2011 +0400
+++ b/project_files/HedgewarsMobile/Resources/Settings/Schemes/King Mode.plist	Mon Aug 01 10:08:02 2011 +0400
@@ -44,6 +44,7 @@
 		<false/>
 		<false/>
 		<false/>
+		<false/>
 	</array>
 </dict>
 </plist>
--- a/project_files/HedgewarsMobile/Resources/Settings/Schemes/Minefield.plist	Wed Jul 27 11:41:43 2011 +0400
+++ b/project_files/HedgewarsMobile/Resources/Settings/Schemes/Minefield.plist	Mon Aug 01 10:08:02 2011 +0400
@@ -44,6 +44,7 @@
 		<false/>
 		<false/>
 		<false/>
+		<false/>
 	</array>
 </dict>
 </plist>
--- a/project_files/HedgewarsMobile/Resources/Settings/Schemes/Pro Mode.plist	Wed Jul 27 11:41:43 2011 +0400
+++ b/project_files/HedgewarsMobile/Resources/Settings/Schemes/Pro Mode.plist	Mon Aug 01 10:08:02 2011 +0400
@@ -44,6 +44,7 @@
 		<false/>
 		<false/>
 		<false/>
+		<false/>
 	</array>
 </dict>
 </plist>
--- a/project_files/HedgewarsMobile/Resources/Settings/Schemes/Shoppa.plist	Wed Jul 27 11:41:43 2011 +0400
+++ b/project_files/HedgewarsMobile/Resources/Settings/Schemes/Shoppa.plist	Mon Aug 01 10:08:02 2011 +0400
@@ -40,6 +40,7 @@
 		<false/>
 		<false/>
 		<false/>
+		<true/>
 		<false/>
 		<false/>
 		<false/>
--- a/project_files/HedgewarsMobile/Resources/Settings/Schemes/Thinking with Portals.plist	Wed Jul 27 11:41:43 2011 +0400
+++ b/project_files/HedgewarsMobile/Resources/Settings/Schemes/Thinking with Portals.plist	Mon Aug 01 10:08:02 2011 +0400
@@ -30,9 +30,10 @@
 		<false/>
 		<false/>
 		<false/>
+		<true/>
 		<false/>
 		<true/>
-		<true/>
+		<false/>
 		<false/>
 		<false/>
 		<false/>
--- a/project_files/HedgewarsMobile/Resources/Settings/Schemes/Timeless.plist	Wed Jul 27 11:41:43 2011 +0400
+++ b/project_files/HedgewarsMobile/Resources/Settings/Schemes/Timeless.plist	Mon Aug 01 10:08:02 2011 +0400
@@ -35,7 +35,7 @@
 		<true/>
 		<false/>
 		<false/>
-		<true/>
+		<false/>
 		<false/>
 		<false/>
 		<false/>
@@ -44,6 +44,7 @@
 		<true/>
 		<false/>
 		<false/>
+		<false/>
 	</array>
 </dict>
 </plist>
--- a/project_files/HedgewarsMobile/Resources/Settings/Schemes/Tunnel Hogs.plist	Wed Jul 27 11:41:43 2011 +0400
+++ b/project_files/HedgewarsMobile/Resources/Settings/Schemes/Tunnel Hogs.plist	Mon Aug 01 10:08:02 2011 +0400
@@ -44,6 +44,7 @@
 		<false/>
 		<false/>
 		<false/>
+		<false/>
 	</array>
 </dict>
 </plist>
Binary file share/hedgewars/Data/Graphics/AmmoMenu/Ammos.png has changed
Binary file share/hedgewars/Data/Graphics/AmmoMenu/Ammos_bw.png has changed
--- a/share/hedgewars/Data/Missions/Training/User_Mission_-_Bamboo_Thicket.lua	Wed Jul 27 11:41:43 2011 +0400
+++ b/share/hedgewars/Data/Missions/Training/User_Mission_-_Bamboo_Thicket.lua	Mon Aug 01 10:08:02 2011 +0400
@@ -23,7 +23,7 @@
 	player = AddHog("Ikeda", 0, 10, "StrawHat")
 			
 	AddTeam(loc("Cybernetic Empire"), 	1175851, "Simple", "Island", "Default")
-	enemy = AddHog(loc("Unit 835"), 5, 10, "cyborg")
+	enemy = AddHog(loc("Unit 835"), 1, 10, "cyborg")
 
 	SetGearPosition(player,1166,1680)
 	SetGearPosition(enemy,2848,1443)
--- a/share/hedgewars/Data/Scripts/Multiplayer/The_Specialists.lua	Wed Jul 27 11:41:43 2011 +0400
+++ b/share/hedgewars/Data/Scripts/Multiplayer/The_Specialists.lua	Mon Aug 01 10:08:02 2011 +0400
@@ -1,5 +1,5 @@
 ----------------------------------
--- THE SPECIALISTS MODE 0.4
+-- THE SPECIALISTS MODE 0.5
 -- by mikade
 ----------------------------------
 
@@ -29,15 +29,22 @@
 -- fix potential switch explit
 -- improve user feedback on start
 
+----------------
+-- version 0.5
+----------------
+-- provision for variable minetimer / demo mines set to 5000ms
+-- don't autoswitch if player only has 1 hog on his team
+
 --------------------
 --TO DO
 --------------------
 
--- add proper gameflag checking, maybe
--- set crate drops etc.
--- add alternative switch
+-- balance hog health, maybe
+-- add proper gameflag checking, maybe (so that we can throw in a .cfg and let the users break everything)
+-- set crate drops etc. (super crate for each class? or will this ruin the mode's simplicity?)
 
 loadfile(GetDataPath() .. "Scripts/Locale.lua")()
+loadfile(GetDataPath() .. "Scripts/Tracker.lua")()
 
 local numhhs = 0
 local hhs = {}
@@ -47,6 +54,12 @@
 local started = false
 local switchStage = 0
 
+local hogCounter
+
+function CountHog(gear)
+	hogCounter = hogCounter +1
+end
+
 function CreateTeam()
 
         currTeam = ""
@@ -222,6 +235,8 @@
                                 "", 4, 4000
                                 )
 
+	trackTeams()
+
 end
 
 
@@ -229,14 +244,8 @@
         currName = GetHogName(CurrentHedgehog)
         lastName = GetHogName(CurrentHedgehog)
         AssignAmmo()
-
-        ---------------
-        --switch
-        started = false
+        started = true
         switchStage = 0
-        --AddAmmo(CurrentHedgehog, amSwitch, 1)
-	---------------
-
 end
 
 function onGameTick()
@@ -254,19 +263,30 @@
 			
 			AddCaption(loc("Prepare yourself") .. ", " .. currName .. "!") 
 
-			switchStage = switchStage + 1	
+			hogCounter = 0
+			runOnHogsInTeam(CountHog, GetHogTeamName(CurrentHedgehog) )
+
+			if hogCounter > 1 then
+
+				switchStage = switchStage + 1	
 			
-			if switchStage == 1 then
-				AddAmmo(CurrentHedgehog, amSwitch, 1)
+				if switchStage == 1 then
+					AddAmmo(CurrentHedgehog, amSwitch, 1)
 				
-			elseif switchStage == 2 then
-				ParseCommand("setweap " .. string.char(amSwitch))
-			elseif switchStage == 3 then
-				SetGearMessage(CurrentHedgehog,gmAttack) 
-			elseif switchStage == 4 then
+				elseif switchStage == 2 then
+					ParseCommand("setweap " .. string.char(amSwitch))
+				elseif switchStage == 3 then
+					SetGearMessage(CurrentHedgehog,gmAttack) 
+				elseif switchStage == 4 then
+					switchStage = 110
+					AddAmmo(CurrentHedgehog, amSwitch, 0)
+				end
+			
+			else
 				switchStage = 110
-				AddAmmo(CurrentHedgehog, amSwitch, 0)
 			end
+
+
 		end		
 		
 		lastName = currName
@@ -280,12 +300,21 @@
         if GetGearType(gear) == gtHedgehog then
                 hhs[numhhs] = gear
                 numhhs = numhhs + 1
-        end
+        elseif (GetGearType(gear) == gtMine) and (started == true) then
+		SetTimer(gear,5000)	
+	end
+	
+	if (GetGearType(gear) == gtHedgehog) or (GetGearType(gear) == gtResurrector) then
+		trackGear(gear)
+	end 
+
 
 end
 
 function onGearDelete(gear)
---
+	if (GetGearType(gear) == gtHedgehog) or (GetGearType(gear) == gtResurrector) then
+		trackDeletion(gear)
+	end 
 end
 
 function onAmmoStoreInit()
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/share/hedgewars/Data/Scripts/plist/Balanced Random Weapon.plist	Mon Aug 01 10:08:02 2011 +0400
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+	<key>command</key>
+	<string>escript Scripts/Multiplayer/Balanced_Random_Weapon.lua</string>
+	<key>description</key>
+	<string></string>
+	<key>scheme</key>
+	<string>Default.plist</string>
+	<key>weapon</key>
+	<string></string>
+</dict>
+</plist>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/share/hedgewars/Data/Scripts/plist/Capture the Flag.plist	Mon Aug 01 10:08:02 2011 +0400
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+	<key>command</key>
+	<string>escript Scripts/Multiplayer/Capture_the_Flag.lua</string>
+	<key>description</key>
+	<string></string>
+	<key>scheme</key>
+	<string>Default.plist</string>
+	<key>weapon</key>
+	<string>Default.plist</string>
+</dict>
+</plist>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/share/hedgewars/Data/Scripts/plist/Gaudy Racer.plist	Mon Aug 01 10:08:02 2011 +0400
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+	<key>command</key>
+	<string>escript Scripts/Multiplayer/GaudyRacer.lua</string>
+	<key>description</key>
+	<string></string>
+	<key>scheme</key>
+	<string>Default.plist</string>
+	<key>weapon</key>
+	<string>Default.plist</string>
+</dict>
+</plist>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/share/hedgewars/Data/Scripts/plist/No Jumping.plist	Mon Aug 01 10:08:02 2011 +0400
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+	<key>command</key>
+	<string>escript Scripts/Multiplayer/No_Jumping.lua</string>
+	<key>description</key>
+	<string></string>
+	<key>scheme</key>
+	<string>Default.plist</string>
+	<key>weapon</key>
+	<string>Default.plist</string>
+</dict>
+</plist>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/share/hedgewars/Data/Scripts/plist/Normal.plist	Mon Aug 01 10:08:02 2011 +0400
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+	<key>command</key>
+	<string></string>
+	<key>description</key>
+	<string></string>
+	<key>scheme</key>
+	<string>Default.plist</string>
+	<key>weapon</key>
+	<string>Default.plist</string>
+</dict>
+</plist>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/share/hedgewars/Data/Scripts/plist/Random Weapon.plist	Mon Aug 01 10:08:02 2011 +0400
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+	<key>command</key>
+	<string>escript Scripts/Multiplayer/Balanced_Random_Weapon.lua</string>
+	<key>description</key>
+	<string></string>
+	<key>scheme</key>
+	<string>Default.plist</string>
+	<key>weapon</key>
+	<string></string>
+</dict>
+</plist>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/share/hedgewars/Data/Scripts/plist/Space Invasion.plist	Mon Aug 01 10:08:02 2011 +0400
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+	<key>command</key>
+	<string>escript Scripts/Multiplayer/Space_Invasion.lua</string>
+	<key>description</key>
+	<string></string>
+	<key>scheme</key>
+	<string>Default.plist</string>
+	<key>weapon</key>
+	<string>Default.plist</string>
+</dict>
+</plist>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/share/hedgewars/Data/Scripts/plist/The Specialists.plist	Mon Aug 01 10:08:02 2011 +0400
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+	<key>command</key>
+	<string>escript Scripts/Multiplayer/The_Specialists.lua</string>
+	<key>description</key>
+	<string></string>
+	<key>scheme</key>
+	<string></string>
+	<key>weapon</key>
+	<string></string>
+</dict>
+</plist>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/share/hedgewars/Data/Scripts/plist/Tumbler.plist	Mon Aug 01 10:08:02 2011 +0400
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+	<key>command</key>
+	<string>escript Scripts/Multiplayer/Tumbler.lua</string>
+	<key>description</key>
+	<string></string>
+	<key>scheme</key>
+	<string>Default.plist</string>
+	<key>weapon</key>
+	<string>Default.plist</string>
+</dict>
+</plist>
Binary file share/hedgewars/Data/Themes/Underwater/SDFlake.png has changed
--- a/share/hedgewars/Data/Themes/Underwater/theme.cfg	Wed Jul 27 11:41:43 2011 +0400
+++ b/share/hedgewars/Data/Themes/Underwater/theme.cfg	Mon Aug 01 10:08:02 2011 +0400
@@ -11,5 +11,5 @@
 object = coral, 3, 10, 193, 38, 32, 2, 128, 66, 66, 94, 39, 0, 88, 167
 object = coral2, 3, 119, 146, 23, 22, 1, 5, 0, 123, 130
 flakes = 20, 20, 150, 0, 5
-sd-flakes = 20, 20, 150, 0, 5
+sd-flakes = 5, 16, 150, 0, 1
 rq-sky = 0, 70, 210