Rip out S_FindMusicSFX() from A_CallSound() and use in SE6/14 on-spawn init.

This makes the subway sound not played once on map initialization.

git-svn-id: https://svn.eduke32.com/eduke32@4481 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
helixhorned 2014-05-23 20:25:29 +00:00
parent 123906a9d7
commit e61afe6d88
3 changed files with 56 additions and 39 deletions

View file

@ -6937,7 +6937,7 @@ int32_t A_Spawn(int32_t j, int32_t pn)
{ {
case SE_6_SUBWAY: case SE_6_SUBWAY:
case SE_14_SUBWAY_CAR: case SE_14_SUBWAY_CAR:
j = A_CallSound(sect,i); S_FindMusicSFX(sect, &j);
if (j == -1) j = SUBWAY; if (j == -1) j = SUBWAY;
actor[i].lastvx = j; actor[i].lastvx = j;
case SE_30_TWO_WAY_TRAIN: case SE_30_TWO_WAY_TRAIN:

View file

@ -33,23 +33,40 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
static int32_t g_haltSoundHack = 0; static int32_t g_haltSoundHack = 0;
// this function activates a sector's MUSICANDSFX sprite int32_t S_FindMusicSFX(int32_t sn, int32_t *sndptr)
int32_t A_CallSound(int32_t sn, int32_t whatsprite)
{ {
int32_t i; int32_t i;
if (g_haltSoundHack)
{
g_haltSoundHack = 0;
return -1;
}
for (SPRITES_OF_SECT(sn, i)) for (SPRITES_OF_SECT(sn, i))
{ {
const int32_t snd = sprite[i].lotag; const int32_t snd = sprite[i].lotag;
EDUKE32_STATIC_ASSERT(MAXSOUNDS >= 1000); EDUKE32_STATIC_ASSERT(MAXSOUNDS >= 1000);
if (PN == MUSICANDSFX && (unsigned)snd < 1000) // XXX: in other places, 999 if (PN == MUSICANDSFX && (unsigned)snd < 1000) // XXX: in other places, 999
{
*sndptr = snd;
return i;
}
}
*sndptr = -1;
return -1;
}
// this function activates a sector's MUSICANDSFX sprite
int32_t A_CallSound(int32_t sn, int32_t whatsprite)
{
int32_t i, snd;
if (g_haltSoundHack)
{
g_haltSoundHack = 0;
return -1;
}
i = S_FindMusicSFX(sn, &snd);
if (i >= 0)
{ {
if (whatsprite == -1) if (whatsprite == -1)
whatsprite = i; whatsprite = i;
@ -82,7 +99,6 @@ int32_t A_CallSound(int32_t sn, int32_t whatsprite)
return snd; return snd;
} }
}
return -1; return -1;
} }

View file

@ -103,6 +103,7 @@ typedef struct {
//extern map_t MapInfo[(MAXVOLUMES+1)*MAXLEVELS]; // +1 volume for "intro", "briefing" music //extern map_t MapInfo[(MAXVOLUMES+1)*MAXLEVELS]; // +1 volume for "intro", "briefing" music
void G_ActivateBySector(int32_t sect,int32_t j); void G_ActivateBySector(int32_t sect,int32_t j);
int32_t S_FindMusicSFX(int32_t sn, int32_t *sndptr);
int32_t A_CallSound(int32_t sn,int32_t whatsprite); int32_t A_CallSound(int32_t sn,int32_t whatsprite);
int32_t A_CheckHitSprite(int32_t i,int16_t *hitsp); int32_t A_CheckHitSprite(int32_t i,int16_t *hitsp);
void A_DamageObject(int32_t i,int32_t sn); void A_DamageObject(int32_t i,int32_t sn);