mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-10 14:51:40 +00:00
Fixes for SCALEDNOLERP
No longer relies on last input fraction to determine offset on frame (now uses TicFrac). No longer modifies Actor angle in real-time. Fixed offsetting breaking when other viewports are being renderer.
This commit is contained in:
parent
d848a57bac
commit
e4ea5ad307
4 changed files with 30 additions and 58 deletions
|
@ -458,8 +458,7 @@ public:
|
||||||
bool Resurrect();
|
bool Resurrect();
|
||||||
|
|
||||||
// Scaled angle adjustment info. Not for direct manipulation.
|
// Scaled angle adjustment info. Not for direct manipulation.
|
||||||
DRotator angleTargets;
|
DRotator angleOffsetTargets;
|
||||||
DRotator angleAppliedAmounts;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// Bookkeeping on players - state.
|
// Bookkeeping on players - state.
|
||||||
|
|
|
@ -3495,22 +3495,16 @@ void AActor::SetPitch(DAngle p, int fflags)
|
||||||
{
|
{
|
||||||
if (player != nullptr)
|
if (player != nullptr)
|
||||||
{
|
{
|
||||||
const bool mustLerp = !P_NoInterpolation(player, this);
|
if (fflags & SPF_SCALEDNOLERP)
|
||||||
|
|
||||||
if ((fflags & SPF_INTERPOLATE) || ((fflags & SPF_SCALEDNOLERP) && mustLerp))
|
|
||||||
{
|
{
|
||||||
Angles.Pitch = p;
|
player->angleOffsetTargets.Pitch = deltaangle(Angles.Pitch, p);
|
||||||
player->cheats |= CF_INTERPVIEW;
|
|
||||||
}
|
|
||||||
else if ((fflags & SPF_SCALEDNOLERP) && !mustLerp)
|
|
||||||
{
|
|
||||||
player->angleTargets.Pitch = deltaangle(Angles.Pitch, p);
|
|
||||||
player->angleAppliedAmounts.Pitch = nullAngle;
|
|
||||||
player->cheats |= CF_SCALEDNOLERP;
|
player->cheats |= CF_SCALEDNOLERP;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Angles.Pitch = p;
|
Angles.Pitch = p;
|
||||||
|
if (fflags & SPF_INTERPOLATE)
|
||||||
|
player->cheats |= CF_INTERPVIEW;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -3527,22 +3521,16 @@ void AActor::SetAngle(DAngle ang, int fflags)
|
||||||
{
|
{
|
||||||
if (player != nullptr)
|
if (player != nullptr)
|
||||||
{
|
{
|
||||||
const bool mustLerp = !P_NoInterpolation(player, this);
|
if (fflags & SPF_SCALEDNOLERP)
|
||||||
|
|
||||||
if ((fflags & SPF_INTERPOLATE) || ((fflags & SPF_SCALEDNOLERP) && mustLerp))
|
|
||||||
{
|
{
|
||||||
Angles.Yaw = ang;
|
player->angleOffsetTargets.Yaw = deltaangle(Angles.Yaw, ang);
|
||||||
player->cheats |= CF_INTERPVIEW;
|
|
||||||
}
|
|
||||||
else if ((fflags & SPF_SCALEDNOLERP) && !mustLerp)
|
|
||||||
{
|
|
||||||
player->angleTargets.Yaw = deltaangle(Angles.Yaw, ang);
|
|
||||||
player->angleAppliedAmounts.Yaw = nullAngle;
|
|
||||||
player->cheats |= CF_SCALEDNOLERP;
|
player->cheats |= CF_SCALEDNOLERP;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Angles.Yaw = ang;
|
Angles.Yaw = ang;
|
||||||
|
if (fflags & SPF_INTERPOLATE)
|
||||||
|
player->cheats |= CF_INTERPVIEW;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -3559,22 +3547,16 @@ void AActor::SetRoll(DAngle r, int fflags)
|
||||||
{
|
{
|
||||||
if (player != nullptr)
|
if (player != nullptr)
|
||||||
{
|
{
|
||||||
const bool mustLerp = !P_NoInterpolation(player, this);
|
if (fflags & SPF_SCALEDNOLERP)
|
||||||
|
|
||||||
if ((fflags & SPF_INTERPOLATE) || ((fflags & SPF_SCALEDNOLERP) && mustLerp))
|
|
||||||
{
|
{
|
||||||
Angles.Roll = r;
|
player->angleOffsetTargets.Roll = deltaangle(Angles.Roll, r);
|
||||||
player->cheats |= CF_INTERPVIEW;
|
|
||||||
}
|
|
||||||
else if ((fflags & SPF_SCALEDNOLERP) && !mustLerp)
|
|
||||||
{
|
|
||||||
player->angleTargets.Roll = deltaangle(Angles.Roll, r);
|
|
||||||
player->angleAppliedAmounts.Roll = nullAngle;
|
|
||||||
player->cheats |= CF_SCALEDNOLERP;
|
player->cheats |= CF_SCALEDNOLERP;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Angles.Roll = r;
|
Angles.Roll = r;
|
||||||
|
if (fflags & SPF_INTERPOLATE)
|
||||||
|
player->cheats |= CF_INTERPVIEW;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
@ -1239,6 +1239,17 @@ void P_PlayerThink (player_t *player)
|
||||||
I_Error ("No player %td start\n", player - players + 1);
|
I_Error ("No player %td start\n", player - players + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (unsigned int i = 0u; i < 3u; ++i)
|
||||||
|
{
|
||||||
|
if (fabs(player->angleOffsetTargets[i].Degrees()) >= EQUAL_EPSILON)
|
||||||
|
{
|
||||||
|
player->mo->Angles[i] += player->angleOffsetTargets[i];
|
||||||
|
player->mo->PrevAngles[i] = player->mo->Angles[i];
|
||||||
|
}
|
||||||
|
|
||||||
|
player->angleOffsetTargets[i] = nullAngle;
|
||||||
|
}
|
||||||
|
|
||||||
if (player->SubtitleCounter > 0)
|
if (player->SubtitleCounter > 0)
|
||||||
{
|
{
|
||||||
player->SubtitleCounter--;
|
player->SubtitleCounter--;
|
||||||
|
|
|
@ -783,26 +783,12 @@ static double QuakePower(double factor, double intensity, double offset)
|
||||||
//
|
//
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
|
|
||||||
static void R_DoActorTickerAngleChanges(player_t* const player, AActor* const actor, const double scale)
|
static void R_DoActorTickerAngleChanges(player_t* const player, DRotator& angles, const double scale)
|
||||||
{
|
{
|
||||||
for (unsigned i = 0; i < 3; i++)
|
for (unsigned i = 0; i < 3; i++)
|
||||||
{
|
{
|
||||||
if (player->angleTargets[i].Sgn())
|
if (fabs(player->angleOffsetTargets[i].Degrees()) >= EQUAL_EPSILON)
|
||||||
{
|
angles[i] += player->angleOffsetTargets[i] * scale;
|
||||||
// Calculate scaled amount of target and add to the accumlation buffer.
|
|
||||||
DAngle addition = player->angleTargets[i] * scale;
|
|
||||||
player->angleAppliedAmounts[i] += addition;
|
|
||||||
|
|
||||||
// Test whether we're now reached/exceeded our target.
|
|
||||||
if (abs(player->angleAppliedAmounts[i]) >= abs(player->angleTargets[i]))
|
|
||||||
{
|
|
||||||
addition -= player->angleAppliedAmounts[i] - player->angleTargets[i];
|
|
||||||
player->angleTargets[i] = player->angleAppliedAmounts[i] = nullAngle;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Apply the scaled addition to the angle.
|
|
||||||
actor->Angles[i] += addition;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -843,15 +829,6 @@ 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();
|
|
||||||
|
|
||||||
// [MR] Process player angle changes if permitted to do so.
|
|
||||||
if (player && (player->cheats & CF_SCALEDNOLERP) && P_NoInterpolation(player, viewpoint.camera))
|
|
||||||
{
|
|
||||||
R_DoActorTickerAngleChanges(player, viewpoint.camera, scaleAdjust);
|
|
||||||
}
|
|
||||||
|
|
||||||
iview = FindPastViewer (viewpoint.camera);
|
iview = FindPastViewer (viewpoint.camera);
|
||||||
|
|
||||||
int nowtic = I_GetTime ();
|
int nowtic = I_GetTime ();
|
||||||
|
@ -972,6 +949,9 @@ void R_SetupFrame (FRenderViewpoint &viewpoint, FViewWindow &viewwindow, AActor
|
||||||
// [MR] Apply view angles as the viewpoint angles if asked to do so.
|
// [MR] Apply view angles as the viewpoint angles if asked to do so.
|
||||||
iview->New.Angles = !(viewpoint.camera->flags8 & MF8_ABSVIEWANGLES) ? viewpoint.camera->Angles : viewpoint.camera->ViewAngles;
|
iview->New.Angles = !(viewpoint.camera->flags8 & MF8_ABSVIEWANGLES) ? viewpoint.camera->Angles : viewpoint.camera->ViewAngles;
|
||||||
iview->New.ViewAngles = viewpoint.camera->ViewAngles;
|
iview->New.ViewAngles = viewpoint.camera->ViewAngles;
|
||||||
|
// [MR] Process player angle changes if permitted to do so.
|
||||||
|
if (player && (player->cheats & CF_SCALEDNOLERP) && P_NoInterpolation(player, viewpoint.camera))
|
||||||
|
R_DoActorTickerAngleChanges(player, iview->New.Angles, viewpoint.TicFrac);
|
||||||
|
|
||||||
if (viewpoint.camera->player != 0)
|
if (viewpoint.camera->player != 0)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue