From a34540f27fc121fc1ffeec309d7b7bc9cb530588 Mon Sep 17 00:00:00 2001 From: Alug Date: Sat, 19 Apr 2025 10:28:04 +0200 Subject: [PATCH] unnest timedemo stop stuff --- src/g_game.c | 37 ++++++++++++++++++++++++------------- 1 file changed, 24 insertions(+), 13 deletions(-) diff --git a/src/g_game.c b/src/g_game.c index 2b6cb07cf..bc6c162a5 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -8070,6 +8070,29 @@ void G_StopDemo(void) SV_ResetServer(); } +// Stops timing a demo. +static void G_StopTimingDemo(void) +{ + INT32 demotime; + double f1, f2; + demotime = I_GetTime() - demostarttime; + if (!demotime) + return; + G_StopDemo(); + demo.timing = false; + f1 = (double)demotime; + f2 = (double)framecount*TICRATE; + + CONS_Printf(M_GetText("timed %u gametics in %d realtics - %u frames\n%f seconds, %f avg fps\n"), + leveltime, demotime, (UINT32)framecount, f1/TICRATE, f2/f1); + + if (restorecv_vidwait != cv_vidwait.value) + CV_SetValue(&cv_vidwait, restorecv_vidwait); + + D_StartTitle(); +} + + boolean G_CheckDemoStatus(void) { while (ghosts) @@ -8084,19 +8107,7 @@ boolean G_CheckDemoStatus(void) if (demo.timing) { - INT32 demotime; - double f1, f2; - demotime = I_GetTime() - demostarttime; - if (!demotime) - return true; - G_StopDemo(); - demo.timing = false; - f1 = (double)demotime; - f2 = (double)framecount*TICRATE; - CONS_Printf(M_GetText("timed %u gametics in %d realtics\n%f seconds, %f avg fps\n"), leveltime,demotime,f1/TICRATE,f2/f1); - if (restorecv_vidwait != cv_vidwait.value) - CV_SetValue(&cv_vidwait, restorecv_vidwait); - D_StartTitle(); + G_StopTimingDemo(); return true; }