- Make the new scaled angle changes at frame rate opt-in behind new flag SPF_SCALEDNOLERP.

* This will still test whether the game needs to lerp and will force `SPF_INTERPOLATE` if needed.
This commit is contained in:
Mitchell Richters 2022-12-02 22:24:21 +11:00 committed by Christoph Oelckers
parent cf1ac82da3
commit 6629944d39
6 changed files with 57 additions and 37 deletions

View file

@ -122,7 +122,8 @@ typedef enum
CF_TOTALLYFROZEN = 1 << 12, // [RH] All players can do is press +use CF_TOTALLYFROZEN = 1 << 12, // [RH] All players can do is press +use
CF_PREDICTING = 1 << 13, // [RH] Player movement is being predicted CF_PREDICTING = 1 << 13, // [RH] Player movement is being predicted
CF_INTERPVIEW = 1 << 14, // [RH] view was changed outside of input, so interpolate one frame CF_INTERPVIEW = 1 << 14, // [RH] view was changed outside of input, so interpolate one frame
CF_INTERPVIEWANGLES = 1 << 15, // [RH] flag for interpolating view angles without interpolating the entire frame CF_INTERPVIEWANGLES = 1 << 15, // [MR] flag for interpolating view angles without interpolating the entire frame
CF_SCALEDNOLERP = 1 << 15, // [MR] flag for applying angles changes in the ticrate without interpolating the frame
CF_EXTREMELYDEAD = 1 << 22, // [RH] Reliably let the status bar know about extreme deaths. CF_EXTREMELYDEAD = 1 << 22, // [RH] Reliably let the status bar know about extreme deaths.
CF_BUDDHA2 = 1 << 24, // [MC] Absolute buddha. No voodoo can kill it either. CF_BUDDHA2 = 1 << 24, // [MC] Absolute buddha. No voodoo can kill it either.
CF_GODMODE2 = 1 << 25, // [MC] Absolute godmode. No voodoo can kill it either. CF_GODMODE2 = 1 << 25, // [MC] Absolute godmode. No voodoo can kill it either.

View file

@ -218,6 +218,7 @@ enum SPF
{ {
SPF_FORCECLAMP = 1, // players always clamp SPF_FORCECLAMP = 1, // players always clamp
SPF_INTERPOLATE = 2, SPF_INTERPOLATE = 2,
SPF_SCALEDNOLERP = 4,
}; };
enum PCM enum PCM

View file

@ -3429,18 +3429,22 @@ void AActor::SetPitch(DAngle p, int fflags)
{ {
if (player != nullptr) if (player != nullptr)
{ {
if (fflags & SPF_INTERPOLATE) const bool mustLerp = !P_NoInterpolation(player, this);
if ((fflags & SPF_INTERPOLATE) || ((fflags & SPF_SCALEDNOLERP) && mustLerp))
{ {
if (P_NoInterpolation(player, this)) Angles.Pitch = p;
{ player->cheats |= CF_INTERPVIEW;
player->angleTargets.Pitch = deltaangle(Angles.Pitch, p); }
player->angleAppliedAmounts.Pitch = nullAngle; else if ((fflags & SPF_SCALEDNOLERP) && !mustLerp)
} {
else player->angleTargets.Pitch = deltaangle(Angles.Pitch, p);
{ player->angleAppliedAmounts.Pitch = nullAngle;
Angles.Pitch = p; player->cheats |= CF_SCALEDNOLERP;
player->cheats |= CF_INTERPVIEW; }
} else
{
Angles.Pitch = p;
} }
} }
else else
@ -3457,18 +3461,22 @@ void AActor::SetAngle(DAngle ang, int fflags)
{ {
if (player != nullptr) if (player != nullptr)
{ {
if (fflags & SPF_INTERPOLATE) const bool mustLerp = !P_NoInterpolation(player, this);
if ((fflags & SPF_INTERPOLATE) || ((fflags & SPF_SCALEDNOLERP) && mustLerp))
{ {
if (P_NoInterpolation(player, this)) Angles.Yaw = ang;
{ player->cheats |= CF_INTERPVIEW;
player->angleTargets.Yaw = deltaangle(Angles.Yaw, ang); }
player->angleAppliedAmounts.Yaw = nullAngle; else if ((fflags & SPF_SCALEDNOLERP) && !mustLerp)
} {
else player->angleTargets.Yaw = deltaangle(Angles.Yaw, ang);
{ player->angleAppliedAmounts.Yaw = nullAngle;
Angles.Yaw = ang; player->cheats |= CF_SCALEDNOLERP;
player->cheats |= CF_INTERPVIEW; }
} else
{
Angles.Yaw = ang;
} }
} }
else else
@ -3485,18 +3493,22 @@ void AActor::SetRoll(DAngle r, int fflags)
{ {
if (player != nullptr) if (player != nullptr)
{ {
if (fflags & SPF_INTERPOLATE) const bool mustLerp = !P_NoInterpolation(player, this);
if ((fflags & SPF_INTERPOLATE) || ((fflags & SPF_SCALEDNOLERP) && mustLerp))
{ {
if (P_NoInterpolation(player, this)) Angles.Roll = r;
{ player->cheats |= CF_INTERPVIEW;
player->angleTargets.Roll = deltaangle(Angles.Roll, r); }
player->angleAppliedAmounts.Roll = nullAngle; else if ((fflags & SPF_SCALEDNOLERP) && !mustLerp)
} {
else player->angleTargets.Roll = deltaangle(Angles.Roll, r);
{ player->angleAppliedAmounts.Roll = nullAngle;
Angles.Roll = r; player->cheats |= CF_SCALEDNOLERP;
player->cheats |= CF_INTERPVIEW; }
} else
{
Angles.Roll = r;
} }
} }
else else

View file

@ -1259,6 +1259,7 @@ void P_PlayerThink (player_t *player)
// Don't interpolate the view for more than one tic // Don't interpolate the view for more than one tic
player->cheats &= ~CF_INTERPVIEW; player->cheats &= ~CF_INTERPVIEW;
player->cheats &= ~CF_INTERPVIEWANGLES; player->cheats &= ~CF_INTERPVIEWANGLES;
player->cheats &= ~CF_SCALEDNOLERP;
player->mo->FloatVar("prevBob") = player->bob; player->mo->FloatVar("prevBob") = player->bob;
IFVIRTUALPTRNAME(player->mo, NAME_PlayerPawn, PlayerThink) IFVIRTUALPTRNAME(player->mo, NAME_PlayerPawn, PlayerThink)

View file

@ -828,10 +828,13 @@ void R_SetupFrame (FRenderViewpoint &viewpoint, FViewWindow &viewwindow, AActor
I_Error ("You lost your body. Bad dehacked work is likely to blame."); I_Error ("You lost your body. Bad dehacked work is likely to blame.");
} }
// [MR] Get the input fraction, even if we don't need it this frame. Must run every frame.
const auto scaleAdjust = I_GetInputFrac(false);
// [MR] Process player angle changes if permitted to do so. // [MR] Process player angle changes if permitted to do so.
if (player && P_NoInterpolation(player, viewpoint.camera)) if (player && (player->cheats & CF_SCALEDNOLERP) && P_NoInterpolation(player, viewpoint.camera))
{ {
R_DoActorTickerAngleChanges(player, viewpoint.camera, I_GetInputFrac(false)); R_DoActorTickerAngleChanges(player, viewpoint.camera, scaleAdjust);
} }
iview = FindPastViewer (viewpoint.camera); iview = FindPastViewer (viewpoint.camera);

View file

@ -524,6 +524,7 @@ enum EAngleFlags
{ {
SPF_FORCECLAMP = 1, SPF_FORCECLAMP = 1,
SPF_INTERPOLATE = 2, SPF_INTERPOLATE = 2,
SPF_SCALEDNOLERP = 4,
}; };
// flags for A_CheckLOF // flags for A_CheckLOF
@ -1137,7 +1138,8 @@ enum EPlayerCheats
CF_TOTALLYFROZEN = 1 << 12, // [RH] All players can do is press +use CF_TOTALLYFROZEN = 1 << 12, // [RH] All players can do is press +use
CF_PREDICTING = 1 << 13, // [RH] Player movement is being predicted CF_PREDICTING = 1 << 13, // [RH] Player movement is being predicted
CF_INTERPVIEW = 1 << 14, // [RH] view was changed outside of input, so interpolate one frame CF_INTERPVIEW = 1 << 14, // [RH] view was changed outside of input, so interpolate one frame
CF_INTERPVIEWANGLES = 1 << 15, // [RH] flag for interpolating view angles without interpolating the entire frame CF_INTERPVIEWANGLES = 1 << 15, // [MR] flag for interpolating view angles without interpolating the entire frame
CF_SCALEDNOLERP = 1 << 15, // [MR] flag for applying angles changes in the ticrate without interpolating the frame
CF_EXTREMELYDEAD = 1 << 22, // [RH] Reliably let the status bar know about extreme deaths. CF_EXTREMELYDEAD = 1 << 22, // [RH] Reliably let the status bar know about extreme deaths.