- Duke: Tidy up some of the pitch stuff.

* Remove some extern'd CVARs that didn't need externing.
* Change `player_struct::centeringView()` bool into proper method to handle the operation.
* Operation now properly unsets `SB_CENTERVIEW` if conditions aren't met instead of relying on implied behaviour from the rest of the playsim.
This commit is contained in:
Mitchell Richters 2023-03-26 13:34:58 +11:00
parent a5a9882d9a
commit 0da2afe3d7
4 changed files with 18 additions and 19 deletions

View file

@ -43,11 +43,7 @@ EXTERN_CVAR(Bool, cl_bloodweapinterp)
EXTERN_CVAR(Bool, cl_bloodoldweapbalance) EXTERN_CVAR(Bool, cl_bloodoldweapbalance)
EXTERN_CVAR(Bool, cl_loadingscreens) EXTERN_CVAR(Bool, cl_loadingscreens)
EXTERN_CVAR(Bool, cl_clampedpitch) EXTERN_CVAR(Bool, cl_clampedpitch)
EXTERN_CVAR(Int, cl_dukepitchmode) EXTERN_CVAR(Int, cl_dukepitchmode)
EXTERN_CVAR(Flag, cl_dukepitchlockreturn)
EXTERN_CVAR(Flag, cl_dukepitchnohardlanding)
EXTERN_CVAR(Flag, cl_dukepitchnolandingcenter)
EXTERN_CVAR(Bool, demorec_seeds_cvar) EXTERN_CVAR(Bool, demorec_seeds_cvar)
EXTERN_CVAR(Bool, demoplay_diffs) EXTERN_CVAR(Bool, demoplay_diffs)

View file

@ -2730,11 +2730,7 @@ void processinput_d(int snum)
checklook(snum,actions); checklook(snum,actions);
p->Angles.doViewYaw(&p->sync); p->Angles.doViewYaw(&p->sync);
if (p->centeringView()) p->updatecentering(snum);
{
p->sync.horz = 0;
setForcedSyncInput(snum);
}
if (p->on_crane != nullptr) if (p->on_crane != nullptr)
{ {

View file

@ -3318,11 +3318,7 @@ void processinput_r(int snum)
p->Angles.doViewYaw(&p->sync); p->Angles.doViewYaw(&p->sync);
p->apply_seasick(); p->apply_seasick();
if (p->centeringView()) p->updatecentering(snum);
{
p->sync.horz = 0;
setForcedSyncInput(snum);
}
if (p->on_crane != nullptr) if (p->on_crane != nullptr)
{ {

View file

@ -345,12 +345,23 @@ struct player_struct
bobpos = GetActor()->spr.pos.XY(); bobpos = GetActor()->spr.pos.XY();
} }
bool centeringView() void updatecentering(const int snum)
{ {
const bool centering = sync.actions & SB_CENTERVIEW; if (!(sync.actions & SB_CENTERVIEW))
const bool lockedret = cl_dukepitchmode & kDukePitchLockReturn; return;
const bool rangetest = abs(GetActor()->spr.Angles.Pitch.Degrees()) > 2.2370;
return centering && lockedret && rangetest; const bool returnlock = cl_dukepitchmode & kDukePitchLockReturn;
const bool centertest = abs(GetActor()->spr.Angles.Pitch.Degrees()) > 2.2370;
if ((centertest && returnlock) || !sync.horz)
{
setForcedSyncInput(snum);
sync.horz = 0;
}
else
{
sync.actions &= ~SB_CENTERVIEW;
}
} }
}; };