Fixed PK3s.

-Colormaps, palettes and other stuff are properly loaded now. It was a bug related to the generation of the lump name with files in the root of the PK3.

Known issues:
-Map WADs' REJECT and BLOCKMAP are still not loaded.
This commit is contained in:
Nevur 2017-06-25 14:02:39 +02:00
parent 16336dbe22
commit 35189dc219
3 changed files with 12 additions and 44 deletions

View File

@ -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.

View File

@ -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);

View File

@ -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);