Compare commits

..

No commits in common. "0aac95d5a0205a65fa32363180b48793192852c7" and "efb50f2c5e07d43227ffb6522fc745f3224e7c9c" have entirely different histories.

8 changed files with 30 additions and 278 deletions

View File

@ -226,19 +226,17 @@ function SWEP:Think()
end end
if p:KeyPressed(IN_WEAPON1) then if p:KeyPressed(IN_WEAPON1) then
if self:GetDesireR() == NULL then if !self:ItemR() then
if SERVER then if SERVER then
local trace = self:ItemCheckTrace() local trace = self:ItemCheckTrace()
self:EquipItem( trace.Entity ) self:EquipItem( trace.Entity )
end end
else else
if self:GetActiveR() != NULL then ActiveR.Class.Drop( ActiveR.Class, ActiveR, self )
ActiveR.Class.Drop( ActiveR.Class, ActiveR, self ) if SERVER then
if SERVER then self:DropItem()
self:DropItem()
end
self:SetActiveR( NULL )
end end
self:SetActiveR( NULL )
end end
end end
if p:KeyPressed(IN_WEAPON2) then if p:KeyPressed(IN_WEAPON2) then

View File

@ -88,51 +88,19 @@ function GM:CalcView( ply, pos, ang, fov )
local bid = ply:LookupBone("DEF-spine.005") local bid = ply:LookupBone("DEF-spine.005")
ply:ManipulateBoneScale( bid, Vector(1, 1, 1) ) ply:ManipulateBoneScale( bid, Vector(1, 1, 1) )
lastfp = fp lastfp = fp
-- print("show") print("show")
elseif !lastfp and fp then elseif !lastfp and fp then
local bid = ply:LookupBone("DEF-spine.006") local bid = ply:LookupBone("DEF-spine.006")
ply:ManipulateBoneScale( bid, vector_origin ) ply:ManipulateBoneScale( bid, vector_origin )
local bid = ply:LookupBone("DEF-spine.005") local bid = ply:LookupBone("DEF-spine.005")
ply:ManipulateBoneScale( bid, vector_origin ) ply:ManipulateBoneScale( bid, vector_origin )
lastfp = fp lastfp = fp
-- print("hide") print("hide")
end end
return view return view
end end
-- During a full update, bone manipulations will be reset to the server's value. Fix that
gameevent.Listen( "OnRequestFullUpdate" )
hook.Add( "OnRequestFullUpdate", "Benny_OnRequestFullUpdate_CameraFP", function( data )
if CLIENT then
local ply = LocalPlayer()
if !ply:IsValid() then return end
local fp = cam_fp:GetBool()
if lastfp == nil then lastfp = !fp end
timer.Simple( 0, function()
if !fp then
local bid = ply:LookupBone("DEF-spine.006")
if !bid then return end
ply:ManipulateBoneScale( bid, Vector(1, 1, 1) )
local bid = ply:LookupBone("DEF-spine.005")
if !bid then return end
ply:ManipulateBoneScale( bid, Vector(1, 1, 1) )
lastfp = fp
-- print("fullupdate: show")
elseif fp then
local bid = ply:LookupBone("DEF-spine.006")
if !bid then return end
ply:ManipulateBoneScale( bid, vector_origin )
local bid = ply:LookupBone("DEF-spine.005")
if !bid then return end
ply:ManipulateBoneScale( bid, vector_origin )
lastfp = fp
-- print("fullupdate: hide")
end
end)
end
end )
hook.Add( "InputMouseApply", "Benny_InputMouseApply", function( cmd, x, y, ang ) hook.Add( "InputMouseApply", "Benny_InputMouseApply", function( cmd, x, y, ang )
local p = LocalPlayer() local p = LocalPlayer()
local w = p:HandlerCheck() local w = p:HandlerCheck()

View File

@ -121,21 +121,9 @@ local function OpenDebugMenu()
modeller:SetDirectionalLight(BOX_LEFT, HSLToColor( 0, 0, 1.00 ) ) modeller:SetDirectionalLight(BOX_LEFT, HSLToColor( 0, 0, 1.00 ) )
modeller:SetDirectionalLight(BOX_RIGHT, HSLToColor( 0, 0, 1.00 ) ) modeller:SetDirectionalLight(BOX_RIGHT, HSLToColor( 0, 0, 1.00 ) )
function modeller:Update( idata ) function modeller:Update( mdl )
if self.Entity:GetModel() == idata.Model then return end if self.Entity:GetModel() == mdl then return end
self.Entity:SetModel( idata.Model ) self.Entity:SetModel( mdl )
for i=0, self.Entity:GetNumBodyGroups()-1 do
self.Entity:SetBodygroup( i, 0 )
end
for k, v in ipairs(idata.DefaultBodygroups) do
if v then
self.Entity:SetBodygroup( k-1, v )
end
end
local worked = self.Entity:PhysicsInit( SOLID_VPHYSICS ) local worked = self.Entity:PhysicsInit( SOLID_VPHYSICS )
if worked then if worked then
@ -276,7 +264,7 @@ local function OpenDebugMenu()
function button:Think() function button:Think()
if self:IsHovered() then if self:IsHovered() then
texter:SetText( l8(idata.Description) .. "\n\nClipsize: " .. (idata.ClipSize or "?") ) texter:SetText( l8(idata.Description) .. "\n\nClipsize: " .. (idata.ClipSize or "?") )
modeller:Update( idata ) modeller:Update( idata.Model )
end end
end end
end end
@ -291,7 +279,7 @@ local function OpenDebugMenu()
end end
end end
function OpenMyTeamMenu() local function OpenMyTeamMenu()
if IsValid(DebugMenu) then DebugMenu:Remove() end if IsValid(DebugMenu) then DebugMenu:Remove() end
DebugMenu = vgui.Create("DFrame") DebugMenu = vgui.Create("DFrame")
DebugMenu:SetSize( 200, 300 ) DebugMenu:SetSize( 200, 300 )
@ -320,40 +308,16 @@ function OpenMyTeamMenu()
DebugMenu:Center() DebugMenu:Center()
end end
hook.Add("PlayerButtonDown", "Benny_PlayerButtonDown_DebugMenu", function( ply, button ) hook.Add("PlayerButtonDown", "PlayerButtonDown_DebugMenu", function( ply, button )
if CLIENT and IsFirstTimePredicted() then if button == KEY_F1 then
if button == KEY_F1 then OpenDebugMenu()
OpenDebugMenu() elseif button == KEY_F2 then
elseif button == KEY_F2 then OpenMyTeamMenu()
OpenMyTeamMenu()
end
end end
end) end)
local c_id = Color( 255, 200, 200 ) hook.Add("PlayerButtonUp", "PlayerButtonUp_DebugMenu", function( ply, button )
local c_name = Color( 200, 255, 255 ) if button == KEY_F1 then
local c_white = Color( 255, 255, 255 ) --if IsValid(DebugMenu) then DebugMenu:Remove() end
local function recursebones( ent, O_id, level )
local gap = ""
for i=1, level do gap = gap .. " " end
for index, id in ipairs( ent:GetChildBones( O_id ) ) do
chat.AddText( gap, c_id, tostring(id), c_white, " - ", c_name, ent:GetBoneName(id) )
recursebones( ent, id, level+1 )
end end
end
function printallbones( ent )
if !ent:IsValid() then print("invalid ent") return end
for id=0, ent:GetBoneCount()-1 do
if ent:GetBoneName(id) == "__INVALIDBONE__" then continue end
if ent:GetBoneParent(id) != -1 then continue end
chat.AddText( gap, c_id, tostring(id), c_white, " - ", c_name, ent:GetBoneName(id) )
recursebones( ent, id, 1 )
end
end
concommand.Add("b-debug_listbones", function( ply, cmd )
printallbones( ply )
end) end)

View File

@ -33,7 +33,6 @@ BennyGame.TeamsInPlay = {
--5, --5,
--6, --6,
} }
BennyGame.RTeamID = table.Flip( BennyGame.TeamsInPlay )
BennyGame.TeamCount = #BennyGame.TeamsInPlay BennyGame.TeamCount = #BennyGame.TeamsInPlay
BennyGame.Gamemodes = { BennyGame.Gamemodes = {

View File

@ -487,16 +487,7 @@ function GM:HUDPaint()
-- Score -- Score
local count = 1 local count = 1
do -- My team
local o = count-1
S_Push( count%2==1 and (-BARWIDE - 1 - GAP) or (0 + 1 + GAP), (BARTALL+2+16+2)*math.floor(o/2) )
QuickDrawBar( BARWIDE, BARTALL, myteam, BennyGame.RTeamID[myteam], count%2==0 )
S_Pop()
count = count + 1
end
-- Every other team
for TeamID, RealTeamID in ipairs( BennyGame.TeamsInPlay ) do for TeamID, RealTeamID in ipairs( BennyGame.TeamsInPlay ) do
if RealTeamID == myteam then continue end
local o = count-1 local o = count-1
S_Push( count%2==1 and (-BARWIDE - 1 - GAP) or (0 + 1 + GAP), (BARTALL+2+16+2)*math.floor(o/2) ) S_Push( count%2==1 and (-BARWIDE - 1 - GAP) or (0 + 1 + GAP), (BARTALL+2+16+2)*math.floor(o/2) )
QuickDrawBar( BARWIDE, BARTALL, RealTeamID, TeamID, count%2==0 ) QuickDrawBar( BARWIDE, BARTALL, RealTeamID, TeamID, count%2==0 )

View File

@ -47,23 +47,16 @@ AddItem( "base", {
Description = "Beginning item base.", Description = "Beginning item base.",
Category = "base", Category = "base",
Model = "models/benny/weapons/test_m16a2.mdl",
DefaultBodygroups = {},
Vars = { Vars = {
["Float"] = { ["Float"] = {
"Acquisition", "Acquisition",
"HolsterIn", "HolsterIn",
}, },
}, },
HoldType = "slam",
["Initialize"] = function( class, ent, handler ) ["Initialize"] = function( class, ent, handler )
print( class, "Initialized base initialization" ) print( class, "Initialized base initialization" )
for k, v in ipairs(class.DefaultBodygroups) do
if v then
ent:SetBodygroup( k-1, v )
end
end
end, end,
["Deploy"] = function( class, ent, handler ) ["Deploy"] = function( class, ent, handler )
@ -328,7 +321,7 @@ AddItem( "base_firearm", {
handler:EmitSound( "weapons/elite/elite_deploy.wav", 70, 125, 0.4, CHAN_STATIC ) handler:EmitSound( "weapons/elite/elite_deploy.wav", 70, 125, 0.4, CHAN_STATIC )
local ply = handler:GetOwner() local ply = handler:GetOwner()
if SERVER or CLIENT and IsFirstTimePredicted() then if SERVER or CLIENT and IsFirstTimePredicted() then
ply:AddVCDSequenceToGestureSlot( GESTURE_SLOT_ATTACK_AND_RELOAD, ply:LookupSequence( AnimationLookup["deploy"][class.HoldType] ), 0.25, true ) ply:AddVCDSequenceToGestureSlot( GESTURE_SLOT_ATTACK_AND_RELOAD, ply:LookupSequence( AnimationLookup["deploy"][class.HoldType] ), 0, true )
end end
end, end,
}) })
@ -547,14 +540,13 @@ do -- Handguns
Model = "models/benny/weapons/test_mk23.mdl", Model = "models/benny/weapons/test_mk23.mdl",
HoldType = "handgun", HoldType = "handgun",
DefaultBodygroups = { false, false, 1 },
ClipSize = 12, ClipSize = 12,
Delay = (60/320), Delay = (60/350),
FireSound = { FireSound = {
"benny/weapons/usp/sup_01.ogg", "benny/weapons/usp/01.ogg",
"benny/weapons/usp/sup_02.ogg", "benny/weapons/usp/02.ogg",
"benny/weapons/usp/sup_03.ogg", "benny/weapons/usp/03.ogg",
}, },
MagOutSound = "benny/weapons/usp/magout.ogg", MagOutSound = "benny/weapons/usp/magout.ogg",
MagInSound = "benny/weapons/usp/magin.ogg", MagInSound = "benny/weapons/usp/magin.ogg",
@ -638,7 +630,7 @@ do -- Rifles
HoldType = "rifle", HoldType = "rifle",
ClipSize = 30, ClipSize = 30,
Delay = (60/800), Delay = (60/750),
FireSound = { FireSound = {
"benny/weapons/m16a2/01.ogg", "benny/weapons/m16a2/01.ogg",
"benny/weapons/m16a2/02.ogg", "benny/weapons/m16a2/02.ogg",
@ -707,7 +699,7 @@ do -- Rifles
HoldType = "rifle", HoldType = "rifle",
ClipSize = 30, ClipSize = 30,
Delay = (60/1050), Delay = (60/900),
BurstCount = 3, BurstCount = 3,
BurstRunaway = true, BurstRunaway = true,
BurstAuto = true, BurstAuto = true,
@ -762,7 +754,7 @@ do -- SMGs
Model = "models/benny/weapons/test_tmp.mdl",--"models/weapons/w_rif_ar556.mdl", Model = "models/benny/weapons/test_tmp.mdl",--"models/weapons/w_rif_ar556.mdl",
HoldType = "handgun", HoldType = "handgun",
ClipSize = 25, ClipSize = 20,
Delay = (60/850), Delay = (60/850),
FireSound = { FireSound = {
"benny/weapons/tmp/01.ogg", "benny/weapons/tmp/01.ogg",
@ -798,7 +790,7 @@ do -- SMGs
Model = "models/benny/weapons/test_mp5k.mdl",--"models/weapons/w_rif_ar556.mdl", Model = "models/benny/weapons/test_mp5k.mdl",--"models/weapons/w_rif_ar556.mdl",
HoldType = "handgun", HoldType = "handgun",
ClipSize = 30, ClipSize = 20,
Delay = (60/750), Delay = (60/750),
FireSound = { FireSound = {
"benny/weapons/mp5k/01.ogg", "benny/weapons/mp5k/01.ogg",

View File

@ -1,158 +0,0 @@
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 )
draw.SimpleText( self.text, "HUD_24", w/2, 6, COLOR_MAIN, TEXT_ALIGN_CENTER )
end
local settings = {
{
name = "Camera",
items = {
{ type = TYPE_BOOL, cvar = "b-cam_fp", name = "First-person Mode" },
{ type = TYPE_NUMBER, cvar = "b-cam_f", min = -200, max = 200, name = "Camera Forward" },
{ type = TYPE_NUMBER, cvar = "b-cam_r", min = -30, max = 30, name = "Camera Right" },
{ type = TYPE_NUMBER, cvar = "b-cam_u", min = -30, max = 30, name = "Camera Up" },
{ type = TYPE_NUMBER, cvar = "b-cam_fov", min = 1, max = 140, name = "Camera FOV" },
}
},
{
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
if !data.cvarpointer then data.cvarpointer = GetConVar(data.cvar) end
if data.type == TYPE_BOOL then
local Changer = vgui.Create("DCheckBoxLabel", Cat)
Changer:Dock( TOP )
Changer:SetConVar( data.cvar )
Changer:SetText( data.name )
elseif data.type == TYPE_NUMBER then
local Changer = vgui.Create("DNumSlider", Cat)
Changer:Dock( TOP )
Changer:SetConVar( data.cvar )
Changer:SetText( data.name )
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")
PauseMenu:SetSize( 300, 500 )
PauseMenu:SetPos( 100, ScrH() - 500 - 100 )
PauseMenu:MakePopup()
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( "" )
button:SetTall( 32 )
button.text = data.name
button.Paint = qpaint
button.DoClick = data.DoClick
end
end
function GM:OnPauseMenuShow()
StartPauseMenu()
return false
end

View File

@ -58,8 +58,6 @@ AC("gamestate.lua")
IN("gamestate.lua") IN("gamestate.lua")
AC("teams.lua") AC("teams.lua")
IN("teams.lua") IN("teams.lua")
AC("pausemenu.lua")
IN("pausemenu.lua")
AC("debugmenu.lua") AC("debugmenu.lua")
IN("debugmenu.lua") IN("debugmenu.lua")