diff --git a/src/hardware/hw_main.c b/src/hardware/hw_main.c index 79d9e5085..68a0f7338 100644 --- a/src/hardware/hw_main.c +++ b/src/hardware/hw_main.c @@ -4102,8 +4102,10 @@ static void HWR_RotateSpritePolyToAim(gr_vissprite_t *spr, FOutVector *wallVerts interpmobjstate_t interp = {0}; float basey, lowy; + INT32 dist = R_QuickCamDist(spr->mobj->x, spr->mobj->y); + // do interpolation - if (R_UsingFrameInterpolation() && !paused) + if (R_UsingFrameInterpolation() && !paused && (!cv_grmaxinterpdist.value || dist < cv_grmaxinterpdist.value)) { if (precip) { @@ -5315,7 +5317,9 @@ void HWR_ProjectSprite(mobj_t *thing) if (!thing) return; - if (R_UsingFrameInterpolation() && !paused) + INT32 dist = R_QuickCamDist(thing->x, thing->y); + + if (R_UsingFrameInterpolation() && !paused && (!cv_grmaxinterpdist.value || dist < cv_grmaxinterpdist.value)) { R_InterpolateMobjState(thing, rendertimefrac, &interp); } @@ -5655,12 +5659,14 @@ void HWR_ProjectPrecipitationSprite(precipmobj_t *thing) if (!thing) return; - + + INT32 dist = R_QuickCamDist(thing->x, thing->y); + // uncapped/interpolation interpmobjstate_t interp = {0}; // do interpolation - if (R_UsingFrameInterpolation() && !paused) + if (R_UsingFrameInterpolation() && !paused && (!cv_grmaxinterpdist.value || dist < cv_grmaxinterpdist.value)) { R_InterpolatePrecipMobjState(thing, rendertimefrac, &interp); } diff --git a/src/hardware/hw_md2.c b/src/hardware/hw_md2.c index c64d77639..fd6cf4f16 100644 --- a/src/hardware/hw_md2.c +++ b/src/hardware/hw_md2.c @@ -1157,7 +1157,7 @@ void HWR_DrawMD2(gr_vissprite_t *spr) angle_t ang; interpmobjstate_t interp; - if (R_UsingFrameInterpolation() && !paused) + if (R_UsingFrameInterpolation() && !paused && (!cv_grmaxinterpdist.value || R_QuickCamDist(spr->mobj->x, spr->mobj->y) < cv_grmaxinterpdist.value)) { R_InterpolateMobjState(spr->mobj, rendertimefrac, &interp); } diff --git a/src/r_main.c b/src/r_main.c index 44c388ec8..274ea079a 100644 --- a/src/r_main.c +++ b/src/r_main.c @@ -153,6 +153,12 @@ static CV_PossibleValue_t drawdist_precip_cons_t[] = { {3072, "3072"}, {0, "None"}, {0, NULL}}; +static CV_PossibleValue_t maxinterpdist_cons_t[] = { + /*{256, "256"},*/ {512, "512"}, {768, "768"}, + {1024, "1024"}, {1536, "1536"}, {2048, "2048"}, + {3072, "3072"}, {4096, "4096"}, {6144, "6144"}, + {8192, "8192"}, {0, "Infinite"}, {0, NULL}}; + static CV_PossibleValue_t fov_cons_t[] = {{5*FRACUNIT, "MIN"}, {178*FRACUNIT, "MAX"}, {0, NULL}}; //static CV_PossibleValue_t precipdensity_cons_t[] = {{0, "None"}, {1, "Light"}, {2, "Moderate"}, {4, "Heavy"}, {6, "Thick"}, {8, "V.Thick"}, {0, NULL}}; @@ -201,6 +207,8 @@ consvar_t cv_drawdist_precip = {"drawdist_precip", "1024", CV_SAVE, drawdist_pre consvar_t cv_lessprecip = {"lessweathereffects", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; //consvar_t cv_precipdensity = {"precipdensity", "Moderate", CV_SAVE, precipdensity_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; +consvar_t cv_grmaxinterpdist = {"gr_maxinterpdist", "Infinite", 0, maxinterpdist_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; + // cap fov, fov too high tears software apart. consvar_t cv_fov = {"fov", "90", CV_FLOAT|CV_CALL|CV_SAVE, fov_cons_t, Fov_OnChange, 0, NULL, NULL, 0, 0, NULL}; @@ -1885,6 +1893,8 @@ void R_RegisterEngineStuff(void) CV_RegisterVar(&cv_maxportals); + CV_RegisterVar(&cv_grmaxinterpdist); + // Default viewheight is changeable, // initialized to standard viewheight //CV_RegisterVar(&cv_viewheight); diff --git a/src/r_main.h b/src/r_main.h index dadb1c9cf..f057db234 100644 --- a/src/r_main.h +++ b/src/r_main.h @@ -117,6 +117,7 @@ extern consvar_t /*cv_precipdensity,*/ cv_drawdist, /*cv_drawdist_nights,*/ cv_d extern consvar_t cv_fov; extern consvar_t cv_skybox; extern consvar_t cv_tailspickup; +extern consvar_t cv_grmaxinterpdist; // Called by startup code. void R_Init(void); diff --git a/src/r_things.c b/src/r_things.c index 6cc11b49f..1e9a116cc 100644 --- a/src/r_things.c +++ b/src/r_things.c @@ -1357,7 +1357,7 @@ static void R_ProjectSprite(mobj_t *thing) interpmobjstate_t interp = {0}; // do interpolation - if (R_UsingFrameInterpolation() && !paused) + if (R_UsingFrameInterpolation() && !paused && (!cv_grmaxinterpdist.value || R_QuickCamDist(thing->x, thing->y) < cv_grmaxinterpdist.value)) { R_InterpolateMobjState(oldthing, rendertimefrac, &interp); } @@ -1881,7 +1881,7 @@ static void R_ProjectPrecipitationSprite(precipmobj_t *thing) interpmobjstate_t interp = {0}; // do interpolation - if (R_UsingFrameInterpolation() && !paused) + if (R_UsingFrameInterpolation() && !paused && (!cv_grmaxinterpdist.value || R_QuickCamDist(thing->x, thing->y) < cv_grmaxinterpdist.value)) { R_InterpolatePrecipMobjState(thing, rendertimefrac, &interp); } diff --git a/src/r_things.h b/src/r_things.h index 823bad9a8..e6470a952 100644 --- a/src/r_things.h +++ b/src/r_things.h @@ -32,6 +32,12 @@ #define FEETADJUST (4<>FRACBITS) - (viewx>>FRACBITS)), abs(((y)>>FRACBITS) - (viewy>>FRACBITS))) + // Constant arrays used for psprite clipping // and initializing clipping. extern INT16 negonearray[MAXVIDWIDTH];