Hide most HUD elements in cinematic mode
authorWuzzy <Wuzzy2@mail.ru>
Sun, 09 Dec 2018 22:28:46 +0100
changeset 14418 f9a3cfdec1df
parent 14417 694c96fb3a06
child 14419 87562a68c41f
Hide most HUD elements in cinematic mode
ChangeLog.txt
hedgewars/uWorld.pas
--- a/ChangeLog.txt	Sun Dec 09 22:19:31 2018 +0100
+++ b/ChangeLog.txt	Sun Dec 09 22:28:46 2018 +0100
@@ -3,6 +3,7 @@
 =============== 1.0.0 (unreleased) =================
  + New chat command: “/help room” (shows room chat commands within the game)
  + Colorize switching arrows, pointing arrow and target cross in clan color
+ * Hide most HUD elements in cinematic mode
 
 Lua API:
  + New call: SetTurnTimePaused(isPaused): Call with true to pause turn time, false to unpause
--- a/hedgewars/uWorld.pas	Sun Dec 09 22:19:31 2018 +0100
+++ b/hedgewars/uWorld.pas	Sun Dec 09 22:28:46 2018 +0100
@@ -1200,7 +1200,7 @@
     r: TSDL_Rect;
     s: shortstring;
     offsetX, offsetY, screenBottom: LongInt;
-    replicateToLeft, replicateToRight, tmp: boolean;
+    replicateToLeft, replicateToRight, tmp, notHiddenByCinematic: boolean;
 {$IFDEF USE_VIDEO_RECORDING}
     a: Byte;
 {$ENDIF}
@@ -1449,7 +1449,8 @@
 // This scale is used to keep the various widgets at the same dimension at all zoom levels
 SetScale(cDefaultZoomLevel);
 
-// Cinematic Mode: Effects
+notHiddenByCinematic:= true;
+// Cinematic Mode: Determine effects and state
 if CinematicScript or (InCinematicMode and autoCameraOn
     and ((CurrentHedgehog = nil) or CurrentHedgehog^.Team^.ExtDriven
     or (CurrentHedgehog^.BotLevel <> 0) or (GameType = gmtDemo))) then
@@ -1458,7 +1459,10 @@
         begin
         inc(CinematicSteps, Lag);
         if CinematicSteps > 300 then
-        CinematicSteps:= 300;
+            begin
+            CinematicSteps:= 300;
+            notHiddenByCinematic:= false;
+            end;
         end;
     end
 else if CinematicSteps > 0 then
@@ -1468,22 +1472,8 @@
         CinematicSteps:= 0;
     end;
 
-// Cinematic Mode: Render black bars
-if CinematicSteps > 0 then
-    begin
-    r.x:= ViewLeftX;
-    r.w:= ViewWidth;
-    r.y:= ViewTopY;
-    CinematicBarH:= (ViewHeight * CinematicSteps) div 2048;
-    r.h:= CinematicBarH;
-    DrawRect(r, 0, 0, 0, $FF, true);
-    r.y:= ViewBottomY - r.h;
-    DrawRect(r, 0, 0, 0, $FF, true);
-    end;
-
-
 // Turn time
-if UIDisplay <> uiNone then
+if (UIDisplay <> uiNone) and (notHiddenByCinematic) then
     begin
 {$IFDEF USE_TOUCH_INTERFACE}
     offsetX:= cScreenHeight - 13;
@@ -1522,34 +1512,14 @@
         DrawSprite(sprFrame, -(cScreenWidth shr 1) + t - 4 + offsetY, cScreenHeight - offsetX, 0);
         end;
 
-// Captions
-    DrawCaptions
     end;
 
-{$IFDEF USE_TOUCH_INTERFACE}
-// Draw buttons Related to the Touch interface
-DrawScreenWidget(@arrowLeft);
-DrawScreenWidget(@arrowRight);
-DrawScreenWidget(@arrowUp);
-DrawScreenWidget(@arrowDown);
-
-DrawScreenWidget(@fireButton);
-DrawScreenWidget(@jumpWidget);
-DrawScreenWidget(@AMWidget);
-DrawScreenWidget(@pauseButton);
-DrawScreenWidget(@utilityWidget);
-{$ENDIF}
-
 // Team bars
-if UIDisplay = uiAll then
+if (UIDisplay = uiAll) and (notHiddenByCinematic) 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
+if (UIDisplay <> uiNone) and (notHiddenByCinematic) then
     begin
 {$IFDEF USE_TOUCH_INTERFACE}
     offsetX:= cScreenHeight - 13;
@@ -1583,7 +1553,7 @@
     end;
 
 // Indicators for global effects (extra damage, low gravity)
-if UIDisplay <> uiNone then
+if (UIDisplay <> uiNone) and (notHiddenByCinematic) then
     begin
 {$IFDEF USE_TOUCH_INTERFACE}
     offsetX:= (cScreenWidth shr 1) - 95;
@@ -1610,6 +1580,41 @@
         end;
     end;
 
+// Cinematic Mode: Render black bars
+if CinematicSteps > 0 then
+    begin
+    r.x:= ViewLeftX;
+    r.w:= ViewWidth;
+    r.y:= ViewTopY;
+    CinematicBarH:= (ViewHeight * CinematicSteps) div 2048;
+    r.h:= CinematicBarH;
+    DrawRect(r, 0, 0, 0, $FF, true);
+    r.y:= ViewBottomY - r.h;
+    DrawRect(r, 0, 0, 0, $FF, true);
+    end;
+
+// Touchscreen interface widgets
+{$IFDEF USE_TOUCH_INTERFACE}
+DrawScreenWidget(@arrowLeft);
+DrawScreenWidget(@arrowRight);
+DrawScreenWidget(@arrowUp);
+DrawScreenWidget(@arrowDown);
+
+DrawScreenWidget(@fireButton);
+DrawScreenWidget(@jumpWidget);
+DrawScreenWidget(@AMWidget);
+DrawScreenWidget(@utilityWidget);
+DrawScreenWidget(@pauseButton);
+{$ENDIF}
+
+// Captions
+if UIDisplay <> uiNone then
+    DrawCaptions;
+
+// Lag alert
+if isInLag then
+    DrawSprite(sprLag, 32 - (cScreenWidth shr 1), 32, (RealTicks shr 7) mod 12);
+
 // Chat
 DrawChat;