P_AddWadFile: for both WADs and pk3s, if a sound is found to replace an existing sound, don't go on looking for more with the same name (since there shouldn't be any)

This commit is contained in:
Monster Iestyn 2018-01-04 21:06:26 +00:00
parent 03020036d4
commit 0e8db59f4b

View file

@ -3163,6 +3163,7 @@ void P_LoadSoundsRange(UINT16 wadnum, UINT16 first, UINT16 num)
CONS_Debug(DBG_SETUP, "Sound %.8s replaced\n", lumpinfo->name); CONS_Debug(DBG_SETUP, "Sound %.8s replaced\n", lumpinfo->name);
I_FreeSfx(&S_sfx[j]); I_FreeSfx(&S_sfx[j]);
break; // there shouldn't be two sounds with the same name, so stop looking
} }
} }
} }
@ -3290,7 +3291,9 @@ boolean P_AddWadFile(const char *wadfilename)
name = lumpinfo->name; name = lumpinfo->name;
if (name[0] == 'D') if (name[0] == 'D')
{ {
if (name[1] == 'S') for (j = 1; j < NUMSFX; j++) 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))
{ {
@ -3301,6 +3304,8 @@ boolean P_AddWadFile(const char *wadfilename)
I_FreeSfx(&S_sfx[j]); I_FreeSfx(&S_sfx[j]);
sreplaces++; sreplaces++;
break; // there shouldn't be two sounds with the same name, so stop looking
}
} }
} }
else if (name[1] == '_') else if (name[1] == '_')