Toggle hog tag translucency with Precise + Change hog tags key
authorWuzzy <Wuzzy2@mail.ru>
Wed, 14 Feb 2018 22:27:18 +0100
changeset 12998 22e032ab1cb7
parent 12997 f06660523198
child 12999 46ba3285449a
Toggle hog tag translucency with Precise + Change hog tags key
ChangeLog.txt
README.md
hedgewars/uCommandHandlers.pas
--- a/ChangeLog.txt	Wed Feb 14 21:28:44 2018 +0100
+++ b/ChangeLog.txt	Wed Feb 14 22:27:18 2018 +0100
@@ -8,6 +8,7 @@
  + Show remaining ammo when using Birdy egg or RC Plane bomb
  + Add separate control for team chat (default: U)
  + Add separate control for changing hedgehog tags (default: Home)
+ + Hedgehog tag translucency is now changed with Precise + Change hedgehog tags key
  * Fix time box being usable in Sudden Death with 0 health decrease
  * Fix chat input key being sometimes registered twice
 
--- a/README.md	Wed Feb 14 21:28:44 2018 +0100
+++ b/README.md	Wed Feb 14 22:27:18 2018 +0100
@@ -75,6 +75,7 @@
 These are lesser-known controls of Hedgewars, they are based on your
 configured controls:
 
+* Precise + Toggle team bars: Toggle hedgehog tag translucency
 * Precise + Toggle team bars + Switch: Toggle HUD
 * Precise + Capture (screenshot key): Save current map + mask into Screenshot directory
 
--- a/hedgewars/uCommandHandlers.pas	Wed Feb 14 21:28:44 2018 +0100
+++ b/hedgewars/uCommandHandlers.pas	Wed Feb 14 22:27:18 2018 +0100
@@ -26,13 +26,13 @@
 procedure freeModule;
 
 implementation
-uses uCommands, uTypes, uVariables, uIO, uDebug, uConsts, uScript, uUtils, SDLh, uWorld, uRandom, uCaptions, uConsole
+uses uCommands, uTypes, uVariables, uIO, uDebug, uConsts, uScript, uUtils, SDLh, uWorld, uRandom, uCaptions
     , uVisualGearsList, uGearsHedgehog
      {$IFDEF USE_VIDEO_RECORDING}, uVideoRec {$ENDIF};
 
 var prevGState: TGameState = gsConfirm;
-    cTagsMasks : array[0..15] of byte = (7, 0, 0, 0, 15, 6, 4, 5, 0, 0, 0, 0, 0, 14, 12, 13);
-    cTagsMasksNoHealth: array[0..15] of byte = (3, 2, 11, 1, 0, 0, 0, 0, 0, 10, 0, 9, 0, 0, 0, 0);
+    cTagsMasks : array[0..15] of byte = (7, 0, 0, 0, 0, 4, 5, 6, 15, 8, 8, 8, 8, 12, 13, 14);
+    cTagsMasksNoHealth: array[0..15] of byte = (3, 0, 1, 2, 0, 0, 0, 0, 11, 8, 9, 10, 8, 8, 8, 8);
 
 procedure chGenCmd(var s: shortstring);
 begin
@@ -625,11 +625,19 @@
 procedure chRotateTags(var s: shortstring);
 begin
 s:= s; // avoid compiler hint
-if ((GameFlags and gfInvulnerable) = 0) then
-    cTagsMask:= cTagsMasks[cTagsMask]
+// Rotate Tags key + Precise: Toggle translucency only
+if LocalMessage and gmPrecise = gmPrecise then
+    if ((cTagsMask and htTransparent) = 0) then
+        cTagsMask:= cTagsMask or htTransparent
+    else
+        cTagsMask:= cTagsMask and (not htTransparent)
+// Just the rotate tags key: Rotate hog tags
 else
-    cTagsMask:= cTagsMasksNoHealth[cTagsMask]
-end;
+    if ((GameFlags and gfInvulnerable) = 0) then
+        cTagsMask:= cTagsMasks[cTagsMask]
+    else
+        cTagsMask:= cTagsMasksNoHealth[cTagsMask]
+    end;
 
 procedure chSpeedup_p(var s: shortstring);
 begin