merge
authorkoda
Wed, 23 Jun 2010 21:39:14 +0200
changeset 3545 b07ee704f35d
parent 3541 f4f90987e0fa (diff)
parent 3544 aad64e15ca03 (current diff)
child 3546 ccf4854df294
merge
--- a/CMakeLists.txt	Wed Jun 23 22:25:26 2010 +0400
+++ b/CMakeLists.txt	Wed Jun 23 21:39:14 2010 +0200
@@ -184,7 +184,7 @@
 
 add_subdirectory(misc/liblua)
 add_subdirectory(hedgewars)
-add_subdirectory(misc/libopenalbridge)
+#add_subdirectory(misc/libopenalbridge)
 if(NOT BUILD_ENGINE_LIBRARY)
 	add_subdirectory(bin)
 	add_subdirectory(QTfrontend)
--- a/hedgewars/CMakeLists.txt	Wed Jun 23 22:25:26 2010 +0400
+++ b/hedgewars/CMakeLists.txt	Wed Jun 23 21:39:14 2010 +0200
@@ -76,7 +76,6 @@
 	SinTable.inc
 	options.inc
 	${CMAKE_CURRENT_BINARY_DIR}/config.inc
-	openalbridge
 	)
 
 if(BUILD_ENGINE_LIBRARY)
--- a/hedgewars/uChat.pas	Wed Jun 23 22:25:26 2010 +0400
+++ b/hedgewars/uChat.pas	Wed Jun 23 21:39:14 2010 +0200
@@ -30,6 +30,7 @@
 procedure KeyPressChat(Key: Longword);
 
 var UserNick: shortstring;
+    ChatReady: boolean;
     showAll: boolean;
 
 implementation
@@ -45,16 +46,19 @@
         end;
 
 var Strs: array[0 .. MaxStrIndex] of TChatLine;
+    MStrs: array[0 .. MaxStrIndex] of shortstring;
+    missedCount: LongWord;
     lastStr: LongWord;
     visibleCount: LongWord;
     InputStr: TChatLine;
     InputStrL: array[0..260] of char; // for full str + 4-byte utf-8 char
 
