Show remaining ammo when using Birdy egg or RC Plane bomb
authorWuzzy <Wuzzy2@mail.ru>
Mon, 12 Feb 2018 23:23:07 +0100
changeset 12994 c08c53624c0f
parent 12993 a15413d896c3
child 12995 8dd95c095882
Show remaining ammo when using Birdy egg or RC Plane bomb
ChangeLog.txt
hedgewars/uGearsHandlersMess.pas
--- a/ChangeLog.txt	Mon Feb 12 22:22:27 2018 +0100
+++ b/ChangeLog.txt	Mon Feb 12 23:23:07 2018 +0100
@@ -5,6 +5,7 @@
  + New weapon: Minigun
  + Change weapon icons: Mudball, air mine
  + Add healing visual effect in Paramedics mode and a few scripts
+ + Show remaining ammo when using Birdy egg or RC Plane bomb
  * Fix time box being usable in Sudden Death with 0 health decrease
  * Fix chat input key being sometimes registered twice
 
--- a/hedgewars/uGearsHandlersMess.pas	Mon Feb 12 22:22:27 2018 +0100
+++ b/hedgewars/uGearsHandlersMess.pas	Mon Feb 12 23:23:07 2018 +0100
@@ -3812,6 +3812,7 @@
 var
     HHGear: PGear;
     i: LongInt;
+    s: ansistring;
     dX, dY : hwFloat;
     fChanged: boolean;
     trueAngle: Longword;
@@ -3890,12 +3891,17 @@
     else
         AddVisualGear(hwRound(Gear^.X), hwRound(Gear^.Y), vgtSmokeTrace);
 
-    if (HHGear <> nil) and ((HHGear^.Message and gmAttack) <> 0) and (Gear^.Health <> 0) then
-        begin
-        HHGear^.Message := HHGear^.Message and (not gmAttack);
-        AddGear(hwRound(Gear^.X), hwRound(Gear^.Y), gtAirBomb, 0, Gear^.dX * _0_5, Gear^.dY *
-        _0_5, 0);
-        dec(Gear^.Health)
+    if (HHGear <> nil) and ((HHGear^.Message and gmAttack) <> 0) then
+        begin
+        if (Gear^.Health) <> 0 then
+            begin
+            HHGear^.Message := HHGear^.Message and (not gmAttack);
+            AddGear(hwRound(Gear^.X), hwRound(Gear^.Y), gtAirBomb, 0, Gear^.dX * _0_5, Gear^.dY *
+            _0_5, 0);
+            dec(Gear^.Health)
+            end;
+        s:= ansistring(inttostr(Gear^.Health));
+        AddCaption(formatA(trmsg[sidRemaining], s), cWhiteColor, capgrpAmmostate);
         end;
 
     if (HHGear <> nil) and ((HHGear^.Message and gmLJump) <> 0) and ((Gear^.State and gsttmpFlag) = 0) then
@@ -4156,6 +4162,7 @@
     HHGear: PGear;
     fuel, i: LongInt;
     move: hwFloat;
+    s: ansistring;
 begin
     HHGear := Gear^.Hedgehog^.Gear;
     if HHGear = nil then
@@ -4217,6 +4224,8 @@
             PlaySound(sndBirdyLay);
             dec(Gear^.FlightTime)
             end;
+        s:= ansistring(inttostr(Gear^.FlightTime));
+        AddCaption(formatA(trmsg[sidRemaining], s), cWhiteColor, capgrpAmmostate);
         end;
 
     if HHGear^.Message and (gmUp or gmPrecise or gmLeft or gmRight) <> 0 then