Color fixes
authorunc0rr
Thu, 05 Oct 2006 20:07:04 +0000
changeset 189 33d147c69a83
parent 188 a7c2a61524c2
child 190 206aabea2229
Color fixes
hedgewars/CCHandlers.inc
hedgewars/uStore.pas
hedgewars/uTeams.pas
--- a/hedgewars/CCHandlers.inc	Thu Oct 05 19:40:11 2006 +0000
+++ b/hedgewars/CCHandlers.inc	Thu Oct 05 20:07:04 2006 +0000
@@ -86,7 +86,8 @@
 begin
 if CurrentTeam = nil then OutError(errmsgIncorrectUse + ' "/color"', true);
 val(id, CurrentTeam.Color, c);
-AdjustColor(CurrentTeam.Color)
+CurrentTeam.AdjColor:= CurrentTeam.Color;
+AdjustColor(CurrentTeam.AdjColor)
 end;
 
 procedure chAdd(var id: shortstring);
--- a/hedgewars/uStore.pas	Thu Oct 05 19:40:11 2006 +0000
+++ b/hedgewars/uStore.pas	Thu Oct 05 20:07:04 2006 +0000
@@ -104,7 +104,10 @@
 Result.w:= w + 6;
 Result.h:= h + 2;
 DrawRoundRect(@Result, cWhiteColor, cColorNearBlack, Surface);
-SDL_GetRGB(Color, Surface.format, @clr.r, @clr.g, @clr.b);
+clr.r:= Color shr 16;
+clr.g:= (Color shr 8) and $FF;
+clr.b:= Color and $FF;
+clr.a:= 0;
 tmpsurf:= TTF_RenderUTF8_Blended(Fontz[Font].Handle, PChar(s), clr);
 Result.x:= X + 3;
 Result.y:= Y + 1;
@@ -143,7 +146,7 @@
       Team.HealthRect:= r;
       rr:= r;
       inc(rr.x, 2); dec(rr.w, 4); inc(rr.y, 2); dec(rr.h, 4);
-      DrawRoundRect(@rr, Team.Color, Team.Color, StoreSurface, false);
+      DrawRoundRect(@rr, Team.AdjColor, Team.AdjColor, StoreSurface, false);
       inc(r.y, r.h);
       dec(drY, r.h + 2);
       Team.DrawHealthY:= drY;
@@ -174,7 +177,7 @@
     Team:= TeamsList;
     while Team<>nil do
       begin
-      SDL_FillRect(StoreSurface, @r, Team.Color);
+      SDL_FillRect(StoreSurface, @r, Team.AdjColor);
       SDL_UpperBlit(tmpsurf, nil, StoreSurface, @r);
       Team.CrossHairRect:= r;
       inc(r.x, 16);
@@ -376,7 +379,10 @@
 begin
 r.x:= X;
 r.y:= Y;
-SDL_GetRGB(cWhiteColor, PixelFormat, @clr.r, @clr.g, @clr.b);
+clr.r:= $FF;
+clr.g:= $FF;
+clr.b:= $FF;
+clr.a:= 0;
 tmpsurf:= TTF_RenderUTF8_Solid(Fontz[Font].Handle, PChar(s), clr);
 SDL_UpperBlit(tmpsurf, nil, Surface, @r);
 SDL_FreeSurface(tmpsurf)
--- a/hedgewars/uTeams.pas	Thu Oct 05 19:40:11 2006 +0000
+++ b/hedgewars/uTeams.pas	Thu Oct 05 20:07:04 2006 +0000
@@ -38,7 +38,7 @@
      THHAmmo   = array[0..cMaxSlotIndex, 0..cMaxSlotAmmoIndex] of TAmmo;
      TTeam = record
              Next: PTeam;
-             Color: Longword;
+             Color, AdjColor: Longword;
              TeamName: string[MAXNAMELEN];
              ExtDriven: boolean;
              Binds: TBinds;