-const colors: array[#1..#4] of TSDL_Color = (
+const colors: array[#1..#5] of TSDL_Color = (
     (r:$FF; g:$FF; b:$FF; unused:$FF), // chat message [White]
     (r:$FF; g:$00; b:$FF; unused:$FF), // action message [Purple]
     (r:$90; g:$FF; b:$90; unused:$FF), // join/leave message [Lime]
-    (r:$FF; g:$FF; b:$A0; unused:$FF)  // team message [Light Yellow]
+    (r:$FF; g:$FF; b:$A0; unused:$FF), // team message [Light Yellow]
+    (r:$FF; g:$00; b:$00; unused:$ff)  // error messages [Red]
     );
 
 procedure SetLine(var cl: TChatLine; str: shortstring; isInput: boolean);
@@ -103,6 +107,16 @@
 
 procedure AddChatString(s: shortstring);
 begin
+if not ChatReady then
+    begin
+    if MissedCount < MaxStrIndex - 1 then
+        MStrs[MissedCount]:= s
+    else if MissedCount < MaxStrIndex then
+        MStrs[MissedCount]:= #5 + '[...]';
+    inc(MissedCount);
+    exit
+    end;
+
 lastStr:= (lastStr + 1) mod (MaxStrIndex + 1);
 
 SetLine(Strs[lastStr], s, false);
@@ -114,6 +128,13 @@
 var i, t, cnt: Longword;
     r: TSDL_Rect;
 begin
+ChatReady:= true; // maybe move to somewhere else?
+if MissedCount <> 0 then // there are chat strings we missed, so print them now
+    begin
+    for i:= 0 to MissedCount - 1 do
+        AddChatString(MStrs[i]);
+    MissedCount:= 0;
+    end;
 cnt:= 0;
 t:= 0;
 i:= lastStr;
@@ -297,6 +318,8 @@
     visibleCount:= 0;
     UserNick:= '';
     showAll:= false;
+    ChatReady:= false;
+    missedCount:= 0;
 end;
 
 procedure freeModule;
--- a/hedgewars/uConsts.pas	Wed Jun 23 22:25:26 2010 +0400
+++ b/hedgewars/uConsts.pas	Wed Jun 23 21:39:14 2010 +0200
@@ -171,7 +171,7 @@
     PTexture = ^TTexture;
     TTexture = record
             id: GLuint;
-            w, h: LongInt;
+            w, h, scale: LongInt;
             rx, ry: GLfloat;
             priority: GLfloat;
             vb, tb: array [0..3] of TVertex2f;
@@ -220,7 +220,6 @@
     ifCritical    = $00000002;  // image is critical for gameplay (exit game if unable to load)
     ifTransparent = $00000004;  // image uses transparent pixels (color keying)
     ifIgnoreCaps  = $00000008;  // ignore hardware capabilities when loading (i.e. image will not be drawn using OpenGL)
-    ifLowRes      = $00000010;  // try loading a low resolution image when it is critical
 
     // texture priority (allows OpenGL to keep frequently used textures in video memory more easily)
     tpLowest     = 0.00;
--- a/hedgewars/uMisc.pas	Wed Jun 23 22:25:26 2010 +0400
+++ b/hedgewars/uMisc.pas	Wed Jun 23 21:39:14 2010 +0200
@@ -403,6 +403,7 @@
 new(NewTexture);
 NewTexture^.PrevTexture:= nil;
 NewTexture^.NextTexture:= nil;
+NewTexture^.Scale:= 1;
 if TextureList <> nil then
     begin
     TextureList^.PrevTexture:= NewTexture;
--- a/hedgewars/uScript.pas	Wed Jun 23 22:25:26 2010 +0400
+++ b/hedgewars/uScript.pas	Wed Jun 23 21:39:14 2010 +0200
@@ -50,7 +50,8 @@
     uAmmos,
     uSound,
     uTeams,
-    uKeys;
+    uKeys,
+    uChat;
     
 var luaState : Plua_State;
     ScriptAmmoLoadout : shortstring;
@@ -63,9 +64,15 @@
 procedure ScriptApplyAmmoStore; forward;
 procedure ScriptSetAmmo(ammo : TAmmoType; count, propability, delay, reinforcement: Byte); forward;
 
+procedure LuaError(s: shortstring);
+begin
+    WriteLnToConsole(s);
+    AddChatString(#5 + s);
+end;
+
 // wrapped calls //
 
-// functions called from lua:
+// functions called from Lua:
 // function(L : Plua_State) : LongInt; Cdecl;
 // where L contains the state, returns the number of return values on the stack
 // call lua_gettop(L) to receive number of parameters passed
@@ -74,10 +81,10 @@
 begin
     if lua_gettop(L) = 1 then
         begin
-        WriteLnToConsole('LUA: ' + lua_tostring(L ,1));
+        WriteLnToConsole('Lua: ' + lua_tostring(L ,1));
         end
     else
-        WriteLnToConsole('LUA: Wrong number of parameters passed to WriteLnToConsole!');
+        LuaError('Lua: Wrong number of parameters passed to WriteLnToConsole!');
     lc_writelntoconsole:= 0;
 end;
 
@@ -88,7 +95,7 @@
         ParseCommand(lua_tostring(L ,1), true);
         end
     else
-        WriteLnToConsole('LUA: Wrong number of parameters passed to ParseCommand!');
+        LuaError('Lua: Wrong number of parameters passed to ParseCommand!');
     lc_parsecommand:= 0;
 end;
 
@@ -99,7 +106,7 @@
         ShowMission(lua_tostring(L, 1), lua_tostring(L, 2), lua_tostring(L, 3), lua_tointeger(L, 4), lua_tointeger(L, 5));
         end
     else
-        WriteLnToConsole('LUA: Wrong number of parameters passed to ShowMission!');
+        LuaError('Lua: Wrong number of parameters passed to ShowMission!');
     lc_showmission:= 0;
 end;
 
@@ -118,7 +125,7 @@
 begin
     if lua_gettop(L) <> 7 then
         begin
-        WriteLnToConsole('LUA: Wrong number of parameters passed to AddGear!');
+        LuaError('Lua: Wrong number of parameters passed to AddGear!');
         lua_pushnil(L); // return value on stack (nil)
         end
     else
@@ -141,7 +148,7 @@
 begin
     if lua_gettop(L) <> 0 then
         begin
-        WriteLnToConsole('LUA: Wrong number of parameters passed to GetFollowGear!');
+        LuaError('Lua: Wrong number of parameters passed to GetFollowGear!');
         lua_pushnil(L); // return value on stack (nil)
         end
     else
@@ -157,7 +164,7 @@
 begin
     if lua_gettop(L) <> 1 then
         begin
-        WriteLnToConsole('LUA: Wrong number of parameters passed to GetGearType!');
+        LuaError('Lua: Wrong number of parameters passed to GetGearType!');
         lua_pushnil(L); // return value on stack (nil)
         end
     else
@@ -176,7 +183,7 @@
 begin
     if lua_gettop(L) <> 1 then
         begin
-        WriteLnToConsole('LUA: Wrong number of parameters passed to GetHogClan!');
+        LuaError('Lua: Wrong number of parameters passed to GetHogClan!');
         lua_pushnil(L); // return value on stack (nil)
         end
     else
@@ -197,7 +204,7 @@
 begin
     if lua_gettop(L) <> 1 then
         begin
-        WriteLnToConsole('LUA: Wrong number of parameters passed to GetHogName!');
+        LuaError('Lua: Wrong number of parameters passed to GetHogName!');
         lua_pushnil(L); // return value on stack (nil)
         end
     else
@@ -218,7 +225,7 @@
 begin
     if lua_gettop(L) <> 1 then
         begin
-        WriteLnToConsole('LUA: Wrong number of parameters passed to GetX!');
+        LuaError('Lua: Wrong number of parameters passed to GetX!');
         lua_pushnil(L); // return value on stack (nil)
         end
     else
@@ -237,7 +244,7 @@
 begin
     if lua_gettop(L) <> 1 then
         begin
-        WriteLnToConsole('LUA: Wrong number of parameters passed to GetY!');
+        LuaError('Lua: Wrong number of parameters passed to GetY!');
         lua_pushnil(L); // return value on stack (nil)
         end
     else
@@ -256,7 +263,7 @@
 begin
     if lua_gettop(L) <> 2 then
         begin
-        WriteLnToConsole('LUA: Wrong number of parameters passed to CopyPV!');
+        LuaError('Lua: Wrong number of parameters passed to CopyPV!');
         end
     else
         begin
@@ -278,7 +285,7 @@
 begin
     if lua_gettop(L) <> 2 then
         begin
-        WriteLnToConsole('LUA: Wrong number of parameters passed to CopyPV2!');
+        LuaError('Lua: Wrong number of parameters passed to CopyPV2!');
         end
     else
         begin
@@ -299,7 +306,7 @@
 var gear : PGear;
 begin
     if lua_gettop(L) <> 1 then
-        WriteLnToConsole('LUA: Wrong number of parameters passed to FollowGear!')
+        LuaError('Lua: Wrong number of parameters passed to FollowGear!')
     else
         begin
         gear:= GearByUID(lua_tointeger(L, 1));
@@ -313,7 +320,7 @@
 begin
     if lua_gettop(L) <> 2 then
         begin
-        WriteLnToConsole('LUA: Wrong number of parameters passed to SetHealth!');
+        LuaError('Lua: Wrong number of parameters passed to SetHealth!');
         end
     else
         begin
@@ -328,7 +335,7 @@
 begin
     if lua_gettop(L) <> 2 then
         begin
-        WriteLnToConsole('LUA: Wrong number of parameters passed to SetState!');
+        LuaError('Lua: Wrong number of parameters passed to SetState!');
         end
     else
         begin
@@ -343,7 +350,7 @@
 begin
     if lua_gettop(L) <> 1 then
         begin
-        WriteLnToConsole('LUA: Wrong number of parameters passed to GetState!');
+        LuaError('Lua: Wrong number of parameters passed to GetState!');
         end
     else
         begin
@@ -361,7 +368,7 @@
 begin
     if lua_gettop(L) <> 2 then
         begin
-        WriteLnToConsole('LUA: Wrong number of parameters passed to SetTag!');
+        LuaError('Lua: Wrong number of parameters passed to SetTag!');
         end
     else
         begin
@@ -384,7 +391,7 @@
     left, right: LongInt;
 begin
     if lua_gettop(L) <> 4 then
-        WriteLnToConsole('LUA: Wrong number of parameters passed to FindPlace!')
+        LuaError('Lua: Wrong number of parameters passed to FindPlace!')
     else
         begin
         gear:= GearByUID(lua_tointeger(L, 1));
@@ -400,7 +407,7 @@
 function lc_playsound(L : Plua_State) : LongInt; Cdecl;
 begin
     if lua_gettop(L) <> 1 then
-        WriteLnToConsole('LUA: Wrong number of parameters passed to PlaySound!')
+        LuaError('Lua: Wrong number of parameters passed to PlaySound!')
     else
         PlaySound(TSound(lua_tointeger(L, 1)));
     lc_playsound:= 0;
@@ -410,7 +417,7 @@
 begin
     if lua_gettop(L) <> 5 then
         begin
-        WriteLnToConsole('LUA: Wrong number of parameters passed to AddTeam!');
+        LuaError('Lua: Wrong number of parameters passed to AddTeam!');
         //lua_pushnil(L)
         end
     else
@@ -431,7 +438,7 @@
 begin
     if lua_gettop(L) <> 4 then
         begin
-        WriteLnToConsole('LUA: Wrong number of parameters passed to AddHog!');
+        LuaError('Lua: Wrong number of parameters passed to AddHog!');
         lua_pushnil(L)
         end
     else
@@ -449,7 +456,7 @@
 begin
     if lua_gettop(L) <> 1 then
         begin
-        WriteLnToConsole('LUA: Wrong number of parameters passed to GetGearPosition!');
+        LuaError('Lua: Wrong number of parameters passed to GetGearPosition!');
         lua_pushnil(L);
         lua_pushnil(L)
         end
@@ -470,7 +477,7 @@
     x, y: LongInt;
 begin
     if lua_gettop(L) <> 3 then
-        WriteLnToConsole('LUA: Wrong number of parameters passed to SetGearPosition!')
+        LuaError('Lua: Wrong number of parameters passed to SetGearPosition!')
     else
         begin
         gear:= GearByUID(lua_tointeger(L, 1));
@@ -490,7 +497,7 @@
 begin
     np:= lua_gettop(L);
     if (np < 4) or (np > 5) then
-        WriteLnToConsole('LUA: Wrong number of parameters passed to SetAmmo!')
+        LuaError('Lua: Wrong number of parameters passed to SetAmmo!')
     else if np = 4 then
         ScriptSetAmmo(TAmmoType(lua_tointeger(L, 1)), lua_tointeger(L, 2), lua_tointeger(L, 3), lua_tointeger(L, 4), 1)
     else
@@ -503,14 +510,14 @@
 var n, i : LongInt;
 begin
     n:= lua_gettop(luaState);
-    WriteLnToConsole('LUA: Stack (' + inttostr(n) + ' elements):');
+    WriteLnToConsole('Lua: Stack (' + inttostr(n) + ' elements):');
     for i:= 1 to n do
         if not lua_isboolean(luaState, i) then
-            WriteLnToConsole('LUA:  ' + inttostr(i) + ': ' + lua_tostring(luaState, i))
+            WriteLnToConsole('Lua:  ' + inttostr(i) + ': ' + lua_tostring(luaState, i))
         else if lua_toboolean(luaState, i) then
-            WriteLnToConsole('LUA:  ' + inttostr(i) + ': true')
+            WriteLnToConsole('Lua:  ' + inttostr(i) + ': true')
         else
-            WriteLnToConsole('LUA:  ' + inttostr(i) + ': false');
+            WriteLnToConsole('Lua:  ' + inttostr(i) + ': false');
 end;
 
 procedure ScriptClearStack;
@@ -606,10 +613,10 @@
 begin
 ret:= luaL_loadfile(luaState, Str2PChar(name));
 if ret <> 0 then
-    WriteLnToConsole('LUA: Failed to load ' + name + '(error ' + IntToStr(ret) + ')')
+    LuaError('Lua: Failed to load ' + name + '(error ' + IntToStr(ret) + ')')
 else
     begin
-    WriteLnToConsole('LUA: ' + name + ' loaded');
+    WriteLnToConsole('Lua: ' + name + ' loaded');
     // call the script file
     lua_pcall(luaState, 0, 0, 0);
     ScriptLoaded:= true
@@ -638,7 +645,7 @@
 lua_getglobal(luaState, Str2PChar(fname));
 if lua_pcall(luaState, 0, 0, 0) <> 0 then
     begin
-    WriteLnToConsole('LUA: Error while calling ' + fname + ': ' + lua_tostring(luaState, -1));
+    LuaError('Lua: Error while calling ' + fname + ': ' + lua_tostring(luaState, -1));
     lua_pop(luaState, 1)
     end;
 GetGlobals;
@@ -672,7 +679,7 @@
 ScriptCall:= 0;
 if lua_pcall(luaState, 4, 1, 0) <> 0 then
     begin
-    WriteLnToConsole('LUA: Error while calling ' + fname + ': ' + lua_tostring(luaState, -1));
+    LuaError('Lua: Error while calling ' + fname + ': ' + lua_tostring(luaState, -1));
     lua_pop(luaState, 1)
     end
 else
--- a/hedgewars/uStore.pas	Wed Jun 23 22:25:26 2010 +0400
+++ b/hedgewars/uStore.pas	Wed Jun 23 21:39:14 2010 +0200
@@ -395,9 +395,9 @@
         begin
             if AltPath = ptNone then
                 if ii in [sprHorizontL, sprHorizontR, sprSkyL, sprSkyR] then // FIXME: hack
-                    tmpsurf:= LoadImage(Pathz[Path] + '/' + FileName, ifAlpha or ifTransparent or ifLowRes)
+                    tmpsurf:= LoadImage(Pathz[Path] + '/' + FileName, ifAlpha or ifTransparent)
                 else
-                    tmpsurf:= LoadImage(Pathz[Path] + '/' + FileName, ifAlpha or ifTransparent or ifCritical or ifLowRes)
+                    tmpsurf:= LoadImage(Pathz[Path] + '/' + FileName, ifAlpha or ifTransparent or ifCritical)
             else begin
                 tmpsurf:= LoadImage(Pathz[Path] + '/' + FileName, ifAlpha or ifTransparent);
                 if tmpsurf = nil then
@@ -411,7 +411,10 @@
                 if Width = 0 then Width:= tmpsurf^.w;
                 if Height = 0 then Height:= tmpsurf^.h;
                 if (ii in [sprSky, sprSkyL, sprSkyR, sprHorizont, sprHorizontL, sprHorizontR]) then
-                    Texture:= Surface2Tex(tmpsurf, true)
+                    begin
+                    Texture:= Surface2Tex(tmpsurf, true);
+                    Texture^.Scale:= 2
+                    end
                 else
                     begin
                     Texture:= Surface2Tex(tmpsurf, false);
@@ -1089,7 +1092,6 @@
         if (imageFlags and ifCritical) <> 0 then WriteToConsole(' Critical');
         if (imageFlags and ifTransparent) <> 0 then WriteToConsole(' Transparent');
         if (imageFlags and ifIgnoreCaps) <> 0 then WriteToConsole(' IgnoreCaps');
-        if (imageFlags and ifLowRes) <> 0 then WriteToConsole(' LowRes');
         end;
     WriteToConsole('] ');
 {$ENDIF}
@@ -1097,29 +1099,6 @@
     s:= filename + '.png';
     tmpsurf:= IMG_Load(Str2PChar(s));
 
-    if (imageFlags and ifLowRes) <> 0 then
-    begin
-        s:= filename + '-lowres.png';
-        if (tmpsurf <> nil) then
-        begin
-            if ((tmpsurf^.w > MaxTextureSize) or (tmpsurf^.h > MaxTextureSize)) then
-            begin
-                SDL_FreeSurface(tmpsurf);
-                {$IFDEF DEBUGFILE}
-                AddFileLog('...image too big, trying to load lowres version: ' + s + '...');
-                {$ENDIF}
-                tmpsurf:= IMG_Load(Str2PChar(s))
-            end;
-        end
-        else
-        begin
-            {$IFDEF DEBUGFILE}
-            AddFileLog('...image not found, trying to load lowres version: ' + s + '...');
-            {$ENDIF}
-            tmpsurf:= IMG_Load(Str2PChar(s))
-        end;
-    end;
-
     if tmpsurf = nil then
     begin
         OutError(msgFailed, (imageFlags and ifCritical) <> 0);
--- a/hedgewars/uWorld.pas	Wed Jun 23 22:25:26 2010 +0400
+++ b/hedgewars/uWorld.pas	Wed Jun 23 21:39:14 2010 +0200
@@ -486,38 +486,44 @@
 end;
 
 procedure DrawRepeated(spr, sprL, sprR: TSprite; Shift, OffsetY: LongInt);
-var i, w, sw: LongInt;
+var i, w, h, lw, lh, rw, rh, sw: LongInt;
 begin
     sw:= round(cScreenWidth / cScaleFactor);
     if (SpritesData[sprL].Texture = nil) or (SpritesData[sprR].Texture = nil) then
     begin
-        w:= SpritesData[spr].Width;
+        w:= SpritesData[spr].Width * SpritesData[spr].Texture^.Scale;
+        h:= SpritesData[spr].Height * SpritesData[spr].Texture^.Scale;
         i:= Shift mod w;
         if i > 0 then dec(i, w);
         dec(i, w * (sw div w + 1));
         repeat
-            DrawSprite(spr, i, WorldDy + LAND_HEIGHT + OffsetY - SpritesData[spr].Height, 0);
+            DrawTexture(i, WorldDy + LAND_HEIGHT + OffsetY - h, SpritesData[spr].Texture, SpritesData[spr].Texture^.Scale);
             inc(i, w)
         until i > sw
     end
     else
     begin
-        w:= SpritesData[spr].Width;
+        w:= SpritesData[spr].Width * SpritesData[spr].Texture^.Scale;
+        h:= SpritesData[spr].Height * SpritesData[spr].Texture^.Scale;
+        lw:= SpritesData[sprL].Width * SpritesData[spr].Texture^.Scale;
+        lh:= SpritesData[sprL].Height * SpritesData[spr].Texture^.Scale;
+        rw:= SpritesData[sprR].Width * SpritesData[spr].Texture^.Scale;
+        rh:= SpritesData[sprR].Height * SpritesData[spr].Texture^.Scale;
         dec(Shift, w div 2);
-        DrawSprite(spr, Shift, WorldDy + LAND_HEIGHT + OffsetY - SpritesData[spr].Height, 0);
+        DrawTexture(Shift, WorldDy + LAND_HEIGHT + OffsetY - h, SpritesData[spr].Texture, SpritesData[spr].Texture^.Scale);
     
-        i:= Shift - SpritesData[sprL].Width;
-        while i >= -sw - SpritesData[sprL].Width do
+        i:= Shift - lw;
+        while i >= -sw - lw do
         begin
-            DrawSprite(sprL, i, WorldDy + LAND_HEIGHT + OffsetY - SpritesData[sprL].Height, 0);
-            dec(i, SpritesData[sprL].Width);
+            DrawTexture(i, WorldDy + LAND_HEIGHT + OffsetY - lh, SpritesData[sprL].Texture, SpritesData[sprL].Texture^.Scale);
+            dec(i, lw);
         end;
         
         i:= Shift + w;
         while i <= sw do
         begin
-            DrawSprite(sprR, i, WorldDy + LAND_HEIGHT + OffsetY - SpritesData[sprR].Height, 0);
-            inc(i, SpritesData[sprR].Width)
+            DrawTexture(i, WorldDy + LAND_HEIGHT + OffsetY - rh, SpritesData[sprR].Texture, SpritesData[sprR].Texture^.Scale);
+            inc(i, rw)
         end
     end
 end;
--- a/project_files/HedgewarsMobile/Classes/DetailViewController.h	Wed Jun 23 22:25:26 2010 +0400
+++ b/project_files/HedgewarsMobile/Classes/DetailViewController.h	Wed Jun 23 21:39:14 2010 +0200
@@ -13,11 +13,7 @@
 @class WeaponSettingsViewController;
 @class SchemeSettingsViewController;
 
-@interface DetailViewController : UITableViewController
-#if __IPHONE_3_2
-<UISplitViewControllerDelegate, UIPopoverControllerDelegate>
-#endif
-{
+@interface DetailViewController : UITableViewController <UISplitViewControllerDelegate, UIPopoverControllerDelegate> {
     NSArray *controllerNames;
     
     GeneralSettingsViewController *generalSettingsViewController;
--- a/project_files/HedgewarsMobile/Classes/DetailViewController.m	Wed Jun 23 22:25:26 2010 +0400
+++ b/project_files/HedgewarsMobile/Classes/DetailViewController.m	Wed Jun 23 21:39:14 2010 +0200
@@ -128,7 +128,6 @@
     [[NSNotificationCenter defaultCenter] postNotificationName:@"dismissModalView" object:nil];
 }
 
-#if __IPHONE_3_2
 #pragma mark -
 #pragma mark splitview support
 -(void) splitViewController:(UISplitViewController *)svc popoverController:(UIPopoverController *)pc willPresentViewController:(UIViewController *)aViewController {
@@ -170,7 +169,6 @@
         self.navigationItem.rightBarButtonItem = nil;
 
 }
-#endif
 
 -(void) didReceiveMemoryWarning {
     // Releases the view if it doesn't have a superview.
--- a/project_files/HedgewarsMobile/Classes/GameSetup.m	Wed Jun 23 22:25:26 2010 +0400
+++ b/project_files/HedgewarsMobile/Classes/GameSetup.m	Wed Jun 23 21:39:14 2010 +0200
@@ -286,9 +286,6 @@
 				
 				// seed info
 				[self sendToEngine:[self.gameConfig objectForKey:@"seed_command"]];
-				
-                // scheme (returns initial health)
-                NSInteger health = [self provideScheme:[self.gameConfig objectForKey:@"scheme"]];
 
 				// dimension of the map
 				[self sendToEngine:[self.gameConfig objectForKey:@"templatefilter_command"]];
@@ -298,6 +295,9 @@
 				// theme info
 				[self sendToEngine:[self.gameConfig objectForKey:@"theme_command"]];
 				
+                // scheme (returns initial health)
+                NSInteger health = [self provideScheme:[self.gameConfig objectForKey:@"scheme"]];
+                
                 NSArray *teamsConfig = [self.gameConfig objectForKey:@"teams_list"];
                 for (NSDictionary *teamData in teamsConfig) {
                     [self provideTeamData:[teamData objectForKey:@"team"] 
--- a/project_files/HedgewarsMobile/Classes/MainMenuViewController.m	Wed Jun 23 22:25:26 2010 +0400
+++ b/project_files/HedgewarsMobile/Classes/MainMenuViewController.m	Wed Jun 23 21:39:14 2010 +0200
@@ -106,11 +106,10 @@
     switch (button.tag) {
         case 0:
             gameConfigViewController = [[GameConfigViewController alloc] initWithNibName:@"GameConfigViewController" bundle:nil];        
-#ifdef __IPHONE_3_2
+
             // bug in UIModalTransitionStylePartialCurl, displays the controller awkwardly if it is not allocated every time            
             if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad)
                 gameConfigViewController.modalTransitionStyle = UIModalTransitionStylePartialCurl;
-#endif
             [self presentModalViewController:gameConfigViewController animated:YES];
             break;
         case 2:
--- a/project_files/HedgewarsMobile/Classes/OverlayViewController.h	Wed Jun 23 22:25:26 2010 +0400
+++ b/project_files/HedgewarsMobile/Classes/OverlayViewController.h	Wed Jun 23 21:39:14 2010 +0200
@@ -12,11 +12,10 @@
 
 @interface OverlayViewController : UIViewController {
     NSTimer *dimTimer;
-#if __IPHONE_3_2
+
+    // used only on the ipad
     UIPopoverController *popoverController;
-#else
-    id popoverController;
-#endif
+
     PopoverMenuViewController *popupMenu;
     BOOL isPopoverVisible;
     
--- a/project_files/HedgewarsMobile/Classes/OverlayViewController.m	Wed Jun 23 22:25:26 2010 +0400
+++ b/project_files/HedgewarsMobile/Classes/OverlayViewController.m	Wed Jun 23 21:39:14 2010 +0200
@@ -243,15 +243,16 @@
 -(IBAction) showPopover{
     isPopoverVisible = YES;
     CGRect anchorForPopover;
-    Class popoverControllerClass = NSClassFromString(@"UIPopoverController");
-    if (popoverControllerClass) {
-#if __IPHONE_3_2
+
+    if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) {
         if (popupMenu == nil) 
             popupMenu = [[PopoverMenuViewController alloc] initWithStyle:UITableViewStylePlain];
-        popoverController = [[popoverControllerClass alloc] initWithContentViewController:popupMenu];
-        [popoverController setPopoverContentSize:CGSizeMake(220, 170) animated:YES];
-        [popoverController setPassthroughViews:[NSArray arrayWithObject:self.view]];
-
+        if (popoverController == nil) {
+            popoverController = [[UIPopoverController alloc] initWithContentViewController:popupMenu];
+            [popoverController setPopoverContentSize:CGSizeMake(220, 170) animated:YES];
+            [popoverController setPassthroughViews:[NSArray arrayWithObject:self.view]];
+        }
+        
         if (UIDeviceOrientationIsLandscape([[UIDevice currentDevice] orientation]))
             anchorForPopover = CGRectMake(960, 0, 220, 32);
         else
@@ -261,14 +262,14 @@
                                            inView:self.view
                          permittedArrowDirections:UIPopoverArrowDirectionUp
                                          animated:YES];
-#endif
     } else {
-        if (popupMenu == nil) 
+        if (popupMenu == nil) {
             popupMenu = [[PopoverMenuViewController alloc] initWithStyle:UITableViewStyleGrouped];
-        popupMenu.view.backgroundColor = [UIColor clearColor];
-        popupMenu.view.frame = CGRectMake(480, 0, 200, 170);
+            popupMenu.view.backgroundColor = [UIColor clearColor];
+            popupMenu.view.frame = CGRectMake(480, 0, 200, 170);
+        }
         [self.view addSubview:popupMenu.view];
-
+        
         [UIView beginAnimations:@"showing popover" context:NULL];
         [UIView setAnimationDuration:0.35];
         popupMenu.view.frame = CGRectMake(280, 0, 200, 170);
@@ -283,9 +284,7 @@
         isPopoverVisible = NO;
         
         if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) {
-#if __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_3_2
             [popoverController dismissPopoverAnimated:YES];
-#endif
         } else {
             [UIView beginAnimations:@"hiding popover" context:NULL];
             [UIView setAnimationDuration:0.35];
@@ -293,7 +292,6 @@
             [UIView commitAnimations];
         
             [popupMenu.view performSelector:@selector(removeFromSuperview) withObject:nil afterDelay:0.35];
-            [popupMenu performSelector:@selector(release) withObject:nil afterDelay:0.35];
         }
         [self buttonReleased:nil];
     }
@@ -400,7 +398,7 @@
 			
             // the two ifs are not mutually exclusive
             if (deltaX >= minimumGestureLength) {
-                Dlog(@"deltaX: %f deltaY: %f", deltaX, deltaY);
+                DLog(@"deltaX: %f deltaY: %f", deltaX, deltaY);
                 if (currentPosition.x > gestureStartPoint.x) {
                     HW_cursorLeft(logCoeff*log(deltaX));
                 } else {
--- a/project_files/HedgewarsMobile/Classes/PopoverMenuViewController.m	Wed Jun 23 22:25:26 2010 +0400
+++ b/project_files/HedgewarsMobile/Classes/PopoverMenuViewController.m	Wed Jun 23 21:39:14 2010 +0200
@@ -29,15 +29,19 @@
 -(void) viewDidLoad {
     isPaused = NO;
 
-    menuList = [[NSArray alloc] initWithObjects:
-                NSLocalizedString(@"Pause Game", @""),
-                NSLocalizedString(@"Chat", @""),
-                NSLocalizedString(@"End Game", @""),
-                nil];
+    NSArray *array = [[NSArray alloc] initWithObjects:
+                      NSLocalizedString(@"Pause Game", @""),
+                      NSLocalizedString(@"Chat", @""),
+                      NSLocalizedString(@"End Game", @""),
+                      nil];
+    self.menuList = array;
+    [array release];
+    
     [super viewDidLoad];
 }
 
 -(void) viewDidUnload {
+    self.menuList = nil;
     [super viewDidUnload];
     MSG_DIDUNLOAD();
 }
--- a/project_files/HedgewarsMobile/Classes/SplitViewRootController.m	Wed Jun 23 22:25:26 2010 +0400
+++ b/project_files/HedgewarsMobile/Classes/SplitViewRootController.m	Wed Jun 23 21:39:14 2010 +0200
@@ -38,9 +38,7 @@
     if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad)
         self.view.frame = CGRectMake(0, 0, rect.size.height, rect.size.width);
         
-    Class splitViewControllerClass = NSClassFromString(@"UISplitViewController");
-    if (splitViewControllerClass) {
-#if __IPHONE_3_2
+    if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) {
         UISplitViewController *splitViewRootController = [[UISplitViewController alloc] init];
         //splitViewRootController.view.autoresizingMask = UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleWidth;        
         splitViewRootController.view.frame = CGRectMake(0, 0, rect.size.height, rect.size.width);
@@ -57,7 +55,6 @@
         
         // add view to main controller
         [self.view addSubview:splitViewRootController.view];
-#endif
     } else {
         [self.view addSubview:detailedNavController.view];
     }
--- a/project_files/HedgewarsMobile/Classes/otherSrc/SDL_uikitappdelegate.m	Wed Jun 23 22:25:26 2010 +0400
+++ b/project_files/HedgewarsMobile/Classes/otherSrc/SDL_uikitappdelegate.m	Wed Jun 23 21:39:14 2010 +0200
@@ -93,7 +93,7 @@
 	[setup release];
 
     // since the sdlwindow is not yet created, we add the overlayController with a delay
-    [self performSelector:@selector(displayOverlayLater) withObject:nil afterDelay:1];
+    [self performSelector:@selector(displayOverlayLater) withObject:nil afterDelay:0.5];
     
     // this is the pascal fuction that starts the game (wrapped around isInGame)
     isInGame = YES;
--- a/project_files/HedgewarsMobile/Classes/otherSrc/SquareButtonView.m	Wed Jun 23 22:25:26 2010 +0400
+++ b/project_files/HedgewarsMobile/Classes/otherSrc/SquareButtonView.m	Wed Jun 23 21:39:14 2010 +0200
@@ -33,25 +33,28 @@
         // set the color to the first available one
         [self nextColor];
         
-        // this makes the button round and nice
+        // this makes the button round and nice with a border
         [self.layer setCornerRadius:7.0f];
         [self.layer setMasksToBounds:YES];        
+        [self.layer setBorderWidth:2];
         
         // this changes the color at button press
         [self addTarget:self action:@selector(nextColor) forControlEvents:UIControlEventTouchUpInside];
-
-        self.backgroundColor = [UIColor blackColor];
     }
     return self;
 }
 
 -(void) nextColor {
     colorIndex++;
+
     if (colorIndex >= [colorArray count])
         colorIndex = 0;
 
     NSUInteger color = [[self.colorArray objectAtIndex:colorIndex] unsignedIntValue];
-    [self selectColor:color];
+    self.backgroundColor = [UIColor colorWithRed:((color & 0x00FF0000) >> 16)/255.0f 
+                                           green:((color & 0x0000FF00) >> 8)/255.0f 
+                                            blue: (color & 0x000000FF)/255.0f 
+                                           alpha:1.0f];
     
     [ownerDictionary setObject:[NSNumber numberWithInt:color] forKey:@"color"];
 }
@@ -59,28 +62,13 @@
 -(void) selectColor:(NSUInteger) color {
     if (color != selectedColor) {
         selectedColor = color;
-        
-        UIGraphicsBeginImageContext(self.frame.size);	
-        CGContextRef context = UIGraphicsGetCurrentContext();
-        CGContextSetRGBFillColor(context, ((color & 0x00FF0000) >> 16)/255.0f,
-                                          ((color & 0x0000FF00) >> 8)/255.0f,
-                                           (color & 0x000000FF)/255.0f,
-                                            1.0f);
-        CGContextFillRect(context, CGRectMake(1.1, 1.1, self.frame.size.width-2.2, self.frame.size.height-2.2));
+        colorIndex = [colorArray indexOfObject:[NSNumber numberWithUnsignedInt:color]];
         
-        UIImageView *resultingImage = [[UIImageView alloc] initWithImage: UIGraphicsGetImageFromCurrentImageContext()];
-        UIGraphicsEndImageContext();
-        
-        [self setImage:resultingImage.image forState:UIControlStateNormal];
-        [resultingImage release];
-        
+        self.backgroundColor = [UIColor colorWithRed:((color & 0x00FF0000) >> 16)/255.0f 
+                                               green:((color & 0x0000FF00) >> 8)/255.0f 
+                                                blue: (color & 0x000000FF)/255.0f 
+                                               alpha:1.0f];
     }
-    /*  
-    self.backgroundColor = [UIColor colorWithRed:((color & 0x00FF0000) >> 16)/255.0f 
-                                           green:((color & 0x0000FF00) >> 8)/255.0f 
-                                            blue: (color & 0x000000FF)/255.0f 
-                                           alpha:1.0f];
-    */
 }
 
 -(void) dealloc {
Binary file share/hedgewars/Data/Themes/Art/Sky-lowres.png has changed
Binary file share/hedgewars/Data/Themes/Art/Sky.png has changed
Binary file share/hedgewars/Data/Themes/Art/horizont-lowres.png has changed
Binary file share/hedgewars/Data/Themes/Art/horizont.png has changed
Binary file share/hedgewars/Data/Themes/Bamboo/Sky-lowres.png has changed
Binary file share/hedgewars/Data/Themes/Bamboo/Sky.png has changed
Binary file share/hedgewars/Data/Themes/Bamboo/SkyL.png has changed
Binary file share/hedgewars/Data/Themes/Bamboo/SkyR.png has changed
Binary file share/hedgewars/Data/Themes/Bamboo/horizont-lowres.png has changed
Binary file share/hedgewars/Data/Themes/Bamboo/horizont.png has changed
Binary file share/hedgewars/Data/Themes/Bath/Sky-lowres.png has changed
Binary file share/hedgewars/Data/Themes/Bath/Sky.png has changed
Binary file share/hedgewars/Data/Themes/Bath/horizont-lowres.png has changed
Binary file share/hedgewars/Data/Themes/Bath/horizont.png has changed
Binary file share/hedgewars/Data/Themes/Bath/horizontL.png has changed
Binary file share/hedgewars/Data/Themes/Bath/horizontR.png has changed
Binary file share/hedgewars/Data/Themes/Blox/Sky.png has changed
Binary file share/hedgewars/Data/Themes/Blox/horizont-lowres.png has changed
Binary file share/hedgewars/Data/Themes/Blox/horizont.png has changed
Binary file share/hedgewars/Data/Themes/Brick/Sky.png has changed
Binary file share/hedgewars/Data/Themes/Brick/horizont.png has changed
Binary file share/hedgewars/Data/Themes/Cake/Sky.png has changed
Binary file share/hedgewars/Data/Themes/Cake/horizont.png has changed
Binary file share/hedgewars/Data/Themes/Castle/Sky-lowres.png has changed
Binary file share/hedgewars/Data/Themes/Castle/Sky.png has changed
Binary file share/hedgewars/Data/Themes/Castle/SkyL.png has changed
Binary file share/hedgewars/Data/Themes/Castle/SkyR.png has changed
Binary file share/hedgewars/Data/Themes/Castle/horizont-lowres.png has changed
Binary file share/hedgewars/Data/Themes/Castle/horizont.png has changed
Binary file share/hedgewars/Data/Themes/Cheese/Sky.png has changed
Binary file share/hedgewars/Data/Themes/Cheese/horizont.png has changed
Binary file share/hedgewars/Data/Themes/City/Sky-lowres.png has changed
Binary file share/hedgewars/Data/Themes/City/Sky.png has changed
Binary file share/hedgewars/Data/Themes/City/horizont-lowres.png has changed
Binary file share/hedgewars/Data/Themes/City/horizont.png has changed
Binary file share/hedgewars/Data/Themes/Compost/Sky-lowres.png has changed
Binary file share/hedgewars/Data/Themes/Compost/Sky.png has changed
Binary file share/hedgewars/Data/Themes/Compost/horizont-lowres.png has changed
Binary file share/hedgewars/Data/Themes/Compost/horizont.png has changed
Binary file share/hedgewars/Data/Themes/CrazyMission/Sky-lowres.png has changed
Binary file share/hedgewars/Data/Themes/CrazyMission/Sky.png has changed
Binary file share/hedgewars/Data/Themes/CrazyMission/SkyL.png has changed
Binary file share/hedgewars/Data/Themes/CrazyMission/SkyR.png has changed
Binary file share/hedgewars/Data/Themes/CrazyMission/horizont-lowres.png has changed
Binary file share/hedgewars/Data/Themes/CrazyMission/horizont.png has changed
Binary file share/hedgewars/Data/Themes/Deepspace/Sky.png has changed
Binary file share/hedgewars/Data/Themes/Deepspace/horizont.png has changed
Binary file share/hedgewars/Data/Themes/Desert/Sky-lowres.png has changed
Binary file share/hedgewars/Data/Themes/Desert/Sky.png has changed
Binary file share/hedgewars/Data/Themes/Desert/horizont-lowres.png has changed
Binary file share/hedgewars/Data/Themes/Desert/horizont.png has changed
Binary file share/hedgewars/Data/Themes/EarthRise/Sky-lowres.png has changed
Binary file share/hedgewars/Data/Themes/EarthRise/Sky.png has changed
Binary file share/hedgewars/Data/Themes/EarthRise/SkyL.png has changed
Binary file share/hedgewars/Data/Themes/EarthRise/SkyR.png has changed
Binary file share/hedgewars/Data/Themes/EarthRise/horizont-lowres.png has changed
Binary file share/hedgewars/Data/Themes/EarthRise/horizont.png has changed
Binary file share/hedgewars/Data/Themes/EarthRise/horizontL.png has changed
Binary file share/hedgewars/Data/Themes/EarthRise/horizontR.png has changed
Binary file share/hedgewars/Data/Themes/Eyes/Sky-lowres.png has changed
Binary file share/hedgewars/Data/Themes/Eyes/Sky.png has changed
Binary file share/hedgewars/Data/Themes/Eyes/horizont-lowres.png has changed
Binary file share/hedgewars/Data/Themes/Eyes/horizont.png has changed
Binary file share/hedgewars/Data/Themes/Freeway/Sky-lowres.png has changed
Binary file share/hedgewars/Data/Themes/Freeway/Sky.png has changed
Binary file share/hedgewars/Data/Themes/Freeway/horizont-lowres.png has changed
Binary file share/hedgewars/Data/Themes/Freeway/horizont.png has changed
Binary file share/hedgewars/Data/Themes/Halloween/Sky-lowres.png has changed
Binary file share/hedgewars/Data/Themes/Halloween/Sky.png has changed
Binary file share/hedgewars/Data/Themes/Halloween/SkyL.png has changed
Binary file share/hedgewars/Data/Themes/Halloween/SkyR.png has changed
Binary file share/hedgewars/Data/Themes/Halloween/horizont.png has changed
Binary file share/hedgewars/Data/Themes/Hell/Sky.png has changed
Binary file share/hedgewars/Data/Themes/Hell/horizont-lowres.png has changed
Binary file share/hedgewars/Data/Themes/Hell/horizont.png has changed
Binary file share/hedgewars/Data/Themes/Island/Sky-lowres.png has changed
Binary file share/hedgewars/Data/Themes/Island/Sky.png has changed
Binary file share/hedgewars/Data/Themes/Island/horizont-lowres.png has changed
Binary file share/hedgewars/Data/Themes/Island/horizont.png has changed
Binary file share/hedgewars/Data/Themes/Nature/Sky-lowres.png has changed
Binary file share/hedgewars/Data/Themes/Nature/Sky.png has changed
Binary file share/hedgewars/Data/Themes/Nature/horizont-lowres.png has changed
Binary file share/hedgewars/Data/Themes/Nature/horizont.png has changed
Binary file share/hedgewars/Data/Themes/Olympics/Sky-lowres.png has changed
Binary file share/hedgewars/Data/Themes/Olympics/Sky.png has changed
Binary file share/hedgewars/Data/Themes/Olympics/horizont-lowres.png has changed
Binary file share/hedgewars/Data/Themes/Olympics/horizont.png has changed
Binary file share/hedgewars/Data/Themes/Planes/Sky.png has changed
Binary file share/hedgewars/Data/Themes/Planes/horizont-lowres.png has changed
Binary file share/hedgewars/Data/Themes/Planes/horizont.png has changed
Binary file share/hedgewars/Data/Themes/Sheep/Sky-lowres.png has changed
Binary file share/hedgewars/Data/Themes/Sheep/Sky.png has changed
Binary file share/hedgewars/Data/Themes/Sheep/horizont-lowres.png has changed
Binary file share/hedgewars/Data/Themes/Sheep/horizont.png has changed
Binary file share/hedgewars/Data/Themes/Snow/Sky.png has changed
Binary file share/hedgewars/Data/Themes/Snow/horizont-lowres.png has changed
Binary file share/hedgewars/Data/Themes/Snow/horizont.png has changed
Binary file share/hedgewars/Data/Themes/Stage/Sky-lowres.png has changed
Binary file share/hedgewars/Data/Themes/Stage/Sky.png has changed
Binary file share/hedgewars/Data/Themes/Stage/SkyL.png has changed
Binary file share/hedgewars/Data/Themes/Stage/SkyR.png has changed
Binary file share/hedgewars/Data/Themes/Stage/horizont-lowres.png has changed
Binary file share/hedgewars/Data/Themes/Stage/horizont.png has changed
Binary file share/hedgewars/Data/Themes/Underwater/Sky-lowres.png has changed
Binary file share/hedgewars/Data/Themes/Underwater/Sky.png has changed
Binary file share/hedgewars/Data/Themes/Underwater/horizont-lowres.png has changed
Binary file share/hedgewars/Data/Themes/Underwater/horizont.png has changed