From de24fc2c888af15248180a5498a00f207e87f02a Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Fri, 1 Feb 2019 01:37:09 +0100 Subject: [PATCH] - 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. --- src/actor.h | 1 + src/fragglescript/t_func.cpp | 2 +- src/g_shared/p_teleport.cpp | 5 +---- src/p_map.cpp | 15 ++++++--------- src/p_things.cpp | 5 +---- src/r_utility.cpp | 3 ++- 6 files changed, 12 insertions(+), 19 deletions(-) diff --git a/src/actor.h b/src/actor.h index c82b5de754..6070c7b162 100644 --- a/src/actor.h +++ b/src/actor.h @@ -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. diff --git a/src/fragglescript/t_func.cpp b/src/fragglescript/t_func.cpp index c2843665b3..082f3115e3 100644 --- a/src/fragglescript/t_func.cpp +++ b/src/fragglescript/t_func.cpp @@ -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; } } diff --git a/src/g_shared/p_teleport.cpp b/src/g_shared/p_teleport.cpp index a426a4edd3..cf57431774 100644 --- a/src/g_shared/p_teleport.cpp +++ b/src/g_shared/p_teleport.cpp @@ -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; diff --git a/src/p_map.cpp b/src/p_map.cpp index ebdd824347..edcc6161ea 100644 --- a/src/p_map.cpp +++ b/src/p_map.cpp @@ -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; diff --git a/src/p_things.cpp b/src/p_things.cpp index 7f72ed19d7..9ef689e9cd 100644 --- a/src/p_things.cpp +++ b/src/p_things.cpp @@ -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 diff --git a/src/r_utility.cpp b/src/r_utility.cpp index 3d314d34cc..d779156178 100644 --- a/src/r_utility.cpp +++ b/src/r_utility.cpp @@ -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; }