Let animsound value -1 stop all sounds.

git-svn-id: https://svn.eduke32.com/eduke32@6284 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
hendricks266 2017-06-25 11:24:27 +00:00
parent 018bc98ecb
commit 5f8c99c3a1
3 changed files with 18 additions and 4 deletions

View file

@ -36,6 +36,9 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "animsounds.h"
// animsound_t.sound
EDUKE32_STATIC_ASSERT(INT16_MAX >= MAXSOUNDS);
hashtable_t h_dukeanim = { 8, NULL };
dukeanim_t * g_animPtr;
@ -196,7 +199,12 @@ int32_t Anim_Play(const char *fn)
framenum++;
while (soundidx < anim->numsounds && anim->sounds[soundidx].frame == framenum)
{
S_PlaySound(anim->sounds[soundidx].sound);
int16_t sound = anim->sounds[soundidx].sound;
if (sound == -1)
FX_StopAllSounds();
else
S_PlaySound(sound);
soundidx++;
}
@ -335,7 +343,12 @@ int32_t Anim_Play(const char *fn)
while (soundidx < anim->numsounds && anim->sounds[soundidx].frame == (uint16_t)i)
{
S_PlaySound(anim->sounds[soundidx].sound);
int16_t sound = anim->sounds[soundidx].sound;
if (sound == -1)
FX_StopAllSounds();
else
S_PlaySound(sound);
soundidx++;
}

View file

@ -24,7 +24,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#define anim_h_
typedef struct {
uint16_t frame, sound;
uint16_t frame;
int16_t sound;
} animsound_t;
typedef struct

View file

@ -5120,7 +5120,7 @@ static void parsedefinitions_game_animsounds(scriptfile *pScript, char * blockEn
lastFrameNum = frameNum;
if ((unsigned)soundNum >= MAXSOUNDS)
if ((unsigned)soundNum >= MAXSOUNDS && soundNum != -1)
{
initprintf("Error: sound number #%d invalid on line %s:%d\n", soundNum, pScript->filename,
scriptfile_getlinum(pScript, pScript->ltextptr));