From 0fa4e03db6a6334b628accaea2c2932fa8dea6d8 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Tue, 5 Mar 2019 00:22:26 +0100 Subject: [PATCH 1/4] - process escape sequences for episode and skill names For these, colorization is a desirable feature. --- src/gamedata/g_mapinfo.cpp | 2 +- src/gamedata/g_skill.cpp | 2 +- src/gamedata/umapinfo.cpp | 3 ++- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/gamedata/g_mapinfo.cpp b/src/gamedata/g_mapinfo.cpp index 488ac4f0d0..c69430b093 100644 --- a/src/gamedata/g_mapinfo.cpp +++ b/src/gamedata/g_mapinfo.cpp @@ -2019,7 +2019,7 @@ void FMapInfoParser::ParseEpisodeInfo () { ParseAssign(); sc.MustGetString (); - name = sc.String; + name = strbin1(sc.String); } else if (sc.Compare ("picname")) { diff --git a/src/gamedata/g_skill.cpp b/src/gamedata/g_skill.cpp index 897ffdc76f..1b8d15e14a 100644 --- a/src/gamedata/g_skill.cpp +++ b/src/gamedata/g_skill.cpp @@ -214,7 +214,7 @@ void FMapInfoParser::ParseSkill () { ParseAssign(); sc.MustGetString (); - skill.MenuName = sc.String; + skill.MenuName = strbin1(sc.String); } else if (sc.Compare("PlayerClassName")) { diff --git a/src/gamedata/umapinfo.cpp b/src/gamedata/umapinfo.cpp index ac82ff8e2f..39b91efd39 100644 --- a/src/gamedata/umapinfo.cpp +++ b/src/gamedata/umapinfo.cpp @@ -24,6 +24,7 @@ #include "r_defs.h" #include "p_setup.h" #include "gi.h" +#include "cmdlib.h" FName MakeEndPic(const char *string); @@ -231,7 +232,7 @@ static int ParseStandardProperty(FScanner &scanner, UMapEntry *mape) // add the given episode FEpisode epi; - epi.mEpisodeName = split[1]; + epi.mEpisodeName = strbin1(split[1]); epi.mEpisodeMap = mape->MapName; epi.mPicName = split[0]; epi.mShortcut = split[2][0]; From ae1a1df02de3dd5d3f7cc52f3a41b5dedee19989 Mon Sep 17 00:00:00 2001 From: Sterling Parker Date: Wed, 6 Mar 2019 23:25:09 -0700 Subject: [PATCH 2/4] 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. From 81059aee1d55623f8829b84546c540ad5b0807ad Mon Sep 17 00:00:00 2001 From: Sterling Parker Date: Thu, 7 Mar 2019 06:27:10 -0700 Subject: [PATCH 3/4] Fix faulty multiplication logic for LookScale Turns out the entire thing was getting shortcutted because FOVScale is 0 unless set explicitly or via A_ZoomFactor. --- src/g_game.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/g_game.cpp b/src/g_game.cpp index 27e0a65b05..dd5e73e753 100644 --- a/src/g_game.cpp +++ b/src/g_game.cpp @@ -756,11 +756,15 @@ static int LookAdjust(int look) if (players[consoleplayer].playerstate != PST_DEAD && // No adjustment while dead. 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. + auto FOVScale = players[consoleplayer].ReadyWeapon->FloatVar(NAME_FOVScale); + auto LookScale = players[consoleplayer].ReadyWeapon->FloatVar(NAME_LookScale); + if (FOVScale > 0) // No adjustment if it is non-positive. { - look = int(look * scale); + look = int(look * FOVScale); + } + if (LookScale > 0) // No adjustment if it is non-positive. + { + look = int(look * LookScale); } } return look; From cabe0c583e85ca382aae3e2b35878d5ad9cd4cd9 Mon Sep 17 00:00:00 2001 From: Sterling Parker Date: Thu, 7 Mar 2019 12:50:51 -0700 Subject: [PATCH 4/4] Add LookScale property As requested by @coelckers. --- wadsrc/static/zscript/actors/inventory/weapons.zs | 1 + 1 file changed, 1 insertion(+) diff --git a/wadsrc/static/zscript/actors/inventory/weapons.zs b/wadsrc/static/zscript/actors/inventory/weapons.zs index da5498b956..de7a024ce2 100644 --- a/wadsrc/static/zscript/actors/inventory/weapons.zs +++ b/wadsrc/static/zscript/actors/inventory/weapons.zs @@ -59,6 +59,7 @@ class Weapon : StateProvider property BobRangeY: BobRangeY; property SlotNumber: SlotNumber; property SlotPriority: SlotPriority; + property LookScale: LookScale; flagdef NoAutoFire: WeaponFlags, 0; // weapon does not autofire flagdef ReadySndHalf: WeaponFlags, 1; // ready sound is played ~1/2 the time