mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-12 23:54:35 +00:00
- since Wads.ReopenLumpNum already performs caching on the lump data it is not really necessary anymore to maintain a separate musiccache, so this code can be removed.
This commit is contained in:
parent
aecff68a4d
commit
4294b94728
1 changed files with 3 additions and 25 deletions
|
@ -2331,8 +2331,6 @@ bool S_StartMusic (const char *m_id)
|
||||||
// specified, it will only be played if the specified CD is in a drive.
|
// specified, it will only be played if the specified CD is in a drive.
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
|
|
||||||
TArray<BYTE> musiccache;
|
|
||||||
|
|
||||||
bool S_ChangeMusic (const char *musicname, int order, bool looping, bool force)
|
bool S_ChangeMusic (const char *musicname, int order, bool looping, bool force)
|
||||||
{
|
{
|
||||||
if (!force && PlayList)
|
if (!force && PlayList)
|
||||||
|
@ -2456,31 +2454,11 @@ bool S_ChangeMusic (const char *musicname, int order, bool looping, bool force)
|
||||||
}
|
}
|
||||||
if (handle == NULL)
|
if (handle == NULL)
|
||||||
{
|
{
|
||||||
if (!Wads.IsUncompressedFile(lumpnum))
|
if (Wads.LumpLength (lumpnum) == 0)
|
||||||
{
|
{
|
||||||
// We must cache the music data and use it from memory.
|
return false;
|
||||||
|
|
||||||
// shut down old music before reallocating and overwriting the cache!
|
|
||||||
S_StopMusic (true);
|
|
||||||
|
|
||||||
length = Wads.LumpLength (lumpnum);
|
|
||||||
if (length == 0)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
musiccache.Resize(length);
|
|
||||||
Wads.ReadLump(lumpnum, &musiccache[0]);
|
|
||||||
|
|
||||||
reader = new MemoryReader((const char*)&musiccache[0], musiccache.Size());
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (Wads.LumpLength (lumpnum) == 0)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
reader = Wads.ReopenLumpNum(lumpnum);
|
|
||||||
}
|
}
|
||||||
|
reader = Wads.ReopenLumpNum(lumpnum);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
Loading…
Reference in a new issue