- changed lump reader setup for music so that for uncompressed data it opens a new FILE instead of caching the lump.
This reinstates behavior of pre-OpenAL versions but still uses the FileReader interface to keep the simplified code of the OpenAL branch.
This commit is contained in:
parent
4294b94728
commit
13fb76db21
3 changed files with 46 additions and 1 deletions
|
|
@ -1228,6 +1228,17 @@ FWadLump *FWadCollection::ReopenLumpNum (int lump)
|
|||
return new FWadLump(LumpInfo[lump].lump, true);
|
||||
}
|
||||
|
||||
FWadLump *FWadCollection::ReopenLumpNumNewFile (int lump)
|
||||
{
|
||||
if ((unsigned)lump >= (unsigned)LumpInfo.Size())
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return new FWadLump(lump, LumpInfo[lump].lump);
|
||||
}
|
||||
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// GetFileReader
|
||||
|
|
@ -1417,6 +1428,34 @@ FWadLump::FWadLump(FResourceLump *lump, bool alwayscache)
|
|||
}
|
||||
}
|
||||
|
||||
FWadLump::FWadLump(int lumpnum, FResourceLump *lump)
|
||||
: FileReader()
|
||||
{
|
||||
FileReader *f = lump->GetReader();
|
||||
|
||||
if (f != NULL && f->GetFile() != NULL)
|
||||
{
|
||||
// Uncompressed lump in a file. For this we will have to open a new FILE, since we need it for streaming
|
||||
int fileno = Wads.GetLumpFile(lumpnum);
|
||||
const char *filename = Wads.GetWadFullName(fileno);
|
||||
File = fopen(filename, "rb");
|
||||
if (File != NULL)
|
||||
{
|
||||
Length = lump->LumpSize;
|
||||
StartPos = FilePos = lump->GetFileOffset();
|
||||
Lump = NULL;
|
||||
CloseOnDestruct = true;
|
||||
Seek(0, SEEK_SET);
|
||||
return;
|
||||
}
|
||||
}
|
||||
File = NULL;
|
||||
Length = lump->LumpSize;
|
||||
StartPos = FilePos = 0;
|
||||
Lump = lump;
|
||||
Lump->CacheLump();
|
||||
}
|
||||
|
||||
FWadLump::~FWadLump()
|
||||
{
|
||||
if (Lump != NULL)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue