diff options
author | Travis Howell | 2005-05-06 03:09:53 +0000 |
---|---|---|
committer | Travis Howell | 2005-05-06 03:09:53 +0000 |
commit | c8b17da61c84c57516025b5d250885bceee343d6 (patch) | |
tree | 9292cdddc55affc13f5edbf7ab00ab9ad9ef9732 | |
parent | 0411be88db6a542a8b2360e1310058c7ab62f64b (diff) | |
download | scummvm-rg350-c8b17da61c84c57516025b5d250885bceee343d6.tar.gz scummvm-rg350-c8b17da61c84c57516025b5d250885bceee343d6.tar.bz2 scummvm-rg350-c8b17da61c84c57516025b5d250885bceee343d6.zip |
Auto detect music and voice types, where possible.
Use correct set of MIDI tracks for MT32 in Simon the Sorcerer 2.
svn-id: r17925
-rw-r--r-- | simon/intern.h | 29 | ||||
-rw-r--r-- | simon/simon.cpp | 93 | ||||
-rw-r--r-- | simon/sound.cpp | 28 | ||||
-rw-r--r-- | simon/vga.cpp | 2 |
4 files changed, 83 insertions, 69 deletions
diff --git a/simon/intern.h b/simon/intern.h index 04d579e4c0..1d919eb188 100644 --- a/simon/intern.h +++ b/simon/intern.h @@ -149,26 +149,27 @@ struct GameSpecificSettings { } // End of namespace Simon enum { - GF_SIMON2 = 1 << 0, - GF_WIN = 1 << 1, - GF_TALKIE = 1 << 2, - GF_DEMO = 1 << 3, - GF_AMIGA = 1 << 4, - GF_ACORN = 1 << 5, - GF_OLD_BUNDLE = 1 << 6 + GF_SIMON1 = 1 << 0, + GF_SIMON2 = 1 << 1, + GF_WIN = 1 << 2, + GF_TALKIE = 1 << 3, + GF_DEMO = 1 << 4, + GF_AMIGA = 1 << 5, + GF_ACORN = 1 << 6, + GF_OLD_BUNDLE = 1 << 7 }; enum { - GAME_SIMON1DOS = GF_OLD_BUNDLE, + GAME_SIMON1DOS = GF_SIMON1 | GF_OLD_BUNDLE, GAME_SIMON2DOS = GF_SIMON2, - GAME_SIMON1TALKIE = GF_TALKIE, + GAME_SIMON1TALKIE = GF_SIMON1 | GF_TALKIE, GAME_SIMON2TALKIE = GF_SIMON2 | GF_TALKIE, - GAME_SIMON1WIN = GF_WIN | GF_TALKIE, + GAME_SIMON1WIN = GF_SIMON1 | GF_WIN | GF_TALKIE, GAME_SIMON2WIN = GF_SIMON2 | GF_WIN | GF_TALKIE, - GAME_SIMON1DEMO = GF_DEMO | GF_OLD_BUNDLE, - GAME_SIMON1AMIGA = GF_AMIGA | GF_OLD_BUNDLE, - GAME_SIMON1CD32 = GF_TALKIE | GF_AMIGA | GF_OLD_BUNDLE, - GAME_SIMON1ACORN = GF_TALKIE | GF_ACORN + GAME_SIMON1DEMO = GF_SIMON1 | GF_DEMO | GF_OLD_BUNDLE, + GAME_SIMON1AMIGA = GF_SIMON1 | GF_AMIGA | GF_OLD_BUNDLE, + GAME_SIMON1CD32 = GF_SIMON1 | GF_TALKIE | GF_AMIGA | GF_OLD_BUNDLE, + GAME_SIMON1ACORN = GF_SIMON1 | GF_TALKIE | GF_ACORN }; #endif diff --git a/simon/simon.cpp b/simon/simon.cpp index 42c5d33666..a08415b08b 100644 --- a/simon/simon.cpp +++ b/simon/simon.cpp @@ -345,7 +345,8 @@ SimonEngine::SimonEngine(GameDetector *detector, OSystem *syst) VGA_MEM_SIZE = gVars->memory[kMemSimon2Games]; #endif TABLES_MEM_SIZE = 100000; - if ((_game & GF_SIMON2) && ConfMan.getBool("native_mt32")) + // Check whether to use MT-32 MIDI tracks in Simon the Sorcerer 2 + if ((_game & GF_SIMON2) && (ConfMan.getBool("native_mt32") || (_midiDriver == MD_MT32))) MUSIC_INDEX_BASE = (1128 + 612) / 4; else MUSIC_INDEX_BASE = 1128 / 4; @@ -4152,60 +4153,68 @@ void SimonEngine::delay(uint amount) { } void SimonEngine::loadMusic (uint music) { - if (_game & GF_SIMON2) { // Simon 2 music + char buf[4]; + + if (_game & GF_AMIGA) { + if (_game != GAME_SIMON1CD32) { + // TODO Add support for decruncher + debug(5,"loadMusic - Decrunch %dtune attempt", music); + } + // TODO Add Protracker support for simon1amiga/cd32 + debug(5,"playMusic - Load %dtune attempt", music); + } else if (_game & GF_SIMON2) { // Simon 2 music midi.stop(); _game_file->seek(_game_offsets_ptr[MUSIC_INDEX_BASE + music - 1], SEEK_SET); - if (_game & GF_WIN && !(ConfMan.getBool("native_mt32") && (_midiDriver != MD_MT32))) { - midi.loadMultipleSMF (_game_file); - } else { + _game_file->read(buf, 4); + if (!memcmp(buf, "FORM", 4)) { + _game_file->seek(_game_offsets_ptr[MUSIC_INDEX_BASE + music - 1], SEEK_SET); midi.loadXMIDI (_game_file); + } else { + _game_file->seek(_game_offsets_ptr[MUSIC_INDEX_BASE + music - 1], SEEK_SET); + midi.loadMultipleSMF (_game_file); } _last_music_played = music; _next_music_to_play = -1; - } else { // Simon 1 music - if (_game & GF_AMIGA) { - if (_game != GAME_SIMON1CD32) { - // TODO Add support for decruncher - debug(5,"loadMusic - Decrunch %dtune attempt", music); - } - // TODO Add Protracker support for simon1amiga/cd32 - debug(5,"playMusic - Load %dtune attempt", music); - } else { - midi.stop(); - midi.setLoop (true); // Must do this BEFORE loading music. (GMF may have its own override.) - - if (_game & GF_WIN) { - // FIXME: The very last music resource, a cymbal crash for when the - // two demons crash into each other, should NOT be looped like the - // other music tracks. In simon1dos/talkie the GMF resource includes - // a loop override that acomplishes this, but there seems to be nothing - // for this in the SMF resources. - if (music == 35) - midi.setLoop (false); - - _game_file->seek(_game_offsets_ptr[MUSIC_INDEX_BASE + music], SEEK_SET); - midi.loadMultipleSMF (_game_file); - } else if (_game & GF_TALKIE) { + } else if (_game & GF_SIMON1) { // Simon 1 music + midi.stop(); + midi.setLoop (true); // Must do this BEFORE loading music. (GMF may have its own override.) + + if (_game & GF_TALKIE) { + // FIXME: The very last music resource, a cymbal crash for when the + // two demons crash into each other, should NOT be looped like the + // other music tracks. In simon1dos/talkie the GMF resource includes + // a loop override that acomplishes this, but there seems to be nothing + // for this in the SMF resources. + if (music == 35) + midi.setLoop (false); + + _game_file->seek(_game_offsets_ptr[MUSIC_INDEX_BASE + music], SEEK_SET); + _game_file->read(buf, 4); + if (!memcmp(buf, "GMF\x1", 4)) { _game_file->seek(_game_offsets_ptr[MUSIC_INDEX_BASE + music], SEEK_SET); midi.loadSMF (_game_file, music); } else { - char buf[15]; - File f; - sprintf(buf, "MOD%d.MUS", music); - f.open(buf); - if (f.isOpen() == false) { - warning("Can't load music from '%s'", buf); - return; - } - if (_game & GF_DEMO) - midi.loadS1D (&f); - else - midi.loadSMF (&f, music); + _game_file->seek(_game_offsets_ptr[MUSIC_INDEX_BASE + music], SEEK_SET); + midi.loadMultipleSMF (_game_file); } - midi.startTrack (0); + } else { + char filename[15]; + File f; + sprintf(filename, "MOD%d.MUS", music); + f.open(filename); + if (f.isOpen() == false) { + warning("Can't load music from '%s'", filename); + return; + } + if (_game & GF_DEMO) + midi.loadS1D (&f); + else + midi.loadSMF (&f, music); } + + midi.startTrack (0); } } diff --git a/simon/sound.cpp b/simon/sound.cpp index 93dc9fddf9..2ccea96f05 100644 --- a/simon/sound.cpp +++ b/simon/sound.cpp @@ -244,6 +244,11 @@ Sound::Sound(const byte game, const GameSpecificSettings *gss, SoundMixer *mixer _voice_file = false; _ambient_playing = 0; + if (_game == GAME_SIMON1CD32) { + // Uses separate voice files + return; + } + File *file = new File(); const char *s; @@ -274,7 +279,7 @@ Sound::Sound(const byte game, const GameSpecificSettings *gss, SoundMixer *mixer } } #endif - if (!_voice) { + if (!_voice && (_game & GF_SIMON2)) { // for simon2 mac/amiga, only read index file file->open("voices.idx"); if (file->isOpen() == true) { @@ -287,27 +292,26 @@ Sound::Sound(const byte game, const GameSpecificSettings *gss, SoundMixer *mixer for (int i = 1; i <= end / 6; i++) { _filenums[i] = file->readUint16BE(); _offsets[i] = file->readUint32BE(); - } - _voice_file = true; - delete file; - } else if (_game & GF_WIN) { + } + _voice_file = true; + delete file; + } + if (!_voice && gss->wav_filename && gss->wav_filename[0]) { s = gss->wav_filename; file->open(s); if (file->isOpen() == false) { - warning("Can't open voice file %s", s); + debug(0, "Can't open voice file %s", s); delete file; } else { _voice_file = true; _voice = new WavSound(_mixer, file); } - } else if (_game == GAME_SIMON1CD32) { - // simon1cd32 uses separate voice files - return; - } else if (_game & GF_TALKIE) { + } + if (!_voice && gss->voc_filename && gss->voc_filename[0]) { s = gss->voc_filename; file->open(s); if (file->isOpen() == false) { - warning("Can't open voice file %s", s); + debug(0, "Can't open voice file %s", s); delete file; } else { _voice_file = true; @@ -316,7 +320,7 @@ Sound::Sound(const byte game, const GameSpecificSettings *gss, SoundMixer *mixer } } - if (_game == GAME_SIMON1ACORN || _game == GAME_SIMON1TALKIE) { + if ((_game & GF_SIMON1) && (_game & GF_TALKIE)) { file = new File(); #ifdef USE_MAD if (!_effects && gss->mp3_effects_filename && gss->mp3_effects_filename[0]) { diff --git a/simon/vga.cpp b/simon/vga.cpp index 3f2e44a6c4..f5925fe46b 100644 --- a/simon/vga.cpp +++ b/simon/vga.cpp @@ -1024,7 +1024,7 @@ void SimonEngine::vc_12_delay() { // Work around to allow inventory arrows to be // shown in some versions of Simon the Sorcerer 1 - if (!(_game & GF_SIMON2) && !(_game & GF_WIN) && vsp->id == 0x80) + if ((_game & GF_SIMON1) && vsp->id == 0x80) num = 0; else num += VGA_DELAY_BASE; |