HUD, camera, tweaks
This commit is contained in:
parent
f6089bf156
commit
8fae4bd63e
|
@ -37,6 +37,47 @@ function GM:CalcView( ply, pos, ang, fov )
|
||||||
drawviewer = true
|
drawviewer = true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if false then
|
||||||
|
ply:SetupBones()
|
||||||
|
local bm = ply:GetBoneMatrix(ply:LookupBone("DEF-spine.006"))
|
||||||
|
view.origin = bm:GetTranslation()
|
||||||
|
|
||||||
|
if ply:GetLayerSequence( GESTURE_SLOT_JUMP ) == ply:LookupSequence("dive_end_handgun") and ply:GetLayerCycle( GESTURE_SLOT_JUMP )<0.8 then
|
||||||
|
local angles = ply:GetBoneMatrix(ply:LookupBone("DEF-spine.004")):GetAngles()
|
||||||
|
angles.y = ang.y
|
||||||
|
|
||||||
|
local magic = math.Remap( ply:GetLayerCycle( GESTURE_SLOT_JUMP ), 0.6, 0.8, 0, 1 )
|
||||||
|
magic = math.Clamp( magic, 0, 1 )
|
||||||
|
print(magic)
|
||||||
|
angles.p = Lerp( magic, angles.r-90, ang.p )
|
||||||
|
angles.r = 0
|
||||||
|
view.angles = angles
|
||||||
|
else
|
||||||
|
local special = math.Remap( ang.p, 0, 79, 0, 1 )
|
||||||
|
special = math.Clamp(special, 0, 1 )
|
||||||
|
special = math.ease.InCubic( special )
|
||||||
|
local special2 = math.Remap( ang.p, -79, 0, 0, 1 )
|
||||||
|
special2 = math.Clamp(special2, 0, 1 )
|
||||||
|
special2 = special2 * (1-special)
|
||||||
|
view.origin:Sub(ang:Forward()*2)
|
||||||
|
view.origin:Add(ang:Up()*4*special2)
|
||||||
|
view.origin:Add(ang:Up()*4*special)
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
local bid = ply:LookupBone("DEF-spine.006")
|
||||||
|
ply:ManipulateBoneScale( bid, vector_origin )
|
||||||
|
local bid = ply:LookupBone("DEF-spine.005")
|
||||||
|
ply:ManipulateBoneScale( bid, vector_origin )
|
||||||
|
--local bm = ply:GetBoneMatrix(bid)
|
||||||
|
--bm:Scale(Vector(0, 0, 0))
|
||||||
|
--ply:SetBoneMatrix(bid, bm)
|
||||||
|
--local bid = ply:LookupBone("DEF-spine.005")
|
||||||
|
--local bm = ply:GetBoneMatrix(bid)
|
||||||
|
--bm:Scale(Vector(0, 0, 0))
|
||||||
|
--ply:SetBoneMatrix(bid, bm)
|
||||||
|
end
|
||||||
|
|
||||||
return view
|
return view
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,21 @@
|
||||||
|
|
||||||
|
BennyGame = {}
|
||||||
|
|
||||||
|
|
||||||
|
BG_GTYPE_CAMPAIGN = 0
|
||||||
|
BG_GTYPE_MP = 1
|
||||||
|
|
||||||
|
function BennyGame:GetType()
|
||||||
|
return BG_GTYPE_MP
|
||||||
|
end
|
||||||
|
|
||||||
|
BG_GMODE_TDM = 0
|
||||||
|
BG_GMODE_FFA = 1
|
||||||
|
BG_GMODE_DOMINATION = 2
|
||||||
|
BG_GMODE_CTF = 3
|
||||||
|
BG_GMODE_BOMB = 4
|
||||||
|
BG_GMODE_HARDPOINT = 5
|
||||||
|
|
||||||
|
function BennyGame:GetMode()
|
||||||
|
return BG_GMODE_TDM
|
||||||
|
end
|
|
@ -84,6 +84,22 @@ local function hScisoff()
|
||||||
render.SetScissorRect( 0, 0, 0, 0, false )
|
render.SetScissorRect( 0, 0, 0, 0, false )
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local function qt( text, font, x, y, col, xalign, yalign, col2 )
|
||||||
|
draw.SimpleText( text, font, x-1, y-1, col2, xalign, yalign )
|
||||||
|
draw.SimpleText( text, font, x, y-1, col2, xalign, yalign )
|
||||||
|
draw.SimpleText( text, font, x+1, y-1, col2, xalign, yalign )
|
||||||
|
|
||||||
|
draw.SimpleText( text, font, x-1, y, col2, xalign, yalign )
|
||||||
|
|
||||||
|
draw.SimpleText( text, font, x+1, y, col2, xalign, yalign )
|
||||||
|
|
||||||
|
draw.SimpleText( text, font, x-1, y+1, col2, xalign, yalign )
|
||||||
|
draw.SimpleText( text, font, x, y+1, col2, xalign, yalign )
|
||||||
|
draw.SimpleText( text, font, x+1, y+1, col2, xalign, yalign )
|
||||||
|
|
||||||
|
draw.SimpleText( text, font, x, y, col, xalign, yalign )
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
local sizes = {
|
local sizes = {
|
||||||
8, 10, 16, 24, 36, 48
|
8, 10, 16, 24, 36, 48
|
||||||
|
@ -103,13 +119,99 @@ local function regenfonts()
|
||||||
end
|
end
|
||||||
regenfonts()
|
regenfonts()
|
||||||
|
|
||||||
-- local COLOR_DARK = Color( 40, 40, 80 )
|
local FACTIONS = {
|
||||||
-- local COLOR_BRIGHT = Color( 80, 80, 160 )
|
["benny"] = {
|
||||||
-- local COLOR_MAIN = Color( 160, 160, 240 )
|
COLOR_MAIN = Color( 255, 238, 169 ),
|
||||||
|
COLOR_DARK = Color( 54, 44, 39 ),
|
||||||
|
CHARNAME = "BENNY",
|
||||||
|
},
|
||||||
|
["nikki"] = {
|
||||||
|
COLOR_MAIN = Color( 255, 174, 210 ),
|
||||||
|
COLOR_DARK = Color(37, 12, 40 ),
|
||||||
|
CHARNAME = "NIKKI",
|
||||||
|
},
|
||||||
|
["igor"] = {
|
||||||
|
COLOR_MAIN = Color( 253, 208, 207 ),
|
||||||
|
COLOR_DARK = Color( 32, 14, 12 ),
|
||||||
|
CHARNAME = "IGOR",
|
||||||
|
},
|
||||||
|
["yanghao"] = {
|
||||||
|
COLOR_MAIN = Color( 157, 187, 253 ),
|
||||||
|
COLOR_DARK = Color( 19, 21, 28 ),
|
||||||
|
CHARNAME = "YANG-HAO",
|
||||||
|
},
|
||||||
|
-- MP
|
||||||
|
["mp_cia"] = {
|
||||||
|
COLOR_MAIN = Color( 228, 228, 245 ),
|
||||||
|
COLOR_DARK = Color( 25, 23, 47 ),
|
||||||
|
CHARNAME = "CIA",
|
||||||
|
},
|
||||||
|
["mp_plasof"] = {
|
||||||
|
COLOR_MAIN = Color( 255, 153, 153 ),
|
||||||
|
COLOR_DARK = Color( 45, 10, 10 ),
|
||||||
|
CHARNAME = "PLASOF",
|
||||||
|
},
|
||||||
|
["mp_militia"] = {
|
||||||
|
COLOR_MAIN = Color( 255, 219, 153 ),
|
||||||
|
COLOR_DARK = Color( 33, 18, 18 ),
|
||||||
|
CHARNAME = "MILITIA",
|
||||||
|
},
|
||||||
|
["mp_arng"] = {
|
||||||
|
COLOR_MAIN = Color( 198, 255, 192 ),
|
||||||
|
COLOR_DARK = Color( 23, 32, 23 ),
|
||||||
|
CHARNAME = "NATGUARD",
|
||||||
|
},
|
||||||
|
["mp_viper"] = {
|
||||||
|
COLOR_MAIN = Color( 255, 230, 245 ),
|
||||||
|
COLOR_DARK = Color( 40, 20, 30 ),
|
||||||
|
CHARNAME = "VIPER",
|
||||||
|
},
|
||||||
|
["mp_halo"] = {
|
||||||
|
COLOR_MAIN = Color( 200, 255, 246 ),
|
||||||
|
COLOR_DARK = Color( 30, 40, 38 ),
|
||||||
|
CHARNAME = "HALO",
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
local COLOR_DARK = Color( 54, 44, 39 )
|
local CURRCHAR = "mp_arng"
|
||||||
local COLOR_BRIGHT = Color( 94, 84, 79 )
|
local COLOR_MAIN = FACTIONS[CURRCHAR].COLOR_MAIN
|
||||||
local COLOR_MAIN = Color( 255, 238, 169 )
|
local COLOR_DARK = FACTIONS[CURRCHAR].COLOR_DARK
|
||||||
|
local CHARNAME = FACTIONS[CURRCHAR].CHARNAME
|
||||||
|
local COLOR_BRIGHT = Color( 94, 94, 94 )
|
||||||
|
|
||||||
|
--[[
|
||||||
|
BENNY
|
||||||
|
Color( 255, 238, 169 )
|
||||||
|
Color( 54, 44, 39 )
|
||||||
|
NIKKI
|
||||||
|
Color( 255, 174, 210 )
|
||||||
|
Color(37, 12, 40 )
|
||||||
|
IGOR
|
||||||
|
Color( 253, 208, 207 )
|
||||||
|
Color( 32, 14, 12 )
|
||||||
|
YANG-HAO
|
||||||
|
Color( 157, 187, 253 )
|
||||||
|
Color( 19, 21, 28 )
|
||||||
|
|
||||||
|
CIA
|
||||||
|
Color( 93, 118, 215 )
|
||||||
|
Color( 25, 23, 47 )
|
||||||
|
PLASOF
|
||||||
|
Color( 255, 103, 103 )
|
||||||
|
Color( 35, 25, 20 )
|
||||||
|
MILITIA
|
||||||
|
Color( 255, 199, 133 )
|
||||||
|
Color( 33, 18, 18 )
|
||||||
|
ARNG
|
||||||
|
Color( 208, 226, 132 )
|
||||||
|
Color( 23, 25, 23 )
|
||||||
|
VIPER
|
||||||
|
Color( 255, 230, 245 )
|
||||||
|
Color( 40, 30, 30 )
|
||||||
|
HALO
|
||||||
|
Color( 200, 255, 246 )
|
||||||
|
Color( 30, 40, 38 )
|
||||||
|
]]
|
||||||
|
|
||||||
local show_letters = {
|
local show_letters = {
|
||||||
{ "q", "w", "e", "r", "t", "y" },
|
{ "q", "w", "e", "r", "t", "y" },
|
||||||
|
@ -169,36 +271,80 @@ function GM:HUDPaint()
|
||||||
|
|
||||||
-- S_Push( math.random( -4, 4 ), math.random( -4, 4 ) )
|
-- S_Push( math.random( -4, 4 ), math.random( -4, 4 ) )
|
||||||
|
|
||||||
S_Push( 20, h - 20 - 64 )
|
S_Push( 20, h - 20 - 65 )
|
||||||
hCol( COLOR_DARK )
|
hCol( COLOR_DARK )
|
||||||
hRRect( 0, 0, 328, 64, 8 )
|
hRect( 0, 0, 328, 65 )
|
||||||
|
|
||||||
local x, y = hXY( 6, 0 )
|
|
||||||
draw.SimpleText( "BENNY", "HUD_48", x, y, COLOR_MAIN )
|
|
||||||
|
|
||||||
hCol( COLOR_MAIN )
|
|
||||||
hRect( 8, 8, (320-4-4) * p:GetHealth_Blood()/1000, 40-4-4 )
|
|
||||||
hCol( COLOR_DARK )
|
|
||||||
hORect( 8+1, 8+1, (320-4-4)-2, 40-4-4-2, 1 )
|
|
||||||
|
|
||||||
hCol( COLOR_MAIN )
|
|
||||||
hScis( 8, 8, (320-4-4) * p:GetHealth_Blood()/1000, 40-4-4 )
|
|
||||||
local x, y = hXY( 10, 4 )
|
local x, y = hXY( 10, 4 )
|
||||||
draw.SimpleText( "BENNY", "HUD_48", x, y, COLOR_DARK )
|
qt( CHARNAME, "HUD_48", x, y, COLOR_DARK, nil, nil, COLOR_MAIN )
|
||||||
|
|
||||||
|
local HEALTHPER = p:GetHealth_Blood()/1000
|
||||||
|
-- HEALTHPER = 11/100
|
||||||
|
|
||||||
|
hCol( COLOR_MAIN )
|
||||||
|
hRect( 8, 8, (320-4-4) * HEALTHPER, 41-4-4 )
|
||||||
|
hORect( 8, 8, (320-4-4), 41-4-4, 1 )
|
||||||
|
hCol( COLOR_DARK )
|
||||||
|
hORect( 8+1, 8+1, (320-4-4)-2, 41-4-4-2, 1 )
|
||||||
|
|
||||||
|
hCol( COLOR_MAIN )
|
||||||
|
hScis( 8, 8, (320-4-4) * HEALTHPER, 41-4-4 )
|
||||||
|
local x, y = hXY( 10, 4 )
|
||||||
|
draw.SimpleText( CHARNAME, "HUD_48", x, y, COLOR_DARK )
|
||||||
hScisoff()
|
hScisoff()
|
||||||
|
|
||||||
local slen = (320-4-4-4-4-4)
|
local slen = (320-4-4-4-4-4)
|
||||||
hCol( COLOR_MAIN )
|
hCol( COLOR_MAIN )
|
||||||
hRect( 8, 44, slen*0.25, 12 )
|
hRect( 8, 45, slen*0.25, 12 )
|
||||||
hRect( 8 + (slen*0.25+4), 44, slen*0.25, 12 )
|
hRect( 8 + (slen*0.25+4), 45, slen*0.25, 12 )
|
||||||
hRect( 8 + (slen*0.25+4)*2, 44, slen*0.25, 12 )
|
hRect( 8 + (slen*0.25+4)*2, 45, slen*0.25, 12 )
|
||||||
hRect( 8 + (slen*0.25+4)*3, 44, slen*0.25, 12 )
|
hRect( 8 + (slen*0.25+4)*3, 45, slen*0.25, 12 )
|
||||||
|
|
||||||
hCol( COLOR_DARK )
|
hCol( COLOR_DARK )
|
||||||
hORect( 8+1, 44+1, slen*0.25 - 2, 12-2, 1 )
|
hORect( 8+1, 45+1, slen*0.25 - 2, 12-2, 1 )
|
||||||
hORect( 8+1 + (slen*0.25+4), 44+1, slen*0.25 - 2, 12-2, 1 )
|
hORect( 8+1 + (slen*0.25+4), 45+1, slen*0.25 - 2, 12-2, 1 )
|
||||||
hORect( 8+1 + (slen*0.25+4)*2, 44+1, slen*0.25 - 2, 12-2, 1 )
|
hORect( 8+1 + (slen*0.25+4)*2, 45+1, slen*0.25 - 2, 12-2, 1 )
|
||||||
hORect( 8+1 + (slen*0.25+4)*3, 44+1, slen*0.25 - 2, 12-2, 1 )
|
hORect( 8+1 + (slen*0.25+4)*3, 45+1, slen*0.25 - 2, 12-2, 1 )
|
||||||
|
|
||||||
|
if true then -- MP
|
||||||
|
S_Push( 0, -8 - 2 )
|
||||||
|
local targetlength = 328
|
||||||
|
local segments = 10
|
||||||
|
local gap = 2
|
||||||
|
targetlength = targetlength - gap*(segments-1)
|
||||||
|
|
||||||
|
local chunk = 1/segments
|
||||||
|
for i=1, segments do
|
||||||
|
local z = i-1
|
||||||
|
local chunk0, chunk1 = chunk*z, chunk*i
|
||||||
|
local filled = math.Remap( 0.727, chunk0, chunk1, 0, 1 )
|
||||||
|
filled = math.Clamp( filled, 0, 1 )
|
||||||
|
local a1, a2, a3, a4 = ( (targetlength/segments) * z ) + (gap*z), 0, (targetlength/segments), 8
|
||||||
|
if i == segments then a3 = math.ceil(a3) end
|
||||||
|
if filled == 1 then
|
||||||
|
hCol( COLOR_MAIN )
|
||||||
|
hRect( a1, a2, a3, a4 )
|
||||||
|
hCol( COLOR_DARK )
|
||||||
|
hORect( a1, a2, a3, a4, 1 )
|
||||||
|
elseif filled == 0 then
|
||||||
|
hCol( COLOR_DARK )
|
||||||
|
hRect( a1, a2, a3, a4 )
|
||||||
|
else
|
||||||
|
hCol( COLOR_DARK )
|
||||||
|
hRect( a1, a2, a3, a4 )
|
||||||
|
hCol( COLOR_MAIN )
|
||||||
|
hRect( a1, a2, a3*filled, a4 )
|
||||||
|
hCol( COLOR_DARK )
|
||||||
|
hORect( a1, a2, a3, a4, 1 )
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
local x, y = hXY( 0, -14 )
|
||||||
|
qt( "10000 / 15000", "HUD_16", x, y, COLOR_MAIN, nil, nil, COLOR_DARK )
|
||||||
|
--qt( "", "HUD_24", x+328, y, COLOR_MAIN, TEXT_ALIGN_RIGHT, nil, COLOR_DARK )
|
||||||
|
|
||||||
|
S_Pop()
|
||||||
|
end
|
||||||
S_Pop()
|
S_Pop()
|
||||||
|
|
||||||
if handler then
|
if handler then
|
||||||
|
@ -230,7 +376,7 @@ function GM:HUDPaint()
|
||||||
local Bw, Bh = 328, 160
|
local Bw, Bh = 328, 160
|
||||||
S_Push( w - 20 - Bw, h - 20 - Bh )
|
S_Push( w - 20 - Bw, h - 20 - Bh )
|
||||||
hCol( COLOR_DARK )
|
hCol( COLOR_DARK )
|
||||||
hRRect( 0, 0, Bw, Bh, 8 )
|
hRect( 0, 0, Bw, Bh )
|
||||||
|
|
||||||
hCol( COLOR_MAIN )
|
hCol( COLOR_MAIN )
|
||||||
local leng = Bw-8-8
|
local leng = Bw-8-8
|
||||||
|
|
|
@ -107,7 +107,7 @@ else
|
||||||
inv[key] = true
|
inv[key] = true
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
print("TOO EARLY!!!!!!!!!!!!!!!!")
|
print("Asked for inventory too early!!")
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
|
|
|
@ -488,6 +488,34 @@ do -- Handguns
|
||||||
Accuracy_Decay = 5,
|
Accuracy_Decay = 5,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
AddItem( "9mmhandgun", {
|
||||||
|
PrintName = "9mmhandgun",
|
||||||
|
Description = "undecided 9mm handgun",
|
||||||
|
Category = "pistol",
|
||||||
|
Base = "base_firearm",
|
||||||
|
|
||||||
|
Model = "models/benny/weapons/testgun.mdl",
|
||||||
|
HoldType = "handgun",
|
||||||
|
|
||||||
|
ClipSize = 17,
|
||||||
|
Delay = (60/450),
|
||||||
|
FireSound = {
|
||||||
|
"benny/weapons/glock/01.ogg",
|
||||||
|
"benny/weapons/glock/02.ogg",
|
||||||
|
"benny/weapons/glock/03.ogg",
|
||||||
|
},
|
||||||
|
MagOutSound = "benny/weapons/1911/magout.ogg",
|
||||||
|
MagInSound = "benny/weapons/1911/magin.ogg",
|
||||||
|
BoltDropSound = "benny/weapons/1911/slidedrop.ogg",
|
||||||
|
BoltPullSound = "benny/weapons/glock/cock.ogg",
|
||||||
|
|
||||||
|
Accuracy = 5/60,
|
||||||
|
BurstCount = 1,
|
||||||
|
Accuracy_Add = 0.5,
|
||||||
|
Accuracy_Reset = 0.4,
|
||||||
|
Accuracy_Decay = 5,
|
||||||
|
})
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
do -- Rifles
|
do -- Rifles
|
||||||
|
@ -578,7 +606,7 @@ do -- SMGs
|
||||||
Model = "models/benny/weapons/testrifle2.mdl",--"models/weapons/w_rif_ar556.mdl",
|
Model = "models/benny/weapons/testrifle2.mdl",--"models/weapons/w_rif_ar556.mdl",
|
||||||
HoldType = "handgun",
|
HoldType = "handgun",
|
||||||
|
|
||||||
ClipSize = 15,
|
ClipSize = 20,
|
||||||
Delay = (60/850),
|
Delay = (60/850),
|
||||||
FireSound = {
|
FireSound = {
|
||||||
"benny/weapons/tmp/01.ogg",
|
"benny/weapons/tmp/01.ogg",
|
||||||
|
@ -614,7 +642,7 @@ do -- SMGs
|
||||||
Model = "models/benny/weapons/testrifle2.mdl",--"models/weapons/w_rif_ar556.mdl",
|
Model = "models/benny/weapons/testrifle2.mdl",--"models/weapons/w_rif_ar556.mdl",
|
||||||
HoldType = "handgun",
|
HoldType = "handgun",
|
||||||
|
|
||||||
ClipSize = 15,
|
ClipSize = 20,
|
||||||
Delay = (60/750),
|
Delay = (60/750),
|
||||||
FireSound = {
|
FireSound = {
|
||||||
"benny/weapons/mp5k/01.ogg",
|
"benny/weapons/mp5k/01.ogg",
|
||||||
|
@ -632,7 +660,7 @@ do -- SMGs
|
||||||
Model = "models/benny/weapons/testrifle2.mdl",--"models/weapons/w_rif_ar556.mdl",
|
Model = "models/benny/weapons/testrifle2.mdl",--"models/weapons/w_rif_ar556.mdl",
|
||||||
HoldType = "handgun",
|
HoldType = "handgun",
|
||||||
|
|
||||||
ClipSize = 16,
|
ClipSize = 20,
|
||||||
Delay = (60/1000),
|
Delay = (60/1000),
|
||||||
FireSound = {
|
FireSound = {
|
||||||
"benny/weapons/mac11/01.ogg",
|
"benny/weapons/mac11/01.ogg",
|
||||||
|
|
|
@ -26,6 +26,8 @@ AC("player_class.lua")
|
||||||
IN("player_class.lua")
|
IN("player_class.lua")
|
||||||
AC("inventory.lua")
|
AC("inventory.lua")
|
||||||
IN("inventory.lua")
|
IN("inventory.lua")
|
||||||
|
AC("gamestate.lua")
|
||||||
|
IN("gamestate.lua")
|
||||||
|
|
||||||
AC("debugmenu.lua")
|
AC("debugmenu.lua")
|
||||||
IN("debugmenu.lua")
|
IN("debugmenu.lua")
|
||||||
|
|
Loading…
Reference in New Issue