mirror of
https://git.do.srb2.org/KartKrew/Kart-Public.git
synced 2025-01-27 03:30:50 +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);
|
||||
if (cvar)
|
||||
{
|
||||
CONS_Printf(M_GetText("Variable %s:\n"), cvar->name);
|
||||
CONS_Printf("\x82""Variable %s:\n", cvar->name);
|
||||
CONS_Printf(M_GetText(" flags :"));
|
||||
if (cvar->flags & CV_SAVE)
|
||||
CONS_Printf("AUTOSAVE ");
|
||||
|
@ -691,59 +691,68 @@ static void COM_Help_f(void)
|
|||
CONS_Printf("\n");
|
||||
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++)
|
||||
if (!stricmp(cvar->PossibleValue[i].strvalue, "MAX"))
|
||||
break;
|
||||
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);
|
||||
CONS_Printf(" range from %d to %d\n", cvar->PossibleValue[0].value,
|
||||
cvar->PossibleValue[1].value);
|
||||
i = 2;
|
||||
}
|
||||
else
|
||||
|
||||
{
|
||||
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)
|
||||
{
|
||||
CONS_Printf(" %-2d : %s\n", cvar->PossibleValue[i].value,
|
||||
CONS_Printf(" %-2d : %s\n", cvar->PossibleValue[i].value,
|
||||
cvar->PossibleValue[i].strvalue);
|
||||
if (cvar->PossibleValue[i].value == cvar->value)
|
||||
cvalue = cvar->PossibleValue[i].strvalue;
|
||||
i++;
|
||||
}
|
||||
if (cvalue)
|
||||
CONS_Printf(M_GetText(" Current value: %s\n"), cvalue);
|
||||
CONS_Printf(" Current value: %s\n", cvalue);
|
||||
else
|
||||
CONS_Printf(M_GetText(" Current value: %d\n"), cvar->value);
|
||||
CONS_Printf(" Current value: %d\n", cvar->value);
|
||||
}
|
||||
}
|
||||
else
|
||||
CONS_Printf(M_GetText(" Current value: %d\n"), cvar->value);
|
||||
CONS_Printf(" Current value: %d\n", cvar->value);
|
||||
}
|
||||
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)
|
||||
{
|
||||
if (strstr(cmd->name, help))
|
||||
CONS_Printf("%s ",cmd->name);
|
||||
if (strcmp(cmd->name, help))
|
||||
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++;
|
||||
}
|
||||
|
||||
// variables
|
||||
CONS_Printf("\n\x82%s", M_GetText("Variables:\n"));
|
||||
CONS_Printf("\x82""\nVariables:\n");
|
||||
for (cvar = consvar_vars; cvar; cvar = cvar->next)
|
||||
{
|
||||
if (!(cvar->flags & CV_NOSHOWHELP) && (strstr(cvar->name, help)))
|
||||
CONS_Printf("%s ", cvar->name);
|
||||
if ((cvar->flags & CV_NOSHOWHELP) || (!strstr(cvar->name, help)))
|
||||
continue;
|
||||
CONS_Printf("%s ", cvar->name);
|
||||
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);
|
||||
}
|
||||
|
@ -752,7 +761,7 @@ static void COM_Help_f(void)
|
|||
|
||||
{
|
||||
// commands
|
||||
CONS_Printf("\x82%s", M_GetText("Commands:\n"));
|
||||
CONS_Printf("\x82""Commands:\n");
|
||||
for (cmd = com_commands; cmd; cmd = cmd->next)
|
||||
{
|
||||
CONS_Printf("%s ",cmd->name);
|
||||
|
@ -760,17 +769,18 @@ static void COM_Help_f(void)
|
|||
}
|
||||
|
||||
// variables
|
||||
CONS_Printf("\n\x82%s", M_GetText("Variables:\n"));
|
||||
CONS_Printf("\x82""\nVariables:\n");
|
||||
for (cvar = consvar_vars; cvar; cvar = cvar->next)
|
||||
{
|
||||
if (!(cvar->flags & CV_NOSHOWHELP))
|
||||
CONS_Printf("%s ", cvar->name);
|
||||
if (cvar->flags & CV_NOSHOWHELP)
|
||||
continue;
|
||||
CONS_Printf("%s ", cvar->name);
|
||||
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
|
||||
static void Got_Addfilecmd(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_RunSOCcmd(UINT8 **cp, INT32 playernum);
|
||||
static void Got_Teamchange(UINT8 **cp, INT32 playernum);
|
||||
|
@ -136,7 +136,7 @@ static void Command_Delfile(void);
|
|||
#endif
|
||||
static void Command_RunSOC(void);
|
||||
static void Command_Pause(void);
|
||||
static void Command_Suicide(void);
|
||||
static void Command_Respawn(void);
|
||||
|
||||
static void Command_Version_f(void);
|
||||
#ifdef UPDATE_ALERT
|
||||
|
@ -479,7 +479,7 @@ const char *netxcmdnames[MAXNETXCMD - 1] =
|
|||
"REQADDFILE",
|
||||
"DELFILE",
|
||||
"SETMOTD",
|
||||
"SUICIDE",
|
||||
"RESPAWN",
|
||||
"DEMOTED",
|
||||
"SETUPVOTE",
|
||||
"MODIFYVOTE",
|
||||
|
@ -511,7 +511,7 @@ void D_RegisterServerCommands(void)
|
|||
RegisterNetXCmd(XD_DELFILE, Got_Delfilecmd);
|
||||
#endif
|
||||
RegisterNetXCmd(XD_PAUSE, Got_Pause);
|
||||
RegisterNetXCmd(XD_SUICIDE, Got_Suicide);
|
||||
RegisterNetXCmd(XD_RESPAWN, Got_Respawn);
|
||||
RegisterNetXCmd(XD_RUNSOC, Got_RunSOCcmd);
|
||||
#ifdef HAVE_BLUA
|
||||
RegisterNetXCmd(XD_LUACMD, Got_Luacmd);
|
||||
|
@ -554,7 +554,7 @@ void D_RegisterServerCommands(void)
|
|||
#endif
|
||||
COM_AddCommand("runsoc", Command_RunSOC);
|
||||
COM_AddCommand("pause", Command_Pause);
|
||||
COM_AddCommand("suicide", Command_Suicide);
|
||||
COM_AddCommand("respawn", Command_Respawn);
|
||||
|
||||
COM_AddCommand("gametype", Command_ShowGametype_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.
|
||||
static void Command_Suicide(void)
|
||||
static void Command_Respawn(void)
|
||||
{
|
||||
XBOXSTATIC UINT8 buf[4];
|
||||
UINT8 *cp = buf;
|
||||
|
@ -2479,7 +2479,7 @@ static void Command_Suicide(void)
|
|||
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"));
|
||||
return;
|
||||
|
@ -2493,17 +2493,17 @@ static void Command_Suicide(void)
|
|||
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.
|
||||
if (suicideplayer != playernum) // srb2kart: "|| (!G_RaceGametype())"
|
||||
// You can't respawn someone else. Nice try, there.
|
||||
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)
|
||||
{
|
||||
XBOXSTATIC UINT8 buf[2];
|
||||
|
@ -2515,8 +2515,8 @@ static void Got_Suicide(UINT8 **cp, INT32 playernum)
|
|||
return;
|
||||
}
|
||||
|
||||
if (players[suicideplayer].mo)
|
||||
P_DamageMobj(players[suicideplayer].mo, NULL, NULL, 10000);
|
||||
if (players[respawnplayer].mo)
|
||||
P_DamageMobj(players[respawnplayer].mo, NULL, NULL, 10000);
|
||||
}
|
||||
|
||||
/** Deals with an ::XD_RANDOMSEED message in a netgame.
|
||||
|
|
|
@ -190,7 +190,7 @@ typedef enum
|
|||
XD_REQADDFILE, // 17
|
||||
XD_DELFILE, // 18
|
||||
XD_SETMOTD, // 19
|
||||
XD_SUICIDE, // 20
|
||||
XD_RESPAWN, // 20
|
||||
XD_DEMOTED, // 21
|
||||
XD_SETUPVOTE, // 22
|
||||
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)
|
||||
static boolean noFurtherInput = false;
|
||||
|
||||
static void Command_Manual_f(void)
|
||||
{
|
||||
if (modeattacking)
|
||||
return;
|
||||
M_StartControlPanel();
|
||||
M_Manual(INT32_MAX);
|
||||
itemOn = 0;
|
||||
}
|
||||
|
||||
//
|
||||
// M_Responder
|
||||
//
|
||||
|
@ -2500,11 +2509,7 @@ boolean M_Responder(event_t *ev)
|
|||
switch (ch)
|
||||
{
|
||||
case KEY_F1: // Help key
|
||||
if (modeattacking)
|
||||
return true;
|
||||
M_StartControlPanel();
|
||||
M_Manual(INT32_MAX);
|
||||
itemOn = 0;
|
||||
Command_Manual_f();
|
||||
return true;
|
||||
|
||||
case KEY_F2: // Empty
|
||||
|
@ -3093,6 +3098,8 @@ void M_Ticker(void)
|
|||
//
|
||||
void M_Init(void)
|
||||
{
|
||||
COM_AddCommand("manual", Command_Manual_f);
|
||||
|
||||
CV_RegisterVar(&cv_nextmap);
|
||||
CV_RegisterVar(&cv_newgametype);
|
||||
CV_RegisterVar(&cv_chooseskin);
|
||||
|
|
Loading…
Reference in a new issue