adding a "cinematic mode" - currently: black bars on bottom/top. triggered by rcplane when pressing enter
authorsheepluva
Sat, 23 Jan 2016 07:53:57 +0100
changeset 11519 aab4767d9a50
parent 11518 02a13be714d2
child 11520 663ecfb05df6
adding a "cinematic mode" - currently: black bars on bottom/top. triggered by rcplane when pressing enter
hedgewars/uGearsHandlersMess.pas
hedgewars/uVariables.pas
hedgewars/uWorld.pas
--- a/hedgewars/uGearsHandlersMess.pas	Wed Jan 20 00:57:09 2016 +0100
+++ b/hedgewars/uGearsHandlersMess.pas	Sat Jan 23 07:53:57 2016 +0100
@@ -3718,6 +3718,7 @@
         Gear^.State := Gear^.State or gsttmpFlag;
         PauseMusic;
         playSound(sndRideOfTheValkyries);
+        inCinematicMode:= true;
         end;
 
     // pickup bonuses
@@ -3729,6 +3730,7 @@
 
     if ((Gear^.State and gstCollision) <> 0) or CheckGearDrowning(Gear) then
         begin
+        inCinematicMode:= false;
         StopSoundChan(Gear^.SoundChannel);
         StopSound(sndRideOfTheValkyries);
         ResumeMusic;
--- a/hedgewars/uVariables.pas	Wed Jan 20 00:57:09 2016 +0100
+++ b/hedgewars/uVariables.pas	Sat Jan 23 07:53:57 2016 +0100
@@ -212,6 +212,9 @@
     ScreenFade      : TScreenFade;
     ScreenFadeValue : LongInt;
     ScreenFadeSpeed : LongInt;
+    InCinematicMode : boolean;
+    CinematicSteps  : LongInt;
+    CinematicBarH   : LongInt;
 
     UIDisplay       : TUIDisplay;
     LocalMessage    : LongWord;
@@ -2685,6 +2688,9 @@
 
     disableLandBack := false;
     ScreenFade      := sfNone;
+    InCinematicMode := false;
+    CinematicSteps  := 0;
+    CinematicBarH   := 0;
 
     // those values still are not perfect
     cLeftScreenBorder:= round(-cMinZoomLevel * cScreenWidth);
--- a/hedgewars/uWorld.pas	Wed Jan 20 00:57:09 2016 +0100
+++ b/hedgewars/uWorld.pas	Sat Jan 23 07:53:57 2016 +0100
@@ -1382,6 +1382,36 @@
 // this scale is used to keep the various widgets at the same dimension at all zoom levels
 SetScale(cDefaultZoomLevel);
 
+// cinematic effects
+if InCinematicMode
+    and ((CurrentHedgehog = nil) or CurrentHedgehog^.Team^.ExtDriven
+    or (CurrentHedgehog^.BotLevel <> 0) or (GameType = gmtDemo)) then
+    begin
+    inc(CinematicSteps, Lag);
+    if CinematicSteps > 300 then
+        CinematicSteps:= 300;
+    end
+else if CinematicSteps > 0 then
+    begin
+    dec(CinematicSteps, Lag);
+    if CinematicSteps < 0 then
+        CinematicSteps:= 0;
+    end;
+
+// 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
     begin
@@ -1751,7 +1781,7 @@
             WorldDx:= WorldDx + LongInt(rightX) - leftX;
     end;
 
-wdy:= trunc(cScreenHeight / cScaleFactor) + cScreenHeight div 2 - cWaterLine - cVisibleWater;
+wdy:= trunc(cScreenHeight / cScaleFactor) + cScreenHeight div 2 - cWaterLine - (cVisibleWater + CinematicBarH);
 if WorldDy < wdy then
     WorldDy:= wdy;