mirror of
https://github.com/DrBeef/Raze.git
synced 2024-11-15 08:52:00 +00:00
SW: Fix "MV_GetVoice(): bad handle" log spam
git-svn-id: https://svn.eduke32.com/eduke32@8311 1a8010ca-5511-0410-912e-c29ae57300e0 # Conflicts: # source/sw/src/draw.cpp # source/sw/src/menus.cpp
This commit is contained in:
parent
f411b72783
commit
510e737360
8 changed files with 65 additions and 46 deletions
|
@ -109,6 +109,7 @@ static FORCE_INLINE int FX_Pan3D(int handle, int angle, int distance)
|
|||
return FX_CheckMVErr(MV_Pan3D(handle, angle, distance));
|
||||
}
|
||||
static FORCE_INLINE int FX_SoundActive(int handle) { return MV_VoicePlaying(handle); }
|
||||
static FORCE_INLINE int FX_SoundValidAndActive(int handle) { return handle > 0 && MV_VoicePlaying(handle); }
|
||||
static FORCE_INLINE int FX_SoundsPlaying(void) { return MV_VoicesPlaying(); }
|
||||
static FORCE_INLINE int FX_StopSound(int handle) { return FX_CheckMVErr(MV_Kill(handle)); }
|
||||
static FORCE_INLINE int FX_StopAllSounds(void) { return FX_CheckMVErr(MV_KillAllVoices()); }
|
||||
|
|
|
@ -1311,9 +1311,9 @@ MNU_OrderCustom(UserCall call, MenuItem *item)
|
|||
{
|
||||
DidOrderSound = TRUE;
|
||||
choose_snd = STD_RANDOM_RANGE(1000);
|
||||
if (choose_snd > 500 && !FX_SoundActive(wanghandle))
|
||||
if (choose_snd > 500 && !FX_SoundValidAndActive(wanghandle))
|
||||
wanghandle = PlaySound(DIGI_WANGORDER1, &zero, &zero, &zero, v3df_dontpan);
|
||||
else if (!FX_SoundActive(wanghandle))
|
||||
else if (!FX_SoundValidAndActive(wanghandle))
|
||||
wanghandle = PlaySound(DIGI_WANGORDER2, &zero, &zero, &zero, v3df_dontpan);
|
||||
}
|
||||
|
||||
|
@ -3761,11 +3761,11 @@ static void MNU_DownLevel(MenuGroup * group)
|
|||
static void MNU_UpLevel(void)
|
||||
{
|
||||
int zero = 0;
|
||||
static int handle1=0;
|
||||
static int handle1;
|
||||
// if run out of menus then EXIT
|
||||
if (!menuarrayptr)
|
||||
{
|
||||
if(!FX_SoundActive(handle1))
|
||||
if (!FX_SoundValidAndActive(handle1))
|
||||
handle1 = PlaySound(DIGI_STARCLINK,&zero,&zero,&zero,v3df_dontpan);
|
||||
ExitMenus();
|
||||
return;
|
||||
|
@ -4106,7 +4106,7 @@ void MNU_DoMenu( CTLType type, PLAYERp pp )
|
|||
SWBOOL resetitem;
|
||||
unsigned char key;
|
||||
int zero = 0;
|
||||
static int handle2 = 0;
|
||||
static int handle2;
|
||||
static int limitmove=0;
|
||||
static SWBOOL select_held=FALSE;
|
||||
|
||||
|
@ -4140,7 +4140,7 @@ void MNU_DoMenu( CTLType type, PLAYERp pp )
|
|||
{
|
||||
static int handle5=0;
|
||||
I_GeneralTriggerClear();
|
||||
if (!FX_SoundActive(handle5))
|
||||
if (!FX_SoundValidAndActive(handle5))
|
||||
handle5 = PlaySound(DIGI_SWORDSWOOSH,&zero,&zero,&zero,v3df_dontpan);
|
||||
inputState.ClearKeysDown();
|
||||
MNU_DoItem();
|
||||
|
@ -4163,16 +4163,16 @@ void MNU_DoMenu( CTLType type, PLAYERp pp )
|
|||
else if (I_ReturnTrigger())
|
||||
{
|
||||
I_ReturnTriggerClear();
|
||||
static int handle3=0;
|
||||
if (!FX_SoundActive(handle3))
|
||||
static int handle3;
|
||||
if (!FX_SoundValidAndActive(handle3))
|
||||
handle3 = PlaySound(DIGI_SWORDSWOOSH,&zero,&zero,&zero,v3df_dontpan);
|
||||
MNU_UpLevel();
|
||||
resetitem = TRUE;
|
||||
}
|
||||
else if (MNU_DoHotkey())
|
||||
{
|
||||
static int handle4=0;
|
||||
if (!FX_SoundActive(handle4))
|
||||
static int handle4;
|
||||
if (!FX_SoundValidAndActive(handle4))
|
||||
handle4 = PlaySound(DIGI_STAR,&zero,&zero,&zero,v3df_dontpan);
|
||||
resetitem = TRUE;
|
||||
}
|
||||
|
|
|
@ -173,7 +173,7 @@ int DoToiletGirl(short SpriteNum)
|
|||
|
||||
choose_snd = RANDOM_P2(1024<<4)>>4;
|
||||
|
||||
if (!FX_SoundActive(handle))
|
||||
if (!FX_SoundValidAndActive(handle))
|
||||
{
|
||||
if (choose_snd > 750)
|
||||
handle = PlaySound(DIGI_TOILETGIRLFART1,&sp->x,&sp->y,&sp->z,v3df_dontpan);
|
||||
|
@ -188,7 +188,7 @@ int DoToiletGirl(short SpriteNum)
|
|||
{
|
||||
static int madhandle;
|
||||
|
||||
if (!FX_SoundActive(madhandle))
|
||||
if (!FX_SoundValidAndActive(madhandle))
|
||||
{
|
||||
if (RANDOM_RANGE(1000<<8)>>8 > 500)
|
||||
madhandle = PlaySound(DIGI_ANIMEMAD1,&sp->x,&sp->y,&sp->z,v3df_dontpan);
|
||||
|
@ -235,7 +235,7 @@ int NullToiletGirl(short SpriteNum)
|
|||
{
|
||||
static int madhandle;
|
||||
|
||||
if (!FX_SoundActive(madhandle))
|
||||
if (!FX_SoundValidAndActive(madhandle))
|
||||
{
|
||||
if (RANDOM_RANGE(1000<<8)>>8 > 500)
|
||||
madhandle = PlaySound(DIGI_ANIMEMAD1,&sp->x,&sp->y,&sp->z,v3df_dontpan);
|
||||
|
@ -416,7 +416,7 @@ int DoWashGirl(short SpriteNum)
|
|||
{
|
||||
static int handle;
|
||||
|
||||
if (!FX_SoundActive(handle))
|
||||
if (!FX_SoundValidAndActive(handle))
|
||||
{
|
||||
if (RANDOM_P2(1024<<4)>>4 > 500)
|
||||
handle = PlaySound(DIGI_ANIMESING1,&sp->x,&sp->y,&sp->z,v3df_dontpan);
|
||||
|
@ -446,7 +446,7 @@ int DoWashGirl(short SpriteNum)
|
|||
{
|
||||
static int madhandle;
|
||||
|
||||
if (!FX_SoundActive(madhandle))
|
||||
if (!FX_SoundValidAndActive(madhandle))
|
||||
{
|
||||
if (RANDOM_RANGE(1000<<8)>>8 > 500)
|
||||
madhandle = PlaySound(DIGI_ANIMEMAD1,&sp->x,&sp->y,&sp->z,v3df_dontpan);
|
||||
|
@ -490,7 +490,7 @@ int NullWashGirl(short SpriteNum)
|
|||
{
|
||||
static int madhandle;
|
||||
|
||||
if (!FX_SoundActive(madhandle))
|
||||
if (!FX_SoundValidAndActive(madhandle))
|
||||
{
|
||||
if (RANDOM_RANGE(1000<<8)>>8 > 500)
|
||||
madhandle = PlaySound(DIGI_ANIMEMAD1,&sp->x,&sp->y,&sp->z,v3df_dontpan);
|
||||
|
@ -1305,7 +1305,7 @@ int DoCarGirl(short SpriteNum)
|
|||
{
|
||||
static int madhandle;
|
||||
|
||||
if (!FX_SoundActive(madhandle))
|
||||
if (!FX_SoundValidAndActive(madhandle))
|
||||
{
|
||||
short choose;
|
||||
choose = RANDOM_RANGE(1000);
|
||||
|
@ -1360,7 +1360,7 @@ int NullCarGirl(short SpriteNum)
|
|||
{
|
||||
static int madhandle;
|
||||
|
||||
if (!FX_SoundActive(madhandle))
|
||||
if (!FX_SoundValidAndActive(madhandle))
|
||||
{
|
||||
short choose;
|
||||
choose = RANDOM_RANGE(1000);
|
||||
|
@ -1532,7 +1532,7 @@ int DoMechanicGirl(short SpriteNum)
|
|||
{
|
||||
static int madhandle;
|
||||
|
||||
if (!FX_SoundActive(madhandle))
|
||||
if (!FX_SoundValidAndActive(madhandle))
|
||||
{
|
||||
short choose;
|
||||
choose = RANDOM_RANGE(1000);
|
||||
|
@ -1587,7 +1587,7 @@ int NullMechanicGirl(short SpriteNum)
|
|||
{
|
||||
static int madhandle;
|
||||
|
||||
if (!FX_SoundActive(madhandle))
|
||||
if (!FX_SoundValidAndActive(madhandle))
|
||||
{
|
||||
short choose;
|
||||
choose = RANDOM_RANGE(1000);
|
||||
|
@ -1760,7 +1760,7 @@ int DoSailorGirl(short SpriteNum)
|
|||
{
|
||||
static int madhandle;
|
||||
|
||||
if (!FX_SoundActive(madhandle))
|
||||
if (!FX_SoundValidAndActive(madhandle))
|
||||
{
|
||||
short choose;
|
||||
choose = RANDOM_RANGE(1000);
|
||||
|
@ -1820,7 +1820,7 @@ int NullSailorGirl(short SpriteNum)
|
|||
{
|
||||
static int madhandle;
|
||||
|
||||
if (!FX_SoundActive(madhandle))
|
||||
if (!FX_SoundValidAndActive(madhandle))
|
||||
{
|
||||
short choose;
|
||||
choose = RANDOM_RANGE(1000);
|
||||
|
@ -1968,7 +1968,7 @@ int DoPruneGirl(short SpriteNum)
|
|||
USERp u = User[SpriteNum];
|
||||
SPRITEp sp = User[SpriteNum]->SpriteP;
|
||||
short rnd_range = 0;
|
||||
static int madhandle=0,coyhandle=0;
|
||||
static int madhandle, coyhandle;
|
||||
SWBOOL ICanSee = FALSE;
|
||||
|
||||
DoActorPickClosePlayer(SpriteNum);
|
||||
|
@ -1978,7 +1978,7 @@ int DoPruneGirl(short SpriteNum)
|
|||
{
|
||||
if ((u->WaitTics -= ACTORMOVETICS) <= 0 && ICanSee)
|
||||
{
|
||||
if (!FX_SoundActive(madhandle))
|
||||
if (!FX_SoundValidAndActive(madhandle))
|
||||
{
|
||||
short choose;
|
||||
choose = STD_RANDOM_RANGE(1000);
|
||||
|
@ -1998,7 +1998,7 @@ int DoPruneGirl(short SpriteNum)
|
|||
}
|
||||
else
|
||||
{
|
||||
if (!FX_SoundActive(coyhandle))
|
||||
if (!FX_SoundValidAndActive(coyhandle))
|
||||
{
|
||||
short choose;
|
||||
choose = STD_RANDOM_RANGE(1000);
|
||||
|
@ -2049,7 +2049,7 @@ int NullPruneGirl(short SpriteNum)
|
|||
{
|
||||
static int madhandle;
|
||||
|
||||
if (!FX_SoundActive(madhandle))
|
||||
if (!FX_SoundValidAndActive(madhandle))
|
||||
{
|
||||
short choose;
|
||||
choose = RANDOM_RANGE(1000);
|
||||
|
|
|
@ -997,7 +997,11 @@ int WeaponOperate(PLAYERp pp)
|
|||
if (pp->WpnRocketType != 2 || pp->CurWpn != pp->Wpn[WPN_MICRO])
|
||||
{
|
||||
pp->InitingNuke = FALSE;
|
||||
FX_StopSound(pp->nukevochandle);
|
||||
if (pp->nukevochandle > 0)
|
||||
{
|
||||
FX_StopSound(pp->nukevochandle);
|
||||
pp->nukevochandle = 0;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
|
|
@ -3736,7 +3736,7 @@ DoPlayerFall(PLAYERp pp)
|
|||
PlaySound(DIGI_HITGROUND, &pp->posx, &pp->posy, &pp->posz, v3df_follow|v3df_dontpan);
|
||||
}
|
||||
|
||||
if (handle && FX_SoundActive(handle))
|
||||
if (FX_SoundValidAndActive(handle))
|
||||
{
|
||||
// My sound code will detect the sound has stopped and clean up
|
||||
// for you.
|
||||
|
@ -5166,9 +5166,10 @@ DoPlayerStopDiveNoWarp(PLAYERp pp)
|
|||
|
||||
if (!NoMeters) SetRedrawScreen(pp);
|
||||
|
||||
if (pp->TalkVocHandle && FX_SoundActive(pp->TalkVocHandle))
|
||||
if (FX_SoundValidAndActive(pp->TalkVocHandle))
|
||||
{
|
||||
FX_StopSound(pp->TalkVocHandle);
|
||||
pp->TalkVocHandle = 0;
|
||||
pp->PlayerTalking = FALSE;
|
||||
}
|
||||
|
||||
|
@ -5201,9 +5202,10 @@ DoPlayerStopDive(PLAYERp pp)
|
|||
|
||||
if (!NoMeters) SetRedrawScreen(pp);
|
||||
|
||||
if (pp->TalkVocHandle && FX_SoundActive(pp->TalkVocHandle))
|
||||
if (FX_SoundValidAndActive(pp->TalkVocHandle))
|
||||
{
|
||||
FX_StopSound(pp->TalkVocHandle);
|
||||
pp->TalkVocHandle = 0;
|
||||
pp->PlayerTalking = FALSE;
|
||||
}
|
||||
|
||||
|
@ -6503,7 +6505,7 @@ DoPlayerBeginDie(PLAYERp pp)
|
|||
// Override any previous talking, death scream has precedance
|
||||
if (pp->PlayerTalking)
|
||||
{
|
||||
if (FX_SoundActive(pp->TalkVocHandle))
|
||||
if (FX_SoundValidAndActive(pp->TalkVocHandle))
|
||||
FX_StopSound(pp->TalkVocHandle);
|
||||
pp->PlayerTalking = FALSE;
|
||||
pp->TalkVocnum = -1;
|
||||
|
|
|
@ -1246,11 +1246,11 @@ int DoRipper2StandHeart(short SpriteNum)
|
|||
{
|
||||
SPRITEp sp = &sprite[SpriteNum];
|
||||
USERp u = User[SpriteNum];
|
||||
static int riphearthandle=0;
|
||||
static int riphearthandle;
|
||||
|
||||
NullRipper2(SpriteNum);
|
||||
|
||||
if (!FX_SoundActive(riphearthandle))
|
||||
if (!FX_SoundValidAndActive(riphearthandle))
|
||||
riphearthandle = PlaySound(DIGI_RIPPER2HEARTOUT,&sp->x,&sp->y,&sp->z,v3df_none);
|
||||
|
||||
if ((u->WaitTics -= ACTORMOVETICS) <= 0)
|
||||
|
|
|
@ -527,9 +527,10 @@ StopSong(void)
|
|||
if (DemoMode)
|
||||
return;
|
||||
|
||||
if (SongType == SongTypeWave && SongVoice >= 0)
|
||||
if (SongType == SongTypeWave && SongVoice > 0)
|
||||
{
|
||||
FX_StopSound(SongVoice);
|
||||
SongVoice = 0;
|
||||
}
|
||||
else if (SongType == SongTypeMIDI)
|
||||
{
|
||||
|
@ -553,7 +554,7 @@ PauseSong(SWBOOL pauseon)
|
|||
{
|
||||
if (!MusicEnabled()) return;
|
||||
|
||||
if (SongType == SongTypeWave && SongVoice >= 0)
|
||||
if (SongType == SongTypeWave && SongVoice > 0)
|
||||
{
|
||||
FX_PauseVoice(SongVoice, pauseon);
|
||||
}
|
||||
|
@ -1313,9 +1314,10 @@ DeleteNoSoundOwner(short spritenum)
|
|||
|
||||
// Make sure to stop active
|
||||
// sounds
|
||||
if (FX_SoundActive(vp->handle))
|
||||
if (FX_SoundValidAndActive(vp->handle))
|
||||
{
|
||||
FX_StopSound(vp->handle);
|
||||
vp->handle = 0;
|
||||
}
|
||||
|
||||
#if 0
|
||||
|
@ -1372,9 +1374,10 @@ void DeleteNoFollowSoundOwner(short spritenum)
|
|||
// If the follow flag is set, compare the x and y addresses.
|
||||
if ((vp->flags & v3df_follow) && vp->x == &sp->x && vp->y == &sp->y)
|
||||
{
|
||||
if (FX_SoundActive(vp->handle))
|
||||
if (FX_SoundValidAndActive(vp->handle))
|
||||
{
|
||||
FX_StopSound(vp->handle);
|
||||
vp->handle = 0;
|
||||
}
|
||||
|
||||
#if 0
|
||||
|
@ -1529,7 +1532,7 @@ DoTimedSound(VOC3D_INFOp p)
|
|||
|
||||
if (p->tics >= p->maxtics)
|
||||
{
|
||||
if (!FX_SoundActive(p->handle))
|
||||
if (!FX_SoundValidAndActive(p->handle))
|
||||
{
|
||||
// Check for special case ambient sounds
|
||||
p->num = RandomizeAmbientSpecials(p->num);
|
||||
|
@ -1549,7 +1552,7 @@ DoTimedSound(VOC3D_INFOp p)
|
|||
p->deleted = TRUE; // Mark old sound for deletion
|
||||
}
|
||||
}
|
||||
} // !FX_SoundActive
|
||||
}
|
||||
|
||||
p->tics = 0;
|
||||
//while (p->tics >= p->maxtics) // Really stupid thing to do!
|
||||
|
@ -1577,8 +1580,11 @@ StopAmbientSound(void)
|
|||
|
||||
if (p->flags & v3df_kill)
|
||||
{
|
||||
if (FX_SoundActive(p->handle))
|
||||
if (FX_SoundValidAndActive(p->handle))
|
||||
{
|
||||
FX_StopSound(p->handle); // Make sure to stop active sounds
|
||||
p->handle = 0;
|
||||
}
|
||||
|
||||
p->deleted = TRUE;
|
||||
}
|
||||
|
@ -1668,8 +1674,11 @@ DoUpdateSounds3D(void)
|
|||
// Is the sound slated for death? Kill it, otherwise play it.
|
||||
if (p->flags & v3df_kill)
|
||||
{
|
||||
if (FX_SoundActive(p->handle))
|
||||
if (FX_SoundValidAndActive(p->handle))
|
||||
{
|
||||
FX_StopSound(p->handle); // Make sure to stop active sounds
|
||||
p->handle = 0;
|
||||
}
|
||||
|
||||
//DSPRINTF(ds,"%d had v3df_kill.\n",p->num);
|
||||
//MONO_PRINT(ds);
|
||||
|
@ -1677,7 +1686,7 @@ DoUpdateSounds3D(void)
|
|||
}
|
||||
else
|
||||
{
|
||||
if (!FX_SoundActive(p->handle) && !looping)
|
||||
if (!FX_SoundValidAndActive(p->handle) && !looping)
|
||||
{
|
||||
if (p->flags & v3df_intermit)
|
||||
{
|
||||
|
@ -1691,7 +1700,7 @@ DoUpdateSounds3D(void)
|
|||
p->deleted = TRUE;
|
||||
}
|
||||
}
|
||||
else if (FX_SoundActive(p->handle))
|
||||
else if (FX_SoundValidAndActive(p->handle))
|
||||
{
|
||||
if (p->flags & v3df_follow)
|
||||
{
|
||||
|
@ -1732,6 +1741,7 @@ DoUpdateSounds3D(void)
|
|||
if (dist >= 255 && p->vp->voc_distance == DIST_NORMAL)
|
||||
{
|
||||
FX_StopSound(p->handle); // Make sure to stop active
|
||||
p->handle = 0;
|
||||
// sounds
|
||||
}
|
||||
else
|
||||
|
@ -1770,7 +1780,7 @@ DoUpdateSounds3D(void)
|
|||
}
|
||||
}
|
||||
}
|
||||
else if (!FX_SoundActive(p->handle) && looping)
|
||||
else if (!FX_SoundValidAndActive(p->handle) && looping)
|
||||
{
|
||||
if (p->flags & v3df_follow)
|
||||
{
|
||||
|
@ -1898,7 +1908,9 @@ Terminate3DSounds(void)
|
|||
|
||||
while (vp)
|
||||
{
|
||||
FX_StopSound(vp->handle); // Make sure to stop active sounds
|
||||
if (vp->handle > 0)
|
||||
FX_StopSound(vp->handle); // Make sure to stop active sounds
|
||||
vp->handle = 0;
|
||||
vp->deleted = TRUE;
|
||||
vp = vp->next;
|
||||
}
|
||||
|
|
|
@ -725,7 +725,7 @@ int DoZillaMove(short SpriteNum)
|
|||
//DoActorSlide(SpriteNum);
|
||||
|
||||
// Random Zilla taunts
|
||||
if (!FX_SoundActive(handle))
|
||||
if (!FX_SoundValidAndActive(handle))
|
||||
{
|
||||
choose = STD_RANDOM_RANGE(1000);
|
||||
if (choose > 990)
|
||||
|
|
Loading…
Reference in a new issue