# HG changeset patch # User koda # Date 1261661900 0 # Node ID 1b327b7515ed77549a6ce5512215244787f4db99 # Parent 4eec706e86b0289a2e3db3a2989e2a06002e4f61 regression, powerpc colors working again diff -r 4eec706e86b0 -r 1b327b7515ed hedgewars/uMisc.pas --- a/hedgewars/uMisc.pas Thu Dec 24 02:02:12 2009 +0000 +++ b/hedgewars/uMisc.pas Thu Dec 24 13:38:20 2009 +0000 @@ -169,8 +169,9 @@ function Surface2Tex(surf: PSDL_Surface; enableClamp: boolean): PTexture; procedure FreeTexture(tex: PTexture); function toPowerOf2(i: Longword): Longword; -function DecodeBase64(s: shortstring): shortstring; -function doSurfaceConversion(tmpsurf: PSDL_Surface): PSDL_Surface; +function DecodeBase64(s: shortstring): shortstring; +function doSurfaceConversion(tmpsurf: PSDL_Surface): PSDL_Surface; +function endian(independent: LongWord): LongWord; {$IFNDEF IPHONEOS} procedure MakeScreenshot(s: shortstring); {$ENDIF} @@ -560,6 +561,17 @@ else doSurfaceConversion:= tmpsurf; end; +function endian(independent: LongWord): LongWord; +begin +{$IFDEF ENDIAN_LITTLE} +endian:= independent; +{$ELSE} +endian:= (((independent and $FF000000) shr 24) or + ((independent and $00FF0000) shr 8) or + ((independent and $0000FF00) shl 8) or + ((independent and $000000FF) shl 24)) +{$ENDIF} +end; initialization cDrownSpeed.QWordValue:= 257698038;// 0.06 diff -r 4eec706e86b0 -r 1b327b7515ed hedgewars/uStore.pas --- a/hedgewars/uStore.pas Thu Dec 24 02:02:12 2009 +0000 +++ b/hedgewars/uStore.pas Thu Dec 24 13:38:20 2009 +0000 @@ -123,12 +123,11 @@ Result.y:= Y; Result.w:= w + FontBorder * 2 + 4; Result.h:= h + FontBorder * 2; -DrawRoundRect(@Result, cWhiteColor, cNearBlackColorChannels.value, Surface, true); -clr.r:= Color shr 16; +DrawRoundRect(@Result, cWhiteColor, endian(cNearBlackColorChannels.value), Surface, true); +clr.r:= (Color shr 16) and $FF; clr.g:= (Color shr 8) and $FF; clr.b:= Color and $FF; tmpsurf:= TTF_RenderUTF8_Blended(Fontz[Font].Handle, Str2PChar(s), clr); -tmpsurf:= doSurfaceConversion(tmpsurf); Result.x:= X + FontBorder + 2; Result.y:= Y + FontBorder; SDLTry(tmpsurf <> nil, true); @@ -337,17 +336,21 @@ AddProgress; +// name of weapons in ammo menu for ai:= Low(TAmmoType) to High(TAmmoType) do with Ammoz[ai] do begin tmpsurf:= TTF_RenderUTF8_Blended(Fontz[fnt16].Handle, Str2PChar(trAmmo[NameId]), cWhiteColorChannels); + tmpsurf:= doSurfaceConversion(tmpsurf); NameTex:= Surface2Tex(tmpsurf, false); SDL_FreeSurface(tmpsurf) end; +// number of weapons in ammo menu for i:= Low(CountTexz) to High(CountTexz) do begin tmpsurf:= TTF_RenderUTF8_Blended(Fontz[fnt16].Handle, Str2PChar(IntToStr(i) + 'x'), cWhiteColorChannels); + tmpsurf:= doSurfaceConversion(tmpsurf); CountTexz[i]:= Surface2Tex(tmpsurf, false); SDL_FreeSurface(tmpsurf) end; diff -r 4eec706e86b0 -r 1b327b7515ed hedgewars/uWorld.pas --- a/hedgewars/uWorld.pas Thu Dec 24 02:02:12 2009 +0000 +++ b/hedgewars/uWorld.pas Thu Dec 24 13:38:20 2009 +0000 @@ -576,6 +576,7 @@ s:= inttostr(FPS) + ' fps'; if fpsTexture <> nil then FreeTexture(fpsTexture); tmpSurface:= TTF_RenderUTF8_Blended(Fontz[fnt16].Handle, Str2PChar(s), cWhiteColorChannels); + tmpSurface:= doSurfaceConversion(tmpSurface); fpsTexture:= Surface2Tex(tmpSurface, false); SDL_FreeSurface(tmpSurface) end;