mirror of
https://github.com/JonnyBro/beatrun.git
synced 2024-12-29 21:33:02 +05:00
Further polish up the FOV fix
This commit is contained in:
parent
fdb3d703bf
commit
f626a1d1a7
1 changed files with 27 additions and 9 deletions
|
@ -7,6 +7,11 @@ if CLIENT then
|
||||||
CreateConVar("cl_weaponcolor", "0.30 1.80 2.10", {FCVAR_ARCHIVE, FCVAR_USERINFO, FCVAR_DONTRECORD}, "The value is a Vector - so between 0-1 - not between 0-255")
|
CreateConVar("cl_weaponcolor", "0.30 1.80 2.10", {FCVAR_ARCHIVE, FCVAR_USERINFO, FCVAR_DONTRECORD}, "The value is a Vector - so between 0-1 - not between 0-255")
|
||||||
CreateConVar("cl_playerskin", "0", {FCVAR_ARCHIVE, FCVAR_USERINFO, FCVAR_DONTRECORD}, "The skin to use, if the model has any")
|
CreateConVar("cl_playerskin", "0", {FCVAR_ARCHIVE, FCVAR_USERINFO, FCVAR_DONTRECORD}, "The skin to use, if the model has any")
|
||||||
CreateConVar("cl_playerbodygroups", "0", {FCVAR_ARCHIVE, FCVAR_USERINFO, FCVAR_DONTRECORD}, "The bodygroups to use, if the model has any")
|
CreateConVar("cl_playerbodygroups", "0", {FCVAR_ARCHIVE, FCVAR_USERINFO, FCVAR_DONTRECORD}, "The bodygroups to use, if the model has any")
|
||||||
|
|
||||||
|
CreateConVar("Beatrun_Debug_FOVFix", "0", {FCVAR_DONTRECORD, FCVAR_UNREGISTERED}, "DEBUG: Toggles the FOV fix on or off.")
|
||||||
|
-- Don't record this CVar's value. Don't want players wondering how they broke FOV behavior even after restarting GMod.
|
||||||
|
|
||||||
|
local lframeswepclass = lframeswepclass or ""
|
||||||
end
|
end
|
||||||
|
|
||||||
local PLAYER = {}
|
local PLAYER = {}
|
||||||
|
@ -373,12 +378,25 @@ function PLAYER:CalcView(view)
|
||||||
local fixfovmult = 1
|
local fixfovmult = 1
|
||||||
|
|
||||||
if CLIENT then
|
if CLIENT then
|
||||||
if !LocalPlayer():GetActiveWeapon().ARC9 and !FOVModifierBlock then
|
if GetConVar("Beatrun_Debug_FOVFix"):GetBool() then
|
||||||
fixfovmult = view.fov / fov
|
-- VERY hacky and dirty code and I apologize in advance
|
||||||
|
|
||||||
|
if lframeswepclass != LocalPlayer():GetActiveWeapon():GetClass() then
|
||||||
|
-- SP weapon swap detection, proper hook isn't called in SP
|
||||||
|
FOVModifierBlock = true
|
||||||
|
timer.Simple(1, function() FOVModifierBlock = false end)
|
||||||
|
end
|
||||||
|
|
||||||
|
if !FOVModifierBlock and !LocalPlayer():GetActiveWeapon().ARC9 then
|
||||||
|
fixfovmult = view.fov / fov
|
||||||
|
else
|
||||||
|
fixfovmult = 1
|
||||||
|
end
|
||||||
|
view.fov = fov * mult * fixfovmult
|
||||||
|
lframeswepclass = LocalPlayer():GetActiveWeapon():GetClass()
|
||||||
else
|
else
|
||||||
fixfovmult = 1
|
view.fov = fov * mult
|
||||||
end
|
end
|
||||||
view.fov = fov * mult * fixfovmult
|
|
||||||
end
|
end
|
||||||
|
|
||||||
if self.TauntCam:CalcView(view, self.Player, self.Player:IsPlayingTaunt()) then return true end
|
if self.TauntCam:CalcView(view, self.Player, self.Player:IsPlayingTaunt()) then return true end
|
||||||
|
@ -541,12 +559,12 @@ hook.Add("PlayerSwitchWeapon", "BeatrunSwitchFOVFix", function(ply, oldwep)
|
||||||
-- behavior after switching away from an ARC9 SWEP.
|
-- behavior after switching away from an ARC9 SWEP.
|
||||||
|
|
||||||
-- Yes this is hacky as hell.
|
-- Yes this is hacky as hell.
|
||||||
FOVModifierBlock = true
|
if ply:GetInfoNum("Beatrun_Debug_FOVFix", 1) == 1 then
|
||||||
ply:SetFOV(ply:GetInfoNum("Beatrun_FOV", 120))
|
|
||||||
timer.Simple(0, function()
|
|
||||||
ply:SetFOV(ply:GetInfoNum("Beatrun_FOV", 120))
|
ply:SetFOV(ply:GetInfoNum("Beatrun_FOV", 120))
|
||||||
end)
|
timer.Simple(0, function()
|
||||||
timer.Simple(0.8, function() FOVModifierBlock = false end)
|
ply:SetFOV(ply:GetInfoNum("Beatrun_FOV", 120))
|
||||||
|
end)
|
||||||
|
end
|
||||||
end)
|
end)
|
||||||
|
|
||||||
player_manager.RegisterClass("player_beatrun", PLAYER, "player_default")
|
player_manager.RegisterClass("player_beatrun", PLAYER, "player_default")
|
||||||
|
|
Loading…
Reference in a new issue