diff -r fc52f7c22c9b -r 6155187bf599 hedgewars/uTextures.pas --- a/hedgewars/uTextures.pas Mon Jan 16 10:22:21 2012 +0100 +++ b/hedgewars/uTextures.pas Tue Jan 17 09:01:31 2012 -0500 @@ -39,10 +39,10 @@ procedure SetTextureParameters(enableClamp: Boolean); begin if enableClamp and ((cReducedQuality and rqClampLess) = 0) then - begin + begin glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE) - end; + end; glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR) end; @@ -156,7 +156,8 @@ fromP4:= Surf^.pixels; -if cGrayScale then Surface2GrayScale(Surf); +if cGrayScale then + Surface2GrayScale(Surf); if (not SupportNPOTT) and (not (isPowerOf2(Surf^.w) and isPowerOf2(Surf^.h))) then begin @@ -173,15 +174,18 @@ for y:= 0 to Pred(Surf^.h) do begin - for x:= 0 to Pred(Surf^.w) do toP4^[x]:= fromP4^[x]; - for x:= Surf^.w to Pred(tw) do toP4^[x]:= 0; + for x:= 0 to Pred(Surf^.w) do + toP4^[x]:= fromP4^[x]; + for x:= Surf^.w to Pred(tw) do + toP4^[x]:= 0; toP4:= @(toP4^[tw]); fromP4:= @(fromP4^[Surf^.pitch div 4]) end; for y:= Surf^.h to Pred(th) do begin - for x:= 0 to Pred(tw) do toP4^[x]:= 0; + for x:= 0 to Pred(tw) do + toP4^[x]:= 0; toP4:= @(toP4^[tw]) end; @@ -208,17 +212,17 @@ // if nil is passed nothing is done procedure FreeTexture(tex: PTexture); begin - if tex <> nil then - begin - if tex^.NextTexture <> nil then - tex^.NextTexture^.PrevTexture:= tex^.PrevTexture; - if tex^.PrevTexture <> nil then - tex^.PrevTexture^.NextTexture:= tex^.NextTexture - else - TextureList:= tex^.NextTexture; - glDeleteTextures(1, @tex^.id); - Dispose(tex); - end +if tex <> nil then + begin + if tex^.NextTexture <> nil then + tex^.NextTexture^.PrevTexture:= tex^.PrevTexture; + if tex^.PrevTexture <> nil then + tex^.PrevTexture^.NextTexture:= tex^.NextTexture + else + TextureList:= tex^.NextTexture; + glDeleteTextures(1, @tex^.id); + Dispose(tex); + end end; procedure initModule; @@ -228,7 +232,8 @@ procedure freeModule; begin - if TextureList <> nil then WriteToConsole('FIXME FIXME FIXME. App shutdown without full cleanup of texture list; read game0.log and please report this problem'); +if TextureList <> nil then + WriteToConsole('FIXME FIXME FIXME. App shutdown without full cleanup of texture list; read game0.log and please report this problem'); while TextureList <> nil do begin AddFileLog('Texture not freed: width='+inttostr(LongInt(TextureList^.w))+' height='+inttostr(LongInt(TextureList^.h))+' priority='+inttostr(round(TextureList^.priority*1000)));