mirror of
https://github.com/DrBeef/Raze.git
synced 2024-11-15 00:41:55 +00:00
- stop the railgun's active sound if another weapon is selected.
This commit is contained in:
parent
ffbe275a4a
commit
f53b348782
4 changed files with 11 additions and 22 deletions
|
@ -502,26 +502,9 @@ FSoundChan *SoundEngine::StartSound(int type, const void *source,
|
|||
int seen = 0;
|
||||
if (source != NULL && channel == CHAN_AUTO)
|
||||
{
|
||||
// Select a channel that isn't already playing something.
|
||||
// Try channel 0 first, then travel from channel 7 down.
|
||||
if (!IsChannelUsed(type, source, 0, &seen))
|
||||
{
|
||||
channel = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
for (channel = 7; channel > 0; --channel)
|
||||
{
|
||||
if (!IsChannelUsed(type, source, channel, &seen))
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (channel == 0)
|
||||
{ // Crap. No free channels.
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
// In the old sound system, 'AUTO' hijacked one of the other channels.
|
||||
// Now, with CHANF_OVERLAP at our disposal that isn't needed anymore. Just set the flag and let all sounds play on channel 0.
|
||||
chanflags |= CHANF_OVERLAP;
|
||||
}
|
||||
|
||||
// If this actor is already playing something on the selected channel, stop it.
|
||||
|
|
|
@ -184,6 +184,7 @@ struct FSoundChan : public FISoundChannel
|
|||
// CHAN_ITEM is for small things and item pickup
|
||||
// CHAN_BODY is for generic body sounds
|
||||
// CHAN_PICKUP can optionally be set as a local sound only for "compatibility"
|
||||
// Channels below 0 are reserved for CHAN_AUTO.
|
||||
|
||||
enum EChannel
|
||||
{
|
||||
|
|
|
@ -982,11 +982,16 @@ int WeaponOperate(PLAYERp pp)
|
|||
}
|
||||
|
||||
// Shut that computer chick up if weapon has changed!
|
||||
// This really should be handled better, but since there's no usable tracking state for the sounds, the easiest way to handle them is to play on otherwise unused channels.
|
||||
if (pp->WpnRocketType != 2 || pp->CurWpn != pp->Wpn[WPN_MICRO])
|
||||
{
|
||||
pp->InitingNuke = FALSE;
|
||||
soundEngine->StopSound(SOURCE_Player, pp, CHAN_WEAPON);
|
||||
}
|
||||
if (pp->CurWpn != pp->Wpn[WPN_RAIL])
|
||||
{
|
||||
soundEngine->StopSound(SOURCE_Player, pp, CHAN_ITEM);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -3718,7 +3723,7 @@ InitWeaponRail(PLAYERp pp)
|
|||
pSetState(psp, psp->PresentState);
|
||||
|
||||
PlaySound(DIGI_RAIL_UP, pp, v3df_follow);
|
||||
PlaySound(DIGI_RAILREADY, pp, v3df_follow|v3df_dontpan);
|
||||
PlaySound(DIGI_RAILREADY, pp, v3df_follow | v3df_dontpan, CHAN_ITEM); // this one needs to be on a dedicated channel to allow switching it off without too many checks.
|
||||
Set3DSoundOwner(psp->PlayerP->PlayerSprite);
|
||||
|
||||
FLAG_KEY_RELEASE(psp->PlayerP, SK_SHOOT);
|
||||
|
|
|
@ -945,7 +945,7 @@ SWBOOL PlaySong(const char* mapname, const char* song_file_name, int cdaudio_tra
|
|||
}
|
||||
if (!Mus_Play(mapname, song_file_name, true))
|
||||
{
|
||||
// try the CD track anyway if no MIDI could be found (the original game doesn't have any MIDI, it was CD Audio only, this avoids no music playing id mus_redbook is off.)
|
||||
// try the CD track anyway if no MIDI could be found (the original game doesn't have any MIDI, it was CD Audio only, this avoids no music playing if mus_redbook is off.)
|
||||
FStringf trackname("track%02d.ogg", cdaudio_track);
|
||||
if (!Mus_Play(nullptr, trackname, true)) return false;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue