diff --git a/src/p_setup.c b/src/p_setup.c index 2cc70e6a0..896f38ba9 100644 --- a/src/p_setup.c +++ b/src/p_setup.c @@ -2746,10 +2746,10 @@ boolean P_SetupLevel(boolean skipprecip) P_MakeMapMD5(lastloadedmaplumpnum, &mapmd5); - // HACK ALERT: Cache the WAD, get the map data into the table, free memory. + // HACK ALERT: Cache the WAD, get the map data into the tables, free memory. // As it is implemented right now, we're assuming an uncompressed WAD. // (As in, a normal PWAD, not ZWAD or anything. The lump itself can be compressed.) - // Basically this is a nerfed&modified version of W_InitFile from w_wad. + // We're not accounting for extra lumps and scrambled lump positions. Any additional data will cause an error. lumpfullName = (wadfiles[WADFILENUM(lastloadedmaplumpnum)]->lumpinfo + LUMPNUM(lastloadedmaplumpnum))->name2; if (!strnicmp(lumpfullName + strlen(lumpfullName) - 4, ".wad", 4)) { @@ -2765,7 +2765,6 @@ boolean P_SetupLevel(boolean skipprecip) P_LoadRawSubsectors(wadData + (fileinfo + ML_SSECTORS)->filepos, (fileinfo + ML_SSECTORS)->size); P_LoadRawNodes(wadData + (fileinfo + ML_NODES)->filepos, (fileinfo + ML_NODES)->size); P_LoadRawSegs(wadData + (fileinfo + ML_SEGS)->filepos, (fileinfo + ML_SEGS)->size); -// P_LoadReject(lastloadedmaplumpnum + ML_REJECT); // Important: take care of the ordering of the next functions. if (!loadedbm) @@ -3106,27 +3105,6 @@ boolean P_RunSOC(const char *socfilename) return true; } -#ifdef HAVE_BLUA -// Auxiliary function for PK3 loading - runs Lua scripts from range. -void P_LoadLuaScrRange(UINT16 wadnum, UINT16 first, UINT16 num) -{ - for (; num > 0; num--, first++) - { - LUA_LoadLump(wadnum, first); - } -} -#endif - -// Auxiliary function for PK3 loading - runs SOCs from range. -void P_LoadDehackRange(UINT16 wadnum, UINT16 first, UINT16 num) -{ - for (; num > 0; num--, first++) - { - CONS_Printf(M_GetText("Loading SOC from %s\n"), wadfiles[wadnum]->filename); - DEH_LoadDehackedLumpPwad(wadnum, first); - } -} - // Auxiliary function for PK3 loading - looks for sound replacements. // NOTE: it does not really add any new sound entry or anything. void P_LoadSoundsRange(UINT16 wadnum, UINT16 first, UINT16 num) @@ -3150,8 +3128,8 @@ void P_LoadSoundsRange(UINT16 wadnum, UINT16 first, UINT16 num) } } -// Auxiliary function for PK3 loading - looks for sound replacements. -// NOTE: does nothing but print debug messages. +// Auxiliary function for PK3 loading - looks for music and music replacements. +// NOTE: does nothing but print debug messages. The code is handled somewhere else. void P_LoadMusicsRange(UINT16 wadnum, UINT16 first, UINT16 num) { lumpinfo_t *lumpinfo = wadfiles[wadnum]->lumpinfo + first; @@ -3195,7 +3173,7 @@ boolean P_AddWadFile(const char *wadfilename, char **firstmapname) UINT16 texPos, texNum = 0; // UINT16 patPos, patNum = 0; // UINT16 flaPos, flaNum = 0; - UINT16 mapPos, mapNum = 0; +// UINT16 mapPos, mapNum = 0; // Init file. if ((numlumps = W_InitFile(wadfilename)) == INT16_MAX) @@ -3218,12 +3196,8 @@ boolean P_AddWadFile(const char *wadfilename, char **firstmapname) lumpinfo++; *start = ++i; for (; i < numlumps; i++, lumpinfo++) - { if (strnicmp(lumpinfo->name2, folName, strlen(folName))) - { break; - } - } lumpinfo--; *end = i-- - *start; return; @@ -3243,7 +3217,7 @@ boolean P_AddWadFile(const char *wadfilename, char **firstmapname) FindFolder("Textures/", &texPos, &texNum); // FindFolder("Patches/", &patPos, &patNum); // FindFolder("Flats/", &flaPos, &flaNum); - FindFolder("Maps/", &mapPos, &mapNum); +// FindFolder("Maps/", &mapPos, &mapNum); } // Update the detected resources. diff --git a/src/r_data.c b/src/r_data.c index 65ec67bc1..dcfdb27a5 100644 --- a/src/r_data.c +++ b/src/r_data.c @@ -571,12 +571,11 @@ void R_LoadTextures(void) { texstart = W_CheckNumForFolderStartPK3("textures/", (UINT16)w, 0); texend = W_CheckNumForFolderEndPK3("textures/", (UINT16)w, texstart); - texturesLumpPos = W_CheckNumForFullNamePK3("TEXTURES", (UINT16)w, 0); + texturesLumpPos = W_CheckNumForNamePwad("TEXTURES", (UINT16)w, 0); while (texturesLumpPos != INT16_MAX) { - CONS_Printf("AAA\n"); numtextures += R_CountTexturesInTEXTURESLump((UINT16)w, (UINT16)texturesLumpPos); - texturesLumpPos = W_CheckNumForFullNamePK3("TEXTURES", (UINT16)w, texturesLumpPos + 1); + texturesLumpPos = W_CheckNumForNamePwad("TEXTURES", (UINT16)w, texturesLumpPos + 1); } } else @@ -625,11 +624,11 @@ void R_LoadTextures(void) { texstart = W_CheckNumForFolderStartPK3("textures/", (UINT16)w, 0); texend = W_CheckNumForFolderEndPK3("textures/", (UINT16)w, texstart); - texturesLumpPos = W_CheckNumForFullNamePK3("TEXTURES", (UINT16)w, 0); + texturesLumpPos = W_CheckNumForNamePwad("TEXTURES", (UINT16)w, 0); while (texturesLumpPos != INT16_MAX) { R_ParseTEXTURESLump(w, texturesLumpPos, &i); - texturesLumpPos = W_CheckNumForFullNamePK3("TEXTURES", (UINT16)w, texturesLumpPos + 1); + texturesLumpPos = W_CheckNumForNamePwad("TEXTURES", (UINT16)w, texturesLumpPos + 1); } } else @@ -1300,7 +1299,6 @@ void R_ReInitColormaps(UINT16 num) { char colormap[9] = "COLORMAP"; lumpnum_t lump; - CONS_Printf("Reinitting colormaps...\n"); if (num > 0 && num <= 10000) snprintf(colormap, 8, "CLM%04u", num-1); diff --git a/src/w_wad.c b/src/w_wad.c index 209578f62..4b0665679 100644 --- a/src/w_wad.c +++ b/src/w_wad.c @@ -523,22 +523,18 @@ UINT16 W_InitFile(const char *filename) fseek(handle, rememberPos, SEEK_SET); // Let's go back to the central dir. lumpinfo[numlumps].disksize = eCompSize; lumpinfo[numlumps].size = eSize; + // We will trim the file's full name so that only the filename is left. namePos = eNameLen - 1; while(namePos--) - { if(eName[namePos] == '/') - { - namePos++; break; - } - } + namePos++; // We will remove the file extension too. nameEnd = 0; while(nameEnd++ < 8) if(eName[namePos + nameEnd] == '.') break; - memset(lumpinfo[numlumps].name, '\0', 9); strncpy(lumpinfo[numlumps].name, eName + namePos, nameEnd);