diff options
author | Travis Howell | 2007-06-04 05:18:11 +0000 |
---|---|---|
committer | Travis Howell | 2007-06-04 05:18:11 +0000 |
commit | c3a346fb1608d5638ba813822f9cedd0f24b5194 (patch) | |
tree | 2b5f557ce42c8d636fafe0214c59e6c3cbd5961f /engines/agos | |
parent | 6f3d87314ea737d8e62fb4a69f00c047713c8e6f (diff) | |
download | scummvm-rg350-c3a346fb1608d5638ba813822f9cedd0f24b5194.tar.gz scummvm-rg350-c3a346fb1608d5638ba813822f9cedd0f24b5194.tar.bz2 scummvm-rg350-c3a346fb1608d5638ba813822f9cedd0f24b5194.zip |
Virtualise a few sound functions.
svn-id: r27077
Diffstat (limited to 'engines/agos')
-rw-r--r-- | engines/agos/agos.h | 11 | ||||
-rw-r--r-- | engines/agos/res_snd.cpp | 238 |
2 files changed, 130 insertions, 119 deletions
diff --git a/engines/agos/agos.h b/engines/agos/agos.h index cae1c4cf03..e40b1b10a5 100644 --- a/engines/agos/agos.h +++ b/engines/agos/agos.h @@ -809,7 +809,6 @@ protected: void setWindowImage(uint16 mode, uint16 vga_res_id); void setWindowImageEx(uint16 mode, uint16 vga_res); - void playSpeech(uint speech_id, uint vga_sprite_id); void skipSpeech(); bool printNameOf(Item *item, uint x, uint y); @@ -1187,7 +1186,7 @@ protected: virtual void windowNewLine(WindowBlock *window); void windowDrawChar(WindowBlock *window, uint x, uint y, byte chr); - void loadMusic(uint music); + virtual void loadMusic(uint music); void loadModule(uint music); void checkTimerCallback(); @@ -1473,10 +1472,14 @@ protected: virtual void addArrows(WindowBlock *window); virtual uint setupIconHitArea(WindowBlock *window, uint num, uint x, uint y, Item *item_ptr); + virtual void playSpeech(uint speech_id, uint vga_sprite_id); + virtual void listSaveGames(char *dst); virtual void userGame(bool load); virtual int userGameGetKey(bool *b, char *buf, uint maxChar); + virtual void loadMusic(uint music); + virtual void vcStopAnimation(uint zone, uint sprite); }; @@ -1516,6 +1519,10 @@ protected: virtual void addArrows(WindowBlock *window); virtual uint setupIconHitArea(WindowBlock *window, uint num, uint x, uint y, Item *item_ptr); + + virtual void playSpeech(uint speech_id, uint vga_sprite_id); + + virtual void loadMusic(uint music); }; class AGOSEngine_Feeble : public AGOSEngine_Simon2 { diff --git a/engines/agos/res_snd.cpp b/engines/agos/res_snd.cpp index cc5ba2a793..cbdb8f9baf 100644 --- a/engines/agos/res_snd.cpp +++ b/engines/agos/res_snd.cpp @@ -41,59 +41,59 @@ using Common::File; namespace AGOS { -void AGOSEngine::playSpeech(uint speech_id, uint vgaSpriteId) { - if (getGameType() == GType_SIMON1) { - if (speech_id == 9999) { - if (_subtitles) - return; - if (!getBitFlag(14) && !getBitFlag(28)) { - setBitFlag(14, true); - _variableArray[100] = 15; - animate(4, 1, 130, 0, 0, 0); - waitForSync(130); - } - _skipVgaWait = true; - } else { - if (_subtitles && _scriptVar2) { - animate(4, 2, 204, 0, 0, 0); - waitForSync(204); - stopAnimate(204); - } - if (vgaSpriteId < 100) - stopAnimate(vgaSpriteId + 201); +void AGOSEngine_Simon1::playSpeech(uint speech_id, uint vgaSpriteId) { + if (speech_id == 9999) { + if (_subtitles) + return; + if (!getBitFlag(14) && !getBitFlag(28)) { + setBitFlag(14, true); + _variableArray[100] = 15; + animate(4, 1, 130, 0, 0, 0); + waitForSync(130); + } + _skipVgaWait = true; + } else { + if (_subtitles && _scriptVar2) { + animate(4, 2, 204, 0, 0, 0); + waitForSync(204); + stopAnimate(204); + } + if (vgaSpriteId < 100) + stopAnimate(vgaSpriteId + 201); - loadVoice(speech_id); + loadVoice(speech_id); + + if (vgaSpriteId < 100) + animate(4, 2, vgaSpriteId + 201, 0, 0, 0); + } +} - if (vgaSpriteId < 100) - animate(4, 2, vgaSpriteId + 201, 0, 0, 0); +void AGOSEngine_Simon2::playSpeech(uint speech_id, uint vgaSpriteId) { + if (speech_id == 0xFFFF) { + if (_subtitles) + return; + if (!getBitFlag(14) && !getBitFlag(28)) { + setBitFlag(14, true); + _variableArray[100] = 5; + animate(4, 1, 30, 0, 0, 0); + waitForSync(130); } + _skipVgaWait = true; } else { - if (speech_id == 0xFFFF) { - if (_subtitles) - return; - if (!getBitFlag(14) && !getBitFlag(28)) { - setBitFlag(14, true); - _variableArray[100] = 5; - animate(4, 1, 30, 0, 0, 0); - waitForSync(130); - } - _skipVgaWait = true; - } else { - if (getGameType() == GType_SIMON2 && _subtitles && _language != Common::HB_ISR) { - loadVoice(speech_id); - return; - } - - if (_subtitles && _scriptVar2) { - animate(4, 2, 5, 0, 0, 0); - waitForSync(205); - stopAnimateSimon2(2,5); - } - - stopAnimateSimon2(2, vgaSpriteId + 2); + if (getGameType() == GType_SIMON2 && _subtitles && _language != Common::HB_ISR) { loadVoice(speech_id); - animate(4, 2, vgaSpriteId + 2, 0, 0, 0); + return; + } + + if (_subtitles && _scriptVar2) { + animate(4, 2, 5, 0, 0, 0); + waitForSync(205); + stopAnimateSimon2(2,5); } + + stopAnimateSimon2(2, vgaSpriteId + 2); + loadVoice(speech_id); + animate(4, 2, vgaSpriteId + 2, 0, 0, 0); } } @@ -162,89 +162,93 @@ void AGOSEngine::loadModule(uint music) { _mixer->playInputStream(Audio::Mixer::kMusicSoundType, &_modHandle, audioStream); } -void AGOSEngine::loadMusic(uint music) { +void AGOSEngine_Simon2::loadMusic(uint music) { char buf[4]; - if (getGameType() == GType_SIMON2) { - _midi.stop(); + _midi.stop(); + _gameFile->seek(_gameOffsetsPtr[_musicIndexBase + music - 1], SEEK_SET); + _gameFile->read(buf, 4); + if (!memcmp(buf, "FORM", 4)) { _gameFile->seek(_gameOffsetsPtr[_musicIndexBase + music - 1], SEEK_SET); - _gameFile->read(buf, 4); - if (!memcmp(buf, "FORM", 4)) { - _gameFile->seek(_gameOffsetsPtr[_musicIndexBase + music - 1], SEEK_SET); - _midi.loadXMIDI(_gameFile); - } else { - _gameFile->seek(_gameOffsetsPtr[_musicIndexBase + music - 1], SEEK_SET); - _midi.loadMultipleSMF(_gameFile); - } + _midi.loadXMIDI(_gameFile); + } else { + _gameFile->seek(_gameOffsetsPtr[_musicIndexBase + music - 1], SEEK_SET); + _midi.loadMultipleSMF(_gameFile); + } - _lastMusicPlayed = music; - _nextMusicToPlay = -1; - } else if (getGameType() == GType_SIMON1) { - _midi.stop(); - _midi.setLoop(true); // Must do this BEFORE loading music. (GMF may have its own override.) + _lastMusicPlayed = music; + _nextMusicToPlay = -1; +} - // Support for compressed music from the ScummVM Music Enhancement Project - AudioCD.stop(); - AudioCD.play(music + 1, -1, 0, 0); - if (AudioCD.isPlaying()) - return; +void AGOSEngine_Simon1::loadMusic(uint music) { + char buf[4]; - if (getGameId() == GID_SIMON1ACORN) { - // TODO: Add support for Desktop Tracker format - } else if (getPlatform() == Common::kPlatformAmiga) { - loadModule(music); - } else if (getFeatures() & GF_TALKIE) { - // WORKAROUND: For a script bug in the CD versions - // We skip this music resource, as it was replaced by - // a sound effect, and the script was never updated. - if (music == 35) - return; + _midi.stop(); + _midi.setLoop(true); // Must do this BEFORE loading music. (GMF may have its own override.) + + // Support for compressed music from the ScummVM Music Enhancement Project + AudioCD.stop(); + AudioCD.play(music + 1, -1, 0, 0); + if (AudioCD.isPlaying()) + return; + + if (getGameId() == GID_SIMON1ACORN) { + // TODO: Add support for Desktop Tracker format + } else if (getPlatform() == Common::kPlatformAmiga) { + loadModule(music); + } else if (getFeatures() & GF_TALKIE) { + // WORKAROUND: For a script bug in the CD versions + // We skip this music resource, as it was replaced by + // a sound effect, and the script was never updated. + if (music == 35) + return; + _gameFile->seek(_gameOffsetsPtr[_musicIndexBase + music], SEEK_SET); + _gameFile->read(buf, 4); + if (!memcmp(buf, "GMF\x1", 4)) { _gameFile->seek(_gameOffsetsPtr[_musicIndexBase + music], SEEK_SET); - _gameFile->read(buf, 4); - if (!memcmp(buf, "GMF\x1", 4)) { - _gameFile->seek(_gameOffsetsPtr[_musicIndexBase + music], SEEK_SET); - _midi.loadSMF(_gameFile, music); - } else { - _gameFile->seek(_gameOffsetsPtr[_musicIndexBase + music], SEEK_SET); - _midi.loadMultipleSMF(_gameFile); - } - - _midi.startTrack(0); + _midi.loadSMF(_gameFile, music); } else { - char filename[15]; - File f; - sprintf(filename, "MOD%d.MUS", music); - f.open(filename); - if (f.isOpen() == false) - error("loadMusic: Can't load music from '%s'", filename); - - if (getFeatures() & GF_DEMO) - _midi.loadS1D(&f); - else - _midi.loadSMF(&f, music); - - _midi.startTrack(0); + _gameFile->seek(_gameOffsetsPtr[_musicIndexBase + music], SEEK_SET); + _midi.loadMultipleSMF(_gameFile); } - } else { - if (getPlatform() == Common::kPlatformAmiga) { - loadModule(music); - } else if (getPlatform() == Common::kPlatformAtariST) { - // TODO: Add support for music formats used - } else { - _midi.stop(); - _midi.setLoop(true); // Must do this BEFORE loading music. - char filename[15]; - File f; - sprintf(filename, "MOD%d.MUS", music); - f.open(filename); - if (f.isOpen() == false) - error("loadMusic: Can't load music from '%s'", filename); + _midi.startTrack(0); + } else { + char filename[15]; + File f; + sprintf(filename, "MOD%d.MUS", music); + f.open(filename); + if (f.isOpen() == false) + error("loadMusic: Can't load music from '%s'", filename); + if (getFeatures() & GF_DEMO) _midi.loadS1D(&f); - _midi.startTrack(0); - } + else + _midi.loadSMF(&f, music); + + _midi.startTrack(0); + } +} + +void AGOSEngine::loadMusic(uint music) { + if (getPlatform() == Common::kPlatformAmiga) { + loadModule(music); + } else if (getPlatform() == Common::kPlatformAtariST) { + // TODO: Add support for music formats used + } else { + _midi.stop(); + _midi.setLoop(true); // Must do this BEFORE loading music. + + char filename[15]; + File f; + sprintf(filename, "MOD%d.MUS", music); + f.open(filename); + if (f.isOpen() == false) + error("loadMusic: Can't load music from '%s'", filename); + + _midi.loadS1D(&f); + _midi.startTrack(0); } } |