# HG changeset patch # User sheepluva # Date 1453532037 -3600 # Node ID aab4767d9a50b4d18b2447c2ca2ca25ad7b1ec81 # Parent 02a13be714d264d15dce9d197f8f6ae16cc44ac7 adding a "cinematic mode" - currently: black bars on bottom/top. triggered by rcplane when pressing enter diff -r 02a13be714d2 -r aab4767d9a50 hedgewars/uGearsHandlersMess.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; diff -r 02a13be714d2 -r aab4767d9a50 hedgewars/uVariables.pas --- 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); diff -r 02a13be714d2 -r aab4767d9a50 hedgewars/uWorld.pas --- 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;