paint sentries in clan colors
authoralfadur
Sat, 16 Oct 2021 02:39:22 +0300
changeset 15844 4ede5e84278a
parent 15843 4a1e3d824c34
child 15845 744f4d708963
paint sentries in clan colors
hedgewars/uGearsHandlersMess.pas
hedgewars/uGearsRender.pas
hedgewars/uRender.pas
--- a/hedgewars/uGearsHandlersMess.pas	Sat Oct 16 02:20:15 2021 +0300
+++ b/hedgewars/uGearsHandlersMess.pas	Sat Oct 16 02:39:22 2021 +0300
@@ -7373,7 +7373,7 @@
             if ((HHGear^.State and gstHHDriven) <> 0) and (HHGear^.CollisionIndex < 0) then
             begin
                 if sentry^.Hedgehog <> nil then
-                    friendlyTarget := sentry^.Hedgehog^.Team = CurrentHedgehog^.Team;
+                    friendlyTarget := sentry^.Hedgehog^.Team^.Clan = CurrentHedgehog^.Team^.Clan;
                 if not friendlyTarget then
                     GetSentryTarget := HHGear;
             end
--- a/hedgewars/uGearsRender.pas	Sat Oct 16 02:20:15 2021 +0300
+++ b/hedgewars/uGearsRender.pas	Sat Oct 16 02:39:22 2021 +0300
@@ -1748,8 +1748,8 @@
                     else DrawSpriteRotatedF(sprCreeper, x, y, 1, hwRound(SignAs(_1,Gear^.dX)), 0);
             gtSentry: begin
                 DrawSpriteRotated(sprSentry, x, y, hwSign(Gear^.dX), 0);
-                if Gear^.Tag >= 0 then
-                    DrawCircle(x, y, Gear^.Radius, 1, 255, 0, 0, 255);
+                if Gear^.Hedgehog <> nil then
+                    DrawCircle(x, y, Gear^.Radius, 2, Gear^.Hedgehog^.Team^.Clan^.Color shl 8 or $FF);
             end;
             gtGenericFaller: begin
                              // DEBUG: draw gtGenericFaller
--- a/hedgewars/uRender.pas	Sat Oct 16 02:20:15 2021 +0300
+++ b/hedgewars/uRender.pas	Sat Oct 16 02:39:22 2021 +0300
@@ -50,6 +50,7 @@
 
 procedure DrawCircle            (X, Y, Radius, Width: LongInt);
 procedure DrawCircle            (X, Y, Radius, Width: LongInt; r, g, b, a: Byte);
+procedure DrawCircle            (X, Y, Radius, Width: LongInt; color: LongWord);
 procedure DrawCircleFilled      (X, Y, Radius: LongInt; r, g, b, a: Byte);
 
 procedure DrawLine              (X0, Y0, X1, Y1, Width: Single; color: LongWord); inline;
@@ -1566,6 +1567,13 @@
     untint;
 end;
 
+procedure DrawCircle(X, Y, Radius, Width: LongInt; color: LongWord);
+begin
+    Tint(color);
+    DrawCircle(X, Y, Radius, Width);
+    untint;
+end;
+
 procedure DrawCircle(X, Y, Radius, Width: LongInt);
 var
     i: LongInt;