Fixed crash that happened with WW2GI. Thanks to supergoofy for helping me to find the problem.

The problem was there(GAME.CON)
// loading screen
onevent EVENT_GETLOADTILE
{
sound AAVE // uses spritesound and crashes
}
endevent

Note: the sound was supposed to be played once but with my approach it plays several sounds simultaneously and that's bad. I have chosen not to limit the sound command usage for WW2GI compatibility. I doubt whether I should commit this and decided that it's better to do after all.
If you have a better approach, you're welcome.

git-svn-id: https://svn.eduke32.com/eduke32@805 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
hnt_ts 2008-06-18 08:46:20 +00:00
parent 03b98ea54c
commit 88c8e0681f
1 changed files with 8 additions and 1 deletions

View File

@ -512,17 +512,23 @@ void sound(int num)
int spritesound(unsigned int num, int i)
{
if (num >= MAXSOUNDS) return -1;
if (i < 0)
{
sound(num);
return 0;
}
return xyzsound(num,i,SX,SY,SZ);
}
void stopspritesound(int num, int i)
{
UNREFERENCED_PARAMETER(i);
stopsound(num);
if (num >= 0 && num < MAXSOUNDS) stopsound(num);
}
void stopsound(int num)
{
if (num >= 0 && num < MAXSOUNDS)
if (g_sounds[num].num > 0)
{
FX_StopSound(g_sounds[num].SoundOwner[g_sounds[num].num-1].voice);
@ -534,6 +540,7 @@ void stopenvsound(int num,int i)
{
int j, k;
if (num >= 0 && num < MAXSOUNDS)
if (g_sounds[num].num > 0)
{
k = g_sounds[num].num;