aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/agos/agos.cpp45
-rw-r--r--engines/agos/agos.h3
-rw-r--r--engines/agos/input.cpp12
-rw-r--r--engines/agos/res_snd.cpp8
4 files changed, 34 insertions, 34 deletions
diff --git a/engines/agos/agos.cpp b/engines/agos/agos.cpp
index 5e2f40b17a..c9f4b6cb2c 100644
--- a/engines/agos/agos.cpp
+++ b/engines/agos/agos.cpp
@@ -318,7 +318,6 @@ AGOSEngine::AGOSEngine(OSystem *syst)
_scrollUpHitArea = 0;
_scrollDownHitArea = 0;
-
_noOverWrite = 0;
_rejectBlock = false;
@@ -472,6 +471,9 @@ AGOSEngine::AGOSEngine(OSystem *syst)
_planarBuf = 0;
+ _midiEnabled = false;
+ _nativeMT32 = false;
+
_vgaTickCounter = 0;
_moviePlay = 0;
@@ -572,30 +574,33 @@ int AGOSEngine::init() {
_mixer->setVolumeForSoundType(Audio::Mixer::kSFXSoundType, ConfMan.getInt("sfx_volume"));
_mixer->setVolumeForSoundType(Audio::Mixer::kMusicSoundType, ConfMan.getInt("music_volume"));
- // Setup midi driver
- MidiDriver *driver = 0;
- if (getGameType() == GType_FF || getGameType() == GType_PP || getGameId() == GID_SIMON1CD32) {
- driver = MidiDriver::createMidi(MD_NULL);
- _native_mt32 = false;
- } else {
+ if ((getGameType() == GType_SIMON2 && getPlatform() == Common::kPlatformWindows) ||
+ (getGameType() == GType_SIMON1 && getPlatform() == Common::kPlatformWindows) ||
+ ((getFeatures() & GF_TALKIE) && getPlatform() == Common::kPlatformAcorn) ||
+ (getPlatform() == Common::kPlatformPC)) {
+
+ // Setup midi driver
int midiDriver = MidiDriver::detectMusicDriver(MDT_ADLIB | MDT_MIDI);
- _native_mt32 = ((midiDriver == MD_MT32) || ConfMan.getBool("native_mt32"));
- driver = MidiDriver::createMidi(midiDriver);
- if (_native_mt32) {
+ _nativeMT32 = ((midiDriver == MD_MT32) || ConfMan.getBool("native_mt32"));
+ MidiDriver *driver = MidiDriver::createMidi(midiDriver);
+ if (_nativeMT32) {
driver->property(MidiDriver::PROP_CHANNEL_MASK, 0x03FE);
}
- }
- _midi.mapMT32toGM (getGameType() != GType_SIMON2 && !_native_mt32);
+ _midi.mapMT32toGM (getGameType() != GType_SIMON2 && !_nativeMT32);
+
+ _midi.setDriver(driver);
+ int ret = _midi.open();
+ if (ret)
+ warning("MIDI Player init failed: \"%s\"", _midi.getErrorName (ret));
- _midi.setDriver(driver);
- int ret = _midi.open();
- if (ret)
- warning("MIDI Player init failed: \"%s\"", _midi.getErrorName (ret));
- _midi.setVolume(ConfMan.getInt("music_volume"));
+ _midi.setVolume(ConfMan.getInt("music_volume"));
- if (ConfMan.hasKey("music_mute") && ConfMan.getBool("music_mute") == 1)
- _midi.pause(_musicPaused ^= 1);
+ if (ConfMan.hasKey("music_mute") && ConfMan.getBool("music_mute") == 1)
+ _midi.pause(_musicPaused ^= 1);
+
+ _midiEnabled = true;
+ }
// allocate buffers
_backGroundBuf = (byte *)calloc(_screenWidth * _screenHeight, 1);
@@ -742,7 +747,7 @@ void AGOSEngine_Simon2::setupGame() {
_itemMemSize = 20000;
_tableMemSize = 100000;
// Check whether to use MT-32 MIDI tracks in Simon the Sorcerer 2
- if ((getGameType() == GType_SIMON2) && _native_mt32)
+ if ((getGameType() == GType_SIMON2) && _nativeMT32)
_musicIndexBase = (1128 + 612) / 4;
else
_musicIndexBase = 1128 / 4;
diff --git a/engines/agos/agos.h b/engines/agos/agos.h
index 7d0c2d0d0a..32c399ff8e 100644
--- a/engines/agos/agos.h
+++ b/engines/agos/agos.h
@@ -517,7 +517,8 @@ protected:
byte _lettersToPrintBuf[80];
MidiPlayer _midi;
- bool _native_mt32;
+ bool _midiEnabled;
+ bool _nativeMT32;
int _vgaTickCounter;
diff --git a/engines/agos/input.cpp b/engines/agos/input.cpp
index 0d5a185026..274914b407 100644
--- a/engines/agos/input.cpp
+++ b/engines/agos/input.cpp
@@ -558,26 +558,22 @@ bool AGOSEngine::processSpecialKeys() {
_speech ^= 1;
}
case '+':
- if ((getPlatform() == Common::kPlatformAcorn && (getFeatures() & GF_TALKIE)) ||
- getPlatform() == Common::kPlatformPC || getPlatform() == Common::kPlatformWindows) {
+ if (_midiEnabled) {
_midi.setVolume(_midi.getVolume() + 16);
}
_mixer->setVolumeForSoundType(Audio::Mixer::kMusicSoundType, _mixer->getVolumeForSoundType(Audio::Mixer::kMusicSoundType) + 16);
break;
case '-':
- if ((getPlatform() == Common::kPlatformAcorn && (getFeatures() & GF_TALKIE)) ||
- getPlatform() == Common::kPlatformPC || getPlatform() == Common::kPlatformWindows) {
+ if (_midiEnabled) {
_midi.setVolume(_midi.getVolume() - 16);
}
_mixer->setVolumeForSoundType(Audio::Mixer::kMusicSoundType, _mixer->getVolumeForSoundType(Audio::Mixer::kMusicSoundType) - 16);
break;
case 'm':
- if ((getPlatform() == Common::kPlatformAcorn && (getFeatures() & GF_TALKIE)) ||
- getPlatform() == Common::kPlatformPC || getPlatform() == Common::kPlatformWindows) {
+ if (_midiEnabled) {
_midi.pause(_musicPaused ^= 1);
- } else {
- // TODO
}
+ // TODO
break;
case 's':
if (getGameId() == GID_SIMON1DOS) {
diff --git a/engines/agos/res_snd.cpp b/engines/agos/res_snd.cpp
index a55903c9b2..b890f293ed 100644
--- a/engines/agos/res_snd.cpp
+++ b/engines/agos/res_snd.cpp
@@ -259,12 +259,10 @@ void AGOSEngine::playMusic(uint16 music, uint16 track) {
}
void AGOSEngine::stopMusic() {
- if ((getPlatform() == Common::kPlatformAcorn && (getFeatures() & GF_TALKIE)) ||
- getPlatform() == Common::kPlatformPC || getPlatform() == Common::kPlatformWindows) {
+ if (_midiEnabled) {
_midi.stop();
- } else {
- _mixer->stopHandle(_modHandle);
- }
+ }
+ _mixer->stopHandle(_modHandle);
}
void AGOSEngine::playSting(uint a) {