mirror of
https://git.do.srb2.org/KartKrew/Kart-Public.git
synced 2025-01-27 19:50:51 +00:00
* Re-add support for command "help" (ie, basically no help at all).
* Rename "suicide" command to "respawn" so the game doesn't tell you to kill yourself when you try to get help for it. * Add a "manual" command to open the manual.
This commit is contained in:
parent
8d4ce113e4
commit
bb251c4fbf
4 changed files with 68 additions and 51 deletions
|
@ -676,7 +676,7 @@ static void COM_Help_f(void)
|
||||||
cvar = CV_FindVar(help);
|
cvar = CV_FindVar(help);
|
||||||
if (cvar)
|
if (cvar)
|
||||||
{
|
{
|
||||||
CONS_Printf(M_GetText("Variable %s:\n"), cvar->name);
|
CONS_Printf("\x82""Variable %s:\n", cvar->name);
|
||||||
CONS_Printf(M_GetText(" flags :"));
|
CONS_Printf(M_GetText(" flags :"));
|
||||||
if (cvar->flags & CV_SAVE)
|
if (cvar->flags & CV_SAVE)
|
||||||
CONS_Printf("AUTOSAVE ");
|
CONS_Printf("AUTOSAVE ");
|
||||||
|
@ -691,59 +691,68 @@ static void COM_Help_f(void)
|
||||||
CONS_Printf("\n");
|
CONS_Printf("\n");
|
||||||
if (cvar->PossibleValue)
|
if (cvar->PossibleValue)
|
||||||
{
|
{
|
||||||
if (stricmp(cvar->PossibleValue[0].strvalue, "MIN") == 0)
|
if (!stricmp(cvar->PossibleValue[0].strvalue, "MIN") && !stricmp(cvar->PossibleValue[1].strvalue, "MAX"))
|
||||||
{
|
{
|
||||||
for (i = 1; cvar->PossibleValue[i].strvalue != NULL; i++)
|
CONS_Printf(" range from %d to %d\n", cvar->PossibleValue[0].value,
|
||||||
if (!stricmp(cvar->PossibleValue[i].strvalue, "MAX"))
|
cvar->PossibleValue[1].value);
|
||||||
break;
|
i = 2;
|
||||||
CONS_Printf(M_GetText(" range from %d to %d\n"), cvar->PossibleValue[0].value,
|
|
||||||
cvar->PossibleValue[i].value);
|
|
||||||
CONS_Printf(M_GetText(" Current value: %d\n"), cvar->value);
|
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
{
|
||||||
const char *cvalue = NULL;
|
const char *cvalue = NULL;
|
||||||
CONS_Printf(M_GetText(" possible value : %s\n"), cvar->name);
|
//CONS_Printf(M_GetText(" possible value : %s\n"), cvar->name);
|
||||||
while (cvar->PossibleValue[i].strvalue)
|
while (cvar->PossibleValue[i].strvalue)
|
||||||
{
|
{
|
||||||
CONS_Printf(" %-2d : %s\n", cvar->PossibleValue[i].value,
|
CONS_Printf(" %-2d : %s\n", cvar->PossibleValue[i].value,
|
||||||
cvar->PossibleValue[i].strvalue);
|
cvar->PossibleValue[i].strvalue);
|
||||||
if (cvar->PossibleValue[i].value == cvar->value)
|
if (cvar->PossibleValue[i].value == cvar->value)
|
||||||
cvalue = cvar->PossibleValue[i].strvalue;
|
cvalue = cvar->PossibleValue[i].strvalue;
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
if (cvalue)
|
if (cvalue)
|
||||||
CONS_Printf(M_GetText(" Current value: %s\n"), cvalue);
|
CONS_Printf(" Current value: %s\n", cvalue);
|
||||||
else
|
else
|
||||||
CONS_Printf(M_GetText(" Current value: %d\n"), cvar->value);
|
CONS_Printf(" Current value: %d\n", cvar->value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
CONS_Printf(M_GetText(" Current value: %d\n"), cvar->value);
|
CONS_Printf(" Current value: %d\n", cvar->value);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
CONS_Printf("\x87%s", M_GetText("No exact match, searching...\n"));
|
|
||||||
//CONS_Printf(M_GetText("No help for this command/variable\n"));
|
|
||||||
// commands
|
|
||||||
CONS_Printf("\x82%s", M_GetText("Commands:\n"));
|
|
||||||
for (cmd = com_commands; cmd; cmd = cmd->next)
|
for (cmd = com_commands; cmd; cmd = cmd->next)
|
||||||
{
|
{
|
||||||
if (strstr(cmd->name, help))
|
if (strcmp(cmd->name, help))
|
||||||
CONS_Printf("%s ",cmd->name);
|
continue;
|
||||||
|
|
||||||
|
CONS_Printf("\x82""Command %s:\n", cmd->name);
|
||||||
|
CONS_Printf(" help is not available for commands");
|
||||||
|
CONS_Printf("\x82""\nCheck wiki.srb2.org for more or try typing <name> without arguments\n");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
CONS_Printf("No exact match, searching...\n");
|
||||||
|
// commands
|
||||||
|
CONS_Printf("\x82""Commands:\n");
|
||||||
|
for (cmd = com_commands; cmd; cmd = cmd->next)
|
||||||
|
{
|
||||||
|
if (!strstr(cmd->name, help))
|
||||||
|
continue;
|
||||||
|
CONS_Printf("%s ",cmd->name);
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
|
|
||||||
// variables
|
// variables
|
||||||
CONS_Printf("\n\x82%s", M_GetText("Variables:\n"));
|
CONS_Printf("\x82""\nVariables:\n");
|
||||||
for (cvar = consvar_vars; cvar; cvar = cvar->next)
|
for (cvar = consvar_vars; cvar; cvar = cvar->next)
|
||||||
{
|
{
|
||||||
if (!(cvar->flags & CV_NOSHOWHELP) && (strstr(cvar->name, help)))
|
if ((cvar->flags & CV_NOSHOWHELP) || (!strstr(cvar->name, help)))
|
||||||
CONS_Printf("%s ", cvar->name);
|
continue;
|
||||||
|
CONS_Printf("%s ", cvar->name);
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
|
|
||||||
CONS_Printf("\n\x87%s", M_GetText("Check wiki.srb2.org for more or type help <command or variable>\n"));
|
CONS_Printf("\x82""\nCheck wiki.srb2.org for more or type help <command or variable>\n");
|
||||||
|
|
||||||
CONS_Debug(DBG_GAMELOGIC, "\x87Total : %d\n", i);
|
CONS_Debug(DBG_GAMELOGIC, "\x87Total : %d\n", i);
|
||||||
}
|
}
|
||||||
|
@ -752,7 +761,7 @@ static void COM_Help_f(void)
|
||||||
|
|
||||||
{
|
{
|
||||||
// commands
|
// commands
|
||||||
CONS_Printf("\x82%s", M_GetText("Commands:\n"));
|
CONS_Printf("\x82""Commands:\n");
|
||||||
for (cmd = com_commands; cmd; cmd = cmd->next)
|
for (cmd = com_commands; cmd; cmd = cmd->next)
|
||||||
{
|
{
|
||||||
CONS_Printf("%s ",cmd->name);
|
CONS_Printf("%s ",cmd->name);
|
||||||
|
@ -760,17 +769,18 @@ static void COM_Help_f(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
// variables
|
// variables
|
||||||
CONS_Printf("\n\x82%s", M_GetText("Variables:\n"));
|
CONS_Printf("\x82""\nVariables:\n");
|
||||||
for (cvar = consvar_vars; cvar; cvar = cvar->next)
|
for (cvar = consvar_vars; cvar; cvar = cvar->next)
|
||||||
{
|
{
|
||||||
if (!(cvar->flags & CV_NOSHOWHELP))
|
if (cvar->flags & CV_NOSHOWHELP)
|
||||||
CONS_Printf("%s ", cvar->name);
|
continue;
|
||||||
|
CONS_Printf("%s ", cvar->name);
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
|
|
||||||
CONS_Printf("\n\x87%s", M_GetText("Check wiki.srb2.org for more or type help <command or variable>\n"));
|
CONS_Printf("\x82""\nCheck wiki.srb2.org for more or type help <command or variable>\n");
|
||||||
|
|
||||||
CONS_Debug(DBG_GAMELOGIC, "\x87Total : %d\n", i);
|
CONS_Debug(DBG_GAMELOGIC, "\x82Total : %d\n", i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -72,7 +72,7 @@ static void Got_Delfilecmd(UINT8 **cp, INT32 playernum);
|
||||||
#endif
|
#endif
|
||||||
static void Got_Addfilecmd(UINT8 **cp, INT32 playernum);
|
static void Got_Addfilecmd(UINT8 **cp, INT32 playernum);
|
||||||
static void Got_Pause(UINT8 **cp, INT32 playernum);
|
static void Got_Pause(UINT8 **cp, INT32 playernum);
|
||||||
static void Got_Suicide(UINT8 **cp, INT32 playernum);
|
static void Got_Respawn(UINT8 **cp, INT32 playernum);
|
||||||
static void Got_RandomSeed(UINT8 **cp, INT32 playernum);
|
static void Got_RandomSeed(UINT8 **cp, INT32 playernum);
|
||||||
static void Got_RunSOCcmd(UINT8 **cp, INT32 playernum);
|
static void Got_RunSOCcmd(UINT8 **cp, INT32 playernum);
|
||||||
static void Got_Teamchange(UINT8 **cp, INT32 playernum);
|
static void Got_Teamchange(UINT8 **cp, INT32 playernum);
|
||||||
|
@ -136,7 +136,7 @@ static void Command_Delfile(void);
|
||||||
#endif
|
#endif
|
||||||
static void Command_RunSOC(void);
|
static void Command_RunSOC(void);
|
||||||
static void Command_Pause(void);
|
static void Command_Pause(void);
|
||||||
static void Command_Suicide(void);
|
static void Command_Respawn(void);
|
||||||
|
|
||||||
static void Command_Version_f(void);
|
static void Command_Version_f(void);
|
||||||
#ifdef UPDATE_ALERT
|
#ifdef UPDATE_ALERT
|
||||||
|
@ -479,7 +479,7 @@ const char *netxcmdnames[MAXNETXCMD - 1] =
|
||||||
"REQADDFILE",
|
"REQADDFILE",
|
||||||
"DELFILE",
|
"DELFILE",
|
||||||
"SETMOTD",
|
"SETMOTD",
|
||||||
"SUICIDE",
|
"RESPAWN",
|
||||||
"DEMOTED",
|
"DEMOTED",
|
||||||
"SETUPVOTE",
|
"SETUPVOTE",
|
||||||
"MODIFYVOTE",
|
"MODIFYVOTE",
|
||||||
|
@ -511,7 +511,7 @@ void D_RegisterServerCommands(void)
|
||||||
RegisterNetXCmd(XD_DELFILE, Got_Delfilecmd);
|
RegisterNetXCmd(XD_DELFILE, Got_Delfilecmd);
|
||||||
#endif
|
#endif
|
||||||
RegisterNetXCmd(XD_PAUSE, Got_Pause);
|
RegisterNetXCmd(XD_PAUSE, Got_Pause);
|
||||||
RegisterNetXCmd(XD_SUICIDE, Got_Suicide);
|
RegisterNetXCmd(XD_RESPAWN, Got_Respawn);
|
||||||
RegisterNetXCmd(XD_RUNSOC, Got_RunSOCcmd);
|
RegisterNetXCmd(XD_RUNSOC, Got_RunSOCcmd);
|
||||||
#ifdef HAVE_BLUA
|
#ifdef HAVE_BLUA
|
||||||
RegisterNetXCmd(XD_LUACMD, Got_Luacmd);
|
RegisterNetXCmd(XD_LUACMD, Got_Luacmd);
|
||||||
|
@ -554,7 +554,7 @@ void D_RegisterServerCommands(void)
|
||||||
#endif
|
#endif
|
||||||
COM_AddCommand("runsoc", Command_RunSOC);
|
COM_AddCommand("runsoc", Command_RunSOC);
|
||||||
COM_AddCommand("pause", Command_Pause);
|
COM_AddCommand("pause", Command_Pause);
|
||||||
COM_AddCommand("suicide", Command_Suicide);
|
COM_AddCommand("respawn", Command_Respawn);
|
||||||
|
|
||||||
COM_AddCommand("gametype", Command_ShowGametype_f);
|
COM_AddCommand("gametype", Command_ShowGametype_f);
|
||||||
COM_AddCommand("version", Command_Version_f);
|
COM_AddCommand("version", Command_Version_f);
|
||||||
|
@ -2466,7 +2466,7 @@ static void Got_Pause(UINT8 **cp, INT32 playernum)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Command for stuck characters in netgames, griefing, etc.
|
// Command for stuck characters in netgames, griefing, etc.
|
||||||
static void Command_Suicide(void)
|
static void Command_Respawn(void)
|
||||||
{
|
{
|
||||||
XBOXSTATIC UINT8 buf[4];
|
XBOXSTATIC UINT8 buf[4];
|
||||||
UINT8 *cp = buf;
|
UINT8 *cp = buf;
|
||||||
|
@ -2479,7 +2479,7 @@ static void Command_Suicide(void)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*if (!G_RaceGametype()) // srb2kart: not necessary, suiciding makes you lose a bumper in battle, so it's not desirable to use as a way to escape a hit
|
/*if (!G_RaceGametype()) // srb2kart: not necessary, respawning makes you lose a bumper in battle, so it's not desirable to use as a way to escape a hit
|
||||||
{
|
{
|
||||||
CONS_Printf(M_GetText("You may only use this in co-op, race, and competition!\n"));
|
CONS_Printf(M_GetText("You may only use this in co-op, race, and competition!\n"));
|
||||||
return;
|
return;
|
||||||
|
@ -2493,17 +2493,17 @@ static void Command_Suicide(void)
|
||||||
return;
|
return;
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
SendNetXCmd(XD_SUICIDE, &buf, 4);
|
SendNetXCmd(XD_RESPAWN, &buf, 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void Got_Suicide(UINT8 **cp, INT32 playernum)
|
static void Got_Respawn(UINT8 **cp, INT32 playernum)
|
||||||
{
|
{
|
||||||
INT32 suicideplayer = READINT32(*cp);
|
INT32 respawnplayer = READINT32(*cp);
|
||||||
|
|
||||||
// You can't suicide someone else. Nice try, there.
|
// You can't respawn someone else. Nice try, there.
|
||||||
if (suicideplayer != playernum) // srb2kart: "|| (!G_RaceGametype())"
|
if (respawnplayer != playernum) // srb2kart: "|| (!G_RaceGametype())"
|
||||||
{
|
{
|
||||||
CONS_Alert(CONS_WARNING, M_GetText("Illegal suicide command received from %s\n"), player_names[playernum]);
|
CONS_Alert(CONS_WARNING, M_GetText("Illegal respawn command received from %s\n"), player_names[playernum]);
|
||||||
if (server)
|
if (server)
|
||||||
{
|
{
|
||||||
XBOXSTATIC UINT8 buf[2];
|
XBOXSTATIC UINT8 buf[2];
|
||||||
|
@ -2515,8 +2515,8 @@ static void Got_Suicide(UINT8 **cp, INT32 playernum)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (players[suicideplayer].mo)
|
if (players[respawnplayer].mo)
|
||||||
P_DamageMobj(players[suicideplayer].mo, NULL, NULL, 10000);
|
P_DamageMobj(players[respawnplayer].mo, NULL, NULL, 10000);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Deals with an ::XD_RANDOMSEED message in a netgame.
|
/** Deals with an ::XD_RANDOMSEED message in a netgame.
|
||||||
|
|
|
@ -190,7 +190,7 @@ typedef enum
|
||||||
XD_REQADDFILE, // 17
|
XD_REQADDFILE, // 17
|
||||||
XD_DELFILE, // 18
|
XD_DELFILE, // 18
|
||||||
XD_SETMOTD, // 19
|
XD_SETMOTD, // 19
|
||||||
XD_SUICIDE, // 20
|
XD_RESPAWN, // 20
|
||||||
XD_DEMOTED, // 21
|
XD_DEMOTED, // 21
|
||||||
XD_SETUPVOTE, // 22
|
XD_SETUPVOTE, // 22
|
||||||
XD_MODIFYVOTE, // 23
|
XD_MODIFYVOTE, // 23
|
||||||
|
|
17
src/m_menu.c
17
src/m_menu.c
|
@ -2373,6 +2373,15 @@ static void M_PrevOpt(void)
|
||||||
// (in other words -- stop bullshit happening by mashing buttons in fades)
|
// (in other words -- stop bullshit happening by mashing buttons in fades)
|
||||||
static boolean noFurtherInput = false;
|
static boolean noFurtherInput = false;
|
||||||
|
|
||||||
|
static void Command_Manual_f(void)
|
||||||
|
{
|
||||||
|
if (modeattacking)
|
||||||
|
return;
|
||||||
|
M_StartControlPanel();
|
||||||
|
M_Manual(INT32_MAX);
|
||||||
|
itemOn = 0;
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// M_Responder
|
// M_Responder
|
||||||
//
|
//
|
||||||
|
@ -2500,11 +2509,7 @@ boolean M_Responder(event_t *ev)
|
||||||
switch (ch)
|
switch (ch)
|
||||||
{
|
{
|
||||||
case KEY_F1: // Help key
|
case KEY_F1: // Help key
|
||||||
if (modeattacking)
|
Command_Manual_f();
|
||||||
return true;
|
|
||||||
M_StartControlPanel();
|
|
||||||
M_Manual(INT32_MAX);
|
|
||||||
itemOn = 0;
|
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
case KEY_F2: // Empty
|
case KEY_F2: // Empty
|
||||||
|
@ -3093,6 +3098,8 @@ void M_Ticker(void)
|
||||||
//
|
//
|
||||||
void M_Init(void)
|
void M_Init(void)
|
||||||
{
|
{
|
||||||
|
COM_AddCommand("manual", Command_Manual_f);
|
||||||
|
|
||||||
CV_RegisterVar(&cv_nextmap);
|
CV_RegisterVar(&cv_nextmap);
|
||||||
CV_RegisterVar(&cv_newgametype);
|
CV_RegisterVar(&cv_newgametype);
|
||||||
CV_RegisterVar(&cv_chooseskin);
|
CV_RegisterVar(&cv_chooseskin);
|
||||||
|
|
Loading…
Reference in a new issue