forked from HaodongMo/ArcCW
Improved 3D2D display
This commit is contained in:
parent
bd47128346
commit
8c8174f687
@ -73,7 +73,7 @@ ArcCW.ClientConVars = {
|
||||
["arccw_fastmuzzles"] = { def = 0 },
|
||||
["arccw_fasttracers"] = { def = 0 },
|
||||
|
||||
["arccw_2d3d"] = { def = 1 },
|
||||
["arccw_2d3d"] = { def = 1, min = 0, max = 2},
|
||||
|
||||
["arccw_hud_3dfun"] = { def = 0, usri = true },
|
||||
["arccw_hud_3dfun_lite"] = { def = 0 },
|
||||
|
@ -75,8 +75,8 @@ L["arccw.cvar.glare.desc"] = "Glare visible on your scope lens wh
|
||||
L["arccw.cvar.shake"] = "Screen Shake"
|
||||
L["arccw.cvar.shakevm"] = "Viewmodel Shake"
|
||||
L["arccw.cvar.shake_info"] = "Aggressive snap when you shoot a weapon."
|
||||
L["arccw.cvar.2d3d"] = "Floating Help Text"
|
||||
L["arccw.cvar.2d3d_info"] = "Text that floats over dropped weapons."
|
||||
L["arccw.cvar.2d3d"] = "Draw Help Text"
|
||||
L["arccw.cvar.2d3d_info"] = "Draw name of weapons, ammo and attachments on the ground."
|
||||
L["arccw.cvar.attinv_hideunowned"] = "Hide Unowned Attachments"
|
||||
L["arccw.cvar.attinv_darkunowned"] = "Grey Out Unowned Attachments"
|
||||
L["arccw.cvar.attinv_onlyinspect"] = "Hide Customization UI"
|
||||
@ -407,4 +407,8 @@ L["arccw.cvar.noinspect"] = "Disable inspect animations"
|
||||
|
||||
-- 2022-07-10
|
||||
L["arccw.cvar.override_hud_off"] = "Force Disable HUD"
|
||||
L["arccw.hud_svwarning"] = "The HUD can be disabled serverside by a server administrator."
|
||||
L["arccw.hud_svwarning"] = "The HUD can be disabled serverside by a server administrator."
|
||||
|
||||
-- 2023-10-10
|
||||
L["arccw.cvar.2d3d.1"] = "1 - When Pointed At"
|
||||
L["arccw.cvar.2d3d.2"] = "2 - Always"
|
@ -56,7 +56,9 @@ local ClientPanel = {
|
||||
{ type = "c", text = "#arccw.cvar.shake_info" },
|
||||
{ type = "b", text = "#arccw.cvar.aimassist", var = "arccw_aimassist_cl" },
|
||||
{ type = "c", text = "#arccw.cvar.aimassist_cl.desc" },
|
||||
{ type = "b", text = "#arccw.cvar.2d3d", var = "arccw_2d3d" },
|
||||
-- { type = "b", text = "#arccw.cvar.2d3d", var = "arccw_2d3d" },
|
||||
{ type = "o", text = "#arccw.cvar.2d3d", var = "arccw_2d3d",
|
||||
choices = {[0] = "#arccw.combobox.disabled", [1] = "#arccw.cvar.2d3d.1", [2] = "#arccw.cvar.2d3d.2"}},
|
||||
{ type = "c", text = "#arccw.cvar.2d3d_info" },
|
||||
{ type = "t", text = "#arccw.cvar.language", var = "arccw_language" },
|
||||
{ type = "c", text = "#arccw.cvar.language_info" },
|
||||
|
@ -279,7 +279,8 @@ elseif CLIENT then
|
||||
function ENT:Draw()
|
||||
self:DrawModel()
|
||||
|
||||
if !GetConVar("arccw_2d3d"):GetBool() then return end
|
||||
local cvar2d3d = ArcCW.ConVars["2d3d"]:GetInt()
|
||||
if cvar2d3d == 0 or (cvar2d3d == 1 and LocalPlayer():GetEyeTrace().Entity != self) then return end
|
||||
|
||||
if (EyePos() - self:GetPos()):LengthSqr() <= 262144 then -- 512^2
|
||||
local ang = LocalPlayer():EyeAngles()
|
||||
@ -293,6 +294,10 @@ elseif CLIENT then
|
||||
|
||||
local w = surface.GetTextSize(self.PrintName)
|
||||
|
||||
surface.SetTextPos(-w / 2 + 2, 2)
|
||||
surface.SetTextColor(0, 0, 0, 150)
|
||||
surface.DrawText(self.PrintName)
|
||||
|
||||
surface.SetTextPos(-w / 2, 0)
|
||||
surface.SetTextColor(255, 255, 255, 255)
|
||||
surface.DrawText(self.PrintName)
|
||||
@ -300,6 +305,12 @@ elseif CLIENT then
|
||||
local ammo = self:GetNWInt("truecount", -1) != -1 and self:GetNWInt("truecount", -1) or self.AmmoCount
|
||||
if ammo then
|
||||
w = surface.GetTextSize("×" .. ammo)
|
||||
|
||||
surface.SetTextColor(0, 0, 0, 150)
|
||||
surface.SetTextPos(-w / 2 + 2, 27)
|
||||
surface.DrawText("×" .. ammo)
|
||||
|
||||
surface.SetTextColor(255, 255, 255, 255)
|
||||
surface.SetTextPos(-w / 2, 25)
|
||||
surface.DrawText("×" .. ammo)
|
||||
end
|
||||
|
@ -79,18 +79,17 @@ end
|
||||
else
|
||||
|
||||
local defaulticon = Material("arccw/hud/atts/default.png")
|
||||
|
||||
local iw = 64
|
||||
|
||||
function ENT:DrawTranslucent()
|
||||
|
||||
self:Draw()
|
||||
|
||||
end
|
||||
|
||||
function ENT:Draw()
|
||||
self:DrawModel()
|
||||
|
||||
if !GetConVar("arccw_2d3d"):GetBool() then return end
|
||||
local cvar2d3d = ArcCW.ConVars["2d3d"]:GetInt()
|
||||
if cvar2d3d == 0 or (cvar2d3d == 1 and LocalPlayer():GetEyeTrace().Entity != self) then return end
|
||||
|
||||
if self.PrintName == "Base Dropped Attachment" and self:GetNWInt("attid", -1) != -1 then
|
||||
local att = ArcCW.AttachmentIDTable[self:GetNWInt("attid", -1)]
|
||||
@ -116,15 +115,16 @@ function ENT:Draw()
|
||||
surface.SetFont("ArcCW_32_Unscaled")
|
||||
|
||||
local w = surface.GetTextSize(self.PrintName)
|
||||
|
||||
surface.SetTextPos(-w / 2 + 2, 2)
|
||||
surface.SetTextColor(0, 0, 0, 150)
|
||||
surface.DrawText(self.PrintName)
|
||||
surface.SetTextPos(-w / 2, 0)
|
||||
surface.SetTextColor(255, 255, 255, 255)
|
||||
surface.DrawText(self.PrintName)
|
||||
|
||||
surface.SetDrawColor(255, 255, 255)
|
||||
surface.SetMaterial(self.Icon or defaulticon)
|
||||
local iw = 64
|
||||
surface.DrawTexturedRect(-iw / 2, -iw - 8, iw, iw)
|
||||
surface.DrawTexturedRect(-iw / 2, iw / 2, iw, iw)
|
||||
cam.End3D2D()
|
||||
end
|
||||
end
|
||||
|
@ -11,10 +11,12 @@ ENT.Model = "models/Items/BoxMRounds.mdl"
|
||||
function ENT:Draw()
|
||||
self:DrawModel()
|
||||
|
||||
if !GetConVar("arccw_2d3d"):GetBool() then return end
|
||||
local cvar2d3d = ArcCW.ConVars["2d3d"]:GetInt()
|
||||
if cvar2d3d == 0 or (cvar2d3d == 1 and LocalPlayer():GetEyeTrace().Entity != self) then return end
|
||||
|
||||
if (EyePos() - self:WorldSpaceCenter()):LengthSqr() <= 262144 then -- 512^2
|
||||
local ang = LocalPlayer():EyeAngles()
|
||||
local name = self:GetNWString("boxname", nil) or self.PrintName
|
||||
|
||||
ang:RotateAroundAxis(ang:Forward(), 180)
|
||||
ang:RotateAroundAxis(ang:Right(), 90)
|
||||
@ -22,15 +24,23 @@ function ENT:Draw()
|
||||
|
||||
cam.Start3D2D(self:WorldSpaceCenter() + Vector(0, 0, 14), ang, 0.1)
|
||||
surface.SetFont("ArcCW_32_Unscaled")
|
||||
local w = surface.GetTextSize(name)
|
||||
|
||||
surface.SetTextPos(-w / 2 + 2, 2)
|
||||
surface.SetTextColor(0, 0, 0, 150)
|
||||
surface.DrawText(name)
|
||||
|
||||
local w = surface.GetTextSize(self:GetNWString("boxname", nil) or self.PrintName)
|
||||
surface.SetTextPos(-w / 2, 0)
|
||||
surface.SetTextColor(255, 255, 255, 255)
|
||||
surface.DrawText(self:GetNWString("boxname", nil) or self.PrintName)
|
||||
surface.DrawText(name)
|
||||
|
||||
local count = self:GetNWInt("boxcount", 0)
|
||||
local str = count .. " Attachment" .. (count != 1 and "s" or "")
|
||||
local w2 = surface.GetTextSize(str)
|
||||
|
||||
surface.SetTextPos(-w2 / 2 + 2, 26)
|
||||
surface.SetTextColor(0, 0, 0, 150)
|
||||
surface.DrawText(str)
|
||||
surface.SetTextPos(-w2 / 2, 24)
|
||||
surface.SetTextColor(255, 255, 255, 255)
|
||||
surface.DrawText(str)
|
||||
|
@ -712,30 +712,71 @@ function SWEP:ShouldCheapWorldModel()
|
||||
return !ArcCW.ConVars["att_showothers"]:GetBool()
|
||||
end
|
||||
|
||||
local bird = Material("arccw/hud/arccw_bird.png", "mips smooth")
|
||||
local iw = 32
|
||||
|
||||
function SWEP:DrawWorldModel()
|
||||
-- 512^2
|
||||
if !IsValid(self:GetOwner()) and !TTT2 and GetConVar("arccw_2d3d"):GetBool() and (EyePos() - self:WorldSpaceCenter()):LengthSqr() <= 262144 then
|
||||
local cvar2d3d = ArcCW.ConVars["2d3d"]:GetInt()
|
||||
if !IsValid(self:GetOwner()) and !TTT2
|
||||
and (cvar2d3d == 2 or (cvar2d3d == 1 and LocalPlayer():GetEyeTrace().Entity == self))
|
||||
and (EyePos() - self:WorldSpaceCenter()):LengthSqr() <= 262144 then -- 512^2
|
||||
local ang = LocalPlayer():EyeAngles()
|
||||
ang:RotateAroundAxis(ang:Forward(), 180)
|
||||
ang:RotateAroundAxis(ang:Right(), 90)
|
||||
ang:RotateAroundAxis(ang:Up(), 90)
|
||||
cam.Start3D2D(self:WorldSpaceCenter() + Vector(0, 0, 16), ang, 0.1)
|
||||
|
||||
srf.SetFont("ArcCW_32_Unscaled")
|
||||
local w = srf.GetTextSize(self.PrintName)
|
||||
srf.SetTextPos(-w / 2 + 2, 2)
|
||||
srf.SetTextColor(0, 0, 0, 150)
|
||||
srf.DrawText(self.PrintName)
|
||||
srf.SetTextPos(-w / 2, 0)
|
||||
srf.SetTextColor(255, 255, 255, 255)
|
||||
srf.DrawText(self.PrintName)
|
||||
srf.SetFont("ArcCW_24_Unscaled")
|
||||
local count = self:CountAttachments()
|
||||
|
||||
if count > 0 then
|
||||
local t = tostring(count) .. " Attachments"
|
||||
w = srf.GetTextSize(t)
|
||||
srf.SetTextPos(-w / 2, 32)
|
||||
srf.SetTextColor(255, 255, 255, 255)
|
||||
srf.DrawText(t)
|
||||
local icons = {}
|
||||
for i, slot in pairs(self.Attachments or {}) do
|
||||
if slot.Installed then
|
||||
local atttbl = ArcCW.AttachmentTable[slot.Installed]
|
||||
if !atttbl then continue end
|
||||
local icon = atttbl.Icon
|
||||
if !icon or icon:IsError() then icon = bird end
|
||||
table.insert(icons, icon)
|
||||
end
|
||||
end
|
||||
|
||||
local ind = math.min(6, #icons)
|
||||
|
||||
surface.SetDrawColor(255, 255, 255)
|
||||
for i = 1, ind do
|
||||
if i == 6 and #icons > 6 then
|
||||
local str = "+" .. (#icons - ind)
|
||||
local strw = srf.GetTextSize(str)
|
||||
srf.SetTextPos(-ind * iw / 2 + (i - 1) * iw + 2 + strw / 2, iw + 14)
|
||||
srf.SetTextColor(0, 0, 0, 150)
|
||||
srf.DrawText(str)
|
||||
srf.SetTextPos(-ind * iw / 2 + (i - 1) * iw + strw / 2, iw + 12)
|
||||
srf.SetTextColor(255, 255, 255, 255)
|
||||
srf.DrawText(str)
|
||||
else
|
||||
local icon = icons[i]
|
||||
surface.SetMaterial(icon)
|
||||
surface.DrawTexturedRect(-ind * iw / 2 + (i - 1) * iw, iw + 12, iw, iw)
|
||||
end
|
||||
end
|
||||
|
||||
-- srf.SetFont("ArcCW_24_Unscaled")
|
||||
-- local count = self:CountAttachments()
|
||||
|
||||
-- if count > 0 then
|
||||
-- local t = tostring(count) .. " Attachments"
|
||||
-- w = srf.GetTextSize(t)
|
||||
-- srf.SetTextPos(-w / 2, 32)
|
||||
-- srf.SetTextColor(255, 255, 255, 255)
|
||||
-- srf.DrawText(t)
|
||||
-- end
|
||||
|
||||
cam.End3D2D()
|
||||
end
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user