Delete now toggles hiding team area
authornemo
Tue, 12 Nov 2013 22:34:54 -0500
changeset 9693 9e31e3bb4476
parent 9690 6a1748b71df2
child 9696 cb9f9b79d427
Delete now toggles hiding team area
hedgewars/uCommandHandlers.pas
hedgewars/uInputHandler.pas
hedgewars/uTypes.pas
hedgewars/uVariables.pas
hedgewars/uWorld.pas
--- a/hedgewars/uCommandHandlers.pas	Tue Nov 12 15:38:45 2013 +0400
+++ b/hedgewars/uCommandHandlers.pas	Tue Nov 12 22:34:54 2013 -0500
@@ -318,6 +318,8 @@
 procedure chPrecise_p(var s: shortstring);
 begin
 s:= s; // avoid compiler hint
+if not isExternalSource then
+    LocalMessage:= LocalMessage or gmPrecise;
 if CheckNoTeamOrHH or isPaused then
     exit;
 if not isExternalSource then
@@ -331,6 +333,8 @@
 procedure chPrecise_m(var s: shortstring);
 begin
 s:= s; // avoid compiler hint
+if not isExternalSource then
+    LocalMessage:= LocalMessage and not(gmPrecise);
 if CheckNoTeamOrHH then
     exit;
 if not isExternalSource then
@@ -657,10 +661,26 @@
 procedure chRotateMask(var s: shortstring);
 begin
 s:= s; // avoid compiler hint
-if ((GameFlags and gfInvulnerable) = 0) then
-    cTagsMask:= cTagsMasks[cTagsMask]
+// this is just for me, 'cause I thought it'd be fun.  using the old precise + switch to keep it out of people's way
+if LocalMessage and (gmPrecise or gmSwitch) = (gmPrecise or gmSwitch) then
+    begin
+    if UIDisplay <> uiNone then
+         UIDisplay:= uiNone
+    else UIDisplay:= uiAll
+    end
+else if LocalMessage and gmPrecise = gmPrecise then
+    begin
+    if ((GameFlags and gfInvulnerable) = 0) then
+        cTagsMask:= cTagsMasks[cTagsMask]
+    else
+        cTagsMask:= cTagsMasksNoHealth[cTagsMask]
+    end
 else
-    cTagsMask:= cTagsMasksNoHealth[cTagsMask];
+    begin
+    if UIDisplay <> uiNoTeams then
+         UIDisplay:= uiNoTeams
+    else UIDisplay:= uiAll
+    end
 end;
 
 procedure chSpeedup_p(var s: shortstring);
--- a/hedgewars/uInputHandler.pas	Tue Nov 12 15:38:45 2013 +0400
+++ b/hedgewars/uInputHandler.pas	Tue Nov 12 22:34:54 2013 -0500
@@ -170,6 +170,9 @@
 
     if KeyDown then
         begin
+        if CurrentBinds[code] = 'switch' then
+            LocalMessage:= LocalMessage or gmSwitch;
+            
         ParseCommand(CurrentBinds[code], Trusted);
         if (CurrentTeam <> nil) and (not CurrentTeam^.ExtDriven) and (ReadyTimeLeft > 1) then
             ParseCommand('gencmd R', true)
@@ -181,7 +184,12 @@
         ParseCommand(s, Trusted);
         if (CurrentTeam <> nil) and (not CurrentTeam^.ExtDriven) and (ReadyTimeLeft > 1) then
             ParseCommand('gencmd R', true)
-        end;
+        end
+    else
+        begin
+        if CurrentBinds[code] = 'switch' then
+            LocalMessage:= LocalMessage and not(gmSwitch)
+        end
     end
 end;
 
--- a/hedgewars/uTypes.pas	Tue Nov 12 15:38:45 2013 +0400
+++ b/hedgewars/uTypes.pas	Tue Nov 12 22:34:54 2013 -0500
@@ -172,8 +172,8 @@
 
     TRenderMode = (rmDefault, rmLeftEye, rmRightEye);
     TStereoMode = (smNone, smRedCyan, smCyanRed, smRedBlue, smBlueRed, smRedGreen, smGreenRed, smHorizontal, smVertical);
-
     TWorldEdge = (weNone, weWrap, weBounce, weSea, weSky);
+    TUIDisplay = (uiAll, uiNoTeams, uiNone);
 
     THHFont = record
             Handle: PTTF_Font;
--- a/hedgewars/uVariables.pas	Tue Nov 12 15:38:45 2013 +0400
+++ b/hedgewars/uVariables.pas	Tue Nov 12 22:34:54 2013 -0500
@@ -195,6 +195,9 @@
     ScreenFadeValue : LongInt;
     ScreenFadeSpeed : LongInt;
 
+    UIDisplay       : TUIDisplay;
+    LocalMessage    : LongWord;
+
     Theme           : shortstring;
     disableLandBack : boolean;
 
@@ -2553,6 +2556,9 @@
     cMapName:= '';
 
     LuaTemplateNumber:= 0;
+
+    UIDisplay:= uiAll;
+    LocalMessage:= 0;
 end;
 
 procedure freeModule;
--- a/hedgewars/uWorld.pas	Tue Nov 12 15:38:45 2013 +0400
+++ b/hedgewars/uWorld.pas	Tue Nov 12 22:34:54 2013 -0500
@@ -1439,37 +1439,40 @@
 SetScale(cDefaultZoomLevel);
 
 // Turn time
-{$IFDEF USE_TOUCH_INTERFACE}
-offsetX:= cScreenHeight - 13;
-{$ELSE}
-offsetX:= 48;
-{$ENDIF}
-offsetY:= cOffsetY;
-if ((TurnTimeLeft <> 0) and (TurnTimeLeft < 1000000)) or (ReadyTimeLeft <> 0) then
+if UIDisplay <> uiNone then
     begin
-    if ReadyTimeLeft <> 0 then
-        i:= Succ(Pred(ReadyTimeLeft) div 1000)
-    else
-        i:= Succ(Pred(TurnTimeLeft) div 1000);
-   
-    if i>99 then
-        t:= 112
-    else if i>9 then
-        t:= 96
-    else
-        t:= 80;
-    DrawSprite(sprFrame, -(cScreenWidth shr 1) + t + offsetY, cScreenHeight - offsetX, 1);
-    while i > 0 do
+{$IFDEF USE_TOUCH_INTERFACE}
+    offsetX:= cScreenHeight - 13;
+{$ELSE}
+    offsetX:= 48;
+{$ENDIF}
+    offsetY:= cOffsetY;
+    if ((TurnTimeLeft <> 0) and (TurnTimeLeft < 1000000)) or (ReadyTimeLeft <> 0) then
         begin
-        dec(t, 32);
-        DrawSprite(sprBigDigit, -(cScreenWidth shr 1) + t + offsetY, cScreenHeight - offsetX, i mod 10);
-        i:= i div 10
+        if ReadyTimeLeft <> 0 then
+            i:= Succ(Pred(ReadyTimeLeft) div 1000)
+        else
+            i:= Succ(Pred(TurnTimeLeft) div 1000);
+       
+        if i>99 then
+            t:= 112
+        else if i>9 then
+            t:= 96
+        else
+            t:= 80;
+        DrawSprite(sprFrame, -(cScreenWidth shr 1) + t + offsetY, cScreenHeight - offsetX, 1);
+        while i > 0 do
+            begin
+            dec(t, 32);
+            DrawSprite(sprBigDigit, -(cScreenWidth shr 1) + t + offsetY, cScreenHeight - offsetX, i mod 10);
+            i:= i div 10
+            end;
+        DrawSprite(sprFrame, -(cScreenWidth shr 1) + t - 4 + offsetY, cScreenHeight - offsetX, 0);
         end;
-    DrawSprite(sprFrame, -(cScreenWidth shr 1) + t - 4 + offsetY, cScreenHeight - offsetX, 0);
-    end;
 
 // Captions
-DrawCaptions;
+    DrawCaptions
+    end;
 
 {$IFDEF USE_TOUCH_INTERFACE}
 // Draw buttons Related to the Touch interface
@@ -1485,13 +1488,16 @@
 DrawScreenWidget(@utilityWidget);
 {$ENDIF}
 
-RenderTeamsHealth;
+if UIDisplay = uiAll then
+    RenderTeamsHealth;
 
 // Lag alert
 if isInLag then
     DrawSprite(sprLag, 32 - (cScreenWidth shr 1), 32, (RealTicks shr 7) mod 12);
 
 // Wind bar
+if UIDisplay <> uiNone then
+    begin
 {$IFDEF USE_TOUCH_INTERFACE}
     offsetX:= cScreenHeight - 13;
     offsetY:= (cScreenWidth shr 1) + 74;
@@ -1513,14 +1519,15 @@
     else
         if WindBarWidth < 0 then
         begin
-            {$WARNINGS OFF}
-            r.x:= (Longword(WindBarWidth) + RealTicks shr 6) mod 8;
-            {$WARNINGS ON}
-            r.y:= 0;
-            r.w:= - WindBarWidth;
-            r.h:= 13;
-            DrawSpriteFromRect(sprWindL, r, (cScreenWidth shr 1) - offsetY + 74 + WindBarWidth, cScreenHeight - offsetX + 2, 13, 0);
-        end;
+        {$WARNINGS OFF}
+        r.x:= (Longword(WindBarWidth) + RealTicks shr 6) mod 8;
+        {$WARNINGS ON}
+        r.y:= 0;
+        r.w:= - WindBarWidth;
+        r.h:= 13;
+        DrawSpriteFromRect(sprWindL, r, (cScreenWidth shr 1) - offsetY + 74 + WindBarWidth, cScreenHeight - offsetX + 2, 13, 0);
+        end
+    end;
 
 // AmmoMenu
 if bShowAmmoMenu and ((AMState = AMHidden) or (AMState = AMHiding)) then