diff --git a/src/screen.h b/src/screen.h index bfb9e7fbf..8a8bda376 100644 --- a/src/screen.h +++ b/src/screen.h @@ -194,6 +194,9 @@ extern UINT8 *scr_borderpatch; // patch used to fill the view borders extern consvar_t cv_scr_width, cv_scr_height, cv_scr_depth, cv_renderview, cv_renderer, cv_fullscreen; // wait for page flipping to end or not extern consvar_t cv_vidwait; +#ifdef DEVELOP +extern consvar_t cv_timescale; +#endif // Initialize the screen void SCR_Startup(void); diff --git a/src/sdl/i_system.c b/src/sdl/i_system.c index db1f099cd..8d04a8783 100644 --- a/src/sdl/i_system.c +++ b/src/sdl/i_system.c @@ -2147,6 +2147,16 @@ static double tic_frequency; static Uint64 tic_epoch; static double elapsed_tics; +#ifdef DEVELOP // Tied behind DEVELOP, until sv_cheats is made better +static void UpdateTicFreq(void) +{ + tic_frequency = (timer_frequency / (double)NEWTICRATE) / FIXED_TO_FLOAT(cv_timescale.value); +} + +static CV_PossibleValue_t timescale_cons_t[] = {{FRACUNIT/20, "MIN"}, {20*FRACUNIT, "MAX"}, {0, NULL}}; +consvar_t cv_timescale = CVAR_INIT ("timescale", "1.0", CV_NETVAR|CV_CHEAT|CV_FLOAT|CV_CALL, timescale_cons_t, UpdateTicFreq); +#endif + static void UpdateElapsedTics(void) { const Uint64 now = SDL_GetPerformanceCounter(); @@ -2251,6 +2261,10 @@ double I_GetFrameTime(void) // void I_StartupTimer(void) { +#ifdef DEVELOP + CV_RegisterVar(&cv_timescale); +#endif + timer_frequency = SDL_GetPerformanceFrequency(); tic_epoch = SDL_GetPerformanceCounter();