2024-09-21 16:53:57 -04:00
|
|
|
local COLOR_MAIN
|
|
|
|
local COLOR_DARK
|
|
|
|
|
|
|
|
local function qpaint( self, w, h )
|
|
|
|
surface.SetDrawColor( COLOR_DARK )
|
|
|
|
surface.DrawRect( 0, 0, w, h )
|
|
|
|
surface.SetDrawColor( COLOR_MAIN )
|
|
|
|
surface.DrawOutlinedRect( 1, 1, w-2, h-2, 1 )
|
|
|
|
|
2024-09-21 23:44:54 -04:00
|
|
|
draw.SimpleText( self.text, "HUD_36", w/2, 4, COLOR_MAIN, TEXT_ALIGN_CENTER )
|
2024-09-21 16:53:57 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
local settings = {
|
|
|
|
{
|
|
|
|
name = "Camera",
|
|
|
|
items = {
|
2024-09-27 16:10:50 -04:00
|
|
|
{ type = TYPE_NUMBER, cvar = "cam_f", min = -200, max = 200 },
|
|
|
|
{ type = TYPE_NUMBER, cvar = "cam_r", min = -30, max = 30 },
|
|
|
|
{ type = TYPE_NUMBER, cvar = "cam_u", min = -30, max = 30 },
|
|
|
|
{ type = TYPE_NUMBER, cvar = "cam_fov", min = 30, max = 120 },
|
|
|
|
{ type = TYPE_BOOL, cvar = "cam_fp" },
|
|
|
|
{ type = TYPE_NUMBER, cvar = "cam_fp_fov", min = 30, max = 120 },
|
2024-09-21 16:53:57 -04:00
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name = "Gameplay",
|
|
|
|
items = {
|
|
|
|
}
|
|
|
|
},
|
|
|
|
}
|
|
|
|
|
|
|
|
local entries = {
|
|
|
|
{
|
|
|
|
name = "RESUME",
|
|
|
|
DoClick = function( self )
|
|
|
|
PauseMenu:Remove()
|
|
|
|
end,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name = "LOADOUTS",
|
|
|
|
DoClick = function( self )
|
|
|
|
PauseMenu:Remove()
|
|
|
|
end,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name = "CHANGE TEAM",
|
|
|
|
DoClick = function( self )
|
|
|
|
PauseMenu:Remove()
|
|
|
|
OpenMyTeamMenu()
|
|
|
|
end,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name = "SETTINGS",
|
|
|
|
DoClick = function( self )
|
|
|
|
if SettingsMenu and SettingsMenu:IsValid() then SettingsMenu:Remove() return end
|
|
|
|
SettingsMenu = vgui.Create("EditablePanel")
|
|
|
|
SettingsMenu:SetSize( 300, 500 )
|
|
|
|
SettingsMenu:NoClipping( true )
|
|
|
|
|
|
|
|
function SettingsMenu:Paint( w, h )
|
|
|
|
surface.SetDrawColor( COLOR_DARK )
|
|
|
|
surface.DrawRect( 0, 0, w, h )
|
|
|
|
surface.SetDrawColor( COLOR_MAIN )
|
|
|
|
surface.DrawOutlinedRect( 1, 1, w-2, h-2, 1 )
|
|
|
|
end
|
|
|
|
SettingsMenu:DockPadding( 10, 10, 10, 10 )
|
|
|
|
|
|
|
|
function SettingsMenu:PerformLayout( w, h )
|
|
|
|
local x, y, w, h = PauseMenu:GetBounds()
|
|
|
|
self:SetPos( x + w + 10, y )
|
|
|
|
end
|
|
|
|
|
|
|
|
local SP = SettingsMenu:Add("DScrollPanel")
|
|
|
|
SP:Dock(FILL)
|
|
|
|
|
|
|
|
for index, data in ipairs( settings ) do
|
|
|
|
local Cat = SettingsMenu:Add("DCollapsibleCategory")
|
|
|
|
Cat:SetLabel(data.name)
|
|
|
|
Cat:Dock(TOP)
|
|
|
|
SP:AddItem(Cat)
|
|
|
|
|
|
|
|
for index, data in ipairs( data.items ) do
|
2024-09-27 16:10:50 -04:00
|
|
|
if !data.cvarpointer then data.cvarpointer = GetConVar("b-" .. data.cvar) end
|
2024-09-21 16:53:57 -04:00
|
|
|
if data.type == TYPE_BOOL then
|
|
|
|
local Changer = vgui.Create("DCheckBoxLabel", Cat)
|
|
|
|
Changer:Dock( TOP )
|
2024-09-27 16:10:50 -04:00
|
|
|
Changer:SetConVar( "b-" .. data.cvar )
|
|
|
|
Changer:SetText( l8( "#Convar." .. data.cvar .. ".Name" ) )
|
2024-09-21 16:53:57 -04:00
|
|
|
elseif data.type == TYPE_NUMBER then
|
|
|
|
local Changer = vgui.Create("DNumSlider", Cat)
|
|
|
|
Changer:Dock( TOP )
|
2024-09-27 16:10:50 -04:00
|
|
|
Changer:SetConVar( "b-" .. data.cvar )
|
|
|
|
Changer:SetText( l8( "#Convar." .. data.cvar .. ".Name" ) )
|
2024-09-21 16:53:57 -04:00
|
|
|
Changer:SetMin( data.min )
|
|
|
|
Changer:SetMax( data.max )
|
|
|
|
Changer:SetDecimals( 0 )
|
|
|
|
Changer:SetDefaultValue( data.cvarpointer:GetDefault() )
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name = "QUIT",
|
|
|
|
DoClick = function( self )
|
|
|
|
PauseMenu:Remove()
|
|
|
|
end,
|
|
|
|
},
|
|
|
|
}
|
|
|
|
|
|
|
|
local function StartPauseMenu()
|
|
|
|
if PauseMenu and PauseMenu:IsValid() then PauseMenu:Remove() return end
|
|
|
|
|
|
|
|
PauseMenu = vgui.Create("EditablePanel")
|
2024-09-21 23:44:54 -04:00
|
|
|
PauseMenu:SetSize( 300, 300 )
|
|
|
|
PauseMenu:SetPos( ScrW()/2 - 300 - 5, ScrH()/2 - 300/2 )
|
2024-09-21 16:53:57 -04:00
|
|
|
PauseMenu:MakePopup()
|
2024-09-21 23:44:54 -04:00
|
|
|
PauseMenu:SetKeyboardInputEnabled( true )
|
2024-09-21 16:53:57 -04:00
|
|
|
|
|
|
|
local p = LocalPlayer()
|
|
|
|
local myteam = p:Team()
|
|
|
|
local MP = BennyGame:GetType() == BG_GTYPE_MP
|
|
|
|
local CURRCHAR
|
|
|
|
if BennyGame:GetType() == BG_GTYPE_CAMPAIGN then
|
|
|
|
CURRCHAR = "benny"
|
|
|
|
else
|
|
|
|
CURRCHAR = TEAMS[myteam].factionid
|
|
|
|
end
|
|
|
|
COLOR_MAIN = FACTIONS[CURRCHAR].COLOR_MAIN
|
|
|
|
COLOR_DARK = FACTIONS[CURRCHAR].COLOR_DARK
|
|
|
|
local CHARNAME = FACTIONS[CURRCHAR].CHARNAME
|
|
|
|
|
|
|
|
function PauseMenu:Paint( w, h )
|
|
|
|
surface.SetDrawColor( COLOR_DARK )
|
|
|
|
surface.DrawRect( 0, 0, w, h )
|
|
|
|
surface.SetDrawColor( COLOR_MAIN )
|
|
|
|
surface.DrawOutlinedRect( 1, 1, w-2, h-2, 1 )
|
|
|
|
end
|
|
|
|
PauseMenu:DockPadding( 10, 10, 10, 10 )
|
|
|
|
|
|
|
|
function PauseMenu:OnRemove()
|
|
|
|
if SettingsMenu and SettingsMenu:IsValid() then SettingsMenu:Remove() end
|
|
|
|
end
|
|
|
|
|
|
|
|
for index, data in ipairs( entries ) do
|
|
|
|
local button = PauseMenu:Add("DButton")
|
|
|
|
button:Dock(TOP)
|
|
|
|
button:DockMargin( 0, 0, 0, 10 )
|
|
|
|
button:SetText( "" )
|
2024-09-21 23:44:54 -04:00
|
|
|
button:SetTall( 40 )
|
2024-09-21 16:53:57 -04:00
|
|
|
button.text = data.name
|
|
|
|
button.Paint = qpaint
|
|
|
|
button.DoClick = data.DoClick
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
function GM:OnPauseMenuShow()
|
|
|
|
StartPauseMenu()
|
|
|
|
return false
|
|
|
|
end
|