- added an integrity check to the SNDINFO parser to detect and eliminate recursive links. Normally these would crash the sound code later.

- allow recursive linking of $random definitions (as long as they do not link back, see above.)
- fixed the sound precaching which did not handle $alias inside $random. Normally this went undetected but in cases where the random sound index was the same as a sound index in the current link chain this could hang the function.
This commit is contained in:
Christoph Oelckers 2016-09-30 10:50:41 +02:00
commit b400cf1454
2 changed files with 107 additions and 11 deletions

View file

@ -522,18 +522,19 @@ void S_CacheSound (sfxinfo_t *sfx)
{
return;
}
else if (sfx->bRandomHeader)
sfxinfo_t *orig = sfx;
while (!sfx->bRandomHeader && sfx->link != sfxinfo_t::NO_LINK)
{
S_CacheRandomSound (sfx);
sfx = &S_sfx[sfx->link];
}
if (sfx->bRandomHeader)
{
S_CacheRandomSound(sfx);
}
else
{
while (sfx->link != sfxinfo_t::NO_LINK)
{
sfx = &S_sfx[sfx->link];
}
S_LoadSound(sfx);
sfx->bUsed = true;
S_LoadSound (sfx);
}
}
}