mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2025-01-31 21:50:48 +00:00
Don't skip the first directory entry of PK3 if it's a file
Also puts the marker skipping in the WAD API.
This commit is contained in:
parent
7805828c4a
commit
0a53f91820
4 changed files with 30 additions and 22 deletions
20
src/r_data.c
20
src/r_data.c
|
@ -716,14 +716,12 @@ Rloadflats (INT32 i, INT32 w)
|
|||
}
|
||||
else
|
||||
{
|
||||
texstart = W_CheckNumForNamePwad("F_START", (UINT16)w, 0);
|
||||
texstart = W_CheckNumForMarkerStartPwad("F_START", (UINT16)w, 0);
|
||||
texend = W_CheckNumForNamePwad("F_END", (UINT16)w, texstart);
|
||||
}
|
||||
|
||||
if (!( texstart == INT16_MAX || texend == INT16_MAX ))
|
||||
{
|
||||
texstart++; // Do not count the first marker
|
||||
|
||||
// Work through each lump between the markers in the WAD.
|
||||
for (j = 0; j < (texend - texstart); j++)
|
||||
{
|
||||
|
@ -836,7 +834,7 @@ Rloadtextures (INT32 i, INT32 w)
|
|||
}
|
||||
else
|
||||
{
|
||||
texstart = W_CheckNumForNamePwad(TX_START, (UINT16)w, 0);
|
||||
texstart = W_CheckNumForMarkerStartPwad(TX_START, (UINT16)w, 0);
|
||||
texend = W_CheckNumForNamePwad(TX_END, (UINT16)w, 0);
|
||||
texturesLumpPos = W_CheckNumForNamePwad("TEXTURES", (UINT16)w, 0);
|
||||
if (texturesLumpPos != INT16_MAX)
|
||||
|
@ -845,8 +843,6 @@ Rloadtextures (INT32 i, INT32 w)
|
|||
|
||||
if (!( texstart == INT16_MAX || texend == INT16_MAX ))
|
||||
{
|
||||
texstart++; // Do not count the first marker
|
||||
|
||||
// Work through each lump between the markers in the WAD.
|
||||
for (j = 0; j < (texend - texstart); j++)
|
||||
{
|
||||
|
@ -953,14 +949,12 @@ void R_LoadTextures(void)
|
|||
}
|
||||
else
|
||||
{
|
||||
texstart = W_CheckNumForNamePwad("F_START", (UINT16)w, 0);
|
||||
texstart = W_CheckNumForMarkerStartPwad("F_START", (UINT16)w, 0);
|
||||
texend = W_CheckNumForNamePwad("F_END", (UINT16)w, texstart);
|
||||
}
|
||||
|
||||
if (!( texstart == INT16_MAX || texend == INT16_MAX ))
|
||||
{
|
||||
texstart++; // Do not count the first marker
|
||||
|
||||
// PK3s have subfolders, so we can't just make a simple sum
|
||||
if (wadfiles[w]->type == RET_PK3)
|
||||
{
|
||||
|
@ -993,15 +987,13 @@ void R_LoadTextures(void)
|
|||
}
|
||||
else
|
||||
{
|
||||
texstart = W_CheckNumForNamePwad(TX_START, (UINT16)w, 0);
|
||||
texstart = W_CheckNumForMarkerStartPwad(TX_START, (UINT16)w, 0);
|
||||
texend = W_CheckNumForNamePwad(TX_END, (UINT16)w, 0);
|
||||
}
|
||||
|
||||
if (texstart == INT16_MAX || texend == INT16_MAX)
|
||||
continue;
|
||||
|
||||
texstart++; // Do not count the first marker
|
||||
|
||||
// PK3s have subfolders, so we can't just make a simple sum
|
||||
if (wadfiles[w]->type == RET_PK3)
|
||||
{
|
||||
|
@ -1587,9 +1579,9 @@ lumpnum_t R_GetFlatNumForName(const char *name)
|
|||
switch (wadfiles[i]->type)
|
||||
{
|
||||
case RET_WAD:
|
||||
if ((start = W_CheckNumForNamePwad("F_START", (UINT16)i, 0)) == INT16_MAX)
|
||||
if ((start = W_CheckNumForMarkerStartPwad("F_START", (UINT16)i, 0)) == INT16_MAX)
|
||||
{
|
||||
if ((start = W_CheckNumForNamePwad("FF_START", (UINT16)i, 0)) == INT16_MAX)
|
||||
if ((start = W_CheckNumForMarkerStartPwad("FF_START", (UINT16)i, 0)) == INT16_MAX)
|
||||
continue;
|
||||
else if ((end = W_CheckNumForNamePwad("FF_END", (UINT16)i, start)) == INT16_MAX)
|
||||
continue;
|
||||
|
|
|
@ -437,9 +437,9 @@ void R_AddSpriteDefs(UINT16 wadnum)
|
|||
switch (wadfiles[wadnum]->type)
|
||||
{
|
||||
case RET_WAD:
|
||||
start = W_CheckNumForNamePwad("S_START", wadnum, 0);
|
||||
start = W_CheckNumForMarkerStartPwad("S_START", wadnum, 0);
|
||||
if (start == INT16_MAX)
|
||||
start = W_CheckNumForNamePwad("SS_START", wadnum, 0); //deutex compatib.
|
||||
start = W_CheckNumForMarkerStartPwad("SS_START", wadnum, 0); //deutex compatib.
|
||||
|
||||
end = W_CheckNumForNamePwad("S_END",wadnum,start);
|
||||
if (end == INT16_MAX)
|
||||
|
@ -461,8 +461,6 @@ void R_AddSpriteDefs(UINT16 wadnum)
|
|||
|
||||
start = 0; //let say S_START is lump 0
|
||||
}
|
||||
else
|
||||
start++; // just after S_START
|
||||
|
||||
if (end == INT16_MAX || start >= end)
|
||||
{
|
||||
|
|
23
src/w_wad.c
23
src/w_wad.c
|
@ -194,7 +194,6 @@ static inline void W_LoadDehackedLumpsPK3(UINT16 wadnum, boolean mainfile)
|
|||
if (posStart != INT16_MAX)
|
||||
{
|
||||
posEnd = W_CheckNumForFolderEndPK3("Lua/", wadnum, posStart);
|
||||
posStart++; // first "lump" will be "Lua/" folder itself, so ignore it
|
||||
for (; posStart < posEnd; posStart++)
|
||||
LUA_LoadLump(wadnum, posStart);
|
||||
}
|
||||
|
@ -204,7 +203,6 @@ static inline void W_LoadDehackedLumpsPK3(UINT16 wadnum, boolean mainfile)
|
|||
{
|
||||
posEnd = W_CheckNumForFolderEndPK3("SOC/", wadnum, posStart);
|
||||
|
||||
posStart++; // first "lump" will be "SOC/" folder itself, so ignore it
|
||||
for(; posStart < posEnd; posStart++)
|
||||
{
|
||||
lumpinfo_t *lump_p = &wadfiles[wadnum]->lumpinfo[posStart];
|
||||
|
@ -912,15 +910,32 @@ UINT16 W_CheckNumForNamePwad(const char *name, UINT16 wad, UINT16 startlump)
|
|||
return INT16_MAX;
|
||||
}
|
||||
|
||||
UINT16
|
||||
W_CheckNumForMarkerStartPwad (const char *name, UINT16 wad, UINT16 startlump)
|
||||
{
|
||||
UINT16 marker;
|
||||
marker = W_CheckNumForNamePwad(name, wad, startlump);
|
||||
if (marker != INT16_MAX)
|
||||
marker++; // Do not count the first marker
|
||||
return marker;
|
||||
}
|
||||
|
||||
// Look for the first lump from a folder.
|
||||
UINT16 W_CheckNumForFolderStartPK3(const char *name, UINT16 wad, UINT16 startlump)
|
||||
{
|
||||
size_t name_length;
|
||||
INT32 i;
|
||||
lumpinfo_t *lump_p = wadfiles[wad]->lumpinfo + startlump;
|
||||
name_length = strlen(name);
|
||||
for (i = startlump; i < wadfiles[wad]->numlumps; i++, lump_p++)
|
||||
{
|
||||
if (strnicmp(name, lump_p->name2, strlen(name)) == 0)
|
||||
if (strnicmp(name, lump_p->name2, name_length) == 0)
|
||||
{
|
||||
/* SLADE is special and puts a single directory entry. Skip that. */
|
||||
if (strlen(lump_p->name2) == name_length)
|
||||
i++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return i;
|
||||
}
|
||||
|
@ -1023,7 +1038,7 @@ lumpnum_t W_CheckNumForMap(const char *name)
|
|||
else
|
||||
continue;
|
||||
// Now look for the specified map.
|
||||
for (++lumpNum; lumpNum < end; lumpNum++)
|
||||
for (; lumpNum < end; lumpNum++)
|
||||
if (!strnicmp(name, (wadfiles[i]->lumpinfo + lumpNum)->name, 8))
|
||||
return (i<<16) + lumpNum;
|
||||
}
|
||||
|
|
|
@ -157,6 +157,9 @@ const char *W_CheckNameForNum(lumpnum_t lumpnum);
|
|||
|
||||
UINT16 W_CheckNumForNamePwad(const char *name, UINT16 wad, UINT16 startlump); // checks only in one pwad
|
||||
|
||||
/* Find the first lump after F_START for instance. */
|
||||
UINT16 W_CheckNumForMarkerStartPwad(const char *name, UINT16 wad, UINT16 startlump);
|
||||
|
||||
UINT16 W_CheckNumForFullNamePK3(const char *name, UINT16 wad, UINT16 startlump);
|
||||
UINT16 W_CheckNumForFolderStartPK3(const char *name, UINT16 wad, UINT16 startlump);
|
||||
UINT16 W_CheckNumForFolderEndPK3(const char *name, UINT16 wad, UINT16 startlump);
|
||||
|
|
Loading…
Reference in a new issue