DEADSOFTWARE

do not bilinear anything except sky
[d2df-sdl.git] / src / game / g_map.pas
index bac475b18901716c0c48b4007f0cc24167a60bef..1b92a967f0c31115b5101b3db1be3c003c1ae070 100644 (file)
@@ -242,7 +242,7 @@ var
 implementation
 
 uses
-  e_input, g_main, e_log, SysUtils, g_items, g_gfx, g_console,
+  e_input, g_main, e_log, e_texture, SysUtils, g_items, g_gfx, g_console,
   GL, GLExt, g_weapons, g_game, g_sound, e_sound, CONFIG,
   g_options, g_triggers, g_player,
   Math, g_monsters, g_saveload, g_language, g_netmsg,
@@ -2084,26 +2084,28 @@ begin
     mapReader := nil;
 
     // Çàãðóçêà íåáà
-    if gMapInfo.SkyName <> '' then
+    if (gMapInfo.SkyName <> '') then
     begin
       e_WriteLog('  Loading sky: ' + gMapInfo.SkyName, MSG_NOTIFY);
       g_Game_SetLoadingText(_lc[I_LOAD_SKY], 0, False);
       FileName := g_ExtractWadName(gMapInfo.SkyName);
 
-      if FileName <> '' then
-        FileName := GameDir+'/wads/'+FileName
-      else
-        begin
-          FileName := g_ExtractWadName(Res);
-        end;
+      if (FileName <> '') then FileName := GameDir+'/wads/'+FileName else FileName := g_ExtractWadName(Res);
 
-      s := FileName+':'+g_ExtractFilePathName(gMapInfo.SkyName);
-      if g_Texture_CreateWAD(BackID, s) then
+      if gTextureFilter then TEXTUREFILTER := GL_LINEAR else TEXTUREFILTER := GL_NEAREST;
+      try
+        s := FileName+':'+g_ExtractFilePathName(gMapInfo.SkyName);
+        if g_Texture_CreateWAD(BackID, s) then
         begin
           g_Game_SetupScreenSize();
         end
-      else
-        g_FatalError(Format(_lc[I_GAME_ERROR_SKY], [s]));
+        else
+        begin
+          g_FatalError(Format(_lc[I_GAME_ERROR_SKY], [s]));
+        end;
+      finally
+        TEXTUREFILTER := GL_NEAREST;
+      end;
     end;
 
     // Çàãðóçêà ìóçûêè