make Tint(longword) use RGBA
authornemo
Thu, 02 Dec 2010 20:29:46 -0500
changeset 4452 258945553b18
parent 4451 1c342980b4aa
child 4453 15a483b2558a
make Tint(longword) use RGBA
hedgewars/VGSHandlers.inc
hedgewars/uRender.pas
hedgewars/uVisualGears.pas
--- a/hedgewars/VGSHandlers.inc	Thu Dec 02 19:51:30 2010 -0500
+++ b/hedgewars/VGSHandlers.inc	Thu Dec 02 20:29:46 2010 -0500
@@ -630,7 +630,7 @@
 
 ////////////////////////////////////////////////////////////////////////////////
 procedure doStepCircle(Gear: PVisualGear; Steps: Longword);
-var tmp: byte;
+var tmp: LongInt;
     i: LongWord;
 begin
 with Gear^ do
@@ -645,6 +645,8 @@
                 else dec(tmp);
                 if tmp < round(dX) then tdY:= 1;
                 if tmp > round(dY) then tdY:= -1;
+		if tmp > 255 then tmp := 255;
+		if tmp < 0 then tmp := 0;
                 Gear^.Tint:= (Gear^.Tint and $FFFFFF00) or tmp
                 end
             end
--- a/hedgewars/uRender.pas	Thu Dec 02 19:51:30 2010 -0500
+++ b/hedgewars/uRender.pas	Thu Dec 02 20:29:46 2010 -0500
@@ -444,7 +444,7 @@
 
 procedure Tint(c: Longword); inline;
 begin
-Tint(((c shr 16) and $FF), ((c shr 8) and $FF), (c and $FF), $FF);
+Tint(((c shr 24) and $FF), ((c shr 16) and $FF), (c shr 8) and $FF, (c and $FF))
 end;
 
 end.
--- a/hedgewars/uVisualGears.pas	Thu Dec 02 19:51:30 2010 -0500
+++ b/hedgewars/uVisualGears.pas	Thu Dec 02 20:29:46 2010 -0500
@@ -386,7 +386,6 @@
                           DrawRotatedF(sprFlake, round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy + SkyOffset, Gear^.Frame, 1, Gear^.Angle);
             vgtCloud: DrawSprite(sprCloud, round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy + SkyOffset, Gear^.Frame);
             end;
-	Tint($FFFFFFFF);
         Gear:= Gear^.NextGear
         end;
     1: while Gear <> nil do
@@ -408,7 +407,6 @@
                             DrawRotatedF(sprFeather, round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy, Gear^.Frame, 1, Gear^.Angle);
                             end;
                  end;
-	Tint($FFFFFFFF);
         Gear:= Gear^.NextGear
         end;
     2: while Gear <> nil do
@@ -476,10 +474,10 @@
             vgtHealthTag: if Gear^.Tex <> nil then DrawCentered(round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy, Gear^.Tex);
             vgtCircle: DrawCircle(round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy, Gear^.State, Gear^.Timer);
         end;
-	Tint($FFFFFFFF);
         Gear:= Gear^.NextGear
         end
-    end
+    end;
+Tint($FFFFFFFF);
 end;
 
 function  VisualGearByUID(uid : Longword) : PVisualGear;