From: DeaDDooMER Date: Thu, 16 Feb 2023 16:48:16 +0000 (+0300) Subject: gl: fix draw invalid texture X-Git-Url: http://deadsoftware.ru/gitweb?a=commitdiff_plain;h=92cb2a1c5eab5380829b60c0c65b3e7730d76425;p=d2df-sdl.git gl: fix draw invalid texture --- diff --git a/src/game/renders/opengl/r_map.pas b/src/game/renders/opengl/r_map.pas index 914087d..26a15dc 100644 --- a/src/game/renders/opengl/r_map.pas +++ b/src/game/renders/opengl/r_map.pas @@ -586,24 +586,29 @@ implementation begin ASSERT(p.FCurTexture <= High(p.TextureIDs)); Texture := p.TextureIDs[p.FCurTexture].Texture; + t := nil; + ASSERT(Texture >= -1); ASSERT(Texture <= High(RenTextures)); - t := RenTextures[Texture].tex; - if (RenTextures[Texture].spec = 0) or (t <> nil) then + if Texture >= 0 then begin - count := 0; frame := 0; - if p.AnimTime <= gTime then + t := RenTextures[Texture].tex; + if (RenTextures[Texture].spec = 0) or (t <> nil) then begin - a := RenTextures[Texture].anim; - a.loop := p.AnimLoop; - g_Anim_GetFrameByTime(a, (gTime - p.AnimTime) DIV GAME_TICK, count, frame); + count := 0; frame := 0; + if p.AnimTime <= gTime then + begin + a := RenTextures[Texture].anim; + a.loop := p.AnimLoop; + g_Anim_GetFrameByTime(a, (gTime - p.AnimTime) DIV GAME_TICK, count, frame); + end; + if t <> nil then + begin + tex := t.GetTexture(frame); + r_Draw_TextureRepeat(tex, p.x, p.y, p.width, p.height, false, 255, 255, 255, 255 - p.alpha, p.blending); + end + else + r_Draw_TextureRepeat(nil, p.x, p.y, p.width, p.height, false, 255, 255, 255, 255, false); end; - if t <> nil then - begin - tex := t.GetTexture(frame); - r_Draw_TextureRepeat(tex, p.x, p.y, p.width, p.height, false, 255, 255, 255, 255 - p.alpha, p.blending); - end - else - r_Draw_TextureRepeat(nil, p.x, p.y, p.width, p.height, false, 255, 255, 255, 255, false); end; if t = nil then