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:
Randy Heit 2015-04-05 20:24:49 -05:00
parent a91997d12c
commit 62d036a63e
8 changed files with 40 additions and 0 deletions

View file

@ -344,6 +344,7 @@ void FResourceFile::PostProcessArchive(void *lumps, size_t lumpsize)
// in the ini file use. We reduce the maximum lump concidered after // in the ini file use. We reduce the maximum lump concidered after
// each one so that we don't risk refiltering already filtered lumps. // each one so that we don't risk refiltering already filtered lumps.
DWORD max = NumLumps; DWORD max = NumLumps;
max -= FilterLumpsByGameType(gameinfo.gametype, lumps, lumpsize, max);
max -= FilterLumps(gameinfo.ConfigName, lumps, lumpsize, max); max -= FilterLumps(gameinfo.ConfigName, lumps, lumpsize, max);
max -= FilterLumps(LumpFilterGroup, lumps, lumpsize, max); max -= FilterLumps(LumpFilterGroup, lumps, lumpsize, max);
max -= FilterLumps(LumpFilterIWAD, 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; 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 // FResourceFile :: JunkLeftoverFilters

View file

@ -72,6 +72,7 @@ private:
DWORD FirstLump; DWORD FirstLump;
int FilterLumps(FString filtername, void *lumps, size_t lumpsize, DWORD max); 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); bool FindPrefixRange(FString filter, void *lumps, size_t lumpsize, DWORD max, DWORD &start, DWORD &end);
void JunkLeftoverFilters(void *lumps, size_t lumpsize, DWORD max); void JunkLeftoverFilters(void *lumps, size_t lumpsize, DWORD max);

View file

@ -1,3 +1,4 @@
/****************************************************************************/ /****************************************************************************/
/* */ /* */
/* DOOM SOUNDS */ /* DOOM SOUNDS */

View file

@ -1,3 +1,4 @@
/****************************************************************************/ /****************************************************************************/
/* */ /* */
/* HERETIC SOUNDS */ /* HERETIC SOUNDS */

View file

@ -1,3 +1,4 @@
/****************************************************************************/ /****************************************************************************/
/* */ /* */
/* HEXEN SOUNDS */ /* HEXEN SOUNDS */

View file

@ -1,3 +1,4 @@
/****************************************************************************/ /****************************************************************************/
/* */ /* */
/* STRIFE SOUNDS */ /* STRIFE SOUNDS */