mirror of
https://github.com/DrBeef/Raze.git
synced 2024-11-16 01:11:28 +00:00
gameexec.c: factor code for "ifnosounds" into sounds.c: A_CheckAnySoundPlaying.
git-svn-id: https://svn.eduke32.com/eduke32@3365 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
4a6ded3f98
commit
67cdd9d883
3 changed files with 20 additions and 16 deletions
|
@ -5084,22 +5084,8 @@ nullquote:
|
|||
|
||||
case CON_IFNOSOUNDS:
|
||||
{
|
||||
int32_t j = MAXSOUNDS-1;
|
||||
for (; j>=0; j--)
|
||||
{
|
||||
int32_t k = 0;
|
||||
|
||||
for (; k<MAXSOUNDINSTANCES; k++)
|
||||
{
|
||||
if (g_sounds[j].SoundOwner[k].ow == vm.g_i)
|
||||
break;
|
||||
}
|
||||
|
||||
if (k != MAXSOUNDINSTANCES)
|
||||
break;
|
||||
}
|
||||
|
||||
VM_CONDITIONAL(j < 0);
|
||||
int32_t j = !A_CheckAnySoundPlaying(vm.g_i);
|
||||
VM_CONDITIONAL(j);
|
||||
}
|
||||
continue;
|
||||
|
||||
|
|
|
@ -913,6 +913,23 @@ int32_t A_CheckSoundPlaying(int32_t i, int32_t num)
|
|||
return (i == -1) ? g_sounds[num].num : 0;
|
||||
}
|
||||
|
||||
// Check if actor <i> is playing any sound.
|
||||
int32_t A_CheckAnySoundPlaying(int32_t i)
|
||||
{
|
||||
int32_t j;
|
||||
|
||||
for (j=g_maxSoundPos; j>=0; j--)
|
||||
{
|
||||
int32_t k;
|
||||
|
||||
for (k=0; k<MAXSOUNDINSTANCES; k++)
|
||||
if (g_sounds[j].SoundOwner[k].ow == i)
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int32_t S_CheckSoundPlaying(int32_t i, int32_t num)
|
||||
{
|
||||
if (num > g_maxSoundPos || num < 0) return 0;
|
||||
|
|
|
@ -75,6 +75,7 @@ extern int32_t g_numEnvSoundsPlaying,g_maxSoundPos;
|
|||
int32_t A_CheckSoundPlaying(int32_t i,int32_t num);
|
||||
int32_t A_PlaySound(uint32_t num,int32_t i);
|
||||
void S_Callback(uint32_t num);
|
||||
int32_t A_CheckAnySoundPlaying(int32_t i);
|
||||
int32_t S_CheckSoundPlaying(int32_t i,int32_t num);
|
||||
void S_Cleanup(void);
|
||||
void S_ClearSoundLocks(void);
|
||||
|
|
Loading…
Reference in a new issue