diff --git a/source/core/gamecvars.cpp b/source/core/gamecvars.cpp index ddaf75428..cd8b93ff1 100644 --- a/source/core/gamecvars.cpp +++ b/source/core/gamecvars.cpp @@ -92,6 +92,7 @@ CVARD(Int, cl_showweapon, 1, CVAR_ARCHIVE, "enable/disable show weapons") // onl CVARD(Bool, cl_sointerpolation, true, CVAR_ARCHIVE, "enable/disable sector object interpolation") // only implemented in SW CVARD(Bool, cl_syncinput, false, CVAR_ARCHIVE, "enable/disable synchronized input with game's ticrate") // only implemented in SW CVARD(Bool, cl_dukefixrpgrecoil, true, CVAR_ARCHIVE, "soften recoil of Duke 3D's RPG") +CVARD(Bool, cl_smoothsway, true, CVAR_ARCHIVE, "move SW weapon left and right smoothly while bobbing") CUSTOM_CVARD(Int, cl_crosshairscale, 50, CVAR_ARCHIVE, "changes the size of the crosshair") { if (self < 1) self = 1; diff --git a/source/core/gamecvars.h b/source/core/gamecvars.h index 3368408cc..f903dc058 100644 --- a/source/core/gamecvars.h +++ b/source/core/gamecvars.h @@ -26,6 +26,7 @@ EXTERN_CVAR(Int, cl_crosshairscale) EXTERN_CVAR(Bool, cl_sointerpolation) EXTERN_CVAR(Bool, cl_syncinput) EXTERN_CVAR(Bool, cl_dukefixrpgrecoil) +EXTERN_CVAR(Bool, cl_smoothsway) EXTERN_CVAR(Bool, demorec_seeds_cvar) EXTERN_CVAR(Bool, demoplay_diffs) diff --git a/source/sw/src/panel.cpp b/source/sw/src/panel.cpp index 2432a88ce..c79735765 100644 --- a/source/sw/src/panel.cpp +++ b/source/sw/src/panel.cpp @@ -6808,8 +6808,21 @@ pWeaponBob(PANEL_SPRITEp psp, short condition) // sin_xxx moves the weapon left-right // // - // increment the ndx into the sin table and wrap. - psp->sin_ndx = (psp->sin_ndx + (synctics * 12)) & 2047; + // increment the ndx into the sin table + psp->sin_ndx = psp->sin_ndx + (synctics << 3); + // add an additional increment to ndx + if (cl_smoothsway) + { + // add a fixed factor to it + psp->sin_ndx += (synctics << 2); + } + else + { + // add a random factor to it + psp->sin_ndx += (RANDOM_P2(8) * synctics); + } + // wrap + psp->sin_ndx &= 2047; // get height xdiff = psp->sin_amt * calcSinTableValue(psp->sin_ndx) / 16384.;