Hide health of fake health crates
authorWuzzy <Wuzzy2@mail.ru>
Sun, 07 Apr 2019 23:21:07 +0200
changeset 14759 c6b7f4a4122c
parent 14758 bc0e86b0347b
child 14760 75bd27700837
Hide health of fake health crates
hedgewars/uGears.pas
hedgewars/uGearsHandlersMess.pas
--- a/hedgewars/uGears.pas	Sun Apr 07 23:08:33 2019 +0200
+++ b/hedgewars/uGears.pas	Sun Apr 07 23:21:07 2019 +0200
@@ -1151,6 +1151,7 @@
             begin
             gear^.Pos := gear^.Pos + posCaseHealth;
             gear^.RenderHealth:= true;
+            gear^.Karma:= 2;
             // health crate is smaller than the other crates
             gear^.Radius := cCaseHealthRadius;
             if(FinishedTurnsTotal > -1) then
--- a/hedgewars/uGearsHandlersMess.pas	Sun Apr 07 23:08:33 2019 +0200
+++ b/hedgewars/uGearsHandlersMess.pas	Sun Apr 07 23:21:07 2019 +0200
@@ -2482,7 +2482,15 @@
             begin
             FreeAndNilTexture(Gear^.Tex);
             if ((Gear^.State and gstFrozen) = 0) then
-                Gear^.Tex := RenderStringTex(ansistring(inttostr(Gear^.Health)), $ff80ff80, fnt16);
+                // Karma=2: Always hide health
+                if (Gear^.Karma = 2) then
+                    Gear^.Tex := RenderStringTex(ansistring(trmsg[sidUnknownGearValue]), $ff80ff80, fnt16)
+                // Karma=1: Hide health in game, but show in demo
+                else if (Gear^.Karma = 1) and (GameType in [gmtDemo, gmtRecord]) then
+                    Gear^.Tex := RenderStringTex(ansistring(trmsg[sidUnknownGearValue]), $ff80ff80, fnt16)
+                // Always show health (default)
+                else
+                    Gear^.Tex := RenderStringTex(ansistring(inttostr(Gear^.Health)), $ff80ff80, fnt16);
             end;
         if Gear^.Timer = 500 then
             begin