Added dialogue box API & Cinematic API improvements

master
AlmTech 5 years ago
parent ffe697b6e4
commit fe1d3b8446
  1. 25
      gamemode/engine/derma/lib/cl_menu_dialogueBox.lua
  2. 36
      gamemode/engine/derma/menus/menu_intro.lua
  3. 6
      gamemode/engine/lib/client/cl_cinematic.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

@ -7,6 +7,27 @@
local intro = {} 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 ) function intro.open( dt )
local chars = dt.cont local chars = dt.cont
local resScale = Quantum.Client.ResolutionScale local resScale = Quantum.Client.ResolutionScale
@ -29,20 +50,7 @@ function intro.open( dt )
Quantum.Client.Cam.Stop() -- stop the cinematic Quantum.Client.Cam.Stop() -- stop the cinematic
end end
local scene = { Quantum.Client.Cam.Start( scenes[game.GetMap()], false ) -- start the cinematic
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
end end
end end

@ -15,9 +15,10 @@ function Quantum.Client.Cam.Stop()
Quantum.Debug( "Stopped cinematic." ) Quantum.Debug( "Stopped cinematic." )
end end
function Quantum.Client.Cam.Start( scene, fov, velocity, loop ) function Quantum.Client.Cam.Start( scene, loop )
local frac = 0 local frac = 0
local time -- speed of the camera ( how long till it reaches its finish point ) local time -- speed of the camera ( how long till it reaches its finish point )
local fov
Quantum.Client.Cam.Temp = {} Quantum.Client.Cam.Temp = {}
Quantum.Client.Cam.Temp.scene_index = 1 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.Remove( "CalcView", "Quantum_Cinematic" ) -- if a cinematic is already running; cancel it
hook.Add( "CalcView", "Quantum_Cinematic", function( ply, pos, ang, fov ) 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 ) frac = math.Clamp( frac + FrameTime()/time, 0, 1 )
if( frac <= 0 ) then return end if( frac <= 0 ) then return end

Loading…
Cancel
Save