- ensure for all games that deleting a sprite unlinks all sounds from it.

This was only present in Duke but is needed for all games.
This commit is contained in:
Christoph Oelckers 2020-10-29 00:08:06 +01:00
parent f341fbc1fb
commit 668c34d4c1
3 changed files with 10 additions and 0 deletions

View file

@ -30,6 +30,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "m_crc32.h"
#include "md4.h"
#include "automap.h"
#include "raze_sound.h"
//#include "actor.h"
#include "globals.h"
@ -210,6 +211,9 @@ int qinsertsprite(short nSector, short nStat) // Replace
int DeleteSprite(int nSprite)
{
FVector3 pos = GetSoundPos(&sprite[nSprite].pos);
soundEngine->RelinkSound(SOURCE_Actor, &sprite[nSprite], nullptr, &pos);
if (sprite[nSprite].extra > 0)
{
dbDeleteXSprite(sprite[nSprite].extra);

View file

@ -555,6 +555,9 @@ void mydeletesprite(int nSprite)
I_Error("bad sprite value %d handed to mydeletesprite", nSprite);
}
FVector3 pos = GetSoundPos(&sprite[nSprite].pos);
soundEngine->RelinkSound(SOURCE_Actor, &sprite[nSprite], nullptr, &pos);
deletesprite(nSprite);
if (nSprite == besttarget) {

View file

@ -799,6 +799,9 @@ KillSprite(int16_t SpriteNum)
User[SpriteNum] = 0;
}
FVector3 pos = GetSoundPos(&sprite[SpriteNum].pos);
soundEngine->RelinkSound(SOURCE_Actor, &sprite[SpriteNum], nullptr, &pos);
deletesprite(SpriteNum);
// shred your garbage - but not statnum
statnum = sp->statnum;