hedgewars/uGearsHandlersMess.pas
changeset 14749 533ac9774279
parent 14748 2ad6f0555e61
child 14750 ab7bf5036314
--- a/hedgewars/uGearsHandlersMess.pas	Wed Apr 03 13:00:05 2019 +0200
+++ b/hedgewars/uGearsHandlersMess.pas	Sun Apr 07 18:21:14 2019 +0200
@@ -2391,6 +2391,9 @@
             AddVisualGear(hwRound(Gear^.X) - 16 + Random(32), hwRound(Gear^.Y) - 2, vgtSmoke)
     else
         AddVisualGear(hwRound(Gear^.X) - 16 + Random(32), hwRound(Gear^.Y) - 2, vgtSmokeWhite);
+    // health texture
+    FreeAndNilTexture(Gear^.Tex);
+    Gear^.Tex := RenderStringTex(ansistring(inttostr(Gear^.Health)), $ff808080, fnt16);
     dec(Gear^.Health, Gear^.Damage);
     Gear^.Damage := 0;
     if Gear^.Health <= 0 then
@@ -2465,9 +2468,19 @@
                 AddVisualGear(hwRound(Gear^.X) - 16 + Random(32), hwRound(Gear^.Y) - 2, vgtSmokeWhite);
         dec(Gear^.Health, Gear^.Damage);
         Gear^.Damage := 0;
+        // health texture
+        FreeAndNilTexture(Gear^.Tex);
+        Gear^.Tex := RenderStringTex(ansistring(inttostr(Gear^.Health)), $ff808080, fnt16);
         end
     else
         begin
+        // health texture for health crate
+        if (k = gtCase) and ((Gear^.Pos and $02) <> 0) then
+            begin
+            FreeAndNilTexture(Gear^.Tex);
+            if ((Gear^.State and gstFrozen) = 0) then
+                Gear^.Tex := RenderStringTex(ansistring(inttostr(Gear^.Health)), $ff80ff80, fnt16);
+            end;
         if Gear^.Timer = 500 then
             begin
 (* Can't make sparkles team coloured without working out what the next team is going to be. This should be solved, really, since it also screws up