diff -r 8ca19b467e2f -r 54db061b5710 hedgewars/uRenderUtils.pas --- a/hedgewars/uRenderUtils.pas Thu May 03 00:21:17 2012 -0400 +++ b/hedgewars/uRenderUtils.pas Thu May 03 12:21:16 2012 +0400 @@ -27,15 +27,15 @@ procedure copyRotatedSurface(src, dest: PSDL_Surface); // this is necessary since width/height are read only in SDL procedure copyToXY(src, dest: PSDL_Surface; destX, destY: LongInt); inline; -procedure copyToXY(src, dest: PSDL_Surface; srcX, srcY, srcW, srcH, destX, destY: LongInt); +procedure copyToXYFromRect(src, dest: PSDL_Surface; srcX, srcY, srcW, srcH, destX, destY: LongInt); procedure DrawSprite2Surf(sprite: TSprite; dest: PSDL_Surface; x,y: LongInt); inline; -procedure DrawSprite2Surf(sprite: TSprite; dest: PSDL_Surface; x,y: LongInt; frame: LongInt); +procedure DrawSpriteFrame2Surf(sprite: TSprite; dest: PSDL_Surface; x,y: LongInt; frame: LongInt); procedure DrawLine2Surf(dest: PSDL_Surface; x0,y0,x1,y1:LongInt; r,g,b: byte); procedure DrawRoundRect(rect: PSDL_Rect; BorderColor, FillColor: Longword; Surface: PSDL_Surface; Clear: boolean); function RenderStringTex(s: ansistring; Color: Longword; font: THWFont): PTexture; -function RenderStringTex(s: ansistring; Color: Longword; font: THWFont; maxLength: LongWord): PTexture; +function RenderStringTexLim(s: ansistring; Color: Longword; font: THWFont; maxLength: LongWord): PTexture; function RenderSpeechBubbleTex(s: ansistring; SpeechType: Longword; font: THWFont): PTexture; implementation @@ -140,10 +140,10 @@ procedure copyToXY(src, dest: PSDL_Surface; destX, destY: LongInt); inline; begin - copyToXY(src, dest, 0, 0, src^.w, src^.h, destX, destY); + copyToXYFromRect(src, dest, 0, 0, src^.w, src^.h, destX, destY); end; -procedure copyToXY(src, dest: PSDL_Surface; srcX, srcY, srcW, srcH, destX, destY: LongInt); +procedure copyToXYFromRect(src, dest: PSDL_Surface; srcX, srcY, srcW, srcH, destX, destY: LongInt); var i, j, maxDest, maxSrc, iX, iY: LongInt; srcPixels, destPixels: PLongWordArray; r0, g0, b0, a0, r1, g1, b1, a1: Byte; @@ -173,17 +173,17 @@ procedure DrawSprite2Surf(sprite: TSprite; dest: PSDL_Surface; x,y: LongInt); inline; begin - DrawSprite2Surf(sprite, dest, x, y, 0); + DrawSpriteFrame2Surf(sprite, dest, x, y, 0); end; -procedure DrawSprite2Surf(sprite: TSprite; dest: PSDL_Surface; x,y,frame: LongInt); +procedure DrawSpriteFrame2Surf(sprite: TSprite; dest: PSDL_Surface; x,y,frame: LongInt); var numFramesFirstCol, row, col: LongInt; begin numFramesFirstCol:= SpritesData[sprite].imageHeight div SpritesData[sprite].Height; row:= Frame mod numFramesFirstCol; col:= Frame div numFramesFirstCol; - copyToXY(SpritesData[sprite].Surface, dest, + copyToXYFromRect(SpritesData[sprite].Surface, dest, col*SpritesData[sprite].Width, row*SpritesData[sprite].Height, SpritesData[sprite].Width, @@ -250,10 +250,10 @@ function RenderStringTex(s: ansistring; Color: Longword; font: THWFont): PTexture; begin - RenderStringTex:= RenderStringTex(s, Color, font, 0); + RenderStringTex:= RenderStringTexLim(s, Color, font, 0); end; -function RenderStringTex(s: ansistring; Color: Longword; font: THWFont; maxLength: LongWord): PTexture; +function RenderStringTexLim(s: ansistring; Color: Longword; font: THWFont; maxLength: LongWord): PTexture; var w, h: LongInt; finalSurface: PSDL_Surface; begin @@ -272,7 +272,7 @@ TryDo(SDL_SetColorKey(finalSurface, SDL_SRCCOLORKEY, 0) = 0, errmsgTransparentSet, true); - RenderStringTex:= Surface2Tex(finalSurface, false); + RenderStringTexLim:= Surface2Tex(finalSurface, false); SDL_FreeSurface(finalSurface); end;