Air mine contour: Lower opacity when not seeking
authorWuzzy <Wuzzy2@mail.ru>
Sat, 29 Jun 2019 22:03:44 +0200
changeset 15224 26b4e864b341
parent 15223 9b8010f0d12f
child 15225 f55c1c895797
Air mine contour: Lower opacity when not seeking
hedgewars/uGearsRender.pas
--- a/hedgewars/uGearsRender.pas	Sat Jun 29 21:19:02 2019 +0200
+++ b/hedgewars/uGearsRender.pas	Sat Jun 29 22:03:44 2019 +0200
@@ -339,18 +339,33 @@
 end;
 
 procedure RenderAirMineGuiExtras(Gear: PGear; ox, oy: LongInt);
-var isChasing: boolean;
+var tinted: boolean;
 begin
 // render air mine contour, if underwater
     if (((not SuddenDeathDmg) and (WaterOpacity > cGearContourThreshold)) or (SuddenDeathDmg and (SDWaterOpacity > cGearContourThreshold))) and
         ((cWaterLine < (hwRound(Gear^.Y) + Gear^.Radius + 16)) or
         ((WorldEdge = weSea) and ((hwRound(Gear^.X) < LeftX + 24) or (hwRound(Gear^.X) > RightX - 24)))) then
         begin
-        isChasing:= ((Gear^.State and gstFrozen) = 0) and (Gear^.Hedgehog <> nil) and (Gear^.Hedgehog^.Gear <> nil) and ((Gear^.State and gstTmpFlag) <> 0) and (Gear^.Tag = 0);
-        if isChasing then
-            Tint($FF, $30, $30, $FF);
+        tinted:= true;
+        // tint contour based on air mine state:
+        // not seeking or chasing (frozen, stunned or just launched)
+        if ((Gear^.State and gstFrozen) <> 0) or ((Gear^.State and gstTmpFlag) = 0) or (Gear^.Tag <> 0) then
+            // more transparent
+            Tint($FF, $FF, $FF, $80)
+        // chasing hog
+        else if (Gear^.Hedgehog <> nil) and (Gear^.Hedgehog^.Gear <> nil) then
+            // reddish
+            Tint($FF, $30, $30, $FF)
+        // not seeking or chasing (no target)
+        else if (Gear^.State and gstChooseTarget) = 0 then
+            // more transparent
+            Tint($FF, $FF, $FF, $80)
+        // seeking
+        else
+            // default color
+            tinted:= false;
         DrawSprite(sprAirMine, ox-16, oy-16, 32);
-        if isChasing then
+        if tinted then
             untint;
         end;
 end;