Fixed my error where I was using a local session variable rather than the proper user info for the weapon bob speed.

This commit is contained in:
raa-eruanna 2016-09-16 03:48:09 -04:00 committed by Christoph Oelckers
parent 780d672b25
commit bc0624e3b2
2 changed files with 4 additions and 6 deletions

View file

@ -337,7 +337,7 @@ struct userinfo_t : TMap<FName,FBaseCVar *>
{ {
return *static_cast<FFloatCVar *>(*CheckKey(NAME_StillBob)); return *static_cast<FFloatCVar *>(*CheckKey(NAME_StillBob));
} }
double GetWBobSpeed() const float GetWBobSpeed() const
{ {
return *static_cast<FFloatCVar *>(*CheckKey(NAME_WBobSpeed)); return *static_cast<FFloatCVar *>(*CheckKey(NAME_WBobSpeed));
} }

View file

@ -528,9 +528,6 @@ void P_DropWeapon (player_t *player)
// //
//============================================================================ //============================================================================
// [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;
@ -555,8 +552,9 @@ 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. ([SP] And user's bob speed setting)
FAngle angle = (BobSpeed * wbobspeed * 35 / TICRATE*(level.time - 1 + i)) * (360.f / 8192.f); FAngle angle = (BobSpeed * player->userinfo.GetWBobSpeed() * 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