- SW: Restore random element to player's weapon left/right bobbing behind a CVAR.

# Conflicts:
#	source/core/gamecvars.cpp
#	source/core/gamecvars.h
This commit is contained in:
Mitchell Richters 2020-08-19 19:37:23 +10:00 committed by Christoph Oelckers
parent 50793184ee
commit a9f556c1bd
3 changed files with 17 additions and 2 deletions

View file

@ -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_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_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_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") CUSTOM_CVARD(Int, cl_crosshairscale, 50, CVAR_ARCHIVE, "changes the size of the crosshair")
{ {
if (self < 1) self = 1; if (self < 1) self = 1;

View file

@ -26,6 +26,7 @@ EXTERN_CVAR(Int, cl_crosshairscale)
EXTERN_CVAR(Bool, cl_sointerpolation) EXTERN_CVAR(Bool, cl_sointerpolation)
EXTERN_CVAR(Bool, cl_syncinput) EXTERN_CVAR(Bool, cl_syncinput)
EXTERN_CVAR(Bool, cl_dukefixrpgrecoil) EXTERN_CVAR(Bool, cl_dukefixrpgrecoil)
EXTERN_CVAR(Bool, cl_smoothsway)
EXTERN_CVAR(Bool, demorec_seeds_cvar) EXTERN_CVAR(Bool, demorec_seeds_cvar)
EXTERN_CVAR(Bool, demoplay_diffs) EXTERN_CVAR(Bool, demoplay_diffs)

View file

@ -6808,8 +6808,21 @@ pWeaponBob(PANEL_SPRITEp psp, short condition)
// sin_xxx moves the weapon left-right // sin_xxx moves the weapon left-right
// // // //
// increment the ndx into the sin table and wrap. // increment the ndx into the sin table
psp->sin_ndx = (psp->sin_ndx + (synctics * 12)) & 2047; 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 // get height
xdiff = psp->sin_amt * calcSinTableValue(psp->sin_ndx) / 16384.; xdiff = psp->sin_amt * calcSinTableValue(psp->sin_ndx) / 16384.;