host_cmd.c, menu.c: sanitize whitespace/formatting.
git-svn-id: svn+ssh://svn.code.sf.net/p/quakespasm/code/trunk@252 af15c1b1-3010-417e-b628-4374ebc0bcbd
This commit is contained in:
parent
7a618b80cb
commit
79c16e7f0a
|
@ -225,16 +225,19 @@ void ExtraMaps_Add (char *name)
|
||||||
{
|
{
|
||||||
extralevel_t *level,*cursor,*prev;
|
extralevel_t *level,*cursor,*prev;
|
||||||
|
|
||||||
//ingore duplicate
|
// ignore duplicate
|
||||||
for (level = extralevels; level; level = level->next)
|
for (level = extralevels; level; level = level->next)
|
||||||
|
{
|
||||||
if (!Q_strcmp (name, level->name))
|
if (!Q_strcmp (name, level->name))
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
level = (extralevel_t *) Z_Malloc(sizeof(extralevel_t));
|
level = (extralevel_t *) Z_Malloc(sizeof(extralevel_t));
|
||||||
strcpy (level->name, name);
|
strcpy (level->name, name);
|
||||||
|
|
||||||
// insert each entry in alphabetical order
|
// 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;
|
level->next = extralevels;
|
||||||
extralevels = level;
|
extralevels = level;
|
||||||
|
@ -264,7 +267,8 @@ void ExtraMaps_Init (void)
|
||||||
pack_t *pak;
|
pack_t *pak;
|
||||||
int i;
|
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);
|
sprintf (ignorepakdir, "/%s/", GAMENAME);
|
||||||
|
|
||||||
for (search = com_searchpaths; search; search = search->next)
|
for (search = com_searchpaths; search; search = search->next)
|
||||||
|
@ -286,14 +290,14 @@ void ExtraMaps_Init (void)
|
||||||
}
|
}
|
||||||
else //pakfile
|
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++)
|
for (i = 0, pak = search->pack; i < pak->numfiles; i++)
|
||||||
{
|
{
|
||||||
if (strstr(pak->files[i].name, ".bsp"))
|
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);
|
COM_StripExtension(pak->files[i].name + 5, mapname);
|
||||||
ExtraMaps_Add (mapname);
|
ExtraMaps_Add (mapname);
|
||||||
}
|
}
|
||||||
|
@ -359,14 +363,17 @@ void Modlist_Add (char *name)
|
||||||
|
|
||||||
//ingore duplicate
|
//ingore duplicate
|
||||||
for (mod = modlist; mod; mod = mod->next)
|
for (mod = modlist; mod; mod = mod->next)
|
||||||
|
{
|
||||||
if (!Q_strcmp (name, mod->name))
|
if (!Q_strcmp (name, mod->name))
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
mod = (mod_t *) Z_Malloc(sizeof(mod_t));
|
mod = (mod_t *) Z_Malloc(sizeof(mod_t));
|
||||||
strcpy (mod->name, name);
|
strcpy (mod->name, name);
|
||||||
|
|
||||||
//insert each entry in alphabetical order
|
//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;
|
mod->next = modlist;
|
||||||
modlist = mod;
|
modlist = mod;
|
||||||
|
@ -973,8 +980,10 @@ void Host_SavegameComment (char *text)
|
||||||
memcpy (text+22, kills, strlen(kills));
|
memcpy (text+22, kills, strlen(kills));
|
||||||
// convert space to _ to make stdio happy
|
// convert space to _ to make stdio happy
|
||||||
for (i = 0; i < SAVEGAME_COMMENT_LENGTH; i++)
|
for (i = 0; i < SAVEGAME_COMMENT_LENGTH; i++)
|
||||||
|
{
|
||||||
if (text[i] == ' ')
|
if (text[i] == ' ')
|
||||||
text[i] = '_';
|
text[i] = '_';
|
||||||
|
}
|
||||||
text[SAVEGAME_COMMENT_LENGTH] = '\0';
|
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 (host_client->name[0] && strcmp(host_client->name, "unconnected") )
|
||||||
|
{
|
||||||
if (Q_strcmp(host_client->name, newName) != 0)
|
if (Q_strcmp(host_client->name, newName) != 0)
|
||||||
Con_Printf ("%s renamed to %s\n", host_client->name, newName);
|
Con_Printf ("%s renamed to %s\n", host_client->name, newName);
|
||||||
|
}
|
||||||
Q_strcpy (host_client->name, newName);
|
Q_strcpy (host_client->name, newName);
|
||||||
host_client->edict->v.netname = PR_SetEngineString(host_client->name);
|
host_client->edict->v.netname = PR_SetEngineString(host_client->name);
|
||||||
|
|
||||||
|
@ -1842,9 +1853,9 @@ void Host_Give_f (void)
|
||||||
if (val)
|
if (val)
|
||||||
val->_float = v;
|
val->_float = v;
|
||||||
}
|
}
|
||||||
|
|
||||||
sv_player->v.ammo_shells = v;
|
sv_player->v.ammo_shells = v;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'n':
|
case 'n':
|
||||||
if (rogue)
|
if (rogue)
|
||||||
{
|
{
|
||||||
|
@ -1861,6 +1872,7 @@ void Host_Give_f (void)
|
||||||
sv_player->v.ammo_nails = v;
|
sv_player->v.ammo_nails = v;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'l':
|
case 'l':
|
||||||
if (rogue)
|
if (rogue)
|
||||||
{
|
{
|
||||||
|
@ -1873,6 +1885,7 @@ void Host_Give_f (void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'r':
|
case 'r':
|
||||||
if (rogue)
|
if (rogue)
|
||||||
{
|
{
|
||||||
|
@ -1889,6 +1902,7 @@ void Host_Give_f (void)
|
||||||
sv_player->v.ammo_rockets = v;
|
sv_player->v.ammo_rockets = v;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'm':
|
case 'm':
|
||||||
if (rogue)
|
if (rogue)
|
||||||
{
|
{
|
||||||
|
@ -1901,9 +1915,11 @@ void Host_Give_f (void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'h':
|
case 'h':
|
||||||
sv_player->v.health = v;
|
sv_player->v.health = v;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'c':
|
case 'c':
|
||||||
if (rogue)
|
if (rogue)
|
||||||
{
|
{
|
||||||
|
@ -1920,6 +1936,7 @@ void Host_Give_f (void)
|
||||||
sv_player->v.ammo_cells = v;
|
sv_player->v.ammo_cells = v;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'p':
|
case 'p':
|
||||||
if (rogue)
|
if (rogue)
|
||||||
{
|
{
|
||||||
|
@ -1932,25 +1949,32 @@ void Host_Give_f (void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
//johnfitz -- give armour
|
//johnfitz -- give armour
|
||||||
case 'a':
|
case 'a':
|
||||||
if (v > 150)
|
if (v > 150)
|
||||||
{
|
{
|
||||||
sv_player->v.armortype = 0.8;
|
sv_player->v.armortype = 0.8;
|
||||||
sv_player->v.armorvalue = v;
|
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)
|
else if (v > 100)
|
||||||
{
|
{
|
||||||
sv_player->v.armortype = 0.6;
|
sv_player->v.armortype = 0.6;
|
||||||
sv_player->v.armorvalue = v;
|
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)
|
else if (v >= 0)
|
||||||
{
|
{
|
||||||
sv_player->v.armortype = 0.3;
|
sv_player->v.armortype = 0.3;
|
||||||
sv_player->v.armorvalue = v;
|
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;
|
break;
|
||||||
//johnfitz
|
//johnfitz
|
||||||
|
@ -2254,3 +2278,4 @@ void Host_InitCommands (void)
|
||||||
|
|
||||||
Cmd_AddCommand ("mcache", Mod_Print);
|
Cmd_AddCommand ("mcache", Mod_Print);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -422,7 +422,7 @@ void M_SinglePlayer_Key (int key)
|
||||||
|
|
||||||
int load_cursor; // 0 < load_cursor < MAX_SAVEGAMES
|
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];
|
char m_filenames[MAX_SAVEGAMES][SAVEGAME_COMMENT_LENGTH+1];
|
||||||
int loadable[MAX_SAVEGAMES];
|
int loadable[MAX_SAVEGAMES];
|
||||||
|
|
||||||
|
@ -447,8 +447,10 @@ void M_ScanSaves (void)
|
||||||
|
|
||||||
// change _ back to space
|
// change _ back to space
|
||||||
for (j = 0; j < SAVEGAME_COMMENT_LENGTH; j++)
|
for (j = 0; j < SAVEGAME_COMMENT_LENGTH; j++)
|
||||||
|
{
|
||||||
if (m_filenames[i][j] == '_')
|
if (m_filenames[i][j] == '_')
|
||||||
m_filenames[i][j] = ' ';
|
m_filenames[i][j] = ' ';
|
||||||
|
}
|
||||||
loadable[i] = true;
|
loadable[i] = true;
|
||||||
fclose (f);
|
fclose (f);
|
||||||
}
|
}
|
||||||
|
@ -1715,8 +1717,10 @@ void M_Menu_SerialConfig_f (void)
|
||||||
|
|
||||||
// map uart's port to COMx
|
// map uart's port to COMx
|
||||||
for (n = 0; n < 4; n++)
|
for (n = 0; n < 4; n++)
|
||||||
|
{
|
||||||
if (ISA_uarts[n] == port)
|
if (ISA_uarts[n] == port)
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
if (n == 4)
|
if (n == 4)
|
||||||
{
|
{
|
||||||
n = 0;
|
n = 0;
|
||||||
|
@ -1726,8 +1730,10 @@ void M_Menu_SerialConfig_f (void)
|
||||||
|
|
||||||
// map baudrate to index
|
// map baudrate to index
|
||||||
for (n = 0; n < 6; n++)
|
for (n = 0; n < 6; n++)
|
||||||
|
{
|
||||||
if (serialConfig_baudrate[n] == baudrate)
|
if (serialConfig_baudrate[n] == baudrate)
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
if (n == 6)
|
if (n == 6)
|
||||||
n = 5;
|
n = 5;
|
||||||
serialConfig_baud = n;
|
serialConfig_baud = n;
|
||||||
|
@ -2903,7 +2909,9 @@ void M_ServerList_Draw (void)
|
||||||
int i,j;
|
int i,j;
|
||||||
hostcache_t temp;
|
hostcache_t temp;
|
||||||
for (i = 0; i < hostCacheCount; i++)
|
for (i = 0; i < hostCacheCount; i++)
|
||||||
|
{
|
||||||
for (j = i + 1; j < hostCacheCount; j++)
|
for (j = i + 1; j < hostCacheCount; j++)
|
||||||
|
{
|
||||||
if (strcmp(hostcache[j].name, hostcache[i].name) < 0)
|
if (strcmp(hostcache[j].name, hostcache[i].name) < 0)
|
||||||
{
|
{
|
||||||
Q_memcpy(&temp, &hostcache[j], sizeof(hostcache_t));
|
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));
|
Q_memcpy(&hostcache[i], &temp, sizeof(hostcache_t));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
slist_sorted = true;
|
slist_sorted = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3199,7 +3209,6 @@ void M_Keydown (int key)
|
||||||
void M_ConfigureNetSubsystem(void)
|
void M_ConfigureNetSubsystem(void)
|
||||||
{
|
{
|
||||||
// enable/disable net systems to match desired config
|
// enable/disable net systems to match desired config
|
||||||
|
|
||||||
Cbuf_AddText ("stopdemo\n");
|
Cbuf_AddText ("stopdemo\n");
|
||||||
if (SerialConfig || DirectConfig)
|
if (SerialConfig || DirectConfig)
|
||||||
{
|
{
|
||||||
|
@ -3209,3 +3218,4 @@ void M_ConfigureNetSubsystem(void)
|
||||||
if (IPXConfig || TCPIPConfig)
|
if (IPXConfig || TCPIPConfig)
|
||||||
net_hostport = lanConfig_port;
|
net_hostport = lanConfig_port;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue