Render contour of air mines when in highly opaque water
authorWuzzy <Wuzzy2@mail.ru>
Sat, 29 Jun 2019 20:41:14 +0200
changeset 15200 0879fba70510
parent 15199 b0ed2b17c0cf
child 15201 fb2da6145595
Render contour of air mines when in highly opaque water
ChangeLog.txt
hedgewars/uConsts.pas
hedgewars/uGears.pas
hedgewars/uGearsRender.pas
share/hedgewars/Data/Graphics/AirMine.png
--- a/ChangeLog.txt	Sat Jun 29 19:35:59 2019 +0200
+++ b/ChangeLog.txt	Sat Jun 29 20:41:14 2019 +0200
@@ -123,7 +123,7 @@
  + Don't show crate spawn message for initial crates in missions
  + Don't show hedgehog health if “invulnerable” game modifier is active
  + Display player name of own teams in online games
- + Show contour of flying saucer when in highly opaque water
+ + Show contour of flying saucer and air mines when in highly opaque water
  + Remove visual clutter in cut scenes
  + Add setting to set default/initial zoom
  * Black clan color can now be used without visual problems
--- a/hedgewars/uConsts.pas	Sat Jun 29 19:35:59 2019 +0200
+++ b/hedgewars/uConsts.pas	Sat Jun 29 20:41:14 2019 +0200
@@ -169,6 +169,7 @@
 
     cVisibleWater       : LongInt = 128;
     cTeamHealthWidth    : LongInt = 128;
+    cGearContourThreshold : LongInt = 179; // if water opacity is higher than this, draw contour for some gears when in water
 
     cifRandomize = $00000001;
     cifTheme     = $00000002;
--- a/hedgewars/uGears.pas	Sat Jun 29 19:35:59 2019 +0200
+++ b/hedgewars/uGears.pas	Sat Jun 29 20:41:14 2019 +0200
@@ -718,6 +718,8 @@
     begin
     x:= hwRound(Gear^.X) + WorldDx;
     y:= hwRound(Gear^.Y) + WorldDy;
+    if Gear^.Kind = gtAirMine then
+        RenderAirMineGuiExtras(Gear, x, y);
     RenderGearHealth(Gear, x, y);
     RenderGearTimer(Gear, x, y);
     if Gear^.Kind = gtHedgehog then
--- a/hedgewars/uGearsRender.pas	Sat Jun 29 19:35:59 2019 +0200
+++ b/hedgewars/uGearsRender.pas	Sat Jun 29 20:41:14 2019 +0200
@@ -39,6 +39,7 @@
 procedure RenderGearTimer(Gear: PGear; x, y: LongInt);
 procedure RenderGearHealth(Gear: PGear; x, y: LongInt);
 procedure RenderHHGuiExtras(Gear: PGear; ox, oy: LongInt);
+procedure RenderAirMineGuiExtras(Gear: PGear; ox, oy: LongInt);
 procedure DrawHHOrder();
 
 var RopePoints: record
@@ -313,7 +314,7 @@
         case CurAmmoGear^.Kind of
             gtJetpack:      begin
                             // render jetpack contour if underwater
-                            if (((not SuddenDeathDmg) and (WaterOpacity > 179)) or (SuddenDeathDmg and (SDWaterOpacity > 179))) and
+                            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) or (hwRound(Gear^.X) > RightX)))) then
                                 DrawSprite(sprJetpack, sx-32, sy-32, 4);
@@ -337,6 +338,15 @@
         end
 end;
 
+procedure RenderAirMineGuiExtras(Gear: PGear; ox, oy: LongInt);
+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
+        DrawSprite(sprAirMine, ox-16, oy-16, 32);
+end;
+
 procedure DrawHH(Gear: PGear; ox, oy: LongInt);
 var i, t: LongInt;
     amt: TAmmoType;
Binary file share/hedgewars/Data/Graphics/AirMine.png has changed