diff --git a/src/d_main.c b/src/d_main.c index 6912ec988..7a8ae5f0f 100644 --- a/src/d_main.c +++ b/src/d_main.c @@ -841,17 +841,12 @@ void D_SRB2Loop(void) tictime = entertime; } + dbg_entertime = entertime; + dbg_prevtime = prevtime; + dbg_tictime = tictime; + if (!(paused || P_AutoPause())) { -#if 0 - CONS_Printf("prevtime = %f\n", prevtime); - CONS_Printf("entertime = %f\n", entertime); - CONS_Printf("tictime = %f\n", tictime); - CONS_Printf("entertime - prevtime = %f\n", entertime - prevtime); - CONS_Printf("entertime - tictime = %f\n", entertime - tictime); - CONS_Printf("========\n"); -#endif - if (entertime - prevtime >= 1.0f) { // Lagged for more frames than a gametic... diff --git a/src/r_fps.c b/src/r_fps.c index 45f301551..6307d83a1 100644 --- a/src/r_fps.c +++ b/src/r_fps.c @@ -40,6 +40,8 @@ static CV_PossibleValue_t fpscap_cons_t[] = { }; consvar_t cv_fpscap = CVAR_INIT ("fpscap", "Match refresh rate", CV_SAVE, fpscap_cons_t, NULL); +consvar_t cv_interpdebug = CVAR_INIT ("interpdebug", "Off", 0, CV_OnOff, NULL); + UINT32 R_GetFramerateCap(void) { if (rendermode == render_none) diff --git a/src/r_fps.h b/src/r_fps.h index 32c9131fe..4a0750c3a 100644 --- a/src/r_fps.h +++ b/src/r_fps.h @@ -20,6 +20,7 @@ #include "r_state.h" extern consvar_t cv_fpscap; +extern consvar_t cv_interpdebug; UINT32 R_GetFramerateCap(void); boolean R_UsingFrameInterpolation(void); diff --git a/src/r_main.c b/src/r_main.c index 896b6a29b..a3bddf44f 100644 --- a/src/r_main.c +++ b/src/r_main.c @@ -1625,4 +1625,5 @@ void R_RegisterEngineStuff(void) // Frame interpolation/uncapped CV_RegisterVar(&cv_fpscap); + CV_RegisterVar(&cv_interpdebug); } diff --git a/src/st_stuff.c b/src/st_stuff.c index 6c9a0eeca..535c68ee8 100644 --- a/src/st_stuff.c +++ b/src/st_stuff.c @@ -45,6 +45,8 @@ #include "lua_hud.h" #include "lua_hook.h" +#include "r_fps.h" + UINT16 objectsdrawn = 0; // @@ -621,6 +623,24 @@ static void ST_drawDebugInfo(void) #undef VFLAGS } +float dbg_entertime = 0.0f, dbg_prevtime = 0.0f, dbg_tictime = 0.0f; +static void ST_DrawInterpDebug(void) +{ + // TODO: when the devmode situation stops sucking eggs, + // remove cv_interpdebug and use DBG_RENDER instead. + if (!cv_interpdebug.value || !R_UsingFrameInterpolation()) + { + return; + } + + V_DrawRightAlignedString(312, 8, V_MONOSPACE, va("enter - tic: %.3f", dbg_entertime - dbg_tictime)); + V_DrawRightAlignedString(312, 16, V_MONOSPACE, va("enter - prev: %.3f", dbg_entertime - dbg_prevtime)); + + V_DrawRightAlignedString(312, 24, V_MONOSPACE, va("tic: %.3f", dbg_tictime)); + V_DrawRightAlignedString(312, 32, V_MONOSPACE, va("prev: %.3f", dbg_prevtime)); + V_DrawRightAlignedString(312, 40, V_MONOSPACE, va("enter: %.3f", dbg_entertime)); +} + static void ST_drawScore(void) { if (F_GetPromptHideHud(hudinfo[HUD_SCORE].y)) @@ -2755,6 +2775,8 @@ static void ST_overlayDrawer(void) ST_drawInput(); ST_drawDebugInfo(); + + ST_DrawInterpDebug(); } void ST_Drawer(void) diff --git a/src/st_stuff.h b/src/st_stuff.h index c59bc2ac6..0956bbb7d 100644 --- a/src/st_stuff.h +++ b/src/st_stuff.h @@ -55,6 +55,8 @@ void ST_preDrawTitleCard(void); void ST_preLevelTitleCardDrawer(void); void ST_drawWipeTitleCard(void); +extern float dbg_entertime, dbg_prevtime, dbg_tictime; + extern tic_t lt_ticker, lt_lasttic; extern tic_t lt_exitticker, lt_endtime;