From ae1a1df02de3dd5d3f7cc52f3a41b5dedee19989 Mon Sep 17 00:00:00 2001 From: Sterling Parker Date: Wed, 6 Mar 2019 23:25:09 -0700 Subject: [PATCH] Add LookScale variable on weapon This variable allows a weapon to set a custom look sensitivity multiplier without fiddling with FOVScale / DesiredFOV hacks. --- src/g_game.cpp | 1 + src/utility/namedef.h | 1 + wadsrc/static/zscript/actors/inventory/weapons.zs | 1 + 3 files changed, 3 insertions(+) diff --git a/src/g_game.cpp b/src/g_game.cpp index 32563b9c90..27e0a65b05 100644 --- a/src/g_game.cpp +++ b/src/g_game.cpp @@ -757,6 +757,7 @@ static int LookAdjust(int look) players[consoleplayer].ReadyWeapon != NULL) // No adjustment if no weapon. { auto scale = players[consoleplayer].ReadyWeapon->FloatVar(NAME_FOVScale); + scale *= players[consoleplayer].ReadyWeapon->FloatVar(NAME_LookScale); if (scale > 0) // No adjustment if it is non-positive. { look = int(look * scale); diff --git a/src/utility/namedef.h b/src/utility/namedef.h index 470a58a25b..4d54aadfc7 100644 --- a/src/utility/namedef.h +++ b/src/utility/namedef.h @@ -1029,6 +1029,7 @@ xx(Kickback) xx(MinSelAmmo1) xx(bDehAmmo) xx(FOVScale) +xx(LookScale) xx(YAdjust) xx(Crosshair) xx(WeaponFlags) diff --git a/wadsrc/static/zscript/actors/inventory/weapons.zs b/wadsrc/static/zscript/actors/inventory/weapons.zs index 2bddece742..da5498b956 100644 --- a/wadsrc/static/zscript/actors/inventory/weapons.zs +++ b/wadsrc/static/zscript/actors/inventory/weapons.zs @@ -28,6 +28,7 @@ class Weapon : StateProvider Ammo Ammo1, Ammo2; // In-inventory instance variables Weapon SisterWeapon; double FOVScale; + double LookScale; // Multiplier for look sensitivity (like FOV scaling but without the zooming) int Crosshair; // 0 to use player's crosshair bool GivenAsMorphWeapon; bool bAltFire; // Set when this weapon's alternate fire is used.