Move FindFolder
This commit is contained in:
parent
c89b1ec234
commit
3e3065f67c
|
@ -3189,6 +3189,27 @@ void P_LoadMusicsRange(UINT16 wadnum, UINT16 first, UINT16 num)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Auxiliary function - input a folder name and gives us the resource markers positions.
|
||||||
|
static lumpinfo_t* FindFolder(const char *folName, UINT16 *start, UINT16 *end, lumpinfo_t *lumpinfo, UINT16 *pnumlumps, size_t *pi)
|
||||||
|
{
|
||||||
|
UINT16 numlumps = *pnumlumps;
|
||||||
|
size_t i = *pi;
|
||||||
|
if (!stricmp(lumpinfo->name2, folName))
|
||||||
|
{
|
||||||
|
lumpinfo++;
|
||||||
|
*start = ++i;
|
||||||
|
for (; i < numlumps; i++, lumpinfo++)
|
||||||
|
if (strnicmp(lumpinfo->name2, folName, strlen(folName)))
|
||||||
|
break;
|
||||||
|
lumpinfo--;
|
||||||
|
*end = i-- - *start;
|
||||||
|
*pi = i;
|
||||||
|
*pnumlumps = numlumps;
|
||||||
|
return lumpinfo;
|
||||||
|
}
|
||||||
|
return lumpinfo;
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Add a wadfile to the active wad files,
|
// Add a wadfile to the active wad files,
|
||||||
// replace sounds, musics, patches, textures, sprites and maps
|
// replace sounds, musics, patches, textures, sprites and maps
|
||||||
|
@ -3228,37 +3249,19 @@ boolean P_AddWadFile(const char *wadfilename, char **firstmapname)
|
||||||
switch(wadfiles[wadnum]->type)
|
switch(wadfiles[wadnum]->type)
|
||||||
{
|
{
|
||||||
case RET_PK3:
|
case RET_PK3:
|
||||||
{
|
|
||||||
// Auxiliary function - input a folder name and gives us the resource markers positions.
|
|
||||||
void FindFolder(const char *folName, UINT16 *start, UINT16 *end)
|
|
||||||
{
|
|
||||||
if (!stricmp(lumpinfo->name2, folName))
|
|
||||||
{
|
|
||||||
lumpinfo++;
|
|
||||||
*start = ++i;
|
|
||||||
for (; i < numlumps; i++, lumpinfo++)
|
|
||||||
if (strnicmp(lumpinfo->name2, folName, strlen(folName)))
|
|
||||||
break;
|
|
||||||
lumpinfo--;
|
|
||||||
*end = i-- - *start;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Look for the lumps that act as resource delimitation markers.
|
// Look for the lumps that act as resource delimitation markers.
|
||||||
lumpinfo = wadfiles[wadnum]->lumpinfo;
|
lumpinfo = wadfiles[wadnum]->lumpinfo;
|
||||||
for (i = 0; i < numlumps; i++, lumpinfo++)
|
for (i = 0; i < numlumps; i++, lumpinfo++)
|
||||||
{
|
{
|
||||||
// FindFolder("Lua/", &luaPos, &luaNum);
|
// lumpinfo = FindFolder("Lua/", &luaPos, &luaNum, lumpinfo, &numlumps, &i);
|
||||||
// FindFolder("SOCs/", &socPos, &socNum);
|
// lumpinfo = FindFolder("SOCs/", &socPos, &socNum, lumpinfo, &numlumps, &i);
|
||||||
FindFolder("Sounds/", &sfxPos, &sfxNum);
|
lumpinfo = FindFolder("Sounds/", &sfxPos, &sfxNum, lumpinfo, &numlumps, &i);
|
||||||
FindFolder("Music/", &musPos, &musNum);
|
lumpinfo = FindFolder("Music/", &musPos, &musNum, lumpinfo, &numlumps, &i);
|
||||||
// FindFolder("Sprites/", &sprPos, &sprNum);
|
// lumpinfo = FindFolder("Sprites/", &sprPos, &sprNum, lumpinfo, &numlumps, &i);
|
||||||
FindFolder("Textures/", &texPos, &texNum);
|
lumpinfo = FindFolder("Textures/", &texPos, &texNum, lumpinfo, &numlumps, &i);
|
||||||
// FindFolder("Patches/", &patPos, &patNum);
|
// lumpinfo = FindFolder("Patches/", &patPos, &patNum, lumpinfo, &numlumps, &i);
|
||||||
// FindFolder("Flats/", &flaPos, &flaNum);
|
// lumpinfo = FindFolder("Flats/", &flaPos, &flaNum, lumpinfo, &numlumps, &i);
|
||||||
// FindFolder("Maps/", &mapPos, &mapNum);
|
// lumpinfo = FindFolder("Maps/", &mapPos, &mapNum, lumpinfo, &numlumps, &i);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update the detected resources.
|
// Update the detected resources.
|
||||||
|
@ -3279,7 +3282,6 @@ boolean P_AddWadFile(const char *wadfilename, char **firstmapname)
|
||||||
// R_LoadTextures();
|
// R_LoadTextures();
|
||||||
// if (mapNum) // Maps. TODO: Actually implement the map WAD loading code, lulz.
|
// if (mapNum) // Maps. TODO: Actually implement the map WAD loading code, lulz.
|
||||||
// P_LoadWadMapRange(wadnum, mapPos, mapNum);
|
// P_LoadWadMapRange(wadnum, mapPos, mapNum);
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
lumpinfo = wadfiles[wadnum]->lumpinfo;
|
lumpinfo = wadfiles[wadnum]->lumpinfo;
|
||||||
|
|
Loading…
Reference in New Issue