- fixed: The WAD manager's hash chains could not handle more than 65535 lumps.

- Reinitializing the WAD manager will now delete all data.
- Preparation for GAMEINFO: zdoom.pk3 will be opened separately before checking the IWAD
  so that the internal GAMEINFOs can be externalized, too.


SVN r1494 (trunk)
This commit is contained in:
Christoph Oelckers 2009-03-21 09:03:08 +00:00
parent 273e4a946d
commit 81f834e3f4
3 changed files with 23 additions and 11 deletions

View file

@ -2239,6 +2239,13 @@ void D_DoomMain (void)
I_FatalError ("Cannot find " BASEWAD); I_FatalError ("Cannot find " BASEWAD);
} }
// Load zdoom.pk3 alone so that we can get access to the internal gameinfos before
// the IWAD is known.
wadlist_t *basewad = (wadlist_t*)M_Malloc(sizeof(wadlist_t) + strlen(wad));
strcpy(basewad->name, wad);
basewad->next = NULL;
Wads.InitMultipleFiles(&basewad);
iwad_info = &IWADInfos[IdentifyVersion(wad)]; iwad_info = &IWADInfos[IdentifyVersion(wad)];
I_SetIWADInfo(iwad_info); I_SetIWADInfo(iwad_info);
GameConfig->DoGameSetup (GameNames[gameinfo.gametype]); GameConfig->DoGameSetup (GameNames[gameinfo.gametype]);

View file

@ -164,6 +164,11 @@ FWadCollection::FWadCollection ()
} }
FWadCollection::~FWadCollection () FWadCollection::~FWadCollection ()
{
DeleteAll();
}
void FWadCollection::DeleteAll ()
{ {
if (FirstLumpIndex != NULL) if (FirstLumpIndex != NULL)
{ {
@ -193,6 +198,7 @@ FWadCollection::~FWadCollection ()
} }
} }
LumpInfo.Clear(); LumpInfo.Clear();
NumLumps = 0;
for (DWORD i = 0; i < Wads.Size(); ++i) for (DWORD i = 0; i < Wads.Size(); ++i)
{ {
@ -217,10 +223,8 @@ void FWadCollection::InitMultipleFiles (wadlist_t **filenames)
int numfiles; int numfiles;
// open all the files, load headers, and count lumps // open all the files, load headers, and count lumps
DeleteAll();
numfiles = 0; numfiles = 0;
Wads.Clear();
LumpInfo.Clear();
NumLumps = 0;
while (*filenames) while (*filenames)
{ {
@ -260,10 +264,10 @@ void FWadCollection::InitMultipleFiles (wadlist_t **filenames)
MergeLumps ("HI_START", "HI_END", ns_hires); MergeLumps ("HI_START", "HI_END", ns_hires);
// [RH] Set up hash table // [RH] Set up hash table
FirstLumpIndex = new WORD[NumLumps]; FirstLumpIndex = new DWORD[NumLumps];
NextLumpIndex = new WORD[NumLumps]; NextLumpIndex = new DWORD[NumLumps];
FirstLumpIndex_FullName = new WORD[NumLumps]; FirstLumpIndex_FullName = new DWORD[NumLumps];
NextLumpIndex_FullName = new WORD[NumLumps]; NextLumpIndex_FullName = new DWORD[NumLumps];
InitHashChains (); InitHashChains ();
} }

View file

@ -224,11 +224,11 @@ protected:
class WadFileRecord; class WadFileRecord;
struct LumpRecord; struct LumpRecord;
WORD *FirstLumpIndex; // [RH] Hashing stuff moved out of lumpinfo structure DWORD *FirstLumpIndex; // [RH] Hashing stuff moved out of lumpinfo structure
WORD *NextLumpIndex; DWORD *NextLumpIndex;
WORD *FirstLumpIndex_FullName; // The same information for fully qualified paths from .zips DWORD *FirstLumpIndex_FullName; // The same information for fully qualified paths from .zips
WORD *NextLumpIndex_FullName; DWORD *NextLumpIndex_FullName;
TArray<LumpRecord> LumpInfo; TArray<LumpRecord> LumpInfo;
@ -249,6 +249,7 @@ private:
void ScanForFlatHack (int startlump); void ScanForFlatHack (int startlump);
void RenameSprites (int startlump); void RenameSprites (int startlump);
void SetLumpAddress(LumpRecord *l); void SetLumpAddress(LumpRecord *l);
void DeleteAll();
}; };
extern FWadCollection Wads; extern FWadCollection Wads;