Crosshair edit

This commit is contained in:
Fesiug 2024-09-21 14:06:45 -04:00
parent 3946029046
commit 890b1c5b94
Signed by: Fesiug
GPG Key ID: 374BFF45E1EEF243
1 changed files with 36 additions and 6 deletions

View File

@ -747,22 +747,52 @@ function GM:HUDPaint()
-- S_Pop()
local trac = p:GetEyeTrace().HitPos:ToScreen()
--local trac = p:GetEyeTrace().HitPos:ToScreen()
local trac = util.TraceLine( {
start = p:GetPos() + Vector( 0, 0, 52 ),
endpos = p:GetPos() + Vector( 0, 0, 52 ) + p:EyeAngles():Forward()*(2^31),
filter = p,
} ).HitPos
local trac2 = util.TraceLine( {
start = CamSpot(),
endpos = CamSpot() + TPSOverride:Forward()*(2^16),
endpos = CamSpot() + TPSOverride:Forward()*(2^31),
filter = p,
} ).HitPos:ToScreen()
} ).HitPos
local tol = false
if trac:IsEqualTol( trac2, 2 ) then -- within two inches
trac2 = trac2:ToScreen()
trac = trac2
tol = true
else
trac = trac:ToScreen()
trac2 = trac2:ToScreen()
end
for i=1, 2 do
local shadowtime = i==1
local traac = shadowtime and trac2 or trac
local cx, cy = math.Round(traac.x), math.Round(traac.y)
local gap = 4
local length = 4
S_Push( cx, cy )
local lol = shadowtime and 0 or 255
surface.SetDrawColor( lol, lol, lol )
surface.SetMaterial( shadowtime and xhair_dot_shadow or xhair_dot )
hTrRect( 0, 0, 64, 64, 0 )
local lol2 = shadowtime and 127 or 255
local Shadow_Gap = shadowtime and 1 or 0
local Shadow_Thickness = shadowtime and 2 or 0
surface.SetDrawColor( lol, lol, lol, lol2 )
--surface.SetMaterial( shadowtime and xhair_dot_shadow or xhair_dot )
hRect( -1 - Shadow_Gap, gap - Shadow_Gap, 2 + Shadow_Thickness, length + Shadow_Thickness )
hRect( gap - Shadow_Gap, -1 - Shadow_Gap, length + Shadow_Thickness, 2 + Shadow_Thickness )
-- top and left
hRect( -1 - Shadow_Gap, -length - gap - Shadow_Gap, 2 + Shadow_Thickness, length + Shadow_Thickness )
hRect( -length - gap - Shadow_Gap, -1 - Shadow_Gap, length + Shadow_Thickness, 2 + Shadow_Thickness )
if !shadowtime and !tol then
surface.SetDrawColor( 255, 0, 0 )
hRect( -1, -1, 2, 2 )
end
S_Pop()
end