- do not call renderer code directly to reset the view interpolation

The playsim really has no idea what the renderer is supposed to do here and the current system has some serious issues that eventually need addressing. So it is better to just set a flag that an actor needs to have its view interpolation reset if being used as a camera and let the render code deal with it.

This will keep the playsim clean of future changes to this feature.
This commit is contained in:
Christoph Oelckers 2019-02-01 01:37:09 +01:00
parent 5278274acf
commit de24fc2c88
6 changed files with 12 additions and 19 deletions

View File

@ -452,6 +452,7 @@ enum ActorRenderFlag
RF_SPRITEFLIP = 0x08000000, // sprite flipped on x-axis
RF_ZDOOMTRANS = 0x10000000, // is not normally transparent in Vanilla Doom
RF_NOINTERPOLATEVIEW = 0x40000000, // don't interpolate the view next frame if this actor is a camera.
};
// This translucency value produces the closest match to Heretic's TINTTAB.

View File

@ -1423,7 +1423,7 @@ void FParser::SF_SetCamera(void)
if (t_argc < 4) newcamera->Angles.Pitch = 0.;
else newcamera->Angles.Pitch = clamp(floatvalue(t_argv[3]), -50., 50.) * (20. / 32.);
player->camera=newcamera;
R_ResetViewInterpolation();
newcamera->renderflags |= RF_NOINTERPOLATEVIEW;
}
}

View File

@ -562,10 +562,7 @@ bool FLevelLocals::EV_SilentLineTeleport (line_t *line, int side, AActor *thing,
return false;
}
if (thing == players[consoleplayer].camera)
{
R_ResetViewInterpolation ();
}
thing->renderflags |= RF_NOINTERPOLATEVIEW;
// Rotate thing's orientation according to difference in linedef angles
thing->Angles.Yaw += angle;

View File

@ -508,10 +508,7 @@ bool P_TeleportMove(AActor* thing, const DVector3 &pos, bool telefrag, bool modi
thing->AdjustFloorClip();
}
if (thing == players[consoleplayer].camera)
{
R_ResetViewInterpolation();
}
thing->renderflags |= RF_NOINTERPOLATEVIEW;
// If this teleport was caused by a move, P_TryMove() will handle the
// sector transition messages better than we can here.
@ -6274,7 +6271,7 @@ int P_PushUp(AActor *thing, FChangePosition *cpos)
if (cpos->instant)
{
intersect->Prev.Z += intersect->Z() - oldz;
if (intersect->CheckLocalView()) R_ResetViewInterpolation();
intersect->renderflags |= RF_NOINTERPOLATEVIEW;
}
intersect->UpdateRenderSectorList();
@ -6371,7 +6368,7 @@ void PIT_FloorDrop(AActor *thing, FChangePosition *cpos)
if (cpos->instant)
{
thing->Prev.Z += thing->floorz - oldz;
if (thing->CheckLocalView()) R_ResetViewInterpolation();
thing->renderflags |= RF_NOINTERPOLATEVIEW;
}
thing->SetZ(thing->floorz);
P_CheckFakeFloorTriggers(thing, oldz);
@ -6385,7 +6382,7 @@ void PIT_FloorDrop(AActor *thing, FChangePosition *cpos)
if (cpos->instant)
{
thing->Prev.Z += -oldfloorz + thing->floorz;
if (thing->CheckLocalView()) R_ResetViewInterpolation();
thing->renderflags |= RF_NOINTERPOLATEVIEW;
}
thing->AddZ(-oldfloorz + thing->floorz);
P_CheckFakeFloorTriggers(thing, oldz);
@ -6425,7 +6422,7 @@ void PIT_FloorRaise(AActor *thing, FChangePosition *cpos)
if (cpos->instant)
{
thing->Prev.Z += thing->floorz - thing->Z();
if (thing->CheckLocalView()) R_ResetViewInterpolation();
thing->renderflags |= RF_NOINTERPOLATEVIEW;
}
thing->SetZ(thing->floorz);
@ -6439,7 +6436,7 @@ void PIT_FloorRaise(AActor *thing, FChangePosition *cpos)
if (cpos->instant)
{
thing->Prev.Z += -oldfloorz + thing->floorz;
if (thing->CheckLocalView()) R_ResetViewInterpolation();
thing->renderflags |= RF_NOINTERPOLATEVIEW;
}
}
else return;

View File

@ -131,10 +131,7 @@ bool P_MoveThing(AActor *source, const DVector3 &pos, bool fog)
P_SpawnTeleportFog(source, old, true, true);
}
source->ClearInterpolation();
if (source == players[consoleplayer].camera)
{
R_ResetViewInterpolation();
}
source->renderflags |= RF_NOINTERPOLATEVIEW;
return true;
}
else

View File

@ -815,8 +815,9 @@ void R_SetupFrame (FRenderViewpoint &viewpoint, FViewWindow &viewwindow, AActor
player = viewpoint.camera->player;
}
if (iview->otic == -1 || r_NoInterpolate)
if (iview->otic == -1 || r_NoInterpolate || (viewpoint.camera->renderflags & RF_NOINTERPOLATEVIEW))
{
viewpoint.camera->renderflags &= ~RF_NOINTERPOLATEVIEW;
R_ResetViewInterpolation ();
iview->otic = nowtic;
}