mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2025-02-07 00:41:26 +00:00
P_AddWadFile: Remove useless firstmapname param, clean up map searching code
This commit is contained in:
parent
29d605a104
commit
b0d0738fb6
4 changed files with 10 additions and 17 deletions
|
@ -3066,7 +3066,7 @@ static void Command_Addfile(void)
|
||||||
// Add file on your client directly if it is trivial, or you aren't in a netgame.
|
// Add file on your client directly if it is trivial, or you aren't in a netgame.
|
||||||
if (!(netgame || multiplayer) || musiconly)
|
if (!(netgame || multiplayer) || musiconly)
|
||||||
{
|
{
|
||||||
P_AddWadFile(fn, NULL);
|
P_AddWadFile(fn);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3235,7 +3235,7 @@ static void Got_Addfilecmd(UINT8 **cp, INT32 playernum)
|
||||||
|
|
||||||
ncs = findfile(filename,md5sum,true);
|
ncs = findfile(filename,md5sum,true);
|
||||||
|
|
||||||
if (ncs != FS_FOUND || !P_AddWadFile(filename, NULL))
|
if (ncs != FS_FOUND || !P_AddWadFile(filename))
|
||||||
{
|
{
|
||||||
Command_ExitGame_f();
|
Command_ExitGame_f();
|
||||||
if (ncs == FS_FOUND)
|
if (ncs == FS_FOUND)
|
||||||
|
|
|
@ -423,7 +423,7 @@ void CL_LoadServerFiles(void)
|
||||||
continue; // Already loaded
|
continue; // Already loaded
|
||||||
else if (fileneeded[i].status == FS_FOUND)
|
else if (fileneeded[i].status == FS_FOUND)
|
||||||
{
|
{
|
||||||
P_AddWadFile(fileneeded[i].filename, NULL);
|
P_AddWadFile(fileneeded[i].filename);
|
||||||
G_SetGameModified(true);
|
G_SetGameModified(true);
|
||||||
fileneeded[i].status = FS_OPEN;
|
fileneeded[i].status = FS_OPEN;
|
||||||
}
|
}
|
||||||
|
|
|
@ -3133,7 +3133,7 @@ boolean P_RunSOC(const char *socfilename)
|
||||||
lumpnum_t lump;
|
lumpnum_t lump;
|
||||||
|
|
||||||
if (strstr(socfilename, ".soc") != NULL)
|
if (strstr(socfilename, ".soc") != NULL)
|
||||||
return P_AddWadFile(socfilename, NULL);
|
return P_AddWadFile(socfilename);
|
||||||
|
|
||||||
lump = W_CheckNumForName(socfilename);
|
lump = W_CheckNumForName(socfilename);
|
||||||
if (lump == LUMPERROR)
|
if (lump == LUMPERROR)
|
||||||
|
@ -3214,13 +3214,13 @@ static lumpinfo_t* FindFolder(const char *folName, UINT16 *start, UINT16 *end, l
|
||||||
// Add a wadfile to the active wad files,
|
// Add a wadfile to the active wad files,
|
||||||
// replace sounds, musics, patches, textures, sprites and maps
|
// replace sounds, musics, patches, textures, sprites and maps
|
||||||
//
|
//
|
||||||
boolean P_AddWadFile(const char *wadfilename, char **firstmapname)
|
boolean P_AddWadFile(const char *wadfilename)
|
||||||
{
|
{
|
||||||
size_t i, j, sreplaces = 0, mreplaces = 0, digmreplaces = 0;
|
size_t i, j, sreplaces = 0, mreplaces = 0, digmreplaces = 0;
|
||||||
UINT16 numlumps, wadnum;
|
UINT16 numlumps, wadnum;
|
||||||
INT16 firstmapreplaced = 0, num;
|
|
||||||
char *name;
|
char *name;
|
||||||
lumpinfo_t *lumpinfo;
|
lumpinfo_t *lumpinfo;
|
||||||
|
boolean mapsadded = false;
|
||||||
boolean replacedcurrentmap = false;
|
boolean replacedcurrentmap = false;
|
||||||
|
|
||||||
// Vars to help us with the position start and amount of each resource type.
|
// Vars to help us with the position start and amount of each resource type.
|
||||||
|
@ -3354,10 +3354,9 @@ boolean P_AddWadFile(const char *wadfilename, char **firstmapname)
|
||||||
for (i = 0; i < numlumps; i++, lumpinfo++)
|
for (i = 0; i < numlumps; i++, lumpinfo++)
|
||||||
{
|
{
|
||||||
name = lumpinfo->name;
|
name = lumpinfo->name;
|
||||||
num = firstmapreplaced;
|
|
||||||
|
|
||||||
if (name[0] == 'M' && name[1] == 'A' && name[2] == 'P') // Ignore the headers
|
if (name[0] == 'M' && name[1] == 'A' && name[2] == 'P') // Ignore the headers
|
||||||
{
|
{
|
||||||
|
INT16 num;
|
||||||
if (name[5]!='\0')
|
if (name[5]!='\0')
|
||||||
continue;
|
continue;
|
||||||
num = (INT16)M_MapNumber(name[3], name[4]);
|
num = (INT16)M_MapNumber(name[3], name[4]);
|
||||||
|
@ -3367,16 +3366,10 @@ boolean P_AddWadFile(const char *wadfilename, char **firstmapname)
|
||||||
replacedcurrentmap = true;
|
replacedcurrentmap = true;
|
||||||
|
|
||||||
CONS_Printf("%s\n", name);
|
CONS_Printf("%s\n", name);
|
||||||
}
|
mapsadded = true;
|
||||||
|
|
||||||
if (num && (num < firstmapreplaced || !firstmapreplaced))
|
|
||||||
{
|
|
||||||
firstmapreplaced = num;
|
|
||||||
if (firstmapname)
|
|
||||||
*firstmapname = name;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!firstmapreplaced)
|
if (!mapsadded)
|
||||||
CONS_Printf(M_GetText("No maps added\n"));
|
CONS_Printf(M_GetText("No maps added\n"));
|
||||||
|
|
||||||
// reload status bar (warning should have valid player!)
|
// reload status bar (warning should have valid player!)
|
||||||
|
|
|
@ -59,7 +59,7 @@ void P_ScanThings(INT16 mapnum, INT16 wadnum, INT16 lumpnum);
|
||||||
#endif
|
#endif
|
||||||
void P_LoadThingsOnly(void);
|
void P_LoadThingsOnly(void);
|
||||||
boolean P_SetupLevel(boolean skipprecip);
|
boolean P_SetupLevel(boolean skipprecip);
|
||||||
boolean P_AddWadFile(const char *wadfilename, char **firstmapname);
|
boolean P_AddWadFile(const char *wadfilename);
|
||||||
boolean P_RunSOC(const char *socfilename);
|
boolean P_RunSOC(const char *socfilename);
|
||||||
void P_LoadSoundsRange(UINT16 wadnum, UINT16 first, UINT16 num);
|
void P_LoadSoundsRange(UINT16 wadnum, UINT16 first, UINT16 num);
|
||||||
void P_LoadMusicsRange(UINT16 wadnum, UINT16 first, UINT16 num);
|
void P_LoadMusicsRange(UINT16 wadnum, UINT16 first, UINT16 num);
|
||||||
|
|
Loading…
Reference in a new issue