a bit of crosshair optimization
This commit is contained in:
parent
3da949313b
commit
01deff94f4
|
@ -535,22 +535,15 @@ hook.Add( "HUDPaint", "Benny_HUDPaint", function()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
for h=1, 2 do
|
if wep then -- Crosshair
|
||||||
local hand = h==2
|
|
||||||
if wep:GetUserAim() and wep:BClass( hand ) then -- Crosshair
|
|
||||||
local s, w, h = ss, ScrW(), ScrH()
|
|
||||||
local pl_x, pl_y = w/2, h/2
|
|
||||||
|
|
||||||
if wep:BClass( hand ).Spread then
|
local dispersion = math.rad( 1 )
|
||||||
local dispersion = math.rad( wep:BSpread( hand ) )
|
|
||||||
cam.Start3D()
|
cam.Start3D()
|
||||||
local lool = ( EyePos() + ( EyeAngles():Forward()*8192 ) + ( dispersion * EyeAngles():Up()*8192 ) ) :ToScreen()
|
local lool = ( EyePos() + ( EyeAngles():Forward()*8192 ) + ( dispersion * EyeAngles():Up()*8192 ) ) :ToScreen()
|
||||||
cam.End3D()
|
cam.End3D()
|
||||||
gap = ( (ScrH()/2) - lool.y )
|
gap = ( (ScrH()/2) - lool.y )
|
||||||
else
|
|
||||||
gap = 0
|
|
||||||
end
|
|
||||||
|
|
||||||
do
|
do
|
||||||
local tr1 = util.TraceLine({
|
local tr1 = util.TraceLine({
|
||||||
|
@ -577,7 +570,7 @@ hook.Add( "HUDPaint", "Benny_HUDPaint", function()
|
||||||
local touse1 = col_1
|
local touse1 = col_1
|
||||||
local touse1_primary = col_1a
|
local touse1_primary = col_1a
|
||||||
local touse2 = col_2
|
local touse2 = col_2
|
||||||
if ve then
|
if false then
|
||||||
pl_x = tr1f:ToScreen().x
|
pl_x = tr1f:ToScreen().x
|
||||||
pl_y = tr1f:ToScreen().y
|
pl_y = tr1f:ToScreen().y
|
||||||
ps_x = tr1f:ToScreen().x
|
ps_x = tr1f:ToScreen().x
|
||||||
|
@ -594,10 +587,20 @@ hook.Add( "HUDPaint", "Benny_HUDPaint", function()
|
||||||
ps_x = math.Round( ps_x )
|
ps_x = math.Round( ps_x )
|
||||||
ps_y = math.Round( ps_y )
|
ps_y = math.Round( ps_y )
|
||||||
|
|
||||||
|
for hhhh=1, 2 do
|
||||||
|
local hand = hhhh==2
|
||||||
|
if wep:GetUserAim() and wep:BClass( hand ) then -- Crosshair
|
||||||
|
local s, w, h = ss, ScrW(), ScrH()
|
||||||
|
|
||||||
|
local gap = gap
|
||||||
|
if wep:BClass( hand ).Spread then
|
||||||
|
gap = gap * wep:BSpread( hand )
|
||||||
|
end
|
||||||
|
|
||||||
local meow = wep:C_DualCheck()
|
local meow = wep:C_DualCheck()
|
||||||
|
|
||||||
for i=1, 2 do
|
for i=1, 2 do
|
||||||
local cooler = i == 1 and touse2 or (hand!=meow and touse1_primary or touse1)
|
local cooler = i == 1 and touse2 or touse1--(hand!=meow and touse1_primary or touse1)
|
||||||
local poosx, poosy = i == 1 and ps_x or pl_x, i == 1 and ps_y or pl_y
|
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 mat1 = i == 1 and mat_long_s or mat_long
|
||||||
local mat2 = i == 1 and mat_dot_s or mat_dot
|
local mat2 = i == 1 and mat_dot_s or mat_dot
|
||||||
|
@ -625,8 +628,6 @@ hook.Add( "HUDPaint", "Benny_HUDPaint", function()
|
||||||
fx, fy = math.Round( fx ), math.Round( fy )
|
fx, fy = math.Round( fx ), math.Round( fy )
|
||||||
surface.DrawTexturedRectRotated( fx, fy, s(16), s(16), i+(lmg and 0 or 90) )
|
surface.DrawTexturedRectRotated( fx, fy, s(16), s(16), i+(lmg and 0 or 90) )
|
||||||
end
|
end
|
||||||
--surface.SetMaterial( mat2 )
|
|
||||||
--surface.DrawTexturedRectRotated( poosx, poosy, s(32), s(32), 0 )
|
|
||||||
elseif typ == "pistol" then -- pistol
|
elseif typ == "pistol" then -- pistol
|
||||||
surface.SetMaterial( mat2 )
|
surface.SetMaterial( mat2 )
|
||||||
surface.DrawTexturedRectRotated( poosx - gap - s(spacer), poosy, s(32), s(32), 0 )
|
surface.DrawTexturedRectRotated( poosx - gap - s(spacer), poosy, s(32), s(32), 0 )
|
||||||
|
@ -643,6 +644,7 @@ hook.Add( "HUDPaint", "Benny_HUDPaint", function()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
if false then -- Quickinv
|
if false then -- Quickinv
|
||||||
|
|
Loading…
Reference in New Issue