mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-25 21:41:03 +00:00
- Make view angles interpolate on a separate flag to the one that forces interpolation for the entire frame.
* As view angles are an offset, there's no reason why these cannot lerp separately.
This commit is contained in:
parent
6594ec0750
commit
9f9c1eb18a
6 changed files with 19 additions and 13 deletions
|
@ -923,6 +923,8 @@ public:
|
|||
void SetPitch(DAngle p, int fflags);
|
||||
void SetAngle(DAngle ang, int fflags);
|
||||
void SetRoll(DAngle roll, int fflags);
|
||||
|
||||
// These also set CF_INTERPVIEWANGLES for players.
|
||||
void SetViewPitch(DAngle p, int fflags);
|
||||
void SetViewAngle(DAngle ang, int fflags);
|
||||
void SetViewRoll(DAngle roll, int fflags);
|
||||
|
|
|
@ -122,6 +122,7 @@ typedef enum
|
|||
CF_TOTALLYFROZEN = 1 << 12, // [RH] All players can do is press +use
|
||||
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_INTERPVIEWANGLES = 1 << 15, // [RH] flag for interpolating view angles without interpolating the entire frame
|
||||
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_GODMODE2 = 1 << 25, // [MC] Absolute godmode. No voodoo can kill it either.
|
||||
|
|
|
@ -3473,7 +3473,7 @@ void AActor::SetViewPitch(DAngle p, int fflags)
|
|||
ViewAngles.Pitch = p;
|
||||
if (player != nullptr && (fflags & SPF_INTERPOLATE))
|
||||
{
|
||||
player->cheats |= CF_INTERPVIEW;
|
||||
player->cheats |= CF_INTERPVIEWANGLES;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3486,7 +3486,7 @@ void AActor::SetViewAngle(DAngle ang, int fflags)
|
|||
ViewAngles.Yaw = ang;
|
||||
if (player != nullptr && (fflags & SPF_INTERPOLATE))
|
||||
{
|
||||
player->cheats |= CF_INTERPVIEW;
|
||||
player->cheats |= CF_INTERPVIEWANGLES;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3499,7 +3499,7 @@ void AActor::SetViewRoll(DAngle r, int fflags)
|
|||
ViewAngles.Roll = r;
|
||||
if (player != nullptr && (fflags & SPF_INTERPOLATE))
|
||||
{
|
||||
player->cheats |= CF_INTERPVIEW;
|
||||
player->cheats |= CF_INTERPVIEWANGLES;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1258,6 +1258,7 @@ void P_PlayerThink (player_t *player)
|
|||
player->original_cmd = cmd->ucmd;
|
||||
// Don't interpolate the view for more than one tic
|
||||
player->cheats &= ~CF_INTERPVIEW;
|
||||
player->cheats &= ~CF_INTERPVIEWANGLES;
|
||||
player->mo->FloatVar("prevBob") = player->bob;
|
||||
|
||||
IFVIRTUALPTRNAME(player->mo, NAME_PlayerPawn, PlayerThink)
|
||||
|
|
|
@ -80,6 +80,7 @@ struct InterpolationViewer
|
|||
{
|
||||
DVector3 Pos;
|
||||
DRotator Angles;
|
||||
DRotator ViewAngles;
|
||||
};
|
||||
|
||||
AActor *ViewActor;
|
||||
|
@ -540,6 +541,12 @@ void R_InterpolateView (FRenderViewpoint &viewpoint, player_t *player, double Fr
|
|||
viewpoint.Angles.Roll = (iview->Old.Angles.Roll + deltaangle(iview->Old.Angles.Roll, iview->New.Angles.Roll) * Frac).Normalized180();
|
||||
}
|
||||
|
||||
// [MR] Apply the view angles as an offset if ABSVIEWANGLES isn't specified.
|
||||
if (!(viewpoint.camera->flags8 & MF8_ABSVIEWANGLES))
|
||||
{
|
||||
viewpoint.Angles += (!player || (player->cheats & CF_INTERPVIEWANGLES)) ? interpolatedvalue(iview->Old.ViewAngles, iview->New.ViewAngles, Frac) : iview->New.ViewAngles;
|
||||
}
|
||||
|
||||
// Due to interpolation this is not necessarily the same as the sector the camera is in.
|
||||
viewpoint.sector = Level->PointInRenderSubsector(viewpoint.Pos)->sector;
|
||||
bool moved = false;
|
||||
|
@ -898,16 +905,10 @@ void R_SetupFrame (FRenderViewpoint &viewpoint, FViewWindow &viewwindow, AActor
|
|||
}
|
||||
}
|
||||
|
||||
// [MC] Apply the view angles first, which is the offsets. If the absolute isn't desired,
|
||||
// add the standard angles on top of it.
|
||||
viewpoint.Angles = viewpoint.camera->ViewAngles;
|
||||
// [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.ViewAngles = viewpoint.camera->ViewAngles;
|
||||
|
||||
if (!(viewpoint.camera->flags8 & MF8_ABSVIEWANGLES))
|
||||
{
|
||||
viewpoint.Angles += viewpoint.camera->Angles;
|
||||
}
|
||||
|
||||
iview->New.Angles = viewpoint.Angles;
|
||||
if (viewpoint.camera->player != 0)
|
||||
{
|
||||
player = viewpoint.camera->player;
|
||||
|
|
|
@ -1137,6 +1137,7 @@ enum EPlayerCheats
|
|||
CF_TOTALLYFROZEN = 1 << 12, // [RH] All players can do is press +use
|
||||
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_INTERPVIEWANGLES = 1 << 15, // [RH] flag for interpolating view angles without interpolating the entire frame
|
||||
|
||||
CF_EXTREMELYDEAD = 1 << 22, // [RH] Reliably let the status bar know about extreme deaths.
|
||||
|
||||
|
|
Loading…
Reference in a new issue