aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
Diffstat (limited to 'engines')
-rw-r--r--engines/lure/animseq.h3
-rw-r--r--engines/lure/game.cpp3
-rw-r--r--engines/lure/game.h4
-rw-r--r--engines/lure/lure.cpp7
-rw-r--r--engines/lure/luredefs.h8
-rw-r--r--engines/lure/scripts.cpp12
-rw-r--r--engines/lure/sound.cpp34
-rw-r--r--engines/lure/sound.h7
8 files changed, 52 insertions, 26 deletions
diff --git a/engines/lure/animseq.h b/engines/lure/animseq.h
index e60de55edd..1c467ff016 100644
--- a/engines/lure/animseq.h
+++ b/engines/lure/animseq.h
@@ -34,7 +34,8 @@ enum AnimAbortType {ABORT_NONE, ABORT_END_INTRO, ABORT_NEXT_SCENE};
struct AnimSoundSequence {
uint16 numFrames;
- uint8 soundId;
+ uint8 adlibSoundId;
+ uint8 rolandSoundId;
uint8 channelNum;
};
diff --git a/engines/lure/game.cpp b/engines/lure/game.cpp
index 5d71ee848e..8eca0a918b 100644
--- a/engines/lure/game.cpp
+++ b/engines/lure/game.cpp
@@ -49,7 +49,10 @@ Game::Game() {
_debugger = new Debugger();
_fastTextFlag = false;
_preloadFlag = false;
+
_soundFlag = true;
+ _musicVolume = ConfMan.getBool("music_mute") ? 0 : MIN(255, ConfMan.getInt("music_volume"));
+ _sfxVolume = ConfMan.getBool("sfx_mute") ? 0 : MIN(255, ConfMan.getInt("sfx_volume"));
}
Game::~Game() {
diff --git a/engines/lure/game.h b/engines/lure/game.h
index 79c36804ba..d5f57aa8ff 100644
--- a/engines/lure/game.h
+++ b/engines/lure/game.h
@@ -47,6 +47,8 @@ class Game {
private:
Debugger *_debugger;
bool _fastTextFlag, _soundFlag;
+ uint8 _sfxVolume;
+ uint8 _musicVolume;
uint8 _state;
uint16 _tellCommands[MAX_TELL_COMMANDS * 3 + 1];
int _numTellCommands;
@@ -80,6 +82,8 @@ public:
bool &preloadFlag() { return _preloadFlag; }
bool fastTextFlag() { return _fastTextFlag; }
bool soundFlag() { return _soundFlag; }
+ uint8 sfxVolume() { return _sfxVolume; }
+ uint8 musicVolume() { return _musicVolume; }
Debugger &debugger() { return *_debugger; }
// Menu item support methods
diff --git a/engines/lure/lure.cpp b/engines/lure/lure.cpp
index 8a139ddd5a..2e1d4bf0c2 100644
--- a/engines/lure/lure.cpp
+++ b/engines/lure/lure.cpp
@@ -54,9 +54,6 @@ LureEngine::LureEngine(OSystem *system, const LureGameDescription *gameDesc): En
if (!_mixer->isReady()) {
warning("Sound initialization failed.");
}
-
- _mixer->setVolumeForSoundType(Audio::Mixer::kSFXSoundType, ConfMan.getInt("sfx_volume"));
- _mixer->setVolumeForSoundType(Audio::Mixer::kMusicSoundType, ConfMan.getInt("music_volume"));
}
int LureEngine::init() {
@@ -135,7 +132,7 @@ int LureEngine::go() {
if (ConfMan.getInt("boot_param") == 0) {
// Show the introduction
- Sound.loadSection(INTRO_SOUND_RESOURCE_ID);
+ Sound.loadSection(Sound.isRoland() ? ROLAND_INTRO_SOUND_RESOURCE_ID : ADLIB_INTRO_SOUND_RESOURCE_ID);
Introduction *intro = new Introduction(*_screen, *_system);
intro->show();
@@ -145,7 +142,7 @@ int LureEngine::go() {
// Play the game
if (!_events->quitFlag) {
// Play the game
- Sound.loadSection(MAIN_SOUND_RESOURCE_ID);
+ Sound.loadSection(Sound.isRoland() ? ROLAND_MAIN_SOUND_RESOURCE_ID : ADLIB_MAIN_SOUND_RESOURCE_ID);
gameInstance->execute();
}
diff --git a/engines/lure/luredefs.h b/engines/lure/luredefs.h
index e5362dcd4e..5593d9aef9 100644
--- a/engines/lure/luredefs.h
+++ b/engines/lure/luredefs.h
@@ -236,8 +236,12 @@ enum CursorType {CURSOR_ARROW = 0, CURSOR_DISK = 1, CURSOR_TIME_START = 2,
// Miscellaneous resources
#define NAMES_RESOURCE_ID 9
-#define MAIN_SOUND_RESOURCE_ID 0xC
-#define INTRO_SOUND_RESOURCE_ID 0x31
+#define ROLAND_MAIN_SOUND_RESOURCE_ID 0xC
+#define ADLIB_MAIN_SOUND_RESOURCE_ID 0xD
+#define ROLAND_INTRO_SOUND_RESOURCE_ID 0x30
+#define ADLIB_INTRO_SOUND_RESOURCE_ID 0x31
+#define ROLAND_ENDGAME_SOUND_RESOURCE_ID 0xff10
+
#define NOONE_ID 0x3E7
#define PLAYER_ID 0x3E8
#define RATPOUCH_ID 0x3E9
diff --git a/engines/lure/scripts.cpp b/engines/lure/scripts.cpp
index 4de261d998..a279f5be20 100644
--- a/engines/lure/scripts.cpp
+++ b/engines/lure/scripts.cpp
@@ -48,9 +48,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, 2, 0}, {27, 5, 0}, {24, 3, 0}, {24, 1, 0}, {3, 1, 1}, {3, 1, 2}, {3, 1, 3},
- {3, 1, 4}, {4, 1, 5}, {7, 4, 6}, {31, 6, 0},
- {0, 0, 0}
+ {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, 6, 0}, {0, 0, 0, 0}
};
/*------------------------------------------------------------------------*/
@@ -196,10 +196,12 @@ void Script::endgameSequence(uint16 v1, uint16 v2, uint16 v3) {
AnimationSequence *anim;
screen.paletteFadeOut();
- Sound.killSounds();
- Sound.loadSection(0xFF10);
mouse.cursorOff();
+ Sound.killSounds();
+ if (Sound.isRoland())
+ Sound.loadSection(ROLAND_ENDGAME_SOUND_RESOURCE_ID);
+
Palette p(ENDGAME_PALETTE_ID);
anim = new AnimationSequence(ENDGAME_ANIM_ID, p, true, 9, soundList);
anim->show();
diff --git a/engines/lure/sound.cpp b/engines/lure/sound.cpp
index 65852b2369..2f6a0571a7 100644
--- a/engines/lure/sound.cpp
+++ b/engines/lure/sound.cpp
@@ -38,15 +38,18 @@ namespace Lure {
//#define SOUND_CROP_CHANNELS
SoundManager::SoundManager() {
+ Disk &disk = Disk::getReference();
+ Game &game = Game::getReference();
_soundMutex = g_system->createMutex();
int index;
- _descs = Disk::getReference().getEntry(SOUND_DESC_RESOURCE_ID);
+ _descs = disk.getEntry(SOUND_DESC_RESOURCE_ID);
_numDescs = _descs->size() / sizeof(SoundDescResource);
_soundData = NULL;
_paused = false;
int midiDriver = MidiDriver::detectMusicDriver(MDT_MIDI | MDT_ADLIB | MDT_PREFER_MIDI);
+ _isRoland = midiDriver != MD_ADLIB;
_nativeMT32 = ((midiDriver == MD_MT32) || ConfMan.getBool("native_mt32"));
Common::set_to(_channelsInUse, _channelsInUse+NUM_CHANNELS_OUTER, false);
@@ -63,7 +66,8 @@ SoundManager::SoundManager() {
for (index = 0; index < NUM_CHANNELS_INNER; ++index) {
_channelsInner[index].midiChannel = _driver->allocateChannel();
- _channelsInner[index].volume = DEFAULT_VOLUME;
+ _channelsInner[index].isMusic = false;
+ _channelsInner[index].volume = game.sfxVolume();
}
}
}
@@ -249,12 +253,12 @@ void SoundManager::addSound2(uint8 soundIndex) {
void SoundManager::stopSound(uint8 soundIndex) {
debugC(ERROR_BASIC, kLureDebugSounds, "SoundManager::stopSound index=%d", soundIndex);
SoundDescResource &rec = soundDescs()[soundIndex];
- musicInterface_Stop(rec.soundNumber & 0x7f);
+ musicInterface_Stop(rec.soundNumber);
}
void SoundManager::killSound(uint8 soundNumber) {
debugC(ERROR_BASIC, kLureDebugSounds, "SoundManager::stopSound soundNumber=%d", soundNumber);
- musicInterface_Stop(soundNumber & 0x7f);
+ musicInterface_Stop(soundNumber);
}
void SoundManager::setVolume(uint8 soundNumber, uint8 volume) {
@@ -395,6 +399,7 @@ void SoundManager::fadeOut() {
void SoundManager::musicInterface_Play(uint8 soundNumber, uint8 channelNumber) {
debugC(ERROR_INTERMEDIATE, kLureDebugSounds, "musicInterface_Play soundNumber=%d, channel=%d",
soundNumber, channelNumber);
+ Game &game = Game::getReference();
if (!_soundData)
error("Sound section has not been specified");
@@ -407,7 +412,10 @@ void SoundManager::musicInterface_Play(uint8 soundNumber, uint8 channelNumber) {
// Only play sounds if a sound driver is active
return;
- if (!Game::getReference().soundFlag())
+ bool isMusic = (soundNumber & 0x80) != 0;
+ uint8 volume = isMusic ? game.musicVolume() : game.sfxVolume();
+
+ if (!game.soundFlag() || (volume == 0))
// Don't play sounds if sound is turned off
return;
@@ -424,8 +432,8 @@ void SoundManager::musicInterface_Play(uint8 soundNumber, uint8 channelNumber) {
g_system->lockMutex(_soundMutex);
MidiMusic *sound = new MidiMusic(_driver, _channelsInner, channelNumber, soundNumber,
- soundStart, dataSize);
- sound->setVolume(DEFAULT_VOLUME);
+ isMusic, soundStart, dataSize);
+ sound->setVolume(volume);
_playingSounds.push_back(sound);
g_system->unlockMutex(_soundMutex);
}
@@ -567,16 +575,20 @@ void SoundManager::doTimer() {
/*------------------------------------------------------------------------*/
MidiMusic::MidiMusic(MidiDriver *driver, ChannelEntry channels[NUM_CHANNELS_INNER],
- uint8 channelNum, uint8 soundNum, void *soundData, uint32 size) {
-
+ uint8 channelNum, uint8 soundNum, bool isMusic, void *soundData, uint32 size) {
+ Game &game = Game::getReference();
_driver = driver;
_channels = channels;
_soundNumber = soundNum;
_channelNumber = channelNum;
_numChannels = 4;
- _volume = 0xff;
- setVolume(DEFAULT_VOLUME);
+ _volume = 0;
+ for (int i = 0; i < _numChannels; ++i) {
+ _channels[_channelNumber + i].isMusic = isMusic;
+ _channels[_channelNumber + i].volume = isMusic ? game.musicVolume() : game.sfxVolume();
+ }
+ setVolume(0xff);
_passThrough = false;
diff --git a/engines/lure/sound.h b/engines/lure/sound.h
index 85d889ca4a..0520e8ca09 100644
--- a/engines/lure/sound.h
+++ b/engines/lure/sound.h
@@ -40,7 +40,8 @@ namespace Lure {
struct ChannelEntry {
MidiChannel *midiChannel;
- byte volume;
+ bool isMusic;
+ uint8 volume;
};
class MidiMusic: public MidiDriver {
@@ -67,7 +68,7 @@ private:
public:
MidiMusic(MidiDriver *driver, ChannelEntry channels[NUM_CHANNELS_INNER],
- uint8 channelNum, uint8 soundNum, void *soundData, uint32 size);
+ uint8 channelNum, uint8 soundNum, bool isMusic, void *soundData, uint32 size);
~MidiMusic();
void setVolume(int volume);
int getVolume() { return _volume; }
@@ -117,6 +118,7 @@ private:
bool _channelsInUse[NUM_CHANNELS_OUTER];
bool _isPlaying;
bool _nativeMT32;
+ bool _isRoland;
Common::MutexRef _soundMutex;
bool _paused;
@@ -149,6 +151,7 @@ public:
void pause() { _paused = true; }
void resume() { _paused = false; }
bool getPaused() { return _paused; }
+ bool isRoland() { return _isRoland; }
// The following methods implement the external sound player module
void musicInterface_Initialise();