new scope zoom beta (broken variable zoom)

please use ATT.RTScopeMagnification = 4 ATT.ScopeScreenRatio = 0.5 now!!!
This commit is contained in:
Darsu 2024-08-28 15:09:07 +07:00
parent b5b2cfff88
commit b0d458f23b
4 changed files with 37 additions and 27 deletions

View File

@ -166,8 +166,7 @@ ATT.FLIRHotFunc = function(swep, ent) end -- return true for hot and false for c
ATT.RTScope = true
ATT.RTScopeSubmatIndex = 1
ATT.RTScopeFOV = 2.5
ATT.RTScopeRes = 512
-- ATT.RTScopeFOV = 2.5 -- Do not use this anymore!!! use RTScopeMagnification
ATT.RTScopeReticle = Material("")
ATT.RTScopeReticleScale = 1
ATT.RTScopeShadowIntensity = 1.5
@ -183,7 +182,8 @@ ATT.RTScopeDrawFunc = function(swep, rtsize) end
-- Extra post processing like DrawMotionBlur() DrawSharpen() DrawBloom()
ATT.RTScopeCustomPPFunc = function(swep) end
ATT.ScopeScreenRatio = 0.75 -- Needed for Cheap Scopes
ATT.ScopeScreenRatio = 0.5 -- Take a screenshot of full screen, select whole visible picture in it and divide by screen height (for example = 500/1080, you can just leave it like that here)
ATT.RTScopeMagnification = 4 -- New zoom thing, 1 is 1x, 4 is 4x (crazy!)
ATT.RTScopeNightVision = true
ATT.RTScopeNightVisionMonochrome = true

View File

@ -366,7 +366,9 @@ function SWEP:DoRTScope(model, atttbl, active)
end
function SWEP:GetCheapScopeScale(scale)
return 2 / (scale or 0.5)
local ratio = scale - (!self.ExtraSightDistanceNoRT and self:GetSight().ExtraSightDistance or 0) * 0.045
-- print(ratio)
return 2 / (scale or 0.5) * 0.66 / ratio
end
local hascostscoped = false
@ -401,7 +403,7 @@ function SWEP:DoCheapScope(fov, atttbl)
scrw = scrw
scrh = scrh * scrh / scrw
local s = self:GetCheapScopeScale(atttbl.ScopeScreenRatio)
local s = self:GetCheapScopeScale(atttbl.ScopeScreenRatio or 0.5)
local scrx = (ScrW() - scrw * s) / 2
local scry = (ScrH() - scrh * s) / 2

View File

@ -31,7 +31,8 @@ function SWEP:GenerateAutoSight(sight, slottbl)
-- ExtraAng = ang
ShadowPos = sight.ShadowPos,
Reticle = sight.Reticle,
RTScopeFOV = sight.RTScopeFOV
RTScopeFOV = sight.RTScopeFOV,
RTScopeMagnification = sight.RTScopeMagnification
}
end
@ -54,6 +55,25 @@ local arc9_cheapscopes = GetConVar("arc9_cheapscopes")
local arc9_compensate_sens = GetConVar("arc9_compensate_sens")
local fov_desired = GetConVar("fov_desired")
function SWEP:GetRealZoom(sight)
local atttbl
if sight.BaseSight then
atttbl = self:GetTable()
else
atttbl = self:GetFinalAttTable(sight.slottbl)
end
local scrolllevel = sight.ScrollLevel or 0
if atttbl.RTScopeAdjustable then
return atttbl.RTScopeMagnificationMin and Lerp(scrolllevel / atttbl.RTScopeAdjustmentLevels, atttbl.RTScopeMagnificationMax, atttbl.RTScopeMagnificationMin) or Lerp(scrolllevel / atttbl.RTScopeAdjustmentLevels, atttbl.RTScopeFOVMax, atttbl.RTScopeFOVMin)
else
-- pseudo fake zoom if no real new thing defined
return sight.RTScopeMagnification or atttbl.RTScopeMagnification or (sight.ViewModelFOV or 54) / (sight.RTScopeFOV or atttbl.RTScopeFOV)
end
end
function SWEP:GetMagnification()
local sight = self:GetSight()
@ -67,13 +87,7 @@ function SWEP:GetMagnification()
end
if atttbl and atttbl.RTScope and !atttbl.RTCollimator then
-- target = (self:GetOwner():GetFOV() / self:GetRTScopeFOV())
local realfov = self:GetOwner():GetFOV()
local screenamt = ((ScrW() - ScrH()) / ScrW()) * (atttbl.ScopeScreenRatio or 0.5) * 2
target = (realfov / (self:GetRTScopeFOV() or realfov)) * screenamt
target = math.max(target, 1)
target = math.max(target * self:GetRealZoom(sight), 1)
end
end

View File

@ -371,26 +371,20 @@ function SWEP:GetSight()
return self.MultiSightTable[self:GetMultiSight()] or self:GetValue("IronSights")
end
local arc9_cheapscopes = GetConVar("arc9_cheapscopes")
function SWEP:GetRTScopeFOV()
local sights = self:GetSight()
if !sights then return self:GetOwner():GetFOV() end
local atttbl
local realzoom = self:GetRealZoom(sights)
if sights.BaseSight then
atttbl = self:GetTable()
else
atttbl = self:GetFinalAttTable(sights.slottbl)
end
local ratio = (sights.atttbl.ScopeScreenRatio or 0.5) - (!self.ExtraSightDistanceNoRT and sights.ExtraSightDistance or 0) * 0.045
local vmfovratio = arc9_cheapscopes:GetBool() and sights.Magnification or self:GetSmoothedFOVMag() -- sights.Magnification
local funnyfov = self:ScaleFOVByWidthRatio(self:GetOwner():GetFOV(), 1 / vmfovratio * ratio / 1.5 / realzoom)
local scrolllevel = sights.ScrollLevel or 0
if atttbl.RTScopeAdjustable then
return Lerp(scrolllevel / atttbl.RTScopeAdjustmentLevels, atttbl.RTScopeFOVMax, atttbl.RTScopeFOVMin)
else
return sights.RTScopeFOV or atttbl.RTScopeFOV
end
return funnyfov
end
SWEP.ScrollLevels = {}