diff --git a/src/d_netcmd.c b/src/d_netcmd.c index 7585ac95c..f5d5fd5b8 100644 --- a/src/d_netcmd.c +++ b/src/d_netcmd.c @@ -193,6 +193,10 @@ static void Command_Eval(void); static void Command_WriteTextmap(void); +#ifdef DEVELOP +static void Command_FastForward(void); +#endif + // ========================================================================= // CLIENT VARIABLES // ========================================================================= @@ -462,6 +466,10 @@ void D_RegisterServerCommands(void) COM_AddCommand("dumplua", Command_Dumplua_f); #endif +#ifdef DEVELOP + COM_AddCommand("fastforward", Command_FastForward); +#endif + K_RegisterMidVoteCVars(); { @@ -6771,6 +6779,86 @@ ROUNDQUEUE_MAX CON_ToggleOff(); } +#ifdef DEVELOP +static void Command_FastForward(void) +{ + boolean r_flag = false; + boolean t_flag = false; + + size_t num_time_args = 0; + const char *time_arg = NULL; + + for (size_t i = 1; i < COM_Argc(); ++i) + { + const char *arg = COM_Argv(i); + if (arg[0] == '-') + { + while (*++arg) + { + switch (*arg) + { + case 'r': + r_flag = true; + break; + case 't': + t_flag = true; + break; + } + } + } + else + { + time_arg = arg; + num_time_args++; + } + } + + if (num_time_args != 1) + { + CONS_Printf( + "fastforward [-r] <[mm:]ss>: fast-forward the map time in seconds\n" + "fastforward -t [-r] : fast-forward the map time in tics\n" + "* If the map time has already passed, do nothing.\n" + "* With -r, fast-forward relative to the current time instead of to an exact map time.\n" + ); + return; + } + + char *p; + tic_t t = strtol(time_arg, &p, 10); + + if (!t_flag) + { + t *= TICRATE; + + if (*p == ':') + { + t *= 60; + t += strtol(&p[1], &p, 10) * TICRATE; + } + } + + if (*p) + { + CONS_Printf("fastforward: time value is malformed '%s'\n", time_arg); + return; + } + + if (!r_flag) + { + if (leveltime > t) + { + CONS_Printf("fastforward: leveltime has already passed\n"); + return; + } + + t -= leveltime; + } + + g_fast_forward = t; +} +#endif + /** Makes a change to ::cv_forceskin take effect immediately. * * \sa Command_SetForcedSkin_f, cv_forceskin, forcedskin diff --git a/src/k_hud.cpp b/src/k_hud.cpp index 30b3dd7a9..11e1fe08d 100644 --- a/src/k_hud.cpp +++ b/src/k_hud.cpp @@ -6229,7 +6229,7 @@ void K_drawKartHUD(void) if (modeattacking || freecam) // everything after here is MP and debug only { K_drawInput(); - return; + goto debug; } if ((gametyperules & GTR_KARMA) && !r_splitscreen && (stplyr->karthud[khud_yougotem] % 2)) // * YOU GOT EM * @@ -6286,6 +6286,7 @@ void K_drawKartHUD(void) } } +debug: K_DrawWaypointDebugger(); K_DrawBotDebugger(); K_DrawDirectorDebugger();