mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2025-10-30 08:01:28 +00:00
Kill alreadyExists, check for map replacement by going through the level headers and using W_CheckNumForMapPwad
This commit is contained in:
parent
64b418cb27
commit
a669724217
4 changed files with 17 additions and 75 deletions
51
src/d_main.c
51
src/d_main.c
|
|
@ -1132,9 +1132,9 @@ D_ConvertVersionNumbers (void)
|
|||
//
|
||||
void D_SRB2Main(void)
|
||||
{
|
||||
INT32 numbasemapheaders;
|
||||
INT32 i;
|
||||
UINT16 wadnum;
|
||||
lumpinfo_t *lumpinfo;
|
||||
char *name;
|
||||
|
||||
INT32 p;
|
||||
|
|
@ -1397,31 +1397,7 @@ void D_SRB2Main(void)
|
|||
|
||||
#endif //ifndef DEVELOP
|
||||
|
||||
//
|
||||
// search for maps
|
||||
//
|
||||
for (wadnum = 4; wadnum < 6; wadnum++) // fucking arbitrary numbers
|
||||
{
|
||||
lumpinfo = wadfiles[wadnum]->lumpinfo;
|
||||
for (i = 0; i < wadfiles[wadnum]->numlumps; i++, lumpinfo++)
|
||||
{
|
||||
name = lumpinfo->name;
|
||||
|
||||
if (name[0] == 'M' && name[1] == 'A' && name[2] == 'P') // Ignore the headers
|
||||
{
|
||||
INT16 num;
|
||||
if (name[5] != '\0')
|
||||
continue;
|
||||
num = (INT16)M_MapNumber(name[3], name[4]);
|
||||
|
||||
// we want to record whether this map exists. if it doesn't have a header, we can assume it's not relephant
|
||||
if (num <= NUMMAPS && mapheaderinfo[num - 1])
|
||||
{
|
||||
mapheaderinfo[num - 1]->alreadyExists = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
numbasemapheaders = nummapheaders;
|
||||
|
||||
CON_SetLoadingProgress(LOADED_IWAD);
|
||||
|
||||
|
|
@ -1430,32 +1406,17 @@ void D_SRB2Main(void)
|
|||
D_CleanFile(startuppwads);
|
||||
|
||||
//
|
||||
// search for maps... again.
|
||||
// search for maps
|
||||
//
|
||||
for (wadnum = mainwads+1; wadnum < numwadfiles; wadnum++)
|
||||
{
|
||||
lumpinfo = wadfiles[wadnum]->lumpinfo;
|
||||
for (i = 0; i < wadfiles[wadnum]->numlumps; i++, lumpinfo++)
|
||||
for (i = 0; i < numbasemapheaders; ++i)
|
||||
{
|
||||
name = lumpinfo->name;
|
||||
name = mapheaderinfo[i]->lumpname;
|
||||
|
||||
if (name[0] == 'M' && name[1] == 'A' && name[2] == 'P') // Ignore the headers
|
||||
{
|
||||
INT16 num;
|
||||
if (name[5] != '\0')
|
||||
continue;
|
||||
num = (INT16)M_MapNumber(name[3], name[4]);
|
||||
|
||||
// we want to record whether this map exists. if it doesn't have a header, we can assume it's not relephant
|
||||
if (num <= NUMMAPS && mapheaderinfo[num - 1])
|
||||
{
|
||||
if (mapheaderinfo[num - 1]->alreadyExists != false)
|
||||
if (W_CheckNumForMapPwad(name, wadnum, 0) != INT16_MAX)
|
||||
{
|
||||
G_SetGameModified(multiplayer, true); // oops, double-defined - no record attack privileges for you
|
||||
}
|
||||
|
||||
mapheaderinfo[num - 1]->alreadyExists = true;
|
||||
}
|
||||
|
||||
CONS_Printf("%s\n", name);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -395,9 +395,6 @@ typedef struct
|
|||
|
||||
SINT8 musforcereset; ///< Force resetmusic (-1 for default; 0 for force off; 1 for force on)
|
||||
|
||||
// SRB2Kart: Keeps track of if a map lump exists, so we can tell when a map is being replaced.
|
||||
boolean alreadyExists;
|
||||
|
||||
// Lua stuff.
|
||||
// (This is not ifdeffed so the map header structure can stay identical, just in case.)
|
||||
UINT8 numCustomOptions; ///< Internal. For Lua custom value support.
|
||||
|
|
|
|||
|
|
@ -2840,7 +2840,7 @@ void G_DoPlayDemo(char *defdemoname)
|
|||
demo_p += 4; // Extrainfo location
|
||||
|
||||
// ...*map* not loaded?
|
||||
if (!gamemap || (gamemap > NUMMAPS) || !mapheaderinfo[gamemap-1] || !(mapheaderinfo[gamemap-1]->alreadyExists == true))
|
||||
if (!gamemap || (gamemap > NUMMAPS) || !mapheaderinfo[gamemap-1])
|
||||
{
|
||||
snprintf(msg, 1024, M_GetText("%s features a course that is not currently loaded.\n"), pdemoname);
|
||||
CONS_Alert(CONS_ERROR, "%s", msg);
|
||||
|
|
|
|||
|
|
@ -351,8 +351,6 @@ static void P_ClearSingleMapHeaderInfo(INT16 i)
|
|||
{
|
||||
const INT16 num = (INT16)(i-1);
|
||||
|
||||
boolean exists = (mapheaderinfo[gamemap-1]->alreadyExists == true);
|
||||
|
||||
mapheaderinfo[num]->lvlttl[0] = '\0';
|
||||
mapheaderinfo[num]->selectheading[0] = '\0';
|
||||
mapheaderinfo[num]->subttl[0] = '\0';
|
||||
|
|
@ -411,9 +409,6 @@ static void P_ClearSingleMapHeaderInfo(INT16 i)
|
|||
#endif
|
||||
P_DeleteGrades(num);
|
||||
|
||||
// see p_setup.c - prevents replacing maps in addons with different versions
|
||||
mapheaderinfo[num]->alreadyExists = exists;
|
||||
|
||||
mapheaderinfo[num]->customopts = NULL;
|
||||
mapheaderinfo[num]->numCustomOptions = 0;
|
||||
}
|
||||
|
|
@ -4317,6 +4312,8 @@ static lumpinfo_t* FindFolder(const char *folName, UINT16 *start, UINT16 *end, l
|
|||
boolean P_AddWadFile(const char *wadfilename)
|
||||
{
|
||||
size_t i, j, sreplaces = 0, mreplaces = 0, digmreplaces = 0;
|
||||
INT32 numexistingmapheaders = nummapheaders;
|
||||
INT32 map;
|
||||
UINT16 numlumps, wadnum;
|
||||
char *name;
|
||||
lumpinfo_t *lumpinfo;
|
||||
|
|
@ -4466,36 +4463,23 @@ boolean P_AddWadFile(const char *wadfilename)
|
|||
//
|
||||
// search for maps
|
||||
//
|
||||
lumpinfo = wadfiles[wadnum]->lumpinfo;
|
||||
for (i = 0; i < numlumps; i++, lumpinfo++)
|
||||
for (map = 0; map < numexistingmapheaders; ++map)
|
||||
{
|
||||
name = lumpinfo->name;
|
||||
if (name[0] == 'M' && name[1] == 'A' && name[2] == 'P') // Ignore the headers
|
||||
{
|
||||
INT16 num;
|
||||
if (name[5]!='\0')
|
||||
continue;
|
||||
num = (INT16)G_MapNumber(name);
|
||||
name = mapheaderinfo[map]->lumpname;
|
||||
|
||||
// we want to record whether this map exists. if it doesn't have a header, we can assume it's not relephant
|
||||
if (num <= NUMMAPS && mapheaderinfo[num-1])
|
||||
{
|
||||
if (mapheaderinfo[num - 1]->alreadyExists != false)
|
||||
if (W_CheckNumForMapPwad(name, wadnum, 0) != INT16_MAX)
|
||||
{
|
||||
G_SetGameModified(multiplayer, true); // oops, double-defined - no record attack privileges for you
|
||||
}
|
||||
|
||||
mapheaderinfo[num - 1]->alreadyExists = true;
|
||||
}
|
||||
|
||||
//If you replaced the map you're on, end the level when done.
|
||||
if (num == gamemap)
|
||||
if (map == gamemap - 1)
|
||||
replacedcurrentmap = true;
|
||||
|
||||
CONS_Printf("%s\n", name);
|
||||
mapsadded = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (!mapsadded)
|
||||
CONS_Printf(M_GetText("No maps added\n"));
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue