diff --git a/source/core/gamecvars.cpp b/source/core/gamecvars.cpp index b7a0fe838..ce7bbea74 100644 --- a/source/core/gamecvars.cpp +++ b/source/core/gamecvars.cpp @@ -89,6 +89,7 @@ CVARD(Bool, cl_interpolate, true, CVAR_ARCHIVE, "enable/disable view interpolati CVARD(Bool, cl_slopetilting, false, CVAR_ARCHIVE, "enable/disable slope tilting") // only implemented in Blood CVARD(Int, cl_showweapon, 1, CVAR_ARCHIVE, "enable/disable show weapons") // only implemented in Blood 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 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 e914da07a..68fcecf1e 100644 --- a/source/core/gamecvars.h +++ b/source/core/gamecvars.h @@ -24,6 +24,7 @@ EXTERN_CVAR(Int, cl_showweapon) EXTERN_CVAR(Int, cl_weaponswitch) EXTERN_CVAR(Int, cl_crosshairscale) EXTERN_CVAR(Bool, cl_sointerpolation) +EXTERN_CVAR(Bool, cl_syncinput) EXTERN_CVAR(Bool, demorec_seeds_cvar) EXTERN_CVAR(Bool, demoplay_diffs) diff --git a/source/games/duke/src/global.cpp b/source/games/duke/src/global.cpp index c922c2976..138b67dfd 100644 --- a/source/games/duke/src/global.cpp +++ b/source/games/duke/src/global.cpp @@ -64,7 +64,6 @@ int16_t weaponsandammosprites[15]; int PHEIGHT = PHEIGHT_DUKE; int duke3d_globalflags; input_t loc; -bool synchronized_input; uint8_t ready2send; int gamequit; int playerswhenstarted; diff --git a/source/games/duke/src/global.h b/source/games/duke/src/global.h index 0d3577f36..c6d198feb 100644 --- a/source/games/duke/src/global.h +++ b/source/games/duke/src/global.h @@ -50,7 +50,6 @@ extern int16_t max_ammo_amount[MAX_WEAPONS]; extern int16_t weaponsandammosprites[15]; extern int32_t PHEIGHT; extern int duke3d_globalflags; -extern bool synchronized_input; extern uint8_t ready2send; extern input_t loc; extern int gamequit; diff --git a/source/games/duke/src/input.cpp b/source/games/duke/src/input.cpp index 8b45e4d32..ff755869a 100644 --- a/source/games/duke/src/input.cpp +++ b/source/games/duke/src/input.cpp @@ -1181,7 +1181,7 @@ static void FinalizeInput(int playerNum, input_t& input, bool vehicle) if (p->on_crane < 0 && p->newowner == -1) { loc.q16avel += input.q16avel; - if (!synchronized_input) + if (!cl_syncinput) { p->q16ang = (p->q16ang + input.q16avel) & 0x7FFFFFF; @@ -1193,7 +1193,7 @@ static void FinalizeInput(int playerNum, input_t& input, bool vehicle) if (p->newowner == -1 && p->return_to_center <= 0) { loc.q16horz = fix16_clamp(loc.q16horz + input.q16horz, F16(-MAXHORIZVEL), F16(MAXHORIZVEL)); - if (!synchronized_input) + if (!cl_syncinput) p->q16horiz += input.q16horz; // will be clamped by the caller because further operations on q16horiz can follow. } } @@ -1241,7 +1241,7 @@ void GetInput() processVehicleInput(p, info, input, scaleAdjust); FinalizeInput(myconnectindex, input, true); - if (!synchronized_input) + if (!cl_syncinput) { p->q16horiz = clamp(p->q16horiz, F16(HORIZ_MIN), F16(HORIZ_MAX)); if (sprite[p->i].extra > 0) @@ -1257,7 +1257,7 @@ void GetInput() processInputBits(p, info); FinalizeInput(myconnectindex, input, false); - if (!synchronized_input) + if (!cl_syncinput) { // Do these in the same order as the old code. applylook(myconnectindex, scaleAdjust); diff --git a/source/games/duke/src/player.cpp b/source/games/duke/src/player.cpp index 31d32042c..1074506b1 100644 --- a/source/games/duke/src/player.cpp +++ b/source/games/duke/src/player.cpp @@ -405,7 +405,7 @@ void dokneeattack(int snum, int pi, const std::initializer_list & respawnli if (p->knee_incs > 0) { p->knee_incs++; - if (synchronized_input) + if (cl_syncinput) p->addhoriz(-48); else { @@ -881,7 +881,7 @@ void checklook(int snum, int sb_snum) } p->oq16ang = p->q16ang; - if (synchronized_input) + if (cl_syncinput) applylook(snum, 1); } diff --git a/source/games/duke/src/player_d.cpp b/source/games/duke/src/player_d.cpp index fa48172e0..e5cda012b 100644 --- a/source/games/duke/src/player_d.cpp +++ b/source/games/duke/src/player_d.cpp @@ -2596,7 +2596,7 @@ void processinput_d(int snum) pi = p->i; s = &sprite[pi]; - if (!synchronized_input) + if (!cl_syncinput) { p->horizAngleAdjust = 0; p->horizSkew = 0; @@ -2637,7 +2637,7 @@ void processinput_d(int snum) hittype[pi].floorz = fz; hittype[pi].ceilingz = cz; - if (synchronized_input) + if (cl_syncinput) { p->oq16horiz = p->q16horiz; p->oq16horizoff = p->q16horizoff; @@ -2796,7 +2796,7 @@ void processinput_d(int snum) } else if (sb_avel) //p->ang += syncangvel * constant { //ENGINE calculates angvel for you - if (synchronized_input) + if (cl_syncinput) { // may still be needed later for demo recording int tempang; @@ -3017,7 +3017,7 @@ HORIZONLY: fi.activatebysector(psect, pi); } - if (!synchronized_input) + if (!cl_syncinput) { if (p->return_to_center > 0) p->return_to_center--; @@ -3051,7 +3051,7 @@ HORIZONLY: p->hard_landing--; } - if (synchronized_input) + if (cl_syncinput) { p->q16horiz += (sync[snum].q16horz >> 1); sethorizon(snum, sb_snum, 1); diff --git a/source/games/duke/src/player_r.cpp b/source/games/duke/src/player_r.cpp index 80409b05d..41505d45c 100644 --- a/source/games/duke/src/player_r.cpp +++ b/source/games/duke/src/player_r.cpp @@ -3472,7 +3472,7 @@ void processinput_r(int snum) hittype[pi].floorz = fz; hittype[pi].ceilingz = cz; - if (synchronized_input) + if (cl_syncinput) { p->oq16horiz = p->q16horiz; p->oq16horizoff = p->q16horizoff; @@ -3704,7 +3704,7 @@ void processinput_r(int snum) } else if (sb_avel) //p->ang += syncangvel * constant { //ENGINE calculates angvel for you - if (synchronized_input) + if (cl_syncinput) { // may still be needed later for demo recording int tempang; @@ -4041,7 +4041,7 @@ HORIZONLY: return; } - if (!synchronized_input && p->return_to_center > 0) + if (!cl_syncinput && p->return_to_center > 0) p->return_to_center--; if (sb_snum & SKB_CENTER_VIEW || p->hard_landing) @@ -4078,7 +4078,7 @@ HORIZONLY: p->hard_landing--; } - if (synchronized_input) + if (cl_syncinput) { p->q16horiz += (sync[snum].q16horz >> 1); sethorizon(snum, sb_snum, 1); diff --git a/source/games/duke/src/render.cpp b/source/games/duke/src/render.cpp index 71c10cbaa..ee21e510c 100644 --- a/source/games/duke/src/render.cpp +++ b/source/games/duke/src/render.cpp @@ -536,7 +536,7 @@ void displayrooms(int snum, int smoothratio) setdrugmode(p, i); } - if (!synchronized_input) + if (!cl_syncinput) renderSetRollAngle(p->q16rotscrnang / (float)(FRACUNIT)); else { @@ -549,7 +549,7 @@ void displayrooms(int snum, int smoothratio) cposx = omyx + mulscale16((int)(myx - omyx), smoothratio); cposy = omyy + mulscale16((int)(myy - omyy), smoothratio); cposz = omyz + mulscale16((int)(myz - omyz), smoothratio); - if (synchronized_input) + if (cl_syncinput) { cang.interpolate(q16ang(oq16myang), q16ang(q16myang), smoothratio); fix16_t osum = (oq16myhoriz + oq16myhorizoff); @@ -568,7 +568,7 @@ void displayrooms(int snum, int smoothratio) cposx = p->oposx + mulscale16((int)(p->posx - p->oposx), smoothratio); cposy = p->oposy + mulscale16((int)(p->posy - p->oposy), smoothratio); cposz = p->oposz + mulscale16((int)(p->posz - p->oposz), smoothratio); - if (synchronized_input /*|| smoothcamera*/) + if (cl_syncinput /*|| smoothcamera*/) { // Original code for when the values are passed through the sync struct cang.interpolate(q16ang(p->oq16ang), q16ang(p->q16ang), smoothratio);