mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-29 23:33:00 +00:00
Added gametype-based filter
- For when IWADs are too specific, filter by the base gametype too. - Minor small edits to the sndinfo.txt files so that zipdir will notice the changes, since it doesn't check path names when checking for file differences.
This commit is contained in:
parent
a91997d12c
commit
62d036a63e
8 changed files with 40 additions and 0 deletions
|
@ -344,6 +344,7 @@ void FResourceFile::PostProcessArchive(void *lumps, size_t lumpsize)
|
|||
// in the ini file use. We reduce the maximum lump concidered after
|
||||
// each one so that we don't risk refiltering already filtered lumps.
|
||||
DWORD max = NumLumps;
|
||||
max -= FilterLumpsByGameType(gameinfo.gametype, lumps, lumpsize, max);
|
||||
max -= FilterLumps(gameinfo.ConfigName, lumps, lumpsize, max);
|
||||
max -= FilterLumps(LumpFilterGroup, lumps, lumpsize, max);
|
||||
max -= FilterLumps(LumpFilterIWAD, lumps, lumpsize, max);
|
||||
|
@ -406,6 +407,40 @@ int FResourceFile::FilterLumps(FString filtername, void *lumps, size_t lumpsize,
|
|||
return end - start;
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// FResourceFile :: FilterLumpsByGameType
|
||||
//
|
||||
// Matches any lumps that match "filter/game-<gametype>/*". Includes
|
||||
// inclusive gametypes like Raven.
|
||||
//
|
||||
//==========================================================================
|
||||
|
||||
int FResourceFile::FilterLumpsByGameType(int type, void *lumps, size_t lumpsize, DWORD max)
|
||||
{
|
||||
static const struct { int match; const char *name; } blanket[] =
|
||||
{
|
||||
{ GAME_Raven, "game-Raven" },
|
||||
{ GAME_DoomStrifeChex, "game-DoomStrifeChex" },
|
||||
{ GAME_DoomChex, "game-DoomChex" },
|
||||
};
|
||||
if (type == 0)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
int count = 0;
|
||||
for (int i = 0; i < countof(blanket); ++i)
|
||||
{
|
||||
if (type & blanket[i].match)
|
||||
{
|
||||
count += FilterLumps(blanket[i].name, lumps, lumpsize, max);
|
||||
}
|
||||
}
|
||||
FString filter = "game-";
|
||||
filter += GameNames[type];
|
||||
return count + FilterLumps(filter, lumps, lumpsize, max);
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// FResourceFile :: JunkLeftoverFilters
|
||||
|
|
|
@ -72,6 +72,7 @@ private:
|
|||
DWORD FirstLump;
|
||||
|
||||
int FilterLumps(FString filtername, void *lumps, size_t lumpsize, DWORD max);
|
||||
int FilterLumpsByGameType(int gametype, void *lumps, size_t lumpsize, DWORD max);
|
||||
bool FindPrefixRange(FString filter, void *lumps, size_t lumpsize, DWORD max, DWORD &start, DWORD &end);
|
||||
void JunkLeftoverFilters(void *lumps, size_t lumpsize, DWORD max);
|
||||
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
|
||||
/****************************************************************************/
|
||||
/* */
|
||||
/* DOOM SOUNDS */
|
|
@ -1,3 +1,4 @@
|
|||
|
||||
/****************************************************************************/
|
||||
/* */
|
||||
/* HERETIC SOUNDS */
|
|
@ -1,3 +1,4 @@
|
|||
|
||||
/****************************************************************************/
|
||||
/* */
|
||||
/* HEXEN SOUNDS */
|
|
@ -1,3 +1,4 @@
|
|||
|
||||
/****************************************************************************/
|
||||
/* */
|
||||
/* STRIFE SOUNDS */
|
Loading…
Reference in a new issue