merge
authorkoda
Wed, 23 Jun 2010 21:18:48 +0200
changeset 3541 f4f90987e0fa
parent 3535 9e78c1f3d8d8 (current diff)
parent 3539 c3d1fccbe0ed (diff)
child 3545 b07ee704f35d
merge
share/hedgewars/Data/Themes/Art/Sky-lowres.png
share/hedgewars/Data/Themes/Art/horizont-lowres.png
share/hedgewars/Data/Themes/Bamboo/Sky-lowres.png
share/hedgewars/Data/Themes/Bamboo/horizont-lowres.png
share/hedgewars/Data/Themes/Bath/Sky-lowres.png
share/hedgewars/Data/Themes/Bath/horizont-lowres.png
share/hedgewars/Data/Themes/Blox/horizont-lowres.png
share/hedgewars/Data/Themes/Castle/Sky-lowres.png
share/hedgewars/Data/Themes/Castle/horizont-lowres.png
share/hedgewars/Data/Themes/City/Sky-lowres.png
share/hedgewars/Data/Themes/City/horizont-lowres.png
share/hedgewars/Data/Themes/Compost/Sky-lowres.png
share/hedgewars/Data/Themes/Compost/horizont-lowres.png
share/hedgewars/Data/Themes/CrazyMission/Sky-lowres.png
share/hedgewars/Data/Themes/CrazyMission/horizont-lowres.png
share/hedgewars/Data/Themes/Desert/Sky-lowres.png
share/hedgewars/Data/Themes/Desert/horizont-lowres.png
share/hedgewars/Data/Themes/EarthRise/Sky-lowres.png
share/hedgewars/Data/Themes/EarthRise/horizont-lowres.png
share/hedgewars/Data/Themes/Eyes/Sky-lowres.png
share/hedgewars/Data/Themes/Eyes/horizont-lowres.png
share/hedgewars/Data/Themes/Freeway/Sky-lowres.png
share/hedgewars/Data/Themes/Freeway/horizont-lowres.png
share/hedgewars/Data/Themes/Halloween/Sky-lowres.png
share/hedgewars/Data/Themes/Hell/horizont-lowres.png
share/hedgewars/Data/Themes/Island/Sky-lowres.png
share/hedgewars/Data/Themes/Island/horizont-lowres.png
share/hedgewars/Data/Themes/Nature/Sky-lowres.png
share/hedgewars/Data/Themes/Nature/horizont-lowres.png
share/hedgewars/Data/Themes/Planes/horizont-lowres.png
share/hedgewars/Data/Themes/Sheep/Sky-lowres.png
share/hedgewars/Data/Themes/Sheep/horizont-lowres.png
share/hedgewars/Data/Themes/Snow/horizont-lowres.png
share/hedgewars/Data/Themes/Stage/Sky-lowres.png
share/hedgewars/Data/Themes/Stage/horizont-lowres.png
share/hedgewars/Data/Themes/Underwater/Sky-lowres.png
share/hedgewars/Data/Themes/Underwater/horizont-lowres.png
--- a/CMakeLists.txt	Wed Jun 23 01:00:52 2010 +0200
+++ b/CMakeLists.txt	Wed Jun 23 21:18:48 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/gameServer/HWProtoLobbyState.hs	Wed Jun 23 01:00:52 2010 +0200
+++ b/gameServer/HWProtoLobbyState.hs	Wed Jun 23 21:18:48 2010 +0200
@@ -74,6 +74,35 @@
 handleCmd_lobby ["CREATE_ROOM", newRoom] =
     handleCmd_lobby ["CREATE_ROOM", newRoom, ""]
 
+
+handleCmd_lobby ["JOIN_ROOM", roomName, roomPassword] = do
+    (ci, irnc) <- ask
+    let ris = allRooms irnc
+    let cl =  irnc `client` ci
+    let maybeRI = find (\ri -> roomName == name (irnc `room` ri)) ris
+    let jRI = fromJust maybeRI
+    let jRoom = irnc `room` jRI
+    let jRoomClients = map (client irnc) $! roomClients irnc jRI -- no lazyness here!
+    return $
+        if isNothing maybeRI then 
+            [Warning "No such rooms"]
+            else if isRestrictedJoins jRoom then
+            [Warning "Joining restricted"]
+            else if roomPassword /= password jRoom then
+            [Warning "Wrong password"]
+            else
+            [
+                MoveToRoom jRI,
+                AnswerClients (map sendChan $ cl : jRoomClients) ["NOT_READY", nick cl]
+            ]
+            ++ [ AnswerClients [sendChan cl] $ "JOINED" : map nick jRoomClients | playersIn jRoom /= 0]
+            ++ (map (readynessMessage cl) jRoomClients)
+
+    where
+        readynessMessage cl c = AnswerClients [sendChan cl] [if isReady c then "READY" else "NOT_READY", nick c]
+
+
+
 {-
 
 handleCmd_lobby clID clients rooms ["JOIN_ROOM", roomName, roomPassword]
@@ -90,12 +119,6 @@
         ++ answerTeams
         ++ watchRound
     where
-        noSuchRoom = isNothing mbRoom
-        mbRoom = find (\r -> roomName == name r && roomProto r == clientProto client) $ IntMap.elems rooms
-        jRoom = fromJust mbRoom
-        rID = roomUID jRoom
-        client = clients IntMap.! clID
-        roomClientsIDs = IntSet.elems $ playersIDs jRoom
         answerNicks =
             [AnswerThisClient $ "JOINED" :
             map (\clID -> nick $ clients IntMap.! clID) roomClientsIDs | playersIn jRoom /= 0]
@@ -121,12 +144,12 @@
                 answerAllTeams (clientProto client) (teamsAtStart jRoom)
             else
                 answerAllTeams (clientProto client) (teams jRoom)
-
+-}
 
-handleCmd_lobby clID clients rooms ["JOIN_ROOM", roomName] =
-    handleCmd_lobby clID clients rooms ["JOIN_ROOM", roomName, ""]
+handleCmd_lobby ["JOIN_ROOM", roomName] =
+    handleCmd_lobby ["JOIN_ROOM", roomName, ""]
 
-
+{-
 handleCmd_lobby clID clients rooms ["FOLLOW", asknick] =
     if noSuchClient || roomID followClient == 0 then
         []
--- a/gameServer/HWProtoNEState.hs	Wed Jun 23 01:00:52 2010 +0200
+++ b/gameServer/HWProtoNEState.hs	Wed Jun 23 21:18:48 2010 +0200
@@ -31,6 +31,7 @@
     where
         haveSameNick irnc = False --isJust $ find (\cl -> newNick == nick cl) $ IntMap.elems clients
 
+
 handleCmd_NotEntered ["PROTO", protoNum] = do
     (ci, irnc) <- ask
     let cl = irnc `client` ci
@@ -47,18 +48,17 @@
                            Just (i, t) | B.null t -> fromIntegral i
                            otherwise -> 0
 
-{-
+
+handleCmd_NotEntered ["PASSWORD", passwd] = do
+    (ci, irnc) <- ask
+    let cl = irnc `client` ci
 
-handleCmd_NotEntered clID clients _ ["PASSWORD", passwd] =
-    if passwd == webPassword client then
-        [ModifyClient (\cl -> cl{logonPassed = True}),
-        MoveToLobby] ++ adminNotice
-    else
-        [ByeClient "Authentication failed"]
-    where
-        client = clients IntMap.! clID
-        adminNotice = [AnswerThisClient ["ADMIN_ACCESS"] | isAdministrator client]
+    if passwd == webPassword cl then
+        return $ JoinLobby : [AnswerClients [sendChan cl] ["ADMIN_ACCESS"] | isAdministrator cl]
+        else
+        return [ByeClient "Authentication failed"]
 
+{-
 
 handleCmd_NotEntered clID clients _ ["DUMP"] =
     if isAdministrator (clients IntMap.! clID) then [Dump] else []
--- a/hedgewars/CMakeLists.txt	Wed Jun 23 01:00:52 2010 +0200
+++ b/hedgewars/CMakeLists.txt	Wed Jun 23 21:18:48 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 01:00:52 2010 +0200
+++ b/hedgewars/uChat.pas	Wed Jun 23 21:18:48 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 01:00:52 2010 +0200
+++ b/hedgewars/uConsts.pas	Wed Jun 23 21:18:48 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 01:00:52 2010 +0200
+++ b/hedgewars/uMisc.pas	Wed Jun 23 21:18:48 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 01:00:52 2010 +0200
+++ b/hedgewars/uScript.pas	Wed Jun 23 21:18:48 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 01:00:52 2010 +0200
+++ b/hedgewars/uStore.pas	Wed Jun 23 21:18:48 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 01:00:52 2010 +0200
+++ b/hedgewars/uWorld.pas	Wed Jun 23 21:18:48 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;
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.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