Clean up viewserver code a small bit
This also makes the cheats command show what cvars are active for easy checking
This commit is contained in:
parent
7534f7de3b
commit
2830abb7d0
5 changed files with 34 additions and 54 deletions
|
|
@ -65,8 +65,8 @@ static boolean CV_Command(void);
|
|||
consvar_t *CV_FindVar(const char *name);
|
||||
static const char *CV_StringValue(const char *var_name);
|
||||
|
||||
static consvar_t *consvar_vars; // list of registered console variables
|
||||
static UINT16 consvar_number_of_netids = 0;
|
||||
consvar_t *consvar_vars; // list of registered console variables
|
||||
UINT16 consvar_number_of_netids = 0;
|
||||
|
||||
static char com_token[1024];
|
||||
static char *COM_Parse(char *data);
|
||||
|
|
|
|||
|
|
@ -168,6 +168,9 @@ struct consvar_t //NULL, NULL, 0, NULL, NULL |, 0, NULL, NULL, 0, 0, NULL
|
|||
#define CVAR_INIT( ... ) \
|
||||
{ __VA_ARGS__, 0, NULL, NULL, {0, {NULL}}, 0U, (char)0, NULL }
|
||||
|
||||
extern consvar_t *consvar_vars; // list of registered console variables
|
||||
extern UINT16 consvar_number_of_netids;
|
||||
|
||||
extern CV_PossibleValue_t CV_OnOff[];
|
||||
extern CV_PossibleValue_t CV_YesNo[];
|
||||
extern CV_PossibleValue_t CV_Signed[];
|
||||
|
|
|
|||
|
|
@ -509,7 +509,7 @@ static CV_PossibleValue_t kartdebugitem_cons_t[] =
|
|||
#undef FOREACH
|
||||
{0}
|
||||
};
|
||||
consvar_t cv_kartdebugitem = CVAR_INIT ("kartdebugitem", "0", CV_NETVAR|CV_CHEAT, kartdebugitem_cons_t, NULL);
|
||||
consvar_t cv_kartdebugitem = CVAR_INIT ("kartdebugitem", "NONE", CV_NETVAR|CV_CHEAT, kartdebugitem_cons_t, NULL);
|
||||
static CV_PossibleValue_t kartdebugamount_cons_t[] = {{1, "MIN"}, {255, "MAX"}, {0, NULL}};
|
||||
consvar_t cv_kartdebugamount = CVAR_INIT ("kartdebugamount", "1", CV_NETVAR|CV_CHEAT, kartdebugamount_cons_t, NULL);
|
||||
consvar_t cv_kartdebugshrink = CVAR_INIT ("kartdebugshrink", "Off", CV_NETVAR|CV_CHEAT, CV_OnOff, NULL);
|
||||
|
|
@ -6109,7 +6109,17 @@ static void Command_Cheats_f(void)
|
|||
|
||||
if (CV_CheatsEnabled())
|
||||
{
|
||||
consvar_t *cvar;
|
||||
CONS_Printf(M_GetText("At least one CHEAT-marked variable has been changed -- Cheats are enabled.\n"));
|
||||
|
||||
for (cvar = consvar_vars; cvar; cvar = cvar->next)
|
||||
{
|
||||
if ((cvar->flags & CV_CHEAT) && strcmp(cvar->defaultvalue, cvar->string))
|
||||
{
|
||||
CONS_Printf("%s: Default Value: %s Current Value:%s\n", cvar->name, cvar->defaultvalue, cvar->string);
|
||||
}
|
||||
}
|
||||
|
||||
if (server || (IsPlayerAdmin(consoleplayer)))
|
||||
CONS_Printf(M_GetText("Type CHEATS OFF to reset all cheat variables to default.\n"));
|
||||
}
|
||||
|
|
|
|||
40
src/g_game.c
40
src/g_game.c
|
|
@ -777,58 +777,34 @@ INT32 G_MapNumber(const char * name)
|
|||
INT32 G_LevelTitleToMapNum(const char * leveltitle)
|
||||
{
|
||||
INT32 map;
|
||||
char *levelname;
|
||||
char *levelnameact;
|
||||
char *levelnamezone;
|
||||
char *levelnameactzone;
|
||||
char levelname[48];
|
||||
|
||||
for (map = 0; map < nummapheaders; ++map)
|
||||
{
|
||||
levelname = zva(PU_STATIC, NULL, "%s %s", mapheaderinfo[map]->lvlttl);
|
||||
levelnameact = zva(PU_STATIC, NULL, "%s %s", mapheaderinfo[map]->lvlttl, mapheaderinfo[map]->actnum);
|
||||
levelnamezone = zva(PU_STATIC, NULL, "%s %s", mapheaderinfo[map]->lvlttl, mapheaderinfo[map]->zonttl);
|
||||
levelnameactzone = zva(PU_STATIC, NULL, "%s %s %s", mapheaderinfo[map]->lvlttl, mapheaderinfo[map]->zonttl, mapheaderinfo[map]->actnum);
|
||||
|
||||
sprintf(levelname, "%s", mapheaderinfo[map]->lvlttl);
|
||||
if (!strcasecmp(leveltitle, levelname))
|
||||
{
|
||||
Z_Free(levelname);
|
||||
Z_Free(levelnameact);
|
||||
Z_Free(levelnamezone);
|
||||
Z_Free(levelnameactzone);
|
||||
return map;
|
||||
}
|
||||
|
||||
if (!strcasecmp(leveltitle, levelnameact))
|
||||
sprintf(levelname, "%s %s", mapheaderinfo[map]->lvlttl, mapheaderinfo[map]->actnum);
|
||||
if (!strcasecmp(leveltitle, levelname))
|
||||
{
|
||||
Z_Free(levelname);
|
||||
Z_Free(levelnameact);
|
||||
Z_Free(levelnamezone);
|
||||
Z_Free(levelnameactzone);
|
||||
return map;
|
||||
}
|
||||
|
||||
if (!strcasecmp(leveltitle, levelnamezone))
|
||||
sprintf(levelname, "%s %s", mapheaderinfo[map]->lvlttl, mapheaderinfo[map]->zonttl);
|
||||
if (!strcasecmp(leveltitle, levelname))
|
||||
{
|
||||
Z_Free(levelname);
|
||||
Z_Free(levelnameact);
|
||||
Z_Free(levelnamezone);
|
||||
Z_Free(levelnameactzone);
|
||||
return map;
|
||||
}
|
||||
|
||||
if (!strcasecmp(leveltitle, levelnameactzone))
|
||||
sprintf(levelname, "%s %s %s", mapheaderinfo[map]->lvlttl, mapheaderinfo[map]->zonttl, mapheaderinfo[map]->actnum);
|
||||
if (!strcasecmp(leveltitle, levelname))
|
||||
{
|
||||
Z_Free(levelname);
|
||||
Z_Free(levelnameact);
|
||||
Z_Free(levelnamezone);
|
||||
Z_Free(levelnameactzone);
|
||||
return map;
|
||||
}
|
||||
|
||||
Z_Free(levelname);
|
||||
Z_Free(levelnameact);
|
||||
Z_Free(levelnamezone);
|
||||
Z_Free(levelnameactzone);
|
||||
}
|
||||
return INT32_MIN;
|
||||
}
|
||||
|
|
|
|||
29
src/m_menu.c
29
src/m_menu.c
|
|
@ -6568,7 +6568,6 @@ static void Splitplayers_OnChange(void)
|
|||
// Tails 11-19-2002
|
||||
INT32 MR_ConnectIP(INT32 choice)
|
||||
{
|
||||
int i;
|
||||
(void)choice;
|
||||
|
||||
if (*cv_dummyip.string == 0)
|
||||
|
|
@ -7963,8 +7962,15 @@ INT32 MR_EnterViewServer(INT32 choice)
|
|||
UINT32 ping = serverlist[joinnode].info.time;
|
||||
UINT8 kartvars = serverlist[joinnode].info.kartvars;
|
||||
|
||||
if (serveraddon)
|
||||
Z_Free(serveraddon);
|
||||
if (serverping)
|
||||
Z_Free(serverping);
|
||||
if (servergametype)
|
||||
Z_Free(servergametype);
|
||||
|
||||
serveraddon = zva(PU_STATIC, NULL, "\x82%d Addon%s", fileneedednum, fileneedednum > 1 ? "s" : "");
|
||||
serverping = zva(PU_STATIC, NULL, "Ping: %s%ums", (ping < 128 ? "\x83" : (ping < 256 ? "\x82" : "\x85")), ping);
|
||||
serverping = zva(PU_STATIC, NULL, "Ping: %c%ums", (ping < 128 ? '\x83' : (ping < 256 ? '\x82' : '\x85')), ping);
|
||||
|
||||
switch (kartvars & SV_SPEEDMASK)
|
||||
{
|
||||
|
|
@ -7999,10 +8005,8 @@ INT32 MR_EnterViewServer(INT32 choice)
|
|||
{
|
||||
M_SetItemText(MN_VIEWSERVER, "SERVERCHEATS", "Cheats");
|
||||
}
|
||||
else
|
||||
{
|
||||
M_SetItemText(MN_VIEWSERVER, "SERVERCHEATS", "");
|
||||
}
|
||||
|
||||
M_SetItemVisible(MN_VIEWSERVER, "SERVERCHEATS", serverlist[joinnode].info.cheatsenabled);
|
||||
|
||||
if (kartvars & SV_DEDICATED)
|
||||
{
|
||||
|
|
@ -8020,13 +8024,6 @@ INT32 MR_QuitViewServer(INT32 choice)
|
|||
{
|
||||
(void)choice;
|
||||
|
||||
if (serveraddon)
|
||||
Z_Free(serveraddon);
|
||||
if (serverping)
|
||||
Z_Free(serverping);
|
||||
if (servergametype)
|
||||
Z_Free(servergametype);
|
||||
|
||||
D_QuitNetGame();
|
||||
CL_Reset();
|
||||
return true;
|
||||
|
|
@ -8044,12 +8041,6 @@ INT32 MR_HandleViewServer(INT32 choice)
|
|||
S_StartSound(NULL, sfx_menu1);
|
||||
ChangeClientMode(CL_CHECKFILES);
|
||||
M_ClearMenus(false);
|
||||
if (serveraddon)
|
||||
Z_Free(serveraddon);
|
||||
if (serverping)
|
||||
Z_Free(serverping);
|
||||
if (servergametype)
|
||||
Z_Free(servergametype);
|
||||
return true;
|
||||
break;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue