mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2024-11-22 04:21:23 +00:00
Fix "Several patches used in Sol Sestancia 2 are broken"
This commit is contained in:
parent
8824ce8787
commit
319610763e
2 changed files with 20 additions and 5 deletions
24
src/w_wad.c
24
src/w_wad.c
|
@ -1329,10 +1329,10 @@ UINT16 W_CheckNumForFolderStartPK3(const char *name, UINT16 wad, UINT16 startlum
|
||||||
/* SLADE is special and puts a single directory entry. Skip that. */
|
/* SLADE is special and puts a single directory entry. Skip that. */
|
||||||
if (strlen(lump_p->fullname) == name_length)
|
if (strlen(lump_p->fullname) == name_length)
|
||||||
i++;
|
i++;
|
||||||
break;
|
return i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return i;
|
return INT16_MAX;
|
||||||
}
|
}
|
||||||
|
|
||||||
// In a PK3 type of resource file, it looks for the next lumpinfo entry that doesn't share the specified pathfile.
|
// In a PK3 type of resource file, it looks for the next lumpinfo entry that doesn't share the specified pathfile.
|
||||||
|
@ -1350,6 +1350,17 @@ UINT16 W_CheckNumForFolderEndPK3(const char *name, UINT16 wad, UINT16 startlump)
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Returns 0 if the folder is not empty, 1 if it is empty, -1 if it doesn't exist
|
||||||
|
INT32 W_IsFolderEmpty(const char *name, UINT16 wad)
|
||||||
|
{
|
||||||
|
UINT16 start = W_CheckNumForFolderStartPK3(name, wad, 0);
|
||||||
|
if (start == INT16_MAX)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
// Unlike W_CheckNumForFolderStartPK3, W_CheckNumForFolderEndPK3 doesn't return INT16_MAX.
|
||||||
|
return W_CheckNumForFolderEndPK3(name, wad, start) <= start;
|
||||||
|
}
|
||||||
|
|
||||||
char *W_GetLumpFolderPathPK3(UINT16 wad, UINT16 lump)
|
char *W_GetLumpFolderPathPK3(UINT16 wad, UINT16 lump)
|
||||||
{
|
{
|
||||||
const char *fullname = wadfiles[wad]->lumpinfo[lump].fullname;
|
const char *fullname = wadfiles[wad]->lumpinfo[lump].fullname;
|
||||||
|
@ -1692,7 +1703,7 @@ lumpnum_t W_GetNumForLongName(const char *name)
|
||||||
//
|
//
|
||||||
static UINT16 W_CheckNumForPatchNamePwad(const char *name, UINT16 wad, boolean longname)
|
static UINT16 W_CheckNumForPatchNamePwad(const char *name, UINT16 wad, boolean longname)
|
||||||
{
|
{
|
||||||
UINT16 i, start, end;
|
UINT16 i, start = INT16_MAX, end = INT16_MAX;
|
||||||
static char uname[8 + 1] = { 0 };
|
static char uname[8 + 1] = { 0 };
|
||||||
UINT32 hash = 0;
|
UINT32 hash = 0;
|
||||||
lumpinfo_t *lump_p;
|
lumpinfo_t *lump_p;
|
||||||
|
@ -1714,8 +1725,11 @@ static UINT16 W_CheckNumForPatchNamePwad(const char *name, UINT16 wad, boolean l
|
||||||
// TODO: cache namespace lump IDs
|
// TODO: cache namespace lump IDs
|
||||||
if (W_FileHasFolders(wadfiles[wad]))
|
if (W_FileHasFolders(wadfiles[wad]))
|
||||||
{
|
{
|
||||||
start = W_CheckNumForFolderStartPK3("Flats/", wad, 0);
|
if (!W_IsFolderEmpty("Flats/", wad))
|
||||||
end = W_CheckNumForFolderEndPK3("Flats/", wad, start);
|
{
|
||||||
|
start = W_CheckNumForFolderStartPK3("Flats/", wad, 0);
|
||||||
|
end = W_CheckNumForFolderEndPK3("Flats/", wad, start);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -180,6 +180,7 @@ UINT16 W_CheckNumForMarkerStartPwad(const char *name, UINT16 wad, UINT16 startlu
|
||||||
UINT16 W_CheckNumForFullNamePK3(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_CheckNumForFolderStartPK3(const char *name, UINT16 wad, UINT16 startlump);
|
||||||
UINT16 W_CheckNumForFolderEndPK3(const char *name, UINT16 wad, UINT16 startlump);
|
UINT16 W_CheckNumForFolderEndPK3(const char *name, UINT16 wad, UINT16 startlump);
|
||||||
|
INT32 W_IsFolderEmpty(const char *name, UINT16 wad);
|
||||||
char *W_GetLumpFolderPathPK3(UINT16 wad, UINT16 lump);
|
char *W_GetLumpFolderPathPK3(UINT16 wad, UINT16 lump);
|
||||||
char *W_GetLumpFolderNamePK3(UINT16 wad, UINT16 lump);
|
char *W_GetLumpFolderNamePK3(UINT16 wad, UINT16 lump);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue