From 3e4c594ed4894e6a69897d3c2ac19c878da13280 Mon Sep 17 00:00:00 2001 From: Ketmar Dark Date: Mon, 11 Sep 2017 17:03:29 +0300 Subject: [PATCH] do not bilinear anything except sky --- src/game/g_map.pas | 72 ++++++++++++++++++++---------------------- src/game/g_options.pas | 5 +-- 2 files changed, 36 insertions(+), 41 deletions(-) diff --git a/src/game/g_map.pas b/src/game/g_map.pas index 9c696cb..1b92a96 100644 --- a/src/game/g_map.pas +++ b/src/game/g_map.pas @@ -878,7 +878,6 @@ var TextureData: Pointer; WADName: String; a, ResLength: Integer; - oldFilter: Integer; begin RecName := toLowerCase1251(RecName); if (TextNameHash = nil) then TextNameHash := hashNewStrInt(); @@ -948,38 +947,32 @@ begin end; } - oldFilter := TEXTUREFILTER; - TEXTUREFILTER := GL_NEAREST; - try - if WAD.GetResource(g_ExtractFilePathName(RecName), TextureData, ResLength, log) then + if WAD.GetResource(g_ExtractFilePathName(RecName), TextureData, ResLength, log) then + begin + SetLength(Textures, Length(Textures)+1); + if not e_CreateTextureMem(TextureData, ResLength, Textures[High(Textures)].TextureID) then begin - SetLength(Textures, Length(Textures)+1); - if not e_CreateTextureMem(TextureData, ResLength, Textures[High(Textures)].TextureID) then - begin - SetLength(Textures, Length(Textures)-1); - Exit; - end; - e_GetTextureSize(Textures[High(Textures)].TextureID, @Textures[High(Textures)].Width, @Textures[High(Textures)].Height); - FreeMem(TextureData); - Textures[High(Textures)].TextureName := RecName; - Textures[High(Textures)].Anim := False; + SetLength(Textures, Length(Textures)-1); + Exit; + end; + e_GetTextureSize(Textures[High(Textures)].TextureID, @Textures[High(Textures)].Width, @Textures[High(Textures)].Height); + FreeMem(TextureData); + Textures[High(Textures)].TextureName := RecName; + Textures[High(Textures)].Anim := False; - result := High(Textures); - TextNameHash.put(RecName, result); - end - else // Íåò òàêîãî ðåóñðñà â WAD'å + result := High(Textures); + TextNameHash.put(RecName, result); + end + else // Íåò òàêîãî ðåóñðñà â WAD'å + begin + //e_WriteLog(Format('SHIT! Error loading texture %s : %s', [RecName, g_ExtractFilePathName(RecName)]), MSG_WARNING); + if (BadTextNameHash = nil) then BadTextNameHash := hashNewStrInt(); + if log and (not BadTextNameHash.get(RecName, a)) then begin - //e_WriteLog(Format('SHIT! Error loading texture %s : %s', [RecName, g_ExtractFilePathName(RecName)]), MSG_WARNING); - if (BadTextNameHash = nil) then BadTextNameHash := hashNewStrInt(); - if log and (not BadTextNameHash.get(RecName, a)) then - begin - e_WriteLog(Format('Error loading texture %s', [RecName]), MSG_WARNING); - //e_WriteLog(Format('WAD Reader error: %s', [WAD.GetLastErrorStr]), MSG_WARNING); - end; - BadTextNameHash.put(RecName, -1); + e_WriteLog(Format('Error loading texture %s', [RecName]), MSG_WARNING); + //e_WriteLog(Format('WAD Reader error: %s', [WAD.GetLastErrorStr]), MSG_WARNING); end; - finally - TEXTUREFILTER := oldFilter; + BadTextNameHash.put(RecName, -1); end; WAD.Free(); @@ -2099,14 +2092,19 @@ begin 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 - begin - g_Game_SetupScreenSize(); - end - else - begin - g_FatalError(Format(_lc[I_GAME_ERROR_SKY], [s])); + 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 + begin + g_FatalError(Format(_lc[I_GAME_ERROR_SKY], [s])); + end; + finally + TEXTUREFILTER := GL_NEAREST; end; end; diff --git a/src/game/g_options.pas b/src/game/g_options.pas index 623c10a..13de0c4 100644 --- a/src/game/g_options.pas +++ b/src/game/g_options.pas @@ -529,10 +529,7 @@ begin config.Free(); - if gTextureFilter then - TEXTUREFILTER := GL_LINEAR - else - TEXTUREFILTER := GL_NEAREST; + //if gTextureFilter then TEXTUREFILTER := GL_LINEAR else TEXTUREFILTER := GL_NEAREST; end; procedure g_Options_Write(FileName: String); -- 2.29.2