LURE: Fix music/SFX distinction

Distinction between music and SFX was made based on the most significant bit in
the sound number byte. This does not accurately reflect which MIDI sequences
are music or a sound effect.

Instead, I've added a flag which can be passed to
SoundManager::musicInterface_Play to indicate whether the sound is music or a
sound effect. All music is started from hard-coded animation sequences, so this
flag can be passed from ScummVM code when appropriate.
This commit is contained in:
NMIError 2020-07-11 16:45:03 +02:00 committed by Thierry Crozat
parent a994870fb3
commit 991061ee1b
8 changed files with 16 additions and 14 deletions

View File

@ -234,7 +234,7 @@ AnimAbortType AnimationSequence::show() {
if ((soundFrame != NULL) && (frameCtr == 0))
Sound.musicInterface_Play(
Sound.isRoland() ? soundFrame->rolandSoundId : soundFrame->adlibSoundId,
soundFrame->channelNum);
soundFrame->channelNum, soundFrame->music);
if (_isEGA)
egaDecodeFrame(_pPixels);

View File

@ -34,6 +34,7 @@ struct AnimSoundSequence {
uint8 adlibSoundId;
uint8 rolandSoundId;
uint8 channelNum;
bool music;
};
class AnimationSequence {

View File

@ -388,7 +388,7 @@ void Game::displayChuteAnimation() {
mouse.cursorOff();
Sound.killSounds();
Sound.musicInterface_Play(0x40, 0);
Sound.musicInterface_Play(0x40, 0, true);
AnimationSequence *anim = new AnimationSequence(CHUTE_ANIM_ID, palette, false);
anim->show();
@ -417,7 +417,7 @@ void Game::displayBarrelAnimation() {
mouse.cursorOff();
Sound.killSounds();
Sound.musicInterface_Play(0x3B, 0);
Sound.musicInterface_Play(0x3B, 0, true);
anim->show();

View File

@ -132,7 +132,7 @@ bool Introduction::show() {
Sound.musicInterface_KillAll();
currentSound = curr_anim->soundNumber;
Sound.musicInterface_Play(currentSound, 0);
Sound.musicInterface_Play(currentSound, 0, true);
}
bool fadeIn = curr_anim == anim_screens;

View File

@ -46,9 +46,9 @@ static const uint16 *hotspot_dealloc_set[4] = {&dealloc_list_1[0], &dealloc_list
// Details used for co-ordination of sounds during the endgame sequence
static const AnimSoundSequence soundList[] = {
{9, 0x45, 2, 0}, {27, 0x48, 5, 0}, {24, 0x46, 3, 0}, {24, 0x37, 1, 0}, {3, 0x37, 1, 1},
{3, 0x37, 1, 2}, {3, 0x37, 1, 3}, {3, 0x37, 1, 4}, {4, 0x37, 1, 5}, {7, 0x47, 4, 6},
{31, 0x00, 6, 0}, {0, 0, 0, 0}
{9, 0x45, 2, 0, true}, {27, 0x48, 5, 0, false}, {24, 0x46, 3, 0, false}, {24, 0x37, 1, 0, false}, {3, 0x37, 1, 1, false},
{3, 0x37, 1, 2, false}, {3, 0x37, 1, 3, false}, {3, 0x37, 1, 4, false}, {4, 0x37, 1, 5, false}, {7, 0x47, 4, 6, false},
{31, 0x00, 6, 0, true}, {0, 0, 0, 0}
};
/*------------------------------------------------------------------------*/
@ -207,7 +207,7 @@ void Script::endgameSequence(uint16 v1, uint16 v2, uint16 v3) {
delete anim;
Sound.killSounds();
Sound.musicInterface_Play(6, 0);
Sound.musicInterface_Play(6, 0, true);
anim = new AnimationSequence(ENDGAME_ANIM_ID + 2, p, false);
anim->show();

View File

@ -348,7 +348,7 @@ void SoundManager::addSound(uint8 soundIndex, bool tidyFlag) {
_activeSounds.push_back(SoundList::value_type(newEntry));
musicInterface_Play(rec.soundNumber, channelCtr, numChannels);
musicInterface_Play(rec.soundNumber, channelCtr, false, numChannels);
musicInterface_SetVolume(channelCtr, newEntry->volume);
}
@ -487,7 +487,7 @@ void SoundManager::restoreSounds() {
if ((rec.numChannels != 0) && ((rec.flags & SF_RESTORE) != 0)) {
Common::fill(_channelsInUse + rec.channel, _channelsInUse + rec.channel + rec.numChannels, true);
musicInterface_Play(rec.soundNumber, rec.channel, rec.numChannels);
musicInterface_Play(rec.soundNumber, rec.channel, false, rec.numChannels);
musicInterface_SetVolume(rec.channel, rec.volume);
}
@ -529,7 +529,7 @@ void SoundManager::fadeOut() {
// musicInterface_Play
// Play the specified sound
void SoundManager::musicInterface_Play(uint8 soundNumber, uint8 channelNumber, uint8 numChannels) {
void SoundManager::musicInterface_Play(uint8 soundNumber, uint8 channelNumber, bool isMusic, uint8 numChannels) {
debugC(ERROR_INTERMEDIATE, kLureDebugSounds, "musicInterface_Play soundNumber=%d, channel=%d",
soundNumber, channelNumber);
Game &game = Game::getReference();
@ -545,7 +545,8 @@ void SoundManager::musicInterface_Play(uint8 soundNumber, uint8 channelNumber, u
// Only play sounds if a sound driver is active
return;
bool isMusic = (soundNumber & 0x80) != 0;
// TODO Figure out what this represents
//bool isMusic = (soundNumber & 0x80) != 0;
if (!game.soundFlag())
// Don't play sounds if sound is turned off

View File

@ -157,7 +157,7 @@ public:
// The following methods implement the external sound player module
void musicInterface_Initialize();
void musicInterface_Play(uint8 soundNumber, uint8 channelNumber, uint8 numChannels = 4);
void musicInterface_Play(uint8 soundNumber, uint8 channelNumber, bool isMusic = false, uint8 numChannels = 4);
void musicInterface_Stop(uint8 soundNumber);
bool musicInterface_CheckPlaying(uint8 soundNumber);
void musicInterface_SetVolume(uint8 channelNum, uint8 volume);

View File

@ -1146,7 +1146,7 @@ bool RestartRestoreDialog::show() {
LureEngine &engine = LureEngine::getReference();
Sound.killSounds();
Sound.musicInterface_Play(60, 0);
Sound.musicInterface_Play(60, 0, true);
mouse.setCursorNum(CURSOR_ARROW);
// See if there are any savegames that can be restored