mirror of
https://github.com/Shpoike/Quakespasm.git
synced 2025-03-10 12:01:43 +00:00
host_cmd.c, menu.c: sanitize whitespace/formatting.
git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@252 af15c1b1-3010-417e-b628-4374ebc0bcbd
This commit is contained in:
parent
4a1e01a976
commit
d5e85a5e6c
2 changed files with 309 additions and 274 deletions
|
@ -225,16 +225,19 @@ void ExtraMaps_Add (char *name)
|
|||
{
|
||||
extralevel_t *level,*cursor,*prev;
|
||||
|
||||
//ingore duplicate
|
||||
// ignore duplicate
|
||||
for (level = extralevels; level; level = level->next)
|
||||
{
|
||||
if (!Q_strcmp (name, level->name))
|
||||
return;
|
||||
}
|
||||
|
||||
level = (extralevel_t *) Z_Malloc(sizeof(extralevel_t));
|
||||
strcpy (level->name, name);
|
||||
|
||||
// insert each entry in alphabetical order
|
||||
if (extralevels == NULL || Q_strcasecmp(level->name, extralevels->name) < 0) //insert at front
|
||||
if (extralevels == NULL ||
|
||||
Q_strcasecmp(level->name, extralevels->name) < 0) //insert at front
|
||||
{
|
||||
level->next = extralevels;
|
||||
extralevels = level;
|
||||
|
@ -264,7 +267,8 @@ void ExtraMaps_Init (void)
|
|||
pack_t *pak;
|
||||
int i;
|
||||
|
||||
//we don't want to list the maps in id1 pakfiles, becuase these are not "add-on" levels
|
||||
// we don't want to list the maps in id1 pakfiles,
|
||||
// because these are not "add-on" levels
|
||||
sprintf (ignorepakdir, "/%s/", GAMENAME);
|
||||
|
||||
for (search = com_searchpaths; search; search = search->next)
|
||||
|
@ -286,14 +290,14 @@ void ExtraMaps_Init (void)
|
|||
}
|
||||
else //pakfile
|
||||
{
|
||||
if (!strstr(search->pack->filename, ignorepakdir)) //don't list standard id maps
|
||||
{
|
||||
if (!strstr(search->pack->filename, ignorepakdir))
|
||||
{ //don't list standard id maps
|
||||
for (i = 0, pak = search->pack; i < pak->numfiles; i++)
|
||||
{
|
||||
if (strstr(pak->files[i].name, ".bsp"))
|
||||
{
|
||||
if (pak->files[i].filelen > 32*1024) // don't list files under 32k (ammo boxes etc)
|
||||
{
|
||||
if (pak->files[i].filelen > 32*1024)
|
||||
{ // don't list files under 32k (ammo boxes etc)
|
||||
COM_StripExtension(pak->files[i].name + 5, mapname);
|
||||
ExtraMaps_Add (mapname);
|
||||
}
|
||||
|
@ -359,14 +363,17 @@ void Modlist_Add (char *name)
|
|||
|
||||
//ingore duplicate
|
||||
for (mod = modlist; mod; mod = mod->next)
|
||||
{
|
||||
if (!Q_strcmp (name, mod->name))
|
||||
return;
|
||||
}
|
||||
|
||||
mod = (mod_t *) Z_Malloc(sizeof(mod_t));
|
||||
strcpy (mod->name, name);
|
||||
|
||||
//insert each entry in alphabetical order
|
||||
if (modlist == NULL || Q_strcasecmp(mod->name, modlist->name) < 0) //insert at front
|
||||
if (modlist == NULL ||
|
||||
Q_strcasecmp(mod->name, modlist->name) < 0) //insert at front
|
||||
{
|
||||
mod->next = modlist;
|
||||
modlist = mod;
|
||||
|
@ -973,8 +980,10 @@ void Host_SavegameComment (char *text)
|
|||
memcpy (text+22, kills, strlen(kills));
|
||||
// convert space to _ to make stdio happy
|
||||
for (i = 0; i < SAVEGAME_COMMENT_LENGTH; i++)
|
||||
{
|
||||
if (text[i] == ' ')
|
||||
text[i] = '_';
|
||||
}
|
||||
text[SAVEGAME_COMMENT_LENGTH] = '\0';
|
||||
}
|
||||
|
||||
|
@ -1252,8 +1261,10 @@ void Host_Name_f (void)
|
|||
}
|
||||
|
||||
if (host_client->name[0] && strcmp(host_client->name, "unconnected") )
|
||||
{
|
||||
if (Q_strcmp(host_client->name, newName) != 0)
|
||||
Con_Printf ("%s renamed to %s\n", host_client->name, newName);
|
||||
}
|
||||
Q_strcpy (host_client->name, newName);
|
||||
host_client->edict->v.netname = PR_SetEngineString(host_client->name);
|
||||
|
||||
|
@ -1842,9 +1853,9 @@ void Host_Give_f (void)
|
|||
if (val)
|
||||
val->_float = v;
|
||||
}
|
||||
|
||||
sv_player->v.ammo_shells = v;
|
||||
break;
|
||||
|
||||
case 'n':
|
||||
if (rogue)
|
||||
{
|
||||
|
@ -1861,6 +1872,7 @@ void Host_Give_f (void)
|
|||
sv_player->v.ammo_nails = v;
|
||||
}
|
||||
break;
|
||||
|
||||
case 'l':
|
||||
if (rogue)
|
||||
{
|
||||
|
@ -1873,6 +1885,7 @@ void Host_Give_f (void)
|
|||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case 'r':
|
||||
if (rogue)
|
||||
{
|
||||
|
@ -1889,6 +1902,7 @@ void Host_Give_f (void)
|
|||
sv_player->v.ammo_rockets = v;
|
||||
}
|
||||
break;
|
||||
|
||||
case 'm':
|
||||
if (rogue)
|
||||
{
|
||||
|
@ -1901,9 +1915,11 @@ void Host_Give_f (void)
|
|||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case 'h':
|
||||
sv_player->v.health = v;
|
||||
break;
|
||||
|
||||
case 'c':
|
||||
if (rogue)
|
||||
{
|
||||
|
@ -1920,6 +1936,7 @@ void Host_Give_f (void)
|
|||
sv_player->v.ammo_cells = v;
|
||||
}
|
||||
break;
|
||||
|
||||
case 'p':
|
||||
if (rogue)
|
||||
{
|
||||
|
@ -1932,25 +1949,32 @@ void Host_Give_f (void)
|
|||
}
|
||||
}
|
||||
break;
|
||||
|
||||
//johnfitz -- give armour
|
||||
case 'a':
|
||||
if (v > 150)
|
||||
{
|
||||
sv_player->v.armortype = 0.8;
|
||||
sv_player->v.armorvalue = v;
|
||||
sv_player->v.items = sv_player->v.items - ((int)(sv_player->v.items) & (int)(IT_ARMOR1 | IT_ARMOR2 | IT_ARMOR3)) + IT_ARMOR3;
|
||||
sv_player->v.items = sv_player->v.items -
|
||||
((int)(sv_player->v.items) & (int)(IT_ARMOR1 | IT_ARMOR2 | IT_ARMOR3)) +
|
||||
IT_ARMOR3;
|
||||
}
|
||||
else if (v > 100)
|
||||
{
|
||||
sv_player->v.armortype = 0.6;
|
||||
sv_player->v.armorvalue = v;
|
||||
sv_player->v.items = sv_player->v.items - ((int)(sv_player->v.items) & (int)(IT_ARMOR1 | IT_ARMOR2 | IT_ARMOR3)) + IT_ARMOR2;
|
||||
sv_player->v.items = sv_player->v.items -
|
||||
((int)(sv_player->v.items) & (int)(IT_ARMOR1 | IT_ARMOR2 | IT_ARMOR3)) +
|
||||
IT_ARMOR2;
|
||||
}
|
||||
else if (v >= 0)
|
||||
{
|
||||
sv_player->v.armortype = 0.3;
|
||||
sv_player->v.armorvalue = v;
|
||||
sv_player->v.items = sv_player->v.items - ((int)(sv_player->v.items) & (int)(IT_ARMOR1 | IT_ARMOR2 | IT_ARMOR3)) + IT_ARMOR1;
|
||||
sv_player->v.items = sv_player->v.items -
|
||||
((int)(sv_player->v.items) & (int)(IT_ARMOR1 | IT_ARMOR2 | IT_ARMOR3)) +
|
||||
IT_ARMOR1;
|
||||
}
|
||||
break;
|
||||
//johnfitz
|
||||
|
@ -2254,3 +2278,4 @@ void Host_InitCommands (void)
|
|||
|
||||
Cmd_AddCommand ("mcache", Mod_Print);
|
||||
}
|
||||
|
||||
|
|
14
Quake/menu.c
14
Quake/menu.c
|
@ -422,7 +422,7 @@ void M_SinglePlayer_Key (int key)
|
|||
|
||||
int load_cursor; // 0 < load_cursor < MAX_SAVEGAMES
|
||||
|
||||
#define MAX_SAVEGAMES 20 //johnfitz -- increased from 12
|
||||
#define MAX_SAVEGAMES 20 /* johnfitz -- increased from 12 */
|
||||
char m_filenames[MAX_SAVEGAMES][SAVEGAME_COMMENT_LENGTH+1];
|
||||
int loadable[MAX_SAVEGAMES];
|
||||
|
||||
|
@ -447,8 +447,10 @@ void M_ScanSaves (void)
|
|||
|
||||
// change _ back to space
|
||||
for (j = 0; j < SAVEGAME_COMMENT_LENGTH; j++)
|
||||
{
|
||||
if (m_filenames[i][j] == '_')
|
||||
m_filenames[i][j] = ' ';
|
||||
}
|
||||
loadable[i] = true;
|
||||
fclose (f);
|
||||
}
|
||||
|
@ -1715,8 +1717,10 @@ void M_Menu_SerialConfig_f (void)
|
|||
|
||||
// map uart's port to COMx
|
||||
for (n = 0; n < 4; n++)
|
||||
{
|
||||
if (ISA_uarts[n] == port)
|
||||
break;
|
||||
}
|
||||
if (n == 4)
|
||||
{
|
||||
n = 0;
|
||||
|
@ -1726,8 +1730,10 @@ void M_Menu_SerialConfig_f (void)
|
|||
|
||||
// map baudrate to index
|
||||
for (n = 0; n < 6; n++)
|
||||
{
|
||||
if (serialConfig_baudrate[n] == baudrate)
|
||||
break;
|
||||
}
|
||||
if (n == 6)
|
||||
n = 5;
|
||||
serialConfig_baud = n;
|
||||
|
@ -2903,7 +2909,9 @@ void M_ServerList_Draw (void)
|
|||
int i,j;
|
||||
hostcache_t temp;
|
||||
for (i = 0; i < hostCacheCount; i++)
|
||||
{
|
||||
for (j = i + 1; j < hostCacheCount; j++)
|
||||
{
|
||||
if (strcmp(hostcache[j].name, hostcache[i].name) < 0)
|
||||
{
|
||||
Q_memcpy(&temp, &hostcache[j], sizeof(hostcache_t));
|
||||
|
@ -2911,6 +2919,8 @@ void M_ServerList_Draw (void)
|
|||
Q_memcpy(&hostcache[i], &temp, sizeof(hostcache_t));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
slist_sorted = true;
|
||||
}
|
||||
|
||||
|
@ -3199,7 +3209,6 @@ void M_Keydown (int key)
|
|||
void M_ConfigureNetSubsystem(void)
|
||||
{
|
||||
// enable/disable net systems to match desired config
|
||||
|
||||
Cbuf_AddText ("stopdemo\n");
|
||||
if (SerialConfig || DirectConfig)
|
||||
{
|
||||
|
@ -3209,3 +3218,4 @@ void M_ConfigureNetSubsystem(void)
|
|||
if (IPXConfig || TCPIPConfig)
|
||||
net_hostport = lanConfig_port;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue