From 780d672b255022562f4ac12b94c5aac720c8f6a9 Mon Sep 17 00:00:00 2001 From: raa-eruanna Date: Fri, 16 Sep 2016 03:01:52 -0400 Subject: [PATCH] Adds user-definable weapon bob speed --- src/d_netinfo.cpp | 2 ++ src/d_player.h | 4 ++++ src/namedef.h | 1 + src/p_pspr.cpp | 6 +++++- wadsrc/static/language.enu | 1 + wadsrc/static/menudef.txt | 1 + 6 files changed, 14 insertions(+), 1 deletion(-) diff --git a/src/d_netinfo.cpp b/src/d_netinfo.cpp index 0b99fd73d..3504c5874 100644 --- a/src/d_netinfo.cpp +++ b/src/d_netinfo.cpp @@ -70,6 +70,7 @@ CVAR (String, gender, "male", CVAR_USERINFO | CVAR_ARCHIVE); CVAR (Bool, neverswitchonpickup, false, CVAR_USERINFO | CVAR_ARCHIVE); CVAR (Float, movebob, 0.25f, CVAR_USERINFO | CVAR_ARCHIVE); CVAR (Float, stillbob, 0.f, CVAR_USERINFO | CVAR_ARCHIVE); +CVAR (Float, wbobspeed, 1.f, CVAR_USERINFO | CVAR_ARCHIVE); CVAR (String, playerclass, "Fighter", CVAR_USERINFO | CVAR_ARCHIVE); enum @@ -83,6 +84,7 @@ enum INFO_NeverSwitchOnPickup, INFO_MoveBob, INFO_StillBob, + INFO_WBobSpeed, INFO_PlayerClass, INFO_ColorSet, }; diff --git a/src/d_player.h b/src/d_player.h index e932223aa..6f68aa6f7 100644 --- a/src/d_player.h +++ b/src/d_player.h @@ -337,6 +337,10 @@ struct userinfo_t : TMap { return *static_cast(*CheckKey(NAME_StillBob)); } + double GetWBobSpeed() const + { + return *static_cast(*CheckKey(NAME_WBobSpeed)); + } int GetPlayerClassNum() const { return *static_cast(*CheckKey(NAME_PlayerClass)); diff --git a/src/namedef.h b/src/namedef.h index e5b6c452a..f1279d27c 100644 --- a/src/namedef.h +++ b/src/namedef.h @@ -644,6 +644,7 @@ xx(ColorSet) xx(NeverSwitchOnPickup) xx(MoveBob) xx(StillBob) +xx(WBobSpeed) xx(PlayerClass) xx(Wi_NoAutostartMap) diff --git a/src/p_pspr.cpp b/src/p_pspr.cpp index 9f1233609..4274d81a8 100644 --- a/src/p_pspr.cpp +++ b/src/p_pspr.cpp @@ -524,9 +524,13 @@ void P_DropWeapon (player_t *player) // A_WeaponReady every tic, and it looks bad if they don't bob smoothly. // // [XA] Added new bob styles and exposed bob properties. Thanks, Ryan Cordell! +// [SP] Added new user option for bob speed // //============================================================================ +// [SP] Changes how quickly the weapon bobs +EXTERN_CVAR(Float, wbobspeed) + void P_BobWeapon (player_t *player, float *x, float *y, double ticfrac) { static float curbob; @@ -552,7 +556,7 @@ void P_BobWeapon (player_t *player, float *x, float *y, double ticfrac) for (int i = 0; i < 2; i++) { // Bob the weapon based on movement speed. - FAngle angle = (BobSpeed * 35 / TICRATE*(level.time - 1 + i)) * (360.f / 8192.f); + FAngle angle = (BobSpeed * wbobspeed * 35 / TICRATE*(level.time - 1 + i)) * (360.f / 8192.f); // [RH] Smooth transitions between bobbing and not-bobbing frames. // This also fixes the bug where you can "stick" a weapon off-center by diff --git a/wadsrc/static/language.enu b/wadsrc/static/language.enu index e91c9dd43..4839e1146 100644 --- a/wadsrc/static/language.enu +++ b/wadsrc/static/language.enu @@ -1802,6 +1802,7 @@ DSPLYMNU_MENUDIM = "Menu dim"; DSPLYMNU_DIMCOLOR = "Dim color"; DSPLYMNU_MOVEBOB = "View bob amount while moving"; DSPLYMNU_STILLBOB = "View bob amount while not moving"; +DSPLYMNU_BOBSPEED = "Weapon bob speed"; // HUD Options HUDMNU_TITLE = "HUD Options"; diff --git a/wadsrc/static/menudef.txt b/wadsrc/static/menudef.txt index a605b5cc4..0bcbd3af7 100644 --- a/wadsrc/static/menudef.txt +++ b/wadsrc/static/menudef.txt @@ -690,6 +690,7 @@ OptionMenu "VideoOptions" ColorPicker "$DSPLYMNU_DIMCOLOR", "dimcolor" Slider "$DSPLYMNU_MOVEBOB", "movebob", 0, 1.0, 0.05, 2 Slider "$DSPLYMNU_STILLBOB", "stillbob", 0, 1.0, 0.05, 2 + Slider "$DSPLYMNU_BOBSPEED", "wbobspeed", 0, 2.0, 0.1, 2 } //-------------------------------------------------------------------------------------------