diff --git a/src/d_main.c b/src/d_main.c index e28dc1c5c..ec4fe5425 100644 --- a/src/d_main.c +++ b/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 + if (W_CheckNumForMapPwad(name, wadnum, 0) != INT16_MAX) { - 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) - { - G_SetGameModified(multiplayer, true); // oops, double-defined - no record attack privileges for you - } - - mapheaderinfo[num - 1]->alreadyExists = true; - } + G_SetGameModified(multiplayer, true); // oops, double-defined - no record attack privileges for you CONS_Printf("%s\n", name); } diff --git a/src/doomstat.h b/src/doomstat.h index 91ca7b0ea..7f9dcac93 100644 --- a/src/doomstat.h +++ b/src/doomstat.h @@ -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. diff --git a/src/g_demo.c b/src/g_demo.c index a841afa9e..89846d1a9 100644 --- a/src/g_demo.c +++ b/src/g_demo.c @@ -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); diff --git a/src/p_setup.c b/src/p_setup.c index 4a50e2d08..d44b477bc 100644 --- a/src/p_setup.c +++ b/src/p_setup.c @@ -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 + name = mapheaderinfo[map]->lumpname; + + if (W_CheckNumForMapPwad(name, wadnum, 0) != INT16_MAX) { - INT16 num; - if (name[5]!='\0') - continue; - num = (INT16)G_MapNumber(name); - - // 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) - { - G_SetGameModified(multiplayer, true); // oops, double-defined - no record attack privileges for you - } - - mapheaderinfo[num - 1]->alreadyExists = true; - } + G_SetGameModified(multiplayer, true); // oops, double-defined - no record attack privileges for you //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"));