mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2025-10-30 08:01:28 +00:00
Merge branch 'improve-misc-game-testing' into 'master'
Improvements for testing/debugging See merge request KartKrew/Kart!1004
This commit is contained in:
commit
e65c2ba7a8
6 changed files with 50 additions and 5 deletions
|
|
@ -479,6 +479,7 @@ static void COM_TokenizeString(char *ptext)
|
|||
Z_Free(com_argv[i]);
|
||||
|
||||
com_argc = 0;
|
||||
Z_Free(com_args);
|
||||
com_args = NULL;
|
||||
com_flags = 0;
|
||||
|
||||
|
|
@ -502,7 +503,7 @@ static void COM_TokenizeString(char *ptext)
|
|||
break;
|
||||
|
||||
if (com_argc == 1)
|
||||
com_args = ptext;
|
||||
com_args = COM_Purge(Z_StrDup(ptext), NULL);
|
||||
|
||||
ptext = COM_Parse(ptext);
|
||||
if (ptext == NULL)
|
||||
|
|
|
|||
|
|
@ -226,6 +226,8 @@ static void Command_Schedule_List(void);
|
|||
|
||||
static void Command_Automate_Set(void);
|
||||
|
||||
static void Command_Eval(void);
|
||||
|
||||
// =========================================================================
|
||||
// CLIENT VARIABLES
|
||||
// =========================================================================
|
||||
|
|
@ -492,7 +494,7 @@ consvar_t cv_rollingdemos = CVAR_INIT ("rollingdemos", "On", CV_SAVE, CV_OnOff,
|
|||
|
||||
static CV_PossibleValue_t pointlimit_cons_t[] = {{1, "MIN"}, {MAXSCORE, "MAX"}, {0, "None"}, {-1, "Default"}, {0, NULL}};
|
||||
consvar_t cv_pointlimit = CVAR_INIT ("pointlimit", "Default", CV_NETVAR|CV_CALL|CV_NOINIT, pointlimit_cons_t, PointLimit_OnChange);
|
||||
static CV_PossibleValue_t timelimit_cons_t[] = {{1, "MIN"}, {30, "MAX"}, {0, "None"}, {-1, "Default"}, {0, NULL}};
|
||||
static CV_PossibleValue_t timelimit_cons_t[] = {{1, "MIN"}, {30*60, "MAX"}, {0, "None"}, {-1, "Default"}, {0, NULL}};
|
||||
consvar_t cv_timelimit = CVAR_INIT ("timelimit", "Default", CV_NETVAR|CV_CALL|CV_NOINIT, timelimit_cons_t, TimeLimit_OnChange);
|
||||
|
||||
static CV_PossibleValue_t numlaps_cons_t[] = {{1, "MIN"}, {MAX_LAPS, "MAX"}, {0, "Map default"}, {0, NULL}};
|
||||
|
|
@ -745,6 +747,8 @@ void D_RegisterServerCommands(void)
|
|||
|
||||
COM_AddCommand("automate_set", Command_Automate_Set);
|
||||
|
||||
COM_AddCommand("eval", Command_Eval);
|
||||
|
||||
// for master server connection
|
||||
AddMServCommands();
|
||||
|
||||
|
|
@ -1083,6 +1087,7 @@ void D_RegisterClientCommands(void)
|
|||
COM_AddCommand("god", Command_CheatGod_f);
|
||||
COM_AddCommand("setrings", Command_Setrings_f);
|
||||
COM_AddCommand("setlives", Command_Setlives_f);
|
||||
COM_AddCommand("setscore", Command_Setscore_f);
|
||||
COM_AddCommand("devmode", Command_Devmode_f);
|
||||
COM_AddCommand("savecheckpoint", Command_Savecheckpoint_f);
|
||||
COM_AddCommand("scale", Command_Scale_f);
|
||||
|
|
@ -2051,6 +2056,10 @@ void D_Cheat(INT32 playernum, INT32 cheat, ...)
|
|||
COPY(WRITESINT8, int);
|
||||
COPY(WRITEUINT8, unsigned int);
|
||||
break;
|
||||
|
||||
case CHEAT_SCORE:
|
||||
COPY(WRITEUINT32, UINT32);
|
||||
break;
|
||||
}
|
||||
|
||||
#undef COPY
|
||||
|
|
@ -5029,7 +5038,7 @@ static void TimeLimit_OnChange(void)
|
|||
break;
|
||||
|
||||
default:
|
||||
CONS_Printf(M_GetText("Time limit has been set to %d minute%s.\n"), cv_timelimit.value,cv_timelimit.value == 1 ? "" : "s");
|
||||
CONS_Printf(M_GetText("Time limit has been set to %d second%s.\n"), cv_timelimit.value,cv_timelimit.value == 1 ? "" : "s");
|
||||
}
|
||||
|
||||
timelimitintics = K_TimeLimitForGametype();
|
||||
|
|
@ -5051,7 +5060,7 @@ static void TimeLimit_OnChange(void)
|
|||
break;
|
||||
|
||||
default:
|
||||
CONS_Printf(M_GetText("Time limit will be %d minute%s next round.\n"), cv_timelimit.value,cv_timelimit.value == 1 ? "" : "s");
|
||||
CONS_Printf(M_GetText("Time limit will be %d second%s next round.\n"), cv_timelimit.value,cv_timelimit.value == 1 ? "" : "s");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -5739,6 +5748,15 @@ static void Got_Cheat(UINT8 **cp, INT32 playernum)
|
|||
break;
|
||||
}
|
||||
|
||||
case CHEAT_SCORE: {
|
||||
UINT32 score = READUINT32(*cp);
|
||||
|
||||
player->roundscore = score;
|
||||
|
||||
CV_CheaterWarning(targetPlayer, va("score = %u", score));
|
||||
break;
|
||||
}
|
||||
|
||||
case NUMBER_OF_CHEATS:
|
||||
break;
|
||||
}
|
||||
|
|
@ -6114,6 +6132,18 @@ static void Command_Automate_Set(void)
|
|||
SendNetXCmd(XD_AUTOMATE, buf, buf_p - buf);
|
||||
}
|
||||
|
||||
static void Command_Eval(void)
|
||||
{
|
||||
const char *args = COM_Args();
|
||||
|
||||
if (args)
|
||||
{
|
||||
const fixed_t n = LUA_EvalMath(args);
|
||||
|
||||
CONS_Printf("%f (%d)\n", FixedToFloat(n), n);
|
||||
}
|
||||
}
|
||||
|
||||
/** Makes a change to ::cv_forceskin take effect immediately.
|
||||
*
|
||||
* \sa Command_SetForcedSkin_f, cv_forceskin, forcedskin
|
||||
|
|
|
|||
|
|
@ -11347,7 +11347,7 @@ tic_t K_TimeLimitForGametype(void)
|
|||
|
||||
if (cv_timelimit.value != -1)
|
||||
{
|
||||
return cv_timelimit.value * (60*TICRATE);
|
||||
return cv_timelimit.value * TICRATE;
|
||||
}
|
||||
|
||||
// No time limit for Break the Capsules FREE PLAY
|
||||
|
|
|
|||
|
|
@ -699,6 +699,10 @@ fixed_t LUA_EvalMath(const char *word)
|
|||
lua_pushboolean(L, true);
|
||||
lua_call(L, 1, 0);
|
||||
|
||||
lua_pushcfunction(L, LUA_MathLib);
|
||||
lua_pushboolean(L, true);
|
||||
lua_call(L, 1, 0);
|
||||
|
||||
// change ^ into ^^ for Lua.
|
||||
strcpy(buf, "return ");
|
||||
b = buf+strlen(buf);
|
||||
|
|
|
|||
|
|
@ -763,6 +763,14 @@ void Command_Setlives_f(void)
|
|||
D_Cheat(consoleplayer, CHEAT_LIVES, atoi(COM_Argv(1)));
|
||||
}
|
||||
|
||||
void Command_Setscore_f(void)
|
||||
{
|
||||
REQUIRE_CHEATS;
|
||||
REQUIRE_INLEVEL;
|
||||
|
||||
D_Cheat(consoleplayer, CHEAT_SCORE, atoi(COM_Argv(1)));
|
||||
}
|
||||
|
||||
void Command_Grayscale_f(void)
|
||||
{
|
||||
REQUIRE_CHEATS;
|
||||
|
|
|
|||
|
|
@ -35,6 +35,7 @@ typedef enum {
|
|||
CHEAT_RELATIVE_TELEPORT,
|
||||
CHEAT_DEVMODE,
|
||||
CHEAT_GIVEITEM,
|
||||
CHEAT_SCORE,
|
||||
|
||||
NUMBER_OF_CHEATS
|
||||
} cheat_t;
|
||||
|
|
@ -71,6 +72,7 @@ void Command_CheatGod_f(void);
|
|||
void Command_Savecheckpoint_f(void);
|
||||
void Command_Setrings_f(void);
|
||||
void Command_Setlives_f(void);
|
||||
void Command_Setscore_f(void);
|
||||
void Command_Devmode_f(void);
|
||||
void Command_Scale_f(void);
|
||||
void Command_Gravflip_f(void);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue