2023-09-13 22:15:43 -04:00
|
|
|
|
|
|
|
-- HUD
|
|
|
|
|
|
|
|
local hide = {
|
|
|
|
["CHudHealth"] = true,
|
|
|
|
["CHudBattery"] = true,
|
|
|
|
["CHudAmmo"] = true,
|
|
|
|
["CHudSecondaryAmmo"] = true,
|
|
|
|
["CHudPoisonDamageIndicator"] = true,
|
2023-09-14 16:41:56 -04:00
|
|
|
["CHudCrosshair"] = true,
|
2023-09-23 22:51:35 -04:00
|
|
|
["CHUDQuickInfo"] = true,
|
|
|
|
["CHudSuitPower"] = true,
|
|
|
|
["CHudZoom"] = true,
|
2023-09-13 22:15:43 -04:00
|
|
|
}
|
|
|
|
|
2023-11-06 14:03:14 -05:00
|
|
|
hook.Add( "HUDShouldDraw", "Benny_HUDShouldDraw", function( name )
|
2023-09-13 22:15:43 -04:00
|
|
|
if ( hide[ name ] ) then return false end
|
|
|
|
end )
|
|
|
|
|
|
|
|
function ss( scale )
|
2023-11-29 19:03:14 -05:00
|
|
|
return scale*ConVarCL_Int("hud_scale")--math.Round( scale * ( ScrH() / 480 ) * HSCALE:GetFloat() )
|
2023-09-13 22:15:43 -04:00
|
|
|
end
|
|
|
|
|
2023-09-14 16:41:56 -04:00
|
|
|
local function genfonts()
|
|
|
|
local sizes = {
|
|
|
|
8,
|
|
|
|
10,
|
|
|
|
12,
|
|
|
|
14,
|
|
|
|
16,
|
|
|
|
18,
|
|
|
|
24,
|
2023-11-11 21:08:21 -05:00
|
|
|
28,
|
2023-09-14 16:41:56 -04:00
|
|
|
32,
|
|
|
|
36,
|
|
|
|
48,
|
|
|
|
64,
|
|
|
|
72
|
|
|
|
}
|
|
|
|
for _, size in pairs(sizes) do
|
|
|
|
surface.CreateFont( "Benny_" .. size, {
|
|
|
|
font = "Carbon Plus Bold",
|
|
|
|
size = ss(size),
|
2023-09-25 17:26:52 -04:00
|
|
|
weight = 0,
|
2023-09-14 16:41:56 -04:00
|
|
|
} )
|
|
|
|
end
|
2023-11-12 00:45:28 -05:00
|
|
|
for _, size in pairs(sizes) do
|
|
|
|
surface.CreateFont( "BennyS_" .. size, {
|
|
|
|
font = "Carbon Plus Bold",
|
|
|
|
size = ss(size),
|
|
|
|
weight = 0,
|
|
|
|
scanlines = ss(1),
|
|
|
|
blursize = ss(3),
|
|
|
|
} )
|
|
|
|
end
|
2023-09-14 16:41:56 -04:00
|
|
|
local sizes = {
|
|
|
|
8,
|
|
|
|
9,
|
|
|
|
10,
|
|
|
|
12,
|
|
|
|
}
|
|
|
|
for _, size in pairs(sizes) do
|
2023-09-24 17:50:42 -04:00
|
|
|
for i=1, 4 do
|
|
|
|
local add = i==1 and "" or i==2 and "B" or i==3 and "I" or i==4 and "BI"
|
|
|
|
local mode = i==1 and "" or i==2 and " Bold" or i==3 and " Italic" or i==4 and " Bold Italic"
|
|
|
|
surface.CreateFont( "Benny_Caption_" .. size .. add, {
|
|
|
|
font = "Roboto" .. mode,
|
|
|
|
size = ss(size),
|
|
|
|
weight = 0,
|
|
|
|
} )
|
|
|
|
end
|
2023-09-14 16:41:56 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
genfonts()
|
|
|
|
|
2023-10-09 03:01:06 -04:00
|
|
|
cvars.AddChangeCallback("benny_hud_scale", function(convar_name, value_old, value_new)
|
|
|
|
genfonts()
|
|
|
|
end, "benny_hud_scale_callback")
|
|
|
|
|
2023-09-14 16:41:56 -04:00
|
|
|
schemes = {
|
|
|
|
["benny"] = {
|
|
|
|
fg = Color( 255, 238, 169 ),
|
|
|
|
bg = Color( 54, 44, 39 ),
|
|
|
|
caption = Color( 255, 238, 169 ),
|
|
|
|
name = "BENNY",
|
|
|
|
},
|
2023-11-12 00:45:28 -05:00
|
|
|
["nikki"] = {
|
2023-09-14 16:41:56 -04:00
|
|
|
fg = Color( 255, 174, 210 ),
|
2023-10-31 19:06:09 -04:00
|
|
|
bg = Color(37, 12, 40 ),
|
2023-09-14 16:41:56 -04:00
|
|
|
caption = Color( 255, 174, 210 ),
|
2023-11-12 00:45:28 -05:00
|
|
|
name = "NIKKI",
|
2023-09-14 16:41:56 -04:00
|
|
|
},
|
|
|
|
["igor"] = {
|
2023-10-31 19:06:09 -04:00
|
|
|
fg = Color( 253, 208, 207 ),
|
|
|
|
bg = Color( 32, 14, 12 ),
|
2023-09-14 16:41:56 -04:00
|
|
|
caption = Color( 253, 78, 77 ),
|
|
|
|
name = "IGOR",
|
|
|
|
},
|
|
|
|
["yanghao"] = {
|
2023-10-31 19:06:09 -04:00
|
|
|
fg = Color( 157, 187, 253 ),
|
|
|
|
bg = Color( 19, 21, 28 ),
|
2023-09-14 16:41:56 -04:00
|
|
|
caption = Color( 87, 187, 253 ),
|
|
|
|
name = "YANG-HAO",
|
|
|
|
},
|
2023-11-12 00:45:28 -05:00
|
|
|
["mp_cia"] = {
|
|
|
|
fg = Color( 93, 118, 215 ),
|
|
|
|
bg = Color( 25, 23, 47 ),
|
|
|
|
caption = Color( 87, 187, 253 ),
|
|
|
|
name = "CIA",
|
|
|
|
},
|
|
|
|
["mp_plasof"] = {
|
|
|
|
fg = Color( 255, 103, 103 ),
|
|
|
|
bg = Color( 35, 25, 20 ),
|
|
|
|
caption = Color( 87, 187, 253 ),
|
|
|
|
name = "PLASOF",
|
|
|
|
},
|
|
|
|
["mp_militia"] = {
|
|
|
|
fg = Color( 255, 199, 133 ),
|
|
|
|
bg = Color( 33, 18, 18 ),
|
|
|
|
caption = Color( 87, 187, 253 ),
|
|
|
|
name = "MILITIA",
|
|
|
|
},
|
|
|
|
["mp_natguard"] = {
|
|
|
|
fg = Color( 208, 226, 132 ),
|
|
|
|
bg = Color( 23, 25, 23 ),
|
|
|
|
caption = Color( 87, 187, 253 ),
|
|
|
|
name = "ARNG",
|
|
|
|
},
|
|
|
|
["mp_viper"] = {
|
|
|
|
fg = Color( 255, 230, 245 ),
|
|
|
|
bg = Color( 40, 30, 30 ),
|
|
|
|
caption = Color( 87, 187, 253 ),
|
|
|
|
name = "VIPER",
|
|
|
|
},
|
|
|
|
["mp_halo"] = {
|
|
|
|
fg = Color( 200, 255, 246 ),
|
|
|
|
bg = Color( 30, 40, 38 ),
|
|
|
|
caption = Color( 87, 187, 253 ),
|
|
|
|
name = "HALO",
|
|
|
|
},
|
2023-09-14 16:41:56 -04:00
|
|
|
["enemy"] = {
|
|
|
|
caption = Color( 199, 0, 0 ),
|
|
|
|
name = "ENEMY",
|
|
|
|
},
|
|
|
|
["pistol"] = {
|
|
|
|
caption = Color( 61, 61, 61 ),
|
|
|
|
name = "PISTOL",
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-12-06 02:11:41 -05:00
|
|
|
local activescheme = ConVarCL("hud_tempactive")
|
|
|
|
function schema( i2, alpha )
|
|
|
|
local i1 = activescheme:GetString()
|
|
|
|
return schemes[i1][i2].r, schemes[i1][i2].g, schemes[i1][i2].b, (alpha or 1)*255
|
|
|
|
end
|
|
|
|
|
|
|
|
local junker = Color( 0, 0, 0, 0 )
|
|
|
|
function schema_c( i2, alpha )
|
|
|
|
local r,g,b,a=schema( i2, alpha )
|
|
|
|
junker.r=r
|
|
|
|
junker.g=g
|
|
|
|
junker.b=b
|
|
|
|
junker.a=a
|
|
|
|
return junker
|
2023-11-12 00:45:28 -05:00
|
|
|
end
|
|
|
|
|
2023-09-14 16:41:56 -04:00
|
|
|
captions = {
|
|
|
|
--{
|
|
|
|
-- name = "YANG-HAO",
|
|
|
|
-- color = schemes["yanghao"]["caption"],
|
|
|
|
-- text = { "..." },
|
|
|
|
-- time = 1,
|
|
|
|
--},
|
|
|
|
--{
|
|
|
|
-- name = "BENNY",
|
|
|
|
-- color = schemes["benny"]["caption"],
|
|
|
|
-- text = { "Bleh." },
|
|
|
|
-- time = 2,
|
|
|
|
--},
|
|
|
|
--{
|
|
|
|
-- name = "NICKY",
|
|
|
|
-- color = schemes["nicky"]["caption"],
|
|
|
|
-- text = { "You have a big weapon, sir!" },
|
|
|
|
-- time = 3,
|
|
|
|
--},
|
|
|
|
--{
|
|
|
|
-- name = "IGOR",
|
|
|
|
-- color = schemes["igor"]["caption"],
|
|
|
|
-- text = { "I need more bullets!", "I need more bullets!", "I need more bullets!" },
|
|
|
|
-- time = 4,
|
|
|
|
--},
|
|
|
|
--{
|
|
|
|
-- name = "ENEMY GUARD",
|
|
|
|
-- color = schemes["enemy"]["caption"],
|
|
|
|
-- text = { "Bigger weapons! Bigger weapons!", "Ratatatata!" },
|
|
|
|
-- time = 5,
|
|
|
|
--},
|
|
|
|
}
|
|
|
|
|
|
|
|
function AddCaption( name, color, text, time_to_type, lifetime )
|
|
|
|
if captions[#captions] and captions[#captions].name == name then
|
|
|
|
local weh = captions[#captions]
|
2023-09-24 16:26:55 -04:00
|
|
|
local wehlast = weh.lines[#weh.lines]
|
2023-11-12 19:19:59 -05:00
|
|
|
if wehlast.text == text then
|
|
|
|
wehlast.repeated = wehlast.repeated + 1
|
2023-09-24 16:26:55 -04:00
|
|
|
else
|
2023-11-12 19:19:59 -05:00
|
|
|
table.insert( weh.lines, { text = text, time_to_type=time_to_type, starttime=CurTime(), repeated = 1 } )
|
2023-09-24 16:26:55 -04:00
|
|
|
end
|
2023-09-14 16:41:56 -04:00
|
|
|
weh.lifetime = math.max( CurTime() + lifetime, weh.lifetime )
|
|
|
|
else
|
2023-11-12 19:19:59 -05:00
|
|
|
table.insert( captions, { name = name, color=color, lifetime=CurTime()+lifetime, lines = { { text=text, time_to_type=time_to_type, starttime=CurTime(), repeated = 1 } } })
|
2023-09-14 16:41:56 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
local color_caption = Color( 0, 0, 0, 127 )
|
2023-09-23 22:51:35 -04:00
|
|
|
local mat_grad = Material( "benny/hud/grad.png", "mips smooth" )
|
2023-09-14 16:41:56 -04:00
|
|
|
|
2023-12-03 23:24:42 -05:00
|
|
|
local lonk = {
|
|
|
|
{
|
|
|
|
Glyph = "R",
|
|
|
|
Text1 = "RELOAD",
|
|
|
|
Text2 = "Reload weapon",
|
|
|
|
},
|
|
|
|
{
|
|
|
|
Glyph = "T",
|
|
|
|
Text1 = "RELOAD (AKIMBO)",
|
|
|
|
Text2 = "Reload alternate weapon",
|
|
|
|
},
|
|
|
|
{
|
|
|
|
Glyph = "F",
|
|
|
|
Text1 = "AIM",
|
|
|
|
Text2 = "Enter weapon mode",
|
|
|
|
},
|
|
|
|
{
|
|
|
|
Glyph = "SPACE",
|
|
|
|
Text1 = "STUNT",
|
|
|
|
Text2 = "Do a barrel roll",
|
|
|
|
},
|
|
|
|
{
|
|
|
|
Glyph = "CTRL",
|
|
|
|
Text1 = "STANCE",
|
|
|
|
Text2 = "Get down",
|
|
|
|
},
|
|
|
|
{
|
|
|
|
Glyph = "F1",
|
|
|
|
Text1 = "DEV. SPAWN",
|
|
|
|
Text2 = "Cheat items in",
|
|
|
|
},
|
|
|
|
}
|
|
|
|
|
2023-10-02 01:25:47 -04:00
|
|
|
-- Stew port
|
|
|
|
globhit = Vector()
|
|
|
|
globang = Angle()
|
|
|
|
tr1f = Vector()
|
|
|
|
tr2f = Vector()
|
|
|
|
local col_1 = Color(255, 255, 255, 200)
|
|
|
|
local col_2 = Color(0, 0, 0, 255)
|
|
|
|
local col_3 = Color(255, 127, 127, 255)
|
|
|
|
local col_4 = Color(255, 222, 222, 255)
|
2023-10-31 19:06:09 -04:00
|
|
|
local heartbeatcol = Color(255, 255, 255, 255)
|
2023-12-06 20:50:51 -05:00
|
|
|
local mat_dot = Material("benny/hud/xhair/dotx.png", "smooth")
|
|
|
|
local mat_long = Material("benny/hud/xhair/long.png", "smooth")
|
2023-10-02 01:25:47 -04:00
|
|
|
local mat_dot_s = Material("benny/hud/xhair/dot_s.png", "mips smooth")
|
|
|
|
local mat_long_s = Material("benny/hud/xhair/long_s.png", "mips smooth")
|
2023-12-06 20:50:51 -05:00
|
|
|
local spacer_long = 5 -- screenscaled
|
|
|
|
local spacer = 1 -- screenscaled
|
2023-11-29 19:03:14 -05:00
|
|
|
local gap = 8
|
2023-10-02 01:25:47 -04:00
|
|
|
|
2023-11-12 06:52:30 -05:00
|
|
|
local trash_vec, trash_ang = Vector(), Angle()
|
|
|
|
|
2023-10-22 00:37:35 -04:00
|
|
|
bucket_selected = bucket_selected or 1
|
|
|
|
item_selected = item_selected or 1
|
2023-10-09 03:03:10 -04:00
|
|
|
|
2023-09-13 22:15:43 -04:00
|
|
|
hook.Add( "HUDPaint", "Benny_HUDPaint", function()
|
2023-09-14 16:41:56 -04:00
|
|
|
local sw, sh = ScrW(), ScrH()
|
2023-11-18 00:29:08 -05:00
|
|
|
local Wb = ss(20)
|
|
|
|
local Hb = ss(20)
|
|
|
|
|
|
|
|
-- Wb = (sh*(4/3))
|
|
|
|
-- Wb = (sw-Wb)/2
|
|
|
|
|
2023-09-23 22:51:35 -04:00
|
|
|
local p = LocalPlayer()
|
2023-11-16 01:54:54 -05:00
|
|
|
local wep = p:BennyCheck()
|
2023-09-14 16:41:56 -04:00
|
|
|
|
2023-11-12 00:45:28 -05:00
|
|
|
local active = GetConVar("benny_hud_tempactive"):GetString()
|
|
|
|
local scheme = schemes[active]
|
2023-09-14 16:41:56 -04:00
|
|
|
|
2023-12-04 18:20:18 -05:00
|
|
|
if ConVarCL_Bool("hud_enable_health") then -- Health
|
2023-11-17 21:12:25 -05:00
|
|
|
local b_w, b_h = ss(142), ss(32)
|
|
|
|
local b_bh = ss(14)
|
|
|
|
local b_bh2 = ss(8)
|
|
|
|
local b_s = ss(4)
|
|
|
|
local b_s2 = b_s*2
|
2023-11-18 00:29:08 -05:00
|
|
|
local b_x, b_y = Wb, sh - Hb - b_h
|
2023-09-14 16:41:56 -04:00
|
|
|
-- BG
|
|
|
|
surface.SetDrawColor( scheme["bg"] )
|
2023-11-17 21:12:25 -05:00
|
|
|
surface.DrawRect( b_x, b_y, b_w, b_h )
|
2023-09-14 16:41:56 -04:00
|
|
|
|
2023-09-23 22:51:35 -04:00
|
|
|
local hp = p:Health()/100 --CurTime()*0.5 % 1
|
|
|
|
local ti = (CurTime()*0.75 / (hp)) % 1
|
2023-09-14 16:41:56 -04:00
|
|
|
|
|
|
|
-- Text underneath
|
|
|
|
surface.SetFont( "Benny_18" )
|
|
|
|
surface.SetTextColor( scheme["fg"] )
|
2023-11-17 21:12:25 -05:00
|
|
|
surface.SetTextPos( b_x + ss(6), b_y + ss(3) )
|
2023-09-14 16:41:56 -04:00
|
|
|
surface.DrawText( scheme["name"] )
|
|
|
|
|
|
|
|
-- Bar
|
|
|
|
surface.SetDrawColor( scheme["fg"] )
|
2023-11-17 21:12:25 -05:00
|
|
|
surface.DrawOutlinedRect( b_x + b_s, b_y + b_s, ss(142-8), b_bh, ss( 0.5 ) )
|
|
|
|
surface.DrawRect( b_x + b_s + ss(1), b_y + b_s + ss(1), ss(142*hp-8-2), b_bh - ss(2) )
|
2023-09-14 16:41:56 -04:00
|
|
|
|
2023-10-31 19:06:09 -04:00
|
|
|
heartbeatcol.a = math.ease.OutQuint(1-ti)*255
|
|
|
|
surface.SetDrawColor( heartbeatcol )
|
2023-09-23 22:51:35 -04:00
|
|
|
surface.SetMaterial( mat_grad )
|
2023-11-17 21:12:25 -05:00
|
|
|
surface.DrawTexturedRect( b_x + b_s + ss(1), b_y + b_s + ss(1), ss(142*hp*ti-8-2), b_bh - ss(2) )
|
2023-09-23 22:51:35 -04:00
|
|
|
|
2023-09-14 16:41:56 -04:00
|
|
|
-- Bar text
|
|
|
|
surface.SetTextColor( scheme["bg"] )
|
2023-11-17 21:12:25 -05:00
|
|
|
surface.SetTextPos( b_x + ss(6), b_y + ss(3) )
|
|
|
|
render.SetScissorRect( b_x + b_s, b_y + b_s, b_x + b_s + ss(142*hp-8), b_y + b_s + b_bh, true ) -- Enable the rect
|
2023-09-14 16:41:56 -04:00
|
|
|
surface.DrawText( scheme["name"] )
|
|
|
|
render.SetScissorRect( 0, 0, 0, 0, false ) -- Disable after you are done
|
2023-11-17 21:12:25 -05:00
|
|
|
|
|
|
|
if true then -- Stamina
|
2023-11-28 23:11:10 -05:00
|
|
|
local perc = p:GetStamina()
|
2023-11-17 21:12:25 -05:00
|
|
|
for i=1, 4 do
|
|
|
|
local localperc = math.Clamp( math.Remap( perc, (0.25*(i-1)), (0.25*(i)), 0, 1 ), 0, 1 )
|
|
|
|
surface.SetDrawColor( scheme["fg"] )
|
|
|
|
surface.DrawOutlinedRect( b_x + b_s + ((i-1)*ss(32+2)), b_y + b_bh + ss(4+2), ss(32), b_bh2, ss(0.5) )
|
|
|
|
surface.DrawRect( b_x + b_s + ((i-1)*ss(32+2)) + ss(1), b_y + b_bh + ss(4+2) + ss(1), ss(32*localperc) - ss(2), b_bh2 - ss(2) )
|
|
|
|
end
|
|
|
|
end
|
2023-11-18 00:29:08 -05:00
|
|
|
end
|
|
|
|
|
2023-11-12 06:52:30 -05:00
|
|
|
do -- Vaulting
|
|
|
|
if vaultsave then
|
|
|
|
local tex = "[SPACE] VAULT OVER"
|
2023-11-15 21:46:57 -05:00
|
|
|
if vaultsave == 2 then tex = "[SPACE] MANTLE OVER" end
|
2023-11-12 06:52:30 -05:00
|
|
|
|
|
|
|
surface.SetFont( "Benny_16" )
|
|
|
|
local tox, toy = surface.GetTextSize( tex )
|
|
|
|
local box, boy = ss( 8 ) + tox, ss( 18 )
|
|
|
|
surface.SetDrawColor( scheme["bg"] )
|
|
|
|
surface.DrawRect( sw/2 - box/2, sh/2 + ss( 96 ) - boy/2 - ss( 2 ), box, boy )
|
|
|
|
|
|
|
|
surface.SetTextColor( scheme["fg"] )
|
|
|
|
surface.SetTextPos( sw/2 - tox/2, sh/2 + ss( 96 ) - toy/2 )
|
|
|
|
surface.DrawText( tex )
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2023-12-04 18:20:18 -05:00
|
|
|
if ConVarCL_Bool("hud_enable_hints") then -- Hints
|
2023-11-29 18:00:30 -05:00
|
|
|
local b_w, b_h = ss(130), ss(0)
|
2023-11-29 02:45:48 -05:00
|
|
|
local b_x, b_y = sw - Wb - b_w, Hb + ss(200)--sh/2 - b_h/2
|
2023-11-29 00:37:32 -05:00
|
|
|
|
|
|
|
local honk = ss(1)
|
|
|
|
local honk2 = honk*2
|
|
|
|
|
2023-11-29 18:00:30 -05:00
|
|
|
local tbw, tbh, tbg = ss(6), ss(2), ss(12)
|
2023-11-29 00:37:32 -05:00
|
|
|
|
|
|
|
local bump = 0
|
|
|
|
local tbump = 0
|
|
|
|
|
|
|
|
|
|
|
|
for _, data in ipairs( lonk ) do
|
2023-11-29 02:45:48 -05:00
|
|
|
if _==1 then
|
|
|
|
tbump = tbump + ss(4)
|
|
|
|
end
|
2023-11-29 18:00:30 -05:00
|
|
|
tbump = tbump + ss(16)
|
2023-11-29 02:45:48 -05:00
|
|
|
if _==#lonk then
|
|
|
|
tbump = tbump + ss(4)
|
|
|
|
end
|
2023-11-29 00:37:32 -05:00
|
|
|
end
|
2023-11-29 02:45:48 -05:00
|
|
|
|
2023-11-29 00:37:32 -05:00
|
|
|
b_h = b_h + tbump
|
2023-12-03 23:24:42 -05:00
|
|
|
b_y = sh/2 - b_h/2
|
2023-11-29 02:45:48 -05:00
|
|
|
|
2023-11-29 00:37:32 -05:00
|
|
|
surface.SetDrawColor( scheme["bg"] )
|
|
|
|
surface.DrawRect( b_x, b_y, b_w, b_h )
|
|
|
|
|
|
|
|
surface.SetDrawColor( scheme["fg"] )
|
|
|
|
surface.DrawOutlinedRect( b_x + honk, b_y + honk, b_w - honk2, b_h - honk2, ss(0.5) )
|
|
|
|
for _, data in ipairs( lonk ) do
|
2023-11-29 02:45:48 -05:00
|
|
|
if _==1 then
|
|
|
|
bump = bump + ss(4)
|
|
|
|
end
|
2023-11-29 00:37:32 -05:00
|
|
|
|
2023-11-29 18:00:30 -05:00
|
|
|
-- surface.SetDrawColor( 0, 100, 255, 32 )
|
|
|
|
-- surface.DrawRect( b_x, b_y + bump, b_w, ss(16) )
|
2023-11-29 00:37:32 -05:00
|
|
|
|
2023-11-29 18:00:30 -05:00
|
|
|
draw.SimpleText( data.Text1, "Benny_12", b_x + b_w - tbw,
|
2023-11-29 00:37:32 -05:00
|
|
|
b_y + bump,
|
|
|
|
scheme["fg"], TEXT_ALIGN_RIGHT, TEXT_ALIGN_TOP )
|
|
|
|
|
2023-11-29 02:45:48 -05:00
|
|
|
draw.SimpleText( data.Text2, "Benny_8", b_x + b_w - tbw,
|
2023-11-29 18:00:30 -05:00
|
|
|
b_y+ss(8) + bump,
|
2023-11-29 00:37:32 -05:00
|
|
|
scheme["fg"], TEXT_ALIGN_RIGHT, TEXT_ALIGN_TOP )
|
|
|
|
|
|
|
|
if #data.Glyph == 1 then
|
2023-11-29 18:00:30 -05:00
|
|
|
surface.SetDrawColor( scheme["fg"] )
|
2023-11-29 00:37:32 -05:00
|
|
|
surface.DrawOutlinedRect( b_x + tbw,
|
|
|
|
b_y + ss(2) + bump, tbg, tbg, ss(1) )
|
2023-11-29 18:00:30 -05:00
|
|
|
draw.SimpleText( data.Glyph, "Benny_12", b_x + tbw + tbg/2,
|
2023-11-29 02:45:48 -05:00
|
|
|
b_y + ss(2.6) + bump,
|
2023-11-29 00:37:32 -05:00
|
|
|
scheme["fg"], TEXT_ALIGN_CENTER, TEXT_ALIGN_TOP )
|
|
|
|
else
|
2023-11-29 02:45:48 -05:00
|
|
|
surface.SetFont( "Benny_10" )
|
2023-11-29 00:37:32 -05:00
|
|
|
local tx = surface.GetTextSize( data.Glyph )
|
|
|
|
tx = math.max( tx + ss(8), tbg )
|
|
|
|
|
2023-11-29 18:00:30 -05:00
|
|
|
surface.SetDrawColor( scheme["fg"] )
|
2023-11-29 00:37:32 -05:00
|
|
|
surface.DrawOutlinedRect( b_x + tbw,
|
|
|
|
b_y + ss(2) + bump, tx, tbg, ss(1) )
|
2023-11-29 02:45:48 -05:00
|
|
|
draw.SimpleText( data.Glyph, "Benny_10", b_x + tbw + tx/2,
|
2023-11-29 18:00:30 -05:00
|
|
|
b_y + ss(3.6) + bump,
|
2023-11-29 00:37:32 -05:00
|
|
|
scheme["fg"], TEXT_ALIGN_CENTER, TEXT_ALIGN_TOP )
|
|
|
|
end
|
2023-11-29 18:00:30 -05:00
|
|
|
bump = bump + ss(16)
|
2023-11-29 02:45:48 -05:00
|
|
|
if _==#lonk then
|
|
|
|
bump = bump + ss(4)
|
|
|
|
end
|
2023-11-29 00:37:32 -05:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2023-12-04 18:20:18 -05:00
|
|
|
|
|
|
|
if wep and ConVarCL_Bool("hud_enable_active") then -- Weapon
|
2023-09-24 01:19:23 -04:00
|
|
|
local inv = p:INV_Get()
|
2023-09-25 20:42:13 -04:00
|
|
|
local wep1 = wep:BTable( false )
|
|
|
|
local wep1c = wep:BClass( false )
|
|
|
|
local wep2 = wep:BTable( true )
|
|
|
|
local wep2c = wep:BClass( true )
|
2023-09-24 01:19:23 -04:00
|
|
|
|
2023-11-16 22:00:11 -05:00
|
|
|
for i=1, 2 do
|
|
|
|
local hand = i==2
|
|
|
|
if wep:BTable( hand ) then -- New Weapon HUD
|
|
|
|
local wep_table = wep:BTable( hand )
|
|
|
|
local wep_class = wep:BClass( hand )
|
|
|
|
|
|
|
|
local p_w, p_h = ss(156), ss(64)
|
2023-11-29 02:45:48 -05:00
|
|
|
local p_x, p_y = sw - p_w - Wb, Hb
|
|
|
|
if hand then p_x = Wb end
|
2023-11-16 22:00:11 -05:00
|
|
|
local pb = ss(4)
|
|
|
|
local pb2 = pb*2
|
|
|
|
|
|
|
|
surface.SetDrawColor( scheme["bg"] )
|
|
|
|
surface.DrawRect( p_x, p_y, p_w, p_h )
|
|
|
|
|
|
|
|
do -- Name tag
|
|
|
|
local t_h = ss(15)
|
|
|
|
surface.SetDrawColor( scheme["fg"] )
|
|
|
|
surface.DrawRect( p_x+pb, p_y+pb, p_w-pb2, t_h )
|
2023-09-14 16:41:56 -04:00
|
|
|
|
2023-11-16 22:00:11 -05:00
|
|
|
draw.SimpleText( wep_class.Name, "Benny_16", p_x+ss(6), p_y+ss(5), scheme["bg"], TEXT_ALIGN_LEFT, TEXT_ALIGN_TOP )
|
|
|
|
|
2023-11-17 22:56:41 -05:00
|
|
|
local identicallist = p:INV_Find( wep:BTable( hand ).Class )
|
|
|
|
identicallist = table.Flip( identicallist )
|
|
|
|
local numba = identicallist[ wep:D_GetID( hand ) ]
|
2023-11-29 18:09:31 -05:00
|
|
|
draw.SimpleText( "#" .. tostring(numba) .. ", " .. wep:D_GetID( hand ), "Benny_10", p_x+p_w-pb2, p_y+ss(7), scheme["bg"], TEXT_ALIGN_RIGHT, TEXT_ALIGN_TOP )
|
2023-09-14 16:41:56 -04:00
|
|
|
|
2023-11-16 22:00:11 -05:00
|
|
|
if wep_class.Firemodes then -- Firemode
|
|
|
|
surface.SetDrawColor( scheme["fg"] )
|
|
|
|
surface.DrawRect( p_x+pb, p_y + pb + t_h + ss(2), ss(30), ss(10) )
|
2023-11-03 13:20:39 -04:00
|
|
|
|
2023-11-16 22:00:11 -05:00
|
|
|
draw.SimpleText( wep:B_FiremodeName( hand ), "Benny_12", p_x + pb + ss(14.5), p_y + pb + t_h + ss(8), scheme["bg"], TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER )
|
|
|
|
-- draw.SimpleText( "[AMMO TYPE]", "Benny_10", p_x + pb + ss(30+4), p_y + pb + t_h + ss(8), scheme["fg"], TEXT_ALIGN_LEFT, TEXT_ALIGN_CENTER )
|
|
|
|
end
|
|
|
|
if wep_class.Ammo then -- Ammo
|
|
|
|
local b_w, b_h = ss(3), ss(10)
|
|
|
|
local lw, lh = ss(2), ss(2)
|
|
|
|
surface.SetDrawColor( scheme["fg"] )
|
2023-09-25 20:42:13 -04:00
|
|
|
|
2023-11-16 22:00:11 -05:00
|
|
|
local ammo = math.max( wep:D_GetClip( hand ), wep_class.Ammo )
|
|
|
|
if ammo>30 then b_w, b_h = ss(3), ss(4) end
|
|
|
|
|
|
|
|
local offset = b_h
|
|
|
|
local count = 1
|
|
|
|
for i=1, ammo do
|
|
|
|
local thefunk = surface.DrawRect
|
|
|
|
if i > wep:D_GetClip( hand ) then
|
|
|
|
thefunk = surface.DrawOutlinedRect
|
|
|
|
end
|
|
|
|
if i!=1 and i%30 == 1 then
|
|
|
|
count = 1
|
|
|
|
offset = offset + b_h + lh
|
|
|
|
end
|
|
|
|
thefunk( p_x + p_w - b_w - pb - ((count-1)*(b_w+lw)), p_y + p_h - offset - pb, b_w, b_h, ss(0.5) )
|
|
|
|
count = count + 1
|
2023-11-13 22:54:52 -05:00
|
|
|
end
|
2023-11-16 22:00:11 -05:00
|
|
|
draw.SimpleText( wep:D_GetClip( hand ), "Benny_12", p_x + p_w - pb - ss(1), p_y + p_h - offset - ss(12+3), scheme["fg"], TEXT_ALIGN_RIGHT, TEXT_ALIGN_TOP )
|
2023-11-17 21:12:25 -05:00
|
|
|
|
|
|
|
if wep:D_GetMagID( hand ) != wep_table.Loaded then
|
|
|
|
surface.SetDrawColor( scheme["bg"] )
|
|
|
|
surface.DrawRect( p_x, p_y - ss( 12+3 ), ss( 66 ), ss( 12 ) )
|
|
|
|
draw.SimpleText( "!! Mag desync.", "Benny_12", p_x + ss( 2 ), p_y - ss( 12+2 ), scheme["fg"], TEXT_ALIGN_LEFT, TEXT_ALIGN_TOP )
|
|
|
|
end
|
2023-11-16 22:00:11 -05:00
|
|
|
end
|
|
|
|
if wep_class.Ammo then -- Magazines
|
2023-11-18 00:29:08 -05:00
|
|
|
local m_w, m_h = ss( 12 ), ss( 20 )
|
2023-11-29 02:45:48 -05:00
|
|
|
local m_x, m_y = p_x + p_w - m_w, p_y + p_h + ss(1)--p_x - m_w, p_y + p_h - m_h
|
2023-11-16 22:00:11 -05:00
|
|
|
local bb = ss( 1 )
|
|
|
|
local b2 = ss( 2 )
|
|
|
|
local b3 = ss( 3 )
|
|
|
|
local b4 = ss( 4 )
|
2023-12-06 02:27:15 -05:00
|
|
|
local maglist = p:INV_FindMagSmart( wep_table.Class, wep:D_GetID( hand ) )
|
|
|
|
for id, tag in ipairs( maglist ) do
|
2023-11-17 21:12:25 -05:00
|
|
|
--assert( inv[tag], "That magazine doesn't exist. " .. tag )
|
2023-11-16 22:00:11 -05:00
|
|
|
local chunk = ((ss(1)+m_w)*(id-1))
|
|
|
|
surface.SetDrawColor( scheme["bg"] )
|
|
|
|
surface.DrawRect( m_x - chunk, m_y, m_w, m_h )
|
|
|
|
|
|
|
|
surface.SetDrawColor( scheme["fg"] )
|
|
|
|
surface.DrawOutlinedRect( m_x + bb - chunk, m_y + bb, m_w - b2, m_h - b2, ss( 0.5 ) )
|
|
|
|
|
|
|
|
local s1 = (m_h - b2 - b2)
|
2023-11-29 18:40:45 -05:00
|
|
|
local s2 = (m_h - b2 - b2) * (inv[tag] and ( inv[tag].Ammo / WeaponGet(inv[tag].Class).Ammo ) or 8)
|
2023-11-16 22:00:11 -05:00
|
|
|
local s3 = math.floor( s2 - s1 )
|
|
|
|
|
|
|
|
local m1, m2, m3, m4 = m_x + bb + bb - chunk, m_y + bb + bb - s3, m_w - b2 - b2, s2
|
|
|
|
local active = tag == wep:D_GetMagID( hand )
|
2023-11-17 22:56:41 -05:00
|
|
|
local active2 = tag == wep:D_GetMagID( !hand )
|
|
|
|
if active or active2 then
|
|
|
|
draw.SimpleText( active2 and "|" or "x", "Benny_10", m_x + (m_w/2) - chunk, m_y + (m_h/2), scheme["fg"], TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER )
|
2023-11-16 22:00:11 -05:00
|
|
|
end
|
|
|
|
surface.DrawRect( m1, m2, m3, m4 )
|
|
|
|
|
2023-11-17 22:56:41 -05:00
|
|
|
if active or active2 then
|
2023-11-16 22:00:11 -05:00
|
|
|
render.SetScissorRect( m1, m2, m1 + m3, m2 + m4, true )
|
2023-11-17 22:56:41 -05:00
|
|
|
draw.SimpleText( active2 and "|" or "x", "Benny_10", m_x + (m_w/2) - chunk, m_y + (m_h/2), scheme["bg"], TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER )
|
2023-11-16 22:00:11 -05:00
|
|
|
render.SetScissorRect( 0, 0, 0, 0, false )
|
|
|
|
end
|
2023-11-13 22:54:52 -05:00
|
|
|
end
|
2023-11-03 13:20:39 -04:00
|
|
|
end
|
|
|
|
end
|
2023-09-25 17:26:52 -04:00
|
|
|
end
|
2023-09-14 16:41:56 -04:00
|
|
|
end
|
2023-10-02 01:25:47 -04:00
|
|
|
|
2023-12-08 00:28:34 -05:00
|
|
|
local meow = wep:C_DualCheck()
|
|
|
|
if wep:GetUserAim() and wep:BClass( meow ) and wep:BClass( meow ).Spread then -- Crosshair
|
2023-10-02 01:25:47 -04:00
|
|
|
local s, w, h = ss, ScrW(), ScrH()
|
|
|
|
local pl_x, pl_y = w/2, h/2
|
|
|
|
|
2023-12-08 00:28:34 -05:00
|
|
|
local dispersion = math.rad( wep:BSpread( meow ) )
|
2023-12-06 20:50:51 -05:00
|
|
|
cam.Start3D()
|
|
|
|
local lool = ( EyePos() + ( EyeAngles():Forward()*8192 ) + ( dispersion * EyeAngles():Up()*8192 ) ) :ToScreen()
|
|
|
|
cam.End3D()
|
|
|
|
gap = ( (ScrH()/2) - lool.y )
|
|
|
|
|
2023-10-02 01:25:47 -04:00
|
|
|
do
|
|
|
|
local tr1 = util.TraceLine({
|
|
|
|
start = p:EyePos(),
|
|
|
|
endpos = p:EyePos() + (p:EyeAngles():Forward()*16000),
|
|
|
|
filter = p
|
|
|
|
})
|
|
|
|
|
|
|
|
local tr2 = util.TraceLine({
|
|
|
|
start = globhit,
|
|
|
|
endpos = globhit + (globang:Forward()*16000),
|
|
|
|
filter = p
|
|
|
|
})
|
|
|
|
|
|
|
|
tr1f:Set(tr1.HitPos)
|
|
|
|
tr2f:Set(tr2.HitPos)
|
|
|
|
end
|
|
|
|
|
|
|
|
pl_x = tr2f:ToScreen().x
|
|
|
|
pl_y = tr2f:ToScreen().y
|
|
|
|
ps_x = tr2f:ToScreen().x
|
|
|
|
ps_y = tr2f:ToScreen().y
|
|
|
|
|
|
|
|
local touse1 = col_1
|
|
|
|
local touse2 = col_2
|
|
|
|
if ve then
|
|
|
|
pl_x = tr1f:ToScreen().x
|
|
|
|
pl_y = tr1f:ToScreen().y
|
|
|
|
ps_x = tr1f:ToScreen().x
|
|
|
|
ps_y = tr1f:ToScreen().y
|
|
|
|
elseif util.TraceLine({start = tr2f, endpos = tr1f, filter = p}).Fraction != 1 and !tr2f:IsEqualTol(tr1f, 1) then
|
|
|
|
touse1 = col_4
|
|
|
|
touse2 = col_3
|
|
|
|
pl_x = tr1f:ToScreen().x
|
|
|
|
pl_y = tr1f:ToScreen().y
|
|
|
|
end
|
|
|
|
|
2023-10-09 03:03:26 -04:00
|
|
|
pl_x = math.Round( pl_x )
|
|
|
|
pl_y = math.Round( pl_y )
|
|
|
|
ps_x = math.Round( ps_x )
|
|
|
|
ps_y = math.Round( ps_y )
|
|
|
|
|
2023-10-02 01:25:47 -04:00
|
|
|
for i=1, 2 do
|
|
|
|
local cooler = i == 1 and touse2 or touse1
|
|
|
|
local poosx, poosy = i == 1 and ps_x or pl_x, i == 1 and ps_y or pl_y
|
|
|
|
local mat1 = i == 1 and mat_long_s or mat_long
|
|
|
|
local mat2 = i == 1 and mat_dot_s or mat_dot
|
|
|
|
surface.SetDrawColor( cooler )
|
2023-12-08 00:28:34 -05:00
|
|
|
if wep:BClass( meow ).Type == "rifle" then
|
2023-10-02 01:25:47 -04:00
|
|
|
surface.SetMaterial( mat1 )
|
2023-12-06 20:50:51 -05:00
|
|
|
surface.DrawTexturedRectRotated( poosx - s(spacer_long) - gap, poosy, s(32), s(32), 0 )
|
|
|
|
surface.DrawTexturedRectRotated( poosx + s(spacer_long) + gap, poosy, s(32), s(32), 0 )
|
2023-10-02 01:25:47 -04:00
|
|
|
|
|
|
|
surface.SetMaterial( mat2 )
|
2023-12-06 20:50:51 -05:00
|
|
|
surface.DrawTexturedRectRotated( poosx, poosy - gap - s(spacer), s(32), s(32), 0 )
|
|
|
|
surface.DrawTexturedRectRotated( poosx, poosy + gap + s(spacer), s(32), s(32), 0 )
|
2023-12-08 00:28:34 -05:00
|
|
|
elseif wep:BClass( meow ).Type == "smg" then
|
2023-10-02 01:25:47 -04:00
|
|
|
surface.SetMaterial( mat1 )
|
2023-12-06 20:50:51 -05:00
|
|
|
surface.DrawTexturedRectRotated( poosx, poosy + gap + s(spacer_long), s(32), s(32), 90 )
|
|
|
|
surface.DrawTexturedRectRotated( poosx - (math.sin(math.rad(45))*gap) - (math.sin(math.rad(45))*s(spacer_long)), poosy - (math.sin(math.rad(45))*gap) - (math.sin(math.rad(45))*s(spacer_long)), s(32), s(32), -45 )
|
|
|
|
surface.DrawTexturedRectRotated( poosx + (math.sin(math.rad(45))*gap) + (math.sin(math.rad(45))*s(spacer_long)), poosy - (math.sin(math.rad(45))*gap) - (math.sin(math.rad(45))*s(spacer_long)), s(32), s(32), 45 )
|
2023-10-02 01:25:47 -04:00
|
|
|
|
|
|
|
surface.SetMaterial( mat2 )
|
2023-12-06 20:50:51 -05:00
|
|
|
surface.DrawTexturedRectRotated( poosx, poosy, s(32), s(32), 0 )
|
2023-10-02 01:25:47 -04:00
|
|
|
else -- pistol
|
|
|
|
surface.SetMaterial( mat2 )
|
2023-12-06 20:50:51 -05:00
|
|
|
surface.DrawTexturedRectRotated( poosx - gap - s(spacer), poosy, s(32), s(32), 0 )
|
|
|
|
surface.DrawTexturedRectRotated( poosx + gap + s(spacer), poosy, s(32), s(32), 0 )
|
2023-10-02 01:25:47 -04:00
|
|
|
|
|
|
|
surface.SetMaterial( mat2 )
|
2023-12-06 20:50:51 -05:00
|
|
|
surface.DrawTexturedRectRotated( poosx, poosy - gap - s(spacer), s(32), s(32), 0 )
|
|
|
|
surface.DrawTexturedRectRotated( poosx, poosy + gap + s(spacer), s(32), s(32), 0 )
|
2023-10-02 01:25:47 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2023-11-29 02:45:36 -05:00
|
|
|
if false then -- Quickinv
|
2023-10-02 01:25:47 -04:00
|
|
|
local inv = p:INV_Get()
|
|
|
|
local gap = ss(1)
|
|
|
|
local size_textx = ss(96)
|
|
|
|
local size_texty = ss(12)
|
2023-10-09 03:03:10 -04:00
|
|
|
local size_texty_sel = ss(36)
|
2023-10-02 01:25:47 -04:00
|
|
|
local size_num = ss(12)
|
|
|
|
local size_thi = ss(0.5)
|
|
|
|
|
|
|
|
local nextwe = ss(96+2)
|
|
|
|
local nextwe_no = ss(12+2)
|
|
|
|
local item_start = ss(14)
|
|
|
|
local item_gap = ss(12+2)
|
2023-10-09 03:03:10 -04:00
|
|
|
local item_gap_sel = ss(36+2)
|
2023-10-02 01:25:47 -04:00
|
|
|
|
2023-10-09 15:05:58 -04:00
|
|
|
local inventorylist = p:INV_Buckets()
|
2023-10-02 01:25:47 -04:00
|
|
|
local bump = 0
|
2023-11-15 21:46:57 -05:00
|
|
|
|
|
|
|
-- PROTO: Maybe check this every 10hz instead
|
2023-11-16 01:54:54 -05:00
|
|
|
do
|
|
|
|
for n, bucket in ipairs( inventorylist ) do
|
|
|
|
for i, v in ipairs( bucket ) do
|
2023-11-29 02:45:36 -05:00
|
|
|
if v == wep:D_GetID( false ) then
|
2023-11-16 01:54:54 -05:00
|
|
|
bucket_selected = n
|
|
|
|
item_selected = i
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
2023-11-15 21:46:57 -05:00
|
|
|
|
2023-10-02 01:25:47 -04:00
|
|
|
for i, bucket in ipairs( inventorylist ) do
|
|
|
|
surface.SetDrawColor( scheme["bg"] )
|
2023-11-18 00:29:08 -05:00
|
|
|
surface.DrawRect( bump + Wb, Hb, size_num, size_num )
|
2023-10-02 01:25:47 -04:00
|
|
|
|
2023-10-09 03:03:10 -04:00
|
|
|
if i==bucket_selected then
|
2023-10-02 01:25:47 -04:00
|
|
|
surface.SetDrawColor( scheme["fg"] )
|
2023-11-18 00:29:08 -05:00
|
|
|
surface.DrawRect( bump + Wb + gap, Hb + gap, size_num - (gap*2), size_num - (gap*2) )
|
2023-10-02 01:25:47 -04:00
|
|
|
|
|
|
|
surface.SetFont( "Benny_12" )
|
|
|
|
surface.SetTextColor( scheme["bg"] )
|
2023-11-18 00:29:08 -05:00
|
|
|
surface.SetTextPos( bump + Wb + ss(3), Hb + ss(1) )
|
2023-10-02 01:25:47 -04:00
|
|
|
surface.DrawText( i )
|
|
|
|
else
|
|
|
|
surface.SetFont( "Benny_12" )
|
|
|
|
surface.SetTextColor( scheme["fg"] )
|
2023-11-18 00:29:08 -05:00
|
|
|
surface.SetTextPos( bump + Wb + ss(3), Hb + ss(1) )
|
2023-10-02 01:25:47 -04:00
|
|
|
surface.DrawText( i )
|
|
|
|
end
|
|
|
|
|
2023-10-09 03:03:10 -04:00
|
|
|
local ybump = 0
|
|
|
|
if i!=bucket_selected then
|
2023-10-02 01:25:47 -04:00
|
|
|
for d, item in ipairs( bucket ) do
|
|
|
|
surface.SetDrawColor( scheme["bg"] )
|
2023-11-18 00:29:08 -05:00
|
|
|
surface.DrawRect( bump + Wb, (item_start+ybump) + Hb, size_texty, size_texty )
|
2023-10-09 03:03:10 -04:00
|
|
|
ybump = ybump + (item_gap)
|
2023-10-02 01:25:47 -04:00
|
|
|
end
|
|
|
|
bump = bump + (nextwe_no)
|
|
|
|
else
|
|
|
|
for d, item in ipairs( bucket ) do
|
2023-11-29 18:40:45 -05:00
|
|
|
local idata = WeaponGet(inv[item].Class)
|
2023-11-29 02:45:36 -05:00
|
|
|
local sel = item==wep:D_GetID( false )--d==item_selected
|
2023-10-09 15:45:40 -04:00
|
|
|
surface.SetDrawColor( scheme["bg"] )
|
2023-11-18 00:29:08 -05:00
|
|
|
surface.DrawRect( bump + Wb, (item_start+ybump) + Hb, size_textx, (sel and size_texty_sel or size_texty) )
|
2023-10-09 03:03:10 -04:00
|
|
|
if sel then
|
2023-10-02 01:25:47 -04:00
|
|
|
surface.SetDrawColor( scheme["fg"] )
|
2023-11-18 00:29:08 -05:00
|
|
|
surface.DrawRect( bump + Wb + gap, (item_start+ybump) + Hb + gap, size_textx - (gap*2), (sel and size_texty_sel or size_texty) - (gap*2) )
|
2023-10-02 01:25:47 -04:00
|
|
|
|
|
|
|
surface.SetTextColor( scheme["bg"] )
|
2023-10-09 17:06:27 -04:00
|
|
|
-- PROTO: This is just useful information for me.
|
|
|
|
surface.SetFont( "Benny_8" )
|
|
|
|
local num = 0
|
|
|
|
for i, v in pairs( inv[item] ) do
|
2023-11-18 00:29:08 -05:00
|
|
|
surface.SetTextPos( bump + Wb + ss(3), (item_start+ybump) + Hb + ss(1+6+(4*num)) )
|
2023-10-09 17:06:27 -04:00
|
|
|
surface.DrawText( i .. " : " .. v )
|
|
|
|
num = num +1
|
|
|
|
end
|
2023-10-02 01:25:47 -04:00
|
|
|
else
|
|
|
|
surface.SetTextColor( scheme["fg"] )
|
|
|
|
end
|
2023-10-09 03:03:10 -04:00
|
|
|
surface.SetFont( "Benny_12" )
|
2023-11-18 00:29:08 -05:00
|
|
|
surface.SetTextPos( bump + Wb + ss(3), (item_start+ybump) + Hb + ss(1) )
|
2023-10-09 03:03:10 -04:00
|
|
|
surface.DrawText( idata.Name )
|
|
|
|
|
|
|
|
surface.SetFont( "Benny_8" )
|
2023-11-18 00:29:08 -05:00
|
|
|
surface.SetTextPos( bump + Wb + size_textx - surface.GetTextSize(item) - ss(3), (item_start+ybump) + Hb + ss(1) )
|
2023-10-09 03:03:10 -04:00
|
|
|
surface.DrawText( item )
|
|
|
|
ybump = ybump + (d==item_selected and item_gap_sel or item_gap)
|
2023-10-02 01:25:47 -04:00
|
|
|
end
|
|
|
|
bump = bump + (nextwe)
|
|
|
|
end
|
|
|
|
end
|
2023-09-14 16:41:56 -04:00
|
|
|
end
|
|
|
|
|
2023-12-04 18:20:18 -05:00
|
|
|
|
|
|
|
if wep and ConVarCL_Bool("hud_enable_hotbar") then -- Newinv
|
2023-12-03 23:24:42 -05:00
|
|
|
local weighted = p:INV_Weight()
|
2023-11-29 00:38:09 -05:00
|
|
|
local inv = p:INV_Get()
|
2023-12-03 23:24:42 -05:00
|
|
|
local iflip = table.Flip( p:INV_Get())
|
2023-11-29 00:38:09 -05:00
|
|
|
|
2023-12-03 23:24:42 -05:00
|
|
|
local b_w = 38
|
|
|
|
local b_h = 14
|
2023-11-29 19:03:14 -05:00
|
|
|
|
2023-12-03 23:24:42 -05:00
|
|
|
local b_x, b_y = sw - Wb, sh - Hb - ss(b_h)
|
|
|
|
|
|
|
|
local bump = 0
|
|
|
|
local fbump = 0
|
|
|
|
|
|
|
|
local num, tcount = 0, table.Count( weighted )
|
|
|
|
for _, item in pairs( weighted ) do
|
|
|
|
num = num + 1
|
|
|
|
local class = WeaponGet(item.Class)
|
|
|
|
local boxsize = ss(b_w)
|
|
|
|
fbump = fbump + boxsize
|
|
|
|
if num != tcount then
|
|
|
|
fbump = fbump + ss(2)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
b_x = b_x - fbump
|
|
|
|
|
|
|
|
local invid = 0
|
|
|
|
for _, item in pairs( weighted ) do
|
|
|
|
local id = iflip[item]
|
|
|
|
local class = WeaponGet(item.Class)
|
|
|
|
local boxsize = ss(b_w)
|
2023-11-29 19:03:14 -05:00
|
|
|
surface.SetDrawColor( scheme["bg"] )
|
2023-12-03 23:24:42 -05:00
|
|
|
surface.DrawRect( b_x + bump, b_y, boxsize, ss(b_h) )
|
|
|
|
--draw.SimpleText( class.Type, "Benny_8", b_x + bump + boxsize/2, b_y + ss(3), scheme["fg"], TEXT_ALIGN_CENTER, TEXT_ALIGN_TOP )
|
|
|
|
draw.SimpleText( class.Name, "Benny_8", b_x + bump + boxsize/2, b_y + ss(4), scheme["fg"], TEXT_ALIGN_CENTER, TEXT_ALIGN_TOP )
|
|
|
|
--draw.SimpleText( "", "Benny_8", b_x + bump + boxsize/2, b_y + ss(17), scheme["fg"], TEXT_ALIGN_CENTER, TEXT_ALIGN_TOP )
|
|
|
|
if class.Features == "firearm" or class.Features == "grenade" then
|
|
|
|
surface.SetDrawColor( scheme["fg"] )
|
|
|
|
surface.DrawOutlinedRect( b_x + bump + ss(1), b_y + ss(1), boxsize-ss(2), ss(b_h-2), ss(0.5) )
|
|
|
|
invid = invid + 1
|
|
|
|
surface.SetDrawColor( scheme["bg"] )
|
|
|
|
surface.DrawRect( b_x + bump, b_y - ss(2+12), ss(12), ss(12) )
|
|
|
|
draw.SimpleText( invid, "Benny_10", b_x + bump + ss(6), b_y - ss(2+10), scheme["fg"], TEXT_ALIGN_CENTER, TEXT_ALIGN_TOP )
|
|
|
|
end
|
|
|
|
|
2023-12-06 02:27:15 -05:00
|
|
|
local maginv = p:INV_FindMagSmart( item.Class, id )
|
2023-12-03 23:24:42 -05:00
|
|
|
local magbump = 0
|
2023-12-06 01:03:35 -05:00
|
|
|
for _, mag in ipairs( maginv ) do
|
2023-12-03 23:24:42 -05:00
|
|
|
local mitem = inv[mag]
|
|
|
|
local loaded = (item.Loaded == mag)
|
|
|
|
local perc = mitem.Ammo/WeaponGet(mitem.Class).Ammo
|
|
|
|
surface.SetDrawColor( scheme["bg"] )
|
|
|
|
surface.DrawRect( b_x + bump + magbump + ss(13), b_y - ss(14), ss(4), ss(12) )
|
|
|
|
surface.SetDrawColor( scheme["fg"] )
|
|
|
|
surface.DrawRect( b_x + bump + magbump + ss(13) + ss(1), b_y - ss(14-1) + math.Round((ss(10)-ss(10*perc))), ss(2), math.Round(ss(10*perc)) )
|
|
|
|
magbump = magbump + ss(4+1)
|
|
|
|
end
|
|
|
|
bump = bump + boxsize + ss(2)
|
2023-11-29 19:03:14 -05:00
|
|
|
end
|
2023-11-29 00:38:09 -05:00
|
|
|
end
|
|
|
|
|
2023-09-14 16:41:56 -04:00
|
|
|
do -- Captions
|
2023-11-18 00:29:08 -05:00
|
|
|
local space = Hb
|
2023-09-14 16:41:56 -04:00
|
|
|
for aaa, caption in pairs(captions) do
|
|
|
|
if caption.lifetime <= CurTime() then captions[aaa] = nil end
|
|
|
|
if #caption.lines == 0 then captions[aaa] = nil end
|
|
|
|
end
|
|
|
|
for aaa, caption in SortedPairsByMemberValue(captions, "starttime", false) do
|
2023-11-12 20:30:41 -05:00
|
|
|
surface.SetFont("Benny_Caption_9I")
|
2023-09-14 16:41:56 -04:00
|
|
|
local tw = 0
|
|
|
|
for i, v in pairs( caption.lines ) do
|
2023-11-12 19:19:59 -05:00
|
|
|
local repeater = ( v.repeated > 1 and (" (x" .. v.repeated .. ")") or "" )
|
|
|
|
tw = math.max( tw, surface.GetTextSize( v.text .. repeater ) )
|
2023-09-14 16:41:56 -04:00
|
|
|
end
|
|
|
|
surface.SetFont("Benny_10")
|
|
|
|
tw = math.max( tw, surface.GetTextSize( caption.name ) )
|
|
|
|
space = space + ss(22)+ss(8*(#caption.lines-1))
|
|
|
|
|
|
|
|
-- BG
|
|
|
|
surface.SetDrawColor( color_caption )
|
|
|
|
surface.DrawRect( (sw/2) - (ss(8)+tw)/2, sh - space - ss(0), ss(8)+tw, ss(22)+ss(8*(#caption.lines-1)) )
|
|
|
|
|
2023-09-24 17:50:42 -04:00
|
|
|
-- PROTO: Would be nice to be able to change italics or bold inline.
|
2023-09-14 16:41:56 -04:00
|
|
|
for i, v in SortedPairsByMemberValue( caption.lines, "starttime" ) do
|
2023-11-12 19:19:59 -05:00
|
|
|
local repeater = ( v.repeated > 1 and (" (x" .. v.repeated .. ")") or "" )
|
2023-09-24 17:50:42 -04:00
|
|
|
surface.SetFont("Benny_Caption_9I")
|
2023-09-14 16:41:56 -04:00
|
|
|
surface.SetTextColor( color_white )
|
|
|
|
surface.SetTextPos( (sw/2) - (tw/2), sh - space + ss(10) + (ss(8)*(i-1)) )
|
|
|
|
local waah = ""
|
|
|
|
for i=1, #v.text do
|
|
|
|
waah = waah .. ( ((i-1)/#v.text) <= math.TimeFraction( v.starttime, v.starttime + v.time_to_type, CurTime() ) and v.text[i] or " ")
|
|
|
|
end
|
2023-11-12 19:19:59 -05:00
|
|
|
surface.DrawText( waah .. repeater )
|
2023-09-14 16:41:56 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
surface.SetTextColor( caption.color )
|
|
|
|
surface.SetFont("Benny_10")
|
|
|
|
surface.SetTextPos( (sw/2) - (tw/2), sh - space + ss(2) )
|
|
|
|
surface.DrawText( caption.name )
|
|
|
|
end
|
|
|
|
end
|
2023-09-23 22:51:35 -04:00
|
|
|
|
2023-09-25 21:12:22 -04:00
|
|
|
if false then -- Debug Inventory
|
2023-09-23 22:51:35 -04:00
|
|
|
local gap = 0
|
|
|
|
for ID, Data in pairs( p:INV_Get() ) do
|
2023-09-24 16:26:55 -04:00
|
|
|
local active = (wep:GetWep2() == ID) and "Wep2" or (wep:GetWep1() == ID) and "Wep1" or ""
|
2023-09-23 22:51:35 -04:00
|
|
|
surface.SetDrawColor( scheme["bg"] )
|
2023-09-24 16:26:55 -04:00
|
|
|
surface.DrawRect( b + ss(4), b + ss(4) + gap, ss(240), ss(30) )
|
2023-09-23 22:51:35 -04:00
|
|
|
|
|
|
|
surface.SetFont( "Benny_12" )
|
|
|
|
surface.SetTextColor( scheme["fg"] )
|
|
|
|
surface.SetTextPos( b + ss(4 + 4), b + ss(4 + 3) + gap )
|
2023-09-24 16:26:55 -04:00
|
|
|
surface.DrawText( ID .. " " .. active )
|
2023-09-23 22:51:35 -04:00
|
|
|
|
|
|
|
local str = ""
|
|
|
|
for i, v in pairs( Data ) do
|
|
|
|
str = str .. i .. ": " .. v .. " "
|
|
|
|
end
|
|
|
|
|
|
|
|
surface.SetFont( "Benny_10" )
|
|
|
|
surface.SetTextColor( scheme["fg"] )
|
|
|
|
surface.SetTextPos( b + ss(4 + 4), b + ss(4 + 3 + 8) + gap )
|
|
|
|
surface.DrawText( str )
|
2023-09-24 16:26:55 -04:00
|
|
|
|
|
|
|
surface.SetFont( "Benny_12" )
|
|
|
|
surface.SetTextColor( scheme["fg"] )
|
|
|
|
surface.SetTextPos( b + ss(4 + 4), b + ss(4 + 3 + 8 + 8) + gap )
|
|
|
|
-- surface.DrawText( active )
|
2023-09-23 22:51:35 -04:00
|
|
|
gap = gap + ss(30+4)
|
|
|
|
end
|
|
|
|
end
|
2023-11-11 21:08:21 -05:00
|
|
|
|
2023-11-13 19:26:50 -05:00
|
|
|
if false then -- MP / Arena UI
|
2023-11-11 21:08:21 -05:00
|
|
|
surface.SetDrawColor( scheme["bg"] )
|
|
|
|
|
|
|
|
local r_x, r_y, r_w, r_h = sw/2 - ss(180/2), b, ss(180), ss(30)
|
|
|
|
local ib, ic = ss(20), ss(2)
|
|
|
|
surface.DrawRect( r_x, r_y, r_w, r_h )
|
|
|
|
|
|
|
|
do -- Time
|
2023-11-13 19:26:50 -05:00
|
|
|
local tt = string.FormattedTime( (60*1)-(CurTime() % 60) )
|
2023-11-11 21:08:21 -05:00
|
|
|
local d1, d2
|
|
|
|
if tt.m > 0 then
|
|
|
|
d1 = tt.m -- .. ":"
|
|
|
|
d2 = tt.s
|
|
|
|
if tt.h > 0 then
|
|
|
|
-- d1 = tt.h .. ":" .. d1
|
|
|
|
end
|
|
|
|
else
|
|
|
|
d1 = tt.s -- .. "."
|
2023-11-11 21:44:04 -05:00
|
|
|
d2 = math.floor( tt.ms )
|
2023-11-11 21:08:21 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
d1 = string.format( "%02i", d1 )
|
|
|
|
d2 = string.format( "%02i", d2 )
|
|
|
|
|
|
|
|
if tt.h > 0 then
|
|
|
|
d1 = tt.h .. ":" .. d1 .. ":"
|
|
|
|
elseif tt.m > 0 then
|
|
|
|
d1 = d1 .. ":"
|
|
|
|
else
|
|
|
|
d1 = d1 .. "."
|
|
|
|
end
|
|
|
|
|
2023-11-12 00:45:28 -05:00
|
|
|
surface.SetFont( "Benny_36")
|
|
|
|
local tx = surface.GetTextSize( d1 )
|
|
|
|
|
2023-12-06 02:11:41 -05:00
|
|
|
local c1, c2, c3, c4 = schema( "fg", ((tt.ms/100)%1))
|
2023-11-12 00:45:28 -05:00
|
|
|
|
|
|
|
surface.SetTextColor( c1, c2, c3, c4 )
|
|
|
|
surface.SetTextPos( ib + r_x + ss( 24 ) - tx, r_y )
|
|
|
|
surface.SetFont( "BennyS_36")
|
|
|
|
surface.DrawText( d1 )
|
|
|
|
|
2023-11-11 21:08:21 -05:00
|
|
|
surface.SetTextColor( scheme["fg"] )
|
2023-11-12 00:45:28 -05:00
|
|
|
surface.SetTextPos( ib + r_x + ss( 24 ) - tx, r_y )
|
2023-11-11 21:08:21 -05:00
|
|
|
surface.SetFont( "Benny_36")
|
|
|
|
surface.DrawText( d1 )
|
|
|
|
|
2023-11-12 00:45:28 -05:00
|
|
|
surface.SetTextColor( c1, c2, c3, c4 )
|
|
|
|
surface.SetTextPos( ib + r_x + ss( 24 ), r_y + ss(5) )
|
|
|
|
surface.SetFont( "BennyS_28")
|
|
|
|
surface.DrawText( d2 )
|
|
|
|
|
2023-11-11 21:08:21 -05:00
|
|
|
surface.SetTextColor( scheme["fg"] )
|
|
|
|
surface.SetTextPos( ib + r_x + ss( 24 ), r_y + ss(5) )
|
2023-11-12 00:45:28 -05:00
|
|
|
surface.SetFont( "Benny_28")
|
2023-11-11 21:08:21 -05:00
|
|
|
surface.DrawText( d2 )
|
|
|
|
end
|
|
|
|
do -- Score
|
|
|
|
for i=0, 1 do
|
|
|
|
local s_w, s_h = ss(100), ss(12)
|
|
|
|
local s_x, s_y = r_x + r_w - ic - s_w, ic + r_y + (s_h*i) + (ss(2*i))
|
|
|
|
|
|
|
|
surface.SetDrawColor( scheme["fg"] )
|
|
|
|
if i==1 then -- Losing
|
|
|
|
surface.DrawOutlinedRect( s_x, s_y, s_w, s_h, math.max( ss(0.5), 1 ) )
|
|
|
|
surface.SetTextColor( scheme["fg"] )
|
|
|
|
else
|
|
|
|
surface.DrawRect( s_x, s_y, s_w, s_h )
|
|
|
|
surface.SetTextColor( scheme["bg"] )
|
|
|
|
end
|
|
|
|
|
|
|
|
surface.SetFont( "Benny_12")
|
|
|
|
surface.SetTextPos( s_x + ss(2), s_y + ss(1) )
|
2023-11-11 21:44:04 -05:00
|
|
|
surface.DrawText( i==1 and "HALO" or "CIA" )
|
2023-11-11 21:08:21 -05:00
|
|
|
|
2023-11-13 19:26:50 -05:00
|
|
|
local score = i==1 and "100" or "1200"
|
2023-11-11 21:08:21 -05:00
|
|
|
surface.SetTextPos( s_x + s_w - surface.GetTextSize( score ) - ss(2), s_y + ss(1) )
|
|
|
|
surface.DrawText( score )
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
2023-11-13 18:22:28 -05:00
|
|
|
|
2023-11-18 00:29:08 -05:00
|
|
|
if false and p:BennyCheck() then
|
2023-11-13 18:22:28 -05:00
|
|
|
local bx, by = sw/2, sh*(0.75)
|
|
|
|
local mx = 50
|
|
|
|
|
2023-11-16 22:00:11 -05:00
|
|
|
local wep1_table, wep1_class = wep:BTable( false ), wep:BClass( false )
|
|
|
|
if wep1_table then
|
|
|
|
draw.SimpleText( wep1_class.Name, "Trebuchet24", bx-mx, by+24*-1, color_white, TEXT_ALIGN_RIGHT, TEXT_ALIGN_TOP )
|
|
|
|
draw.SimpleText( "Clip1: " .. wep:Clip1(), "Trebuchet24", bx-mx, by+24*0, color_white, TEXT_ALIGN_RIGHT, TEXT_ALIGN_TOP )
|
|
|
|
draw.SimpleText( "ID1: " .. wep:GetWep1(), "Trebuchet24", bx-mx, by+24*1, color_white, TEXT_ALIGN_RIGHT, TEXT_ALIGN_TOP )
|
|
|
|
draw.SimpleText( "MagID1: " .. wep:D_GetMagID( false ), "Trebuchet24", bx-mx, by+24*2, color_white, TEXT_ALIGN_RIGHT, TEXT_ALIGN_TOP )
|
2023-11-17 21:12:25 -05:00
|
|
|
if wep1_table.Loaded then
|
|
|
|
draw.SimpleText( "T_MagID1: " .. wep1_table.Loaded, "Trebuchet24", bx-mx, by+24*3, color_white, TEXT_ALIGN_RIGHT, TEXT_ALIGN_TOP )
|
|
|
|
end
|
2023-11-16 22:00:11 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
local wep2_table, wep2_class = wep:BTable( true ), wep:BClass( true )
|
|
|
|
if wep2_table then
|
|
|
|
draw.SimpleText( wep2_class.Name, "Trebuchet24", bx+mx, by+24*-1, color_white, TEXT_ALIGN_LEFT, TEXT_ALIGN_TOP )
|
|
|
|
draw.SimpleText( "Clip2: " .. wep:Clip2(), "Trebuchet24", bx+mx, by+24*0, color_white, TEXT_ALIGN_LEFT, TEXT_ALIGN_TOP )
|
|
|
|
draw.SimpleText( "ID2: " .. wep:GetWep2(), "Trebuchet24", bx+mx, by+24*1, color_white, TEXT_ALIGN_LEFT, TEXT_ALIGN_TOP )
|
|
|
|
draw.SimpleText( "MagID2: " .. wep:D_GetMagID( true ), "Trebuchet24", bx+mx, by+24*2, color_white, TEXT_ALIGN_LEFT, TEXT_ALIGN_TOP )
|
2023-11-17 21:12:25 -05:00
|
|
|
if wep2_table.Loaded then
|
|
|
|
draw.SimpleText( "T_MagID2: " .. wep2_table.Loaded, "Trebuchet24", bx+mx, by+24*3, color_white, TEXT_ALIGN_LEFT, TEXT_ALIGN_TOP )
|
|
|
|
end
|
2023-11-16 22:00:11 -05:00
|
|
|
end
|
2023-11-13 18:22:28 -05:00
|
|
|
end
|
2023-10-09 03:03:10 -04:00
|
|
|
end )
|
|
|
|
|
|
|
|
do
|
2023-10-09 17:06:27 -04:00
|
|
|
local function Equip()
|
|
|
|
local ply = LocalPlayer()
|
|
|
|
local buckets = ply:INV_Buckets()
|
2023-11-06 14:03:14 -05:00
|
|
|
if buckets[bucket_selected] and buckets[bucket_selected][item_selected] then
|
2023-11-17 21:12:25 -05:00
|
|
|
-- ply.CLIENTDESIRE = buckets[bucket_selected][item_selected]
|
2023-11-16 01:54:54 -05:00
|
|
|
|
2023-11-17 21:12:25 -05:00
|
|
|
RunConsoleCommand( "benny_inv_equip", buckets[bucket_selected][item_selected] )
|
2023-10-09 17:06:27 -04:00
|
|
|
end
|
|
|
|
end
|
2023-11-12 20:30:33 -05:00
|
|
|
local function Locate( ply, buckets, id )
|
|
|
|
for i, v in ipairs( buckets ) do
|
|
|
|
for a, b in ipairs( v ) do
|
|
|
|
if b == id then
|
|
|
|
-- print( "Found it" )
|
|
|
|
return i, a
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
-- print( "Didn't find it" )
|
|
|
|
return false
|
|
|
|
end
|
2023-11-03 13:20:39 -04:00
|
|
|
local function Wrap( ply, num )
|
2023-11-29 02:45:36 -05:00
|
|
|
do return end
|
2023-11-03 13:20:39 -04:00
|
|
|
local buckets = ply:INV_Buckets()
|
2023-11-29 02:45:36 -05:00
|
|
|
local currsel = ply:GetActiveWeapon():D_GetID( false )
|
2023-11-12 20:30:33 -05:00
|
|
|
|
|
|
|
local lb, li = Locate( ply, buckets, currsel )
|
|
|
|
if lb then
|
|
|
|
bucket_selected = lb
|
|
|
|
item_selected = li
|
|
|
|
end
|
|
|
|
|
2023-11-06 14:03:14 -05:00
|
|
|
if !buckets[num] then return end
|
2023-11-03 13:20:39 -04:00
|
|
|
if bucket_selected == num then
|
|
|
|
item_selected = item_selected + 1
|
|
|
|
if item_selected > #buckets[bucket_selected] then
|
|
|
|
item_selected = 1
|
|
|
|
end
|
|
|
|
else
|
|
|
|
bucket_selected = num
|
|
|
|
item_selected = 1
|
|
|
|
end
|
2023-11-14 01:12:30 -05:00
|
|
|
if buckets[bucket_selected] and buckets[bucket_selected][item_selected] then
|
|
|
|
ply:EmitSound( "benny/hud/hud-02.ogg", 0, 100, 0.75, CHAN_STATIC )
|
|
|
|
else
|
|
|
|
ply:EmitSound( "benny/hud/hud-01.ogg", 0, 100, 0.75, CHAN_STATIC )
|
|
|
|
end
|
2023-11-03 13:20:39 -04:00
|
|
|
Equip()
|
|
|
|
end
|
2023-10-09 03:03:10 -04:00
|
|
|
local qt = {
|
|
|
|
["invnext"] = function( ply )
|
2023-11-29 02:45:36 -05:00
|
|
|
do return end
|
2023-11-12 20:30:33 -05:00
|
|
|
if !ply:BennyCheck() then return end
|
2023-10-09 17:06:27 -04:00
|
|
|
local buckets = ply:INV_Buckets()
|
2023-11-29 02:45:36 -05:00
|
|
|
local currsel = ply:GetActiveWeapon():D_GetID( false )
|
2023-11-12 20:30:33 -05:00
|
|
|
|
|
|
|
local lb, li = Locate( ply, buckets, currsel )
|
|
|
|
if lb then
|
|
|
|
bucket_selected = lb
|
|
|
|
item_selected = li
|
|
|
|
end
|
|
|
|
|
2023-10-09 17:06:27 -04:00
|
|
|
item_selected = item_selected + 1
|
2023-10-22 00:37:35 -04:00
|
|
|
for i=1, #buckets do
|
|
|
|
if item_selected > #buckets[bucket_selected] then
|
|
|
|
bucket_selected = bucket_selected + 1
|
|
|
|
item_selected = 1
|
|
|
|
end
|
|
|
|
if bucket_selected > #buckets then bucket_selected = 1 item_selected = 1 end
|
|
|
|
if buckets[bucket_selected][item_selected] then
|
2023-11-14 01:12:30 -05:00
|
|
|
ply:EmitSound( "benny/hud/hud-02.ogg", 0, 100, 0.75, CHAN_STATIC )
|
2023-10-22 00:37:35 -04:00
|
|
|
Equip()
|
2023-11-13 21:48:11 -05:00
|
|
|
return
|
2023-10-22 00:37:35 -04:00
|
|
|
end
|
2023-10-09 17:06:27 -04:00
|
|
|
end
|
2023-10-09 03:03:10 -04:00
|
|
|
end,
|
|
|
|
["invprev"] = function( ply )
|
2023-11-29 02:45:36 -05:00
|
|
|
do return end
|
2023-10-09 17:06:27 -04:00
|
|
|
local buckets = ply:INV_Buckets()
|
2023-11-29 02:45:36 -05:00
|
|
|
local currsel = ply:GetActiveWeapon():D_GetID( false )
|
2023-11-12 20:30:33 -05:00
|
|
|
|
|
|
|
local lb, li = Locate( ply, buckets, currsel )
|
|
|
|
if lb then
|
|
|
|
bucket_selected = lb
|
|
|
|
item_selected = li
|
|
|
|
end
|
|
|
|
|
2023-10-09 17:06:27 -04:00
|
|
|
item_selected = item_selected - 1
|
2023-10-22 00:37:35 -04:00
|
|
|
for i=1, #buckets do
|
|
|
|
if item_selected < 1 then
|
|
|
|
bucket_selected = bucket_selected - 1
|
|
|
|
if bucket_selected < 1 then bucket_selected = #buckets end
|
|
|
|
item_selected = #buckets[bucket_selected]
|
2023-11-14 01:19:34 -05:00
|
|
|
end
|
|
|
|
if buckets[bucket_selected][item_selected] then
|
|
|
|
ply:EmitSound( "benny/hud/hud-02.ogg", 0, 100, 0.75, CHAN_STATIC )
|
|
|
|
Equip()
|
|
|
|
return
|
2023-10-22 00:37:35 -04:00
|
|
|
end
|
2023-10-09 17:06:27 -04:00
|
|
|
end
|
|
|
|
Equip()
|
2023-10-09 03:03:10 -04:00
|
|
|
end,
|
|
|
|
["slot1"] = function( ply )
|
2023-11-03 13:20:39 -04:00
|
|
|
Wrap( ply, 1 )
|
2023-10-09 03:03:10 -04:00
|
|
|
end,
|
|
|
|
["slot2"] = function( ply )
|
2023-11-03 13:20:39 -04:00
|
|
|
Wrap( ply, 2 )
|
2023-10-09 03:03:10 -04:00
|
|
|
end,
|
|
|
|
["slot3"] = function( ply )
|
2023-11-03 13:20:39 -04:00
|
|
|
Wrap( ply, 3 )
|
2023-10-09 03:03:10 -04:00
|
|
|
end,
|
|
|
|
["slot4"] = function( ply )
|
2023-11-03 13:20:39 -04:00
|
|
|
Wrap( ply, 4 )
|
|
|
|
end,
|
|
|
|
["slot5"] = function( ply )
|
|
|
|
Wrap( ply, 5 )
|
|
|
|
end,
|
|
|
|
["slot6"] = function( ply )
|
2023-11-06 14:03:14 -05:00
|
|
|
Wrap( ply, 6 )
|
2023-11-03 13:20:39 -04:00
|
|
|
end,
|
|
|
|
["slot7"] = function( ply )
|
2023-11-06 14:03:14 -05:00
|
|
|
Wrap( ply, 7 )
|
2023-11-03 13:20:39 -04:00
|
|
|
end,
|
|
|
|
["slot8"] = function( ply )
|
2023-11-06 14:03:14 -05:00
|
|
|
Wrap( ply, 8 )
|
2023-11-03 13:20:39 -04:00
|
|
|
end,
|
|
|
|
["slot9"] = function( ply )
|
2023-11-06 14:03:14 -05:00
|
|
|
Wrap( ply, 9 )
|
2023-11-03 13:20:39 -04:00
|
|
|
end,
|
|
|
|
["slot0"] = function( ply )
|
2023-11-06 14:03:14 -05:00
|
|
|
Wrap( ply, 0 )
|
2023-10-09 03:03:10 -04:00
|
|
|
end,
|
|
|
|
}
|
2023-11-06 14:03:14 -05:00
|
|
|
hook.Add( "PlayerBindPress", "Benny_PlayerBindPress", function( ply, bind, pressed, code )
|
2023-10-09 03:03:10 -04:00
|
|
|
if qt[bind] and pressed then
|
|
|
|
qt[bind]( ply )
|
|
|
|
return true
|
|
|
|
end
|
|
|
|
end)
|
2023-12-03 23:24:42 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
local dads = {
|
|
|
|
[KEY_1] = 1,
|
|
|
|
[KEY_2] = 2,
|
|
|
|
[KEY_3] = 3,
|
|
|
|
[KEY_4] = 4,
|
|
|
|
[KEY_5] = 5,
|
|
|
|
[KEY_6] = 6,
|
|
|
|
[KEY_7] = 7,
|
|
|
|
[KEY_8] = 8,
|
|
|
|
[KEY_9] = 9,
|
|
|
|
[KEY_0] = 0,
|
|
|
|
}
|
|
|
|
|
|
|
|
local function beatup( ply, num )
|
|
|
|
local weighted = ply:INV_Weight()
|
|
|
|
local inv = ply:INV_Get()
|
|
|
|
local iflip = table.Flip( inv )
|
|
|
|
|
|
|
|
local invid = 0
|
|
|
|
for _, item in pairs( weighted ) do
|
|
|
|
local class = WeaponGet(item.Class)
|
|
|
|
if class.Features == "firearm" or class.Features == "grenade" then
|
|
|
|
invid = invid + 1
|
|
|
|
if num == invid then
|
|
|
|
RunConsoleCommand( "benny_inv_equip", iflip[item], "false", "false" )
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
hook.Add( "PlayerButtonDown", "Benny_PlayerButtonDown_Inv", function( ply, button )
|
|
|
|
local wep = ply:BennyCheck()
|
|
|
|
|
|
|
|
if button == KEY_F then
|
|
|
|
if tobool(ply:GetInfoNum("benny_wep_toggleaim", 1)) then
|
|
|
|
wep:SetUserAim( !wep:GetUserAim() )
|
|
|
|
else
|
|
|
|
wep:SetUserAim( true )
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
if dads[button] then
|
|
|
|
beatup( ply, dads[button] )
|
|
|
|
end
|
|
|
|
end)
|