Adds user-definable weapon bob speed

This commit is contained in:
raa-eruanna 2016-09-16 03:01:52 -04:00 committed by Christoph Oelckers
parent b5b9baaa87
commit 780d672b25
6 changed files with 14 additions and 1 deletions

View file

@ -70,6 +70,7 @@ CVAR (String, gender, "male", CVAR_USERINFO | CVAR_ARCHIVE);
CVAR (Bool, neverswitchonpickup, false, CVAR_USERINFO | CVAR_ARCHIVE); CVAR (Bool, neverswitchonpickup, false, CVAR_USERINFO | CVAR_ARCHIVE);
CVAR (Float, movebob, 0.25f, CVAR_USERINFO | CVAR_ARCHIVE); CVAR (Float, movebob, 0.25f, CVAR_USERINFO | CVAR_ARCHIVE);
CVAR (Float, stillbob, 0.f, 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); CVAR (String, playerclass, "Fighter", CVAR_USERINFO | CVAR_ARCHIVE);
enum enum
@ -83,6 +84,7 @@ enum
INFO_NeverSwitchOnPickup, INFO_NeverSwitchOnPickup,
INFO_MoveBob, INFO_MoveBob,
INFO_StillBob, INFO_StillBob,
INFO_WBobSpeed,
INFO_PlayerClass, INFO_PlayerClass,
INFO_ColorSet, INFO_ColorSet,
}; };

View file

@ -337,6 +337,10 @@ struct userinfo_t : TMap<FName,FBaseCVar *>
{ {
return *static_cast<FFloatCVar *>(*CheckKey(NAME_StillBob)); return *static_cast<FFloatCVar *>(*CheckKey(NAME_StillBob));
} }
double GetWBobSpeed() const
{
return *static_cast<FFloatCVar *>(*CheckKey(NAME_WBobSpeed));
}
int GetPlayerClassNum() const int GetPlayerClassNum() const
{ {
return *static_cast<FIntCVar *>(*CheckKey(NAME_PlayerClass)); return *static_cast<FIntCVar *>(*CheckKey(NAME_PlayerClass));

View file

@ -644,6 +644,7 @@ xx(ColorSet)
xx(NeverSwitchOnPickup) xx(NeverSwitchOnPickup)
xx(MoveBob) xx(MoveBob)
xx(StillBob) xx(StillBob)
xx(WBobSpeed)
xx(PlayerClass) xx(PlayerClass)
xx(Wi_NoAutostartMap) xx(Wi_NoAutostartMap)

View file

@ -524,9 +524,13 @@ void P_DropWeapon (player_t *player)
// A_WeaponReady every tic, and it looks bad if they don't bob smoothly. // 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! // [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) void P_BobWeapon (player_t *player, float *x, float *y, double ticfrac)
{ {
static float curbob; 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++) for (int i = 0; i < 2; i++)
{ {
// Bob the weapon based on movement speed. // 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. // [RH] Smooth transitions between bobbing and not-bobbing frames.
// This also fixes the bug where you can "stick" a weapon off-center by // This also fixes the bug where you can "stick" a weapon off-center by

View file

@ -1802,6 +1802,7 @@ DSPLYMNU_MENUDIM = "Menu dim";
DSPLYMNU_DIMCOLOR = "Dim color"; DSPLYMNU_DIMCOLOR = "Dim color";
DSPLYMNU_MOVEBOB = "View bob amount while moving"; DSPLYMNU_MOVEBOB = "View bob amount while moving";
DSPLYMNU_STILLBOB = "View bob amount while not moving"; DSPLYMNU_STILLBOB = "View bob amount while not moving";
DSPLYMNU_BOBSPEED = "Weapon bob speed";
// HUD Options // HUD Options
HUDMNU_TITLE = "HUD Options"; HUDMNU_TITLE = "HUD Options";

View file

@ -690,6 +690,7 @@ OptionMenu "VideoOptions"
ColorPicker "$DSPLYMNU_DIMCOLOR", "dimcolor" ColorPicker "$DSPLYMNU_DIMCOLOR", "dimcolor"
Slider "$DSPLYMNU_MOVEBOB", "movebob", 0, 1.0, 0.05, 2 Slider "$DSPLYMNU_MOVEBOB", "movebob", 0, 1.0, 0.05, 2
Slider "$DSPLYMNU_STILLBOB", "stillbob", 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
} }
//------------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------------