diff --git a/source/client/main.qc b/source/client/main.qc index 84d2949..2986d94 100644 --- a/source/client/main.qc +++ b/source/client/main.qc @@ -70,6 +70,7 @@ noref void(float apiver, string enginename, float enginever) CSQC_Init = registercommand("showscores"); cvar_set("sv_cheats", ftos(1)); + autocvar(r_viewmodel_default_fov, 70); // Runtime check if we're running this in WebASM/WebGL. if (cvar_string("sys_platform") == "Web") @@ -453,7 +454,6 @@ noref void(float isnew) CSQC_Ent_Update = addentity(self); } - // CALLED EVERY CLIENT RENDER FRAME noref void(float width, float height, float menushown) CSQC_UpdateView = { @@ -469,9 +469,12 @@ noref void(float width, float height, float menushown) CSQC_UpdateView = setviewprop(VF_DRAWENGINESBAR, 0); setviewprop(VF_DRAWCROSSHAIR, 0); - setsensitivityscaler(getstatf(STAT_VIEWZOOM)); + setsensitivityscaler(getstatf(STAT_VIEWZOOM)*getstatf(STAT_VIEWZOOM)); setviewprop(VF_AFOV, autocvar(fov,90)*getstatf(STAT_VIEWZOOM)); - + + cvar_set("r_viewmodel_fov", ftos(cvar("r_viewmodel_default_fov")*getstatf(STAT_VIEWZOOM))); + + //autoadd entities received from servers for drawing addentities(MASK_ENGINE); diff --git a/source/server/weapons/weapon_core.qc b/source/server/weapons/weapon_core.qc index 148c731..4124e51 100644 --- a/source/server/weapons/weapon_core.qc +++ b/source/server/weapons/weapon_core.qc @@ -2422,43 +2422,38 @@ void () Weapon_Logic = } #ifdef PC else { - - if (self.weapon == W_KAR_SCOPE || self.weapon == W_PTRS || - self.weapon == W_HEADCRACKER || self.weapon == W_PENETRATOR) { - if (self.viewzoom > 0.5) - self.viewzoom -= 0.05; - else - self.viewzoom = 0.5; - } else { - if (self.viewzoom > 0.9) - self.viewzoom -= 0.01; - else - self.viewzoom = 0.89999; - } + float zoom_factor = 1 - (0.018*GetWeaponZoomAmount(self.weapon)); + if (self.viewzoom > zoom_factor) + self.viewzoom -= 0.03; + else + self.viewzoom = zoom_factor; } #endif // PC } } - } else if (!self.button8 && self.zoom) { + } + // AIM button is released + else if (!self.button8 && self.zoom) { #ifdef PC if (self.weapon == W_KAR_SCOPE || self.weapon == W_PTRS || self.weapon == W_HEADCRACKER || self.weapon == W_PENETRATOR) { if (self.viewzoom == 0.2) { - self.viewzoom += 0.05; + self.viewzoom += 0.03; ReturnWeaponModel(); } else { UpdateVmodel(self.weaponmodel, GetWepSkin(self.weapon)); UpdateV2model(self.weapon2model, 0); - self.viewzoom += 0.05; + self.viewzoom += 0.03; } } else { if (self.viewzoom == 0.9) { W_AimOut(); } else { - self.viewzoom += 0.015; + self.viewzoom += 0.03; } } + // Don't stop aiming until the camera is restored if (self.viewzoom >= 1) { self.viewzoom = 1; self.zoom = 0; diff --git a/source/shared/weapon_defines.qc b/source/shared/weapon_defines.qc index 56ed234..1a90679 100644 --- a/source/shared/weapon_defines.qc +++ b/source/shared/weapon_defines.qc @@ -4217,6 +4217,7 @@ float (float wep) GetWeaponFlash_Size = { case W_COMPRESSOR: return 12; case W_PPSH: + case W_REAPER: return 14; case W_MP40: case W_AFTERBURNER: @@ -4243,3 +4244,76 @@ float (float wep) GetWeaponFlash_Size = { return 5; } } + +// Returns the amount needed to zoom in a weapon. In near-fov "units". +float(float wep) GetWeaponZoomAmount = +{ + switch(wep) { + case W_COLT: + return 10; + case W_KAR: + case W_ARMAGEDDON: + return 25; + case W_KAR_SCOPE: + case W_HEADCRACKER: + return 50; + case W_THOMPSON: + case W_GIBS: + return 10; + case W_TRENCH: + case W_GUT: + return 10; + case W_357: + case W_KILLU: + return 5; + case W_MG: + case W_BARRACUDA: + return 15; + case W_DB: + case W_BORE: + case W_SAWNOFF: + return 10; + case W_M1A1: + case W_WIDDER: + return 20; + case W_BAR: + case W_WIDOW: + return 30; + case W_FG: + case W_IMPELLER: + return 30; + case W_GEWEHR: + case W_COMPRESSOR: + return 25; + case W_PPSH: + case W_REAPER: + return 10; + case W_MP40: + case W_AFTERBURNER: + return 10; + case W_MP5K: + case W_KOLLIDER: + return 10; + case W_STG: + case W_SPATZ: + return 20; + case W_M1: + case W_M1000: + return 25; + case W_BROWNING: + case W_ACCELERATOR: + return 15; + case W_PTRS: + case W_PENETRATOR: + return 50; + case W_TYPE: + case W_SAMURAI: + return 10; + case W_RAY: + case W_PORTER: + return 5; + default: return 0; + } + + return 0; +}