diff -r d080fb32d703 -r fef456439238 hedgewars/uTextures.pas --- a/hedgewars/uTextures.pas Wed Jul 27 11:41:43 2011 +0400 +++ b/hedgewars/uTextures.pas Mon Aug 01 10:08:02 2011 +0400 @@ -131,6 +131,24 @@ if SDL_MustLock(surf) then SDLTry(SDL_LockSurface(surf) >= 0, true); +fromP4:= Surf^.pixels; + +if cGrayScale then + for y:= 0 to Pred(Surf^.h) do + begin + for x:= 0 to Pred(Surf^.w) do + begin + tw:= fromP4^[x]; + tw:= round((tw shr RShift and $FF) * RGB_LUMINANCE_RED + + (tw shr GShift and $FF) * RGB_LUMINANCE_GREEN + + (tw shr BShift and $FF) * RGB_LUMINANCE_BLUE); + if tw > 255 then tw:= 255; + tw:= (tw and $FF shl RShift) or (tw and $FF shl BShift) or (tw and $FF shl GShift) or (fromP4^[x] and AMask); + fromP4^[x]:= tw; + end; + fromP4:= @(fromP4^[Surf^.pitch div 4]) + end; + if (not SupportNPOTT) and (not (isPowerOf2(Surf^.w) and isPowerOf2(Surf^.h))) then begin tw:= toPowerOf2(Surf^.w);