Fix freeing sounds that aren't actually replaced
This commit is contained in:
1 parent
7dfad132dd
commit
b79a05f25b
1 file changed
+6
-1
+6
-1
@@ -3508,11 +3508,12 @@ UINT16 P_PartialAddWadFile(const char *wadfilename, boolean local)
|
||||
for (i = 0; i < numlumps; i++, lumpinfo++)
|
||||
{
|
||||
name = lumpinfo->name;
|
||||
lumpnum_t lumpnum = i|(wadnum<<16);
|
||||
if (name[0] == 'D')
|
||||
{
|
||||
if (name[1] == 'S') for (j = 1; j < NUMSFX; j++)
|
||||
{
|
||||
if (S_sfx[j].name && !strnicmp(S_sfx[j].name, name + 2, 6))
|
||||
if (S_sfx[j].name && !strnicmp(S_sfx[j].name, name + 2, 6) && S_sfx[j].lumpnum != lumpnum && S_sfx[j].lumpnum != LUMPERROR)
|
||||
{
|
||||
// the sound will be reloaded when needed,
|
||||
// since sfx->data will be NULL
|
||||
@@ -3520,6 +3521,10 @@ UINT16 P_PartialAddWadFile(const char *wadfilename, boolean local)
|
||||
|
||||
I_FreeSfx(&S_sfx[j]);
|
||||
|
||||
// Re-cache it
|
||||
if (!sound_disabled && (M_CheckParm("-precachesound") || precachesound.value))
|
||||
S_sfx[j].data = I_GetSfx(&S_sfx[j]);
|
||||
|
||||
sreplaces++;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user