From fe1d3b8446877db75b950088149f327e7b8f7e83 Mon Sep 17 00:00:00 2001 From: AlmTech Date: Thu, 31 Oct 2019 20:56:46 +0100 Subject: [PATCH] Added dialogue box API & Cinematic API improvements --- .../engine/derma/lib/cl_menu_dialogueBox.lua | 25 +++++++++++++ gamemode/engine/derma/menus/menu_intro.lua | 36 +++++++++++-------- gamemode/engine/lib/client/cl_cinematic.lua | 6 ++-- 3 files changed, 51 insertions(+), 16 deletions(-) create mode 100644 gamemode/engine/derma/lib/cl_menu_dialogueBox.lua diff --git a/gamemode/engine/derma/lib/cl_menu_dialogueBox.lua b/gamemode/engine/derma/lib/cl_menu_dialogueBox.lua new file mode 100644 index 0000000..7dddf5d --- /dev/null +++ b/gamemode/engine/derma/lib/cl_menu_dialogueBox.lua @@ -0,0 +1,25 @@ +-- __ _ _______ _ __ +-- / / /\ | | |__ __| | | \ \ +-- / / / \ | |_ __ ___ | | ___ ___| |__ \ \ +-- < < / /\ \ | | '_ ` _ \| |/ _ \/ __| '_ \ > > +-- \ \ / ____ \| | | | | | | | __/ (__| | | | / / +-- \_\ /_/ \_\_|_| |_| |_|_|\___|\___|_| |_| /_/ + +local log = {} +local scale = Quantum.Client.ResolutionScale +local padding = 10 * scale +local padding_s = 4 * scale + +local theme = Quantum.Client.Menu.GetAPI( "theme" ) + +function log.createinfobox( text, parent ) + local box = vgui.Create( "DPanel", parent ) + box:SetSize( 250 * scale, 80 * scale ) + box.Paint = function( self ) theme.panel( self, Color( 0, 0, 0, 100 ) ) + box.w, box.h = box:GetSize() + + local scroll = vgui.Create( "DScrollPanel", box ) + --scroll:SetSize() + + return box +end \ No newline at end of file diff --git a/gamemode/engine/derma/menus/menu_intro.lua b/gamemode/engine/derma/menus/menu_intro.lua index 7ae4c4a..3f39086 100644 --- a/gamemode/engine/derma/menus/menu_intro.lua +++ b/gamemode/engine/derma/menus/menu_intro.lua @@ -7,6 +7,27 @@ local intro = {} +local scenes = { + ["rp_truenorth_v1a_livin"] = { + [1] = { + fov = 80, + velocity = 10, + pos1 = Vector(6879, 4135, 72), + pos2 = Vector(8760, 2740, 86), + ang1 = Angle(7, 122, 0), + ang2 = Angle(1, -104, 0) + }, + [2] = { + fov = 60, + velocity = 8, + pos1 = Vector( 8917, 2194, 83 ), + pos2 = Vector( 8312, 2265, 83 ), + ang1 = Angle( 2, -123, 0 ), + ang2 = Angle( 3, -41, 0 ) + } + } +} + function intro.open( dt ) local chars = dt.cont local resScale = Quantum.Client.ResolutionScale @@ -29,20 +50,7 @@ function intro.open( dt ) Quantum.Client.Cam.Stop() -- stop the cinematic end - local scene = { - pos1 = Vector(6879, 4135, 72), - pos2 = Vector(8760, 2740, 86), - ang1 = Angle(7, 122, 0), - ang2 = Angle(1, -104, 0) - } - local scene2 = { - pos1 = Vector( 8917, 2194, 83 ), - pos2 = Vector( 8312, 2265, 83 ), - ang1 = Angle( 2, -123, 0 ), - ang2 = Angle( 3, -41, 0 ) - } - - Quantum.Client.Cam.Start( {[1] = scene, [2] = scene2}, 80, {[1] = 10, [2] = 8}, false ) -- start the cinematic + Quantum.Client.Cam.Start( scenes[game.GetMap()], false ) -- start the cinematic end end diff --git a/gamemode/engine/lib/client/cl_cinematic.lua b/gamemode/engine/lib/client/cl_cinematic.lua index 9106d65..9b49970 100644 --- a/gamemode/engine/lib/client/cl_cinematic.lua +++ b/gamemode/engine/lib/client/cl_cinematic.lua @@ -15,9 +15,10 @@ function Quantum.Client.Cam.Stop() Quantum.Debug( "Stopped cinematic." ) end -function Quantum.Client.Cam.Start( scene, fov, velocity, loop ) +function Quantum.Client.Cam.Start( scene, loop ) local frac = 0 local time -- speed of the camera ( how long till it reaches its finish point ) + local fov Quantum.Client.Cam.Temp = {} Quantum.Client.Cam.Temp.scene_index = 1 @@ -26,7 +27,8 @@ function Quantum.Client.Cam.Start( scene, fov, velocity, loop ) hook.Remove( "CalcView", "Quantum_Cinematic" ) -- if a cinematic is already running; cancel it hook.Add( "CalcView", "Quantum_Cinematic", function( ply, pos, ang, fov ) - time = velocity[Quantum.Client.Cam.Temp.scene_index] || 5 + time = scene[Quantum.Client.Cam.Temp.scene_index].velocity || 5 + fov = scene[Quantum.Client.Cam.Temp.scene_index].fov || 20 frac = math.Clamp( frac + FrameTime()/time, 0, 1 ) if( frac <= 0 ) then return end