mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2026-01-08 07:52:50 +00:00
Merge branch 'debug-time-attack' into 'master'
Time Attack debug tools See merge request KartKrew/Kart!2118
This commit is contained in:
commit
05007085f5
2 changed files with 90 additions and 1 deletions
|
|
@ -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] <tics>: 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
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue