# HG changeset patch # User unc0rr # Date 1336033276 -14400 # Node ID 54db061b57107ff7c2c529ec7ff817f5fff6910f # Parent 8ca19b467e2f2990af04c66a93860b55308681d0 Get rid of overloaded functions in uRenderUtils 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; diff -r 8ca19b467e2f -r 54db061b5710 hedgewars/uStore.pas --- a/hedgewars/uStore.pas Thu May 03 00:21:17 2012 -0400 +++ b/hedgewars/uStore.pas Thu May 03 12:21:16 2012 +0400 @@ -133,7 +133,7 @@ for t:= 0 to Pred(TeamsCount) do with TeamsArray[t]^ do begin - NameTagTex:= RenderStringTex(TeamName, Clan^.Color, Font, cTeamHealthWidth); + NameTagTex:= RenderStringTexLim(TeamName, Clan^.Color, Font, cTeamHealthWidth); r.w:= cTeamHealthWidth + 5; r.h:= NameTagTex^.h; @@ -199,7 +199,7 @@ with Hedgehogs[i] do if Gear <> nil then begin - NameTagTex:= RenderStringTex(Name, Clan^.Color, fnt16, cTeamHealthWidth); + NameTagTex:= RenderStringTexLim(Name, Clan^.Color, fnt16, cTeamHealthWidth); if Hat <> 'NoHat' then begin if (Length(Hat) > 39) and (Copy(Hat,1,8) = 'Reserved') and (Copy(Hat,9,32) = PlayerHash) then diff -r 8ca19b467e2f -r 54db061b5710 hedgewars/uWorld.pas --- a/hedgewars/uWorld.pas Thu May 03 00:21:17 2012 -0400 +++ b/hedgewars/uWorld.pas Thu May 03 12:21:16 2012 +0400 @@ -447,16 +447,16 @@ AMFrame:= LongInt(Ammo^[i,t].AmmoType) - 1; if STurns >= 0 then //weapon not usable yet, draw grayed out with turns remaining begin - DrawSprite2Surf(sprAMAmmosBW, amSurface, x + AMSlotPadding, + DrawSpriteFrame2Surf(sprAMAmmosBW, amSurface, x + AMSlotPadding, y + AMSlotPadding, AMFrame); if STurns < 100 then - DrawSprite2Surf(sprTurnsLeft, amSurface, - x + AMSlotSize-16, - y + AMSlotSize + 1 - 16, STurns); + DrawSpriteFrame2Surf(sprTurnsLeft, amSurface, + x + AMSlotSize-16, + y + AMSlotSize + 1 - 16, STurns); end else //draw colored version begin - DrawSprite2Surf(sprAMAmmos, amSurface, x + AMSlotPadding, + DrawSpriteFrame2Surf(sprAMAmmos, amSurface, x + AMSlotPadding, y + AMSlotPadding, AMFrame); end; {$IFDEF USE_LANDSCAPE_AMMOMENU} @@ -479,10 +479,10 @@ DrawLine2Surf(amSurface, BORDERSIZE, i * (AMSlotSize+1)+1, AMRect.w + BORDERSIZE, i * (AMSlotSize+1)+1,160,160,160); //draw outer border -DrawSprite2Surf(sprAMCorners, amSurface, 0 , 0 , 0); -DrawSprite2Surf(sprAMCorners, amSurface, AMRect.w + BORDERSIZE, AMRect.y , 1); -DrawSprite2Surf(sprAMCorners, amSurface, AMRect.x , AMRect.h + BORDERSIZE, 2); -DrawSprite2Surf(sprAMCorners, amSurface, AMRect.w + BORDERSIZE, AMRect.h + BORDERSIZE, 3); +DrawSpriteFrame2Surf(sprAMCorners, amSurface, 0 , 0 , 0); +DrawSpriteFrame2Surf(sprAMCorners, amSurface, AMRect.w + BORDERSIZE, AMRect.y , 1); +DrawSpriteFrame2Surf(sprAMCorners, amSurface, AMRect.x , AMRect.h + BORDERSIZE, 2); +DrawSpriteFrame2Surf(sprAMCorners, amSurface, AMRect.w + BORDERSIZE, AMRect.h + BORDERSIZE, 3); for i:=0 to BORDERSIZE-1 do begin