swaggier debug menu

This commit is contained in:
Fesiug 2021-02-23 18:24:41 -05:00
parent 75db1413dd
commit f73ef12f90
3 changed files with 106 additions and 33 deletions

View File

@ -109,43 +109,57 @@ function SWEP:GetHUDData()
return data
end
local t_states = {
[0] = "STATE_IDLE",
[1] = "STATE_SIGHTS",
[2] = "STATE_SPRINT",
[3] = "STATE_DISABLE",
[4] = "STATE_CUSTOMIZE",
[5] = "STATE_BIPOD"
}
local mr = math.Round
local bird = Material("hud/really cool bird.png", "smooth")
function SWEP:DrawHUD()
-- info panel
--[[if true then
surface.SetDrawColor(255, 255, 255)
surface.DrawLine(0, 0, ScrW(), ScrH())
surface.DrawLine(0, ScrH(), ScrW(), 0)
end]]
-- DEBUG PANEL
if GetConVar("arccw_dev_debug"):GetBool() then
local mr = math.Round
local reloadtime = self:GetReloadTime()
local s = ScreenScaleMulti(1)
local awesome = self:GetReloadTime()
local thestate = self:GetState()
local ecksy = s* 64
if thestate == ArcCW.STATE_CUSTOMIZE then
ecksy = s* 256
end
surface.SetFont("ArcCW_26")
surface.SetTextColor(255, 255, 255, 255)
if awesome then
surface.SetTextPos(ScrW() / 2, 26 * s*2)
surface.DrawText(awesome[1])
surface.SetDrawColor(0, 0, 0, 63)
-- it's for contrast, i promise
surface.SetMaterial(bird)
surface.DrawTexturedRect(ecksy - s-400, s-320, s*512, s*512)
surface.SetTextPos(ScrW() / 2, 26 * s*3)
surface.DrawText(awesome[2])
surface.SetDrawColor(255, 255, 255, 255)
if reloadtime then
surface.SetTextPos(ecksy, 26 * s*1)
surface.DrawText(reloadtime[1])
surface.SetTextPos(ScrW() / 2, 26 * s*4)
surface.SetTextPos(ecksy, 26 * s*2)
surface.DrawText(reloadtime[2])
surface.SetTextPos(ecksy, 26 * s*3)
if self:GetMagUpIn()-CurTime() > 0 then
surface.SetTextColor(255, 127, 127, 255)
surface.DrawText( mr( math.max( self:GetMagUpIn() - CurTime(), 0 ), 2) )
else
surface.DrawText( "X" )
end
surface.DrawText( mr( math.max( self:GetMagUpIn() - CurTime(), 0 ), 2) )
else
surface.SetFont("ArcCW_20")
surface.SetTextPos(ScrW() / 2, 26 * s*3)
surface.SetTextPos(ecksy, 26 * s*2)
surface.DrawText("NO RELOAD ANIMATION")
surface.SetFont("ArcCW_12")
surface.SetTextPos(ScrW() / 2, 26 * s*3.66)
surface.SetTextPos(ecksy, 26 * s*2.66)
surface.DrawText("not a mag fed one, at least...")
end
surface.SetFont("ArcCW_26")
@ -154,39 +168,95 @@ function SWEP:DrawHUD()
if self:GetReloadingREAL()-CurTime() > 0 then
surface.SetTextColor(255, 127, 127, 255)
end
surface.SetTextPos(ScrW() / 2, 26 * s*5)
surface.SetTextPos(ecksy, 26 * s*4)
surface.DrawText( mr( math.max( self:GetReloadingREAL() - CurTime(), 0 ), 2 ) )
surface.SetTextColor(255, 255, 255, 255)
if self:GetWeaponOpDelay()-CurTime() > 0 then
surface.SetTextColor(255, 127, 127, 255)
end
surface.SetTextPos(ScrW() / 2, 26 * s*6)
surface.SetTextPos(ecksy, 26 * s*5)
surface.DrawText( mr( math.max( self:GetWeaponOpDelay() - CurTime(), 0 ), 2 ) )
surface.SetTextColor(255, 255, 255, 255)
if self:GetNextPrimaryFire() - CurTime() > 0 then
surface.SetTextColor(255, 127, 127, 255)
end
surface.SetTextPos(ecksy, 26 * s*6)
surface.DrawText( mr( math.max( self:GetNextPrimaryFire()*1000 - CurTime()*1000, 0 ), 0 ) .. "ms" )
surface.SetTextColor(255, 255, 255, 255)
local seq = self:GetSequenceInfo( self:GetOwner():GetViewModel():GetSequence() )
local seq2 = self:GetOwner():GetViewModel():GetSequence()
local seq3 = self:GetOwner():GetViewModel()
surface.SetFont("ArcCW_20")
surface.SetTextPos(ecksy, 26 * s*7)
surface.DrawText( seq2 .. ", " .. seq.label )
local proggers = 1 - ( self.LastAnimFinishTime - CurTime() ) / seq3:SequenceDuration()
surface.SetTextPos(ecksy, 26 * s*8)
surface.SetFont("ArcCW_12")
surface.DrawText( mr( seq3:SequenceDuration()*proggers, 2 ) )
surface.SetTextPos(ecksy + s*30, 26 * s*8)
surface.DrawText( "-" )
surface.SetTextPos(ecksy + s*48, 26 * s*8)
surface.DrawText( mr( self:SequenceDuration( seq2 ), 2 ) )
surface.SetTextPos(ecksy + s*132, 26 * s*7.6)
surface.DrawText( mr(proggers*100) .. "%" )
-- welcome to the bar
surface.DrawOutlinedRect(ecksy, 26 * s*7.7, s*128, s*8, s)
surface.DrawRect(ecksy, 26 * s*7.7+s*2, s*128*proggers, s*8-s*4, s)
surface.SetFont("ArcCW_20")
surface.SetTextPos(ecksy, 26 * s*8.5)
surface.DrawText( t_states[thestate] )
surface.SetTextPos(ecksy, 26 * s*9.25)
surface.DrawText( mr(self:GetSightDelta()*100) .. "%" )
surface.DrawOutlinedRect(ecksy, 26 * s*10, s*64, s*4, s/2)
surface.DrawRect(ecksy, 26 * s*10+s*1, s*64*self:GetSightDelta(), s*4-s*2)
-- Labels
surface.SetTextColor(255, 255, 255, 255)
surface.SetFont("ArcCW_8")
if awesome then
surface.SetTextPos(ScrW() / 2, 26 * s*2)
if reloadtime then
surface.SetTextPos(ecksy, 26 * s*1)
surface.DrawText("RELOAD")
surface.SetTextPos(ScrW() / 2 - s*36, s*26 * 2.33)
surface.SetTextPos(ecksy- s*36, s*26 * 1.33)
surface.DrawText("FULL")
surface.SetTextPos(ScrW() / 2 - s*36, s*26 * 3.33)
surface.SetTextPos(ecksy- s*36, s*26 * 2.33)
surface.DrawText("MAGIN")
surface.SetTextPos(ScrW() / 2 - s*36, s*26 * 4.33)
surface.SetTextPos(ecksy- s*36, s*26 * 3.33)
surface.DrawText("MAG LOAD")
end
surface.SetTextPos(ScrW() / 2, 26 * s*5)
surface.DrawText("RELOAD DELAY")
surface.SetTextPos(ecksy, 26 * s*4)
surface.DrawText("RELOAD DELAY")
surface.SetTextPos(ScrW() / 2, 26 * s*6)
surface.DrawText("WEAPON OPERATION DELAY")
surface.SetTextPos(ecksy, 26 * s*5)
surface.DrawText("WEAPON OPERATION DELAY")
surface.SetTextPos(ecksy, 26 * s*6)
surface.DrawText("NEXT PRIMARY FIRE")
surface.SetTextPos(ecksy, 26 * s*7)
surface.DrawText("CURRENT ANIMATION")
surface.SetTextPos(ecksy, 26 * s*8.5)
surface.DrawText("WEAPON STATE")
surface.SetTextPos(ecksy, 26 * s*9.25)
surface.DrawText("SIGHT DELTA")
end
if self:GetState() != ArcCW.STATE_CUSTOMIZE then

View File

@ -31,6 +31,7 @@ function SWEP:SelectAnimation(anim)
end
SWEP.LastAnimStartTime = 0
SWEP.LastAnimFinishTime = 0
function SWEP:PlayAnimation(key, mult, pred, startfrom, tt, skipholster, ignorereload, absolute)
mult = mult or 1
@ -223,6 +224,8 @@ function SWEP:PlayAnimation(key, mult, pred, startfrom, tt, skipholster, ignorer
vm:SendViewModelMatchingSequence(seq)
local dur = vm:SequenceDuration()
vm:SetPlaybackRate(dur / (ttime + startfrom))
self.LastAnimStartTime = CurTime()
self.LastAnimFinishTime = CurTime() + ( dur * mult )
end
end

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB