Added FOV Interpolation

This commit is contained in:
Boondorl 2022-12-18 01:04:25 -05:00 committed by Christoph Oelckers
commit 0d4d5587b5
13 changed files with 54 additions and 5 deletions

View file

@ -407,6 +407,7 @@ void AActor::PostSerialize()
}
}
ClearInterpolation();
ClearFOVInterpolation();
UpdateWaterLevel(false);
}
@ -3552,6 +3553,28 @@ void AActor::SetViewAngle(DAngle ang, int fflags)
}
double AActor::GetFOV(double ticFrac)
{
// [B] Disable interpolation when playing online, otherwise it gets vomit inducing
if (netgame)
return player ? player->FOV : CameraFOV;
double fov;
if (player)
{
if (player->cheats & CF_NOFOVINTERP)
return player->FOV;
fov = player->FOV;
}
else
{
fov = CameraFOV;
}
return PrevFOV.Degrees() * (1 - ticFrac) + fov * ticFrac;
}
void AActor::SetViewRoll(DAngle r, int fflags)
{
if (r != ViewAngles.Roll)
@ -4566,6 +4589,7 @@ void ConstructActor(AActor *actor, const DVector3 &pos, bool SpawningMapThing)
// set subsector and/or block links
actor->LinkToWorld (nullptr, SpawningMapThing);
actor->ClearInterpolation();
actor->ClearFOVInterpolation();
actor->dropoffz = actor->floorz = actor->Sector->floorplane.ZatPoint(pos);
actor->ceilingz = actor->Sector->ceilingplane.ZatPoint(pos);