diff options
author | Filippos Karapetis | 2008-11-11 17:34:52 +0000 |
---|---|---|
committer | Filippos Karapetis | 2008-11-11 17:34:52 +0000 |
commit | 113a83c0da91cafdb2b3c9d73094a801311c940f (patch) | |
tree | 7e491f5916d17986f821d9567136d60ba7460c0d /engines | |
parent | b7c9958e82da768054ea6bc0b0a2bc7e173b3ef1 (diff) | |
download | scummvm-rg350-113a83c0da91cafdb2b3c9d73094a801311c940f.tar.gz scummvm-rg350-113a83c0da91cafdb2b3c9d73094a801311c940f.tar.bz2 scummvm-rg350-113a83c0da91cafdb2b3c9d73094a801311c940f.zip |
Implemented pauseEngineIntern() for the SAGA engine
svn-id: r35007
Diffstat (limited to 'engines')
-rw-r--r-- | engines/saga/music.cpp | 3 | ||||
-rw-r--r-- | engines/saga/music.h | 2 | ||||
-rw-r--r-- | engines/saga/render.cpp | 16 | ||||
-rw-r--r-- | engines/saga/saga.cpp | 18 | ||||
-rw-r--r-- | engines/saga/saga.h | 1 |
5 files changed, 36 insertions, 4 deletions
diff --git a/engines/saga/music.cpp b/engines/saga/music.cpp index d022768957..328dee3566 100644 --- a/engines/saga/music.cpp +++ b/engines/saga/music.cpp @@ -366,6 +366,7 @@ Music::Music(SagaEngine *vm, Audio::Mixer *mixer, MidiDriver *driver) : _vm(vm), _songTable = 0; _midiMusicData = NULL; + _digitalMusic = false; } Music::~Music() { @@ -474,6 +475,7 @@ void Music::play(uint32 resourceId, MusicFlags flags) { stream = Audio::AudioStream::openStreamFile(trackName[i], 0, 10000 * 40 / 3, (flags == MUSIC_LOOP) ? 0 : 1); if (stream) { _mixer->playInputStream(Audio::Mixer::kMusicSoundType, &_musicHandle, stream); + _digitalMusic = true; return; } } @@ -497,6 +499,7 @@ void Music::play(uint32 resourceId, MusicFlags flags) { if (audioStream) { debug(2, "Playing digitized music"); _mixer->playInputStream(Audio::Mixer::kMusicSoundType, &_musicHandle, audioStream); + _digitalMusic = true; return; } diff --git a/engines/saga/music.h b/engines/saga/music.h index 57ff9e0671..79a3e62519 100644 --- a/engines/saga/music.h +++ b/engines/saga/music.h @@ -113,6 +113,7 @@ public: bool hasAdlib() { return _adlib; } void setPassThrough(bool b) { _player->setPassThrough(b); } bool isPlaying(void); + bool hasDigitalMusic() { return _digitalMusic; } void play(uint32 resourceId, MusicFlags flags = MUSIC_DEFAULT); void pause(void); @@ -138,6 +139,7 @@ private: int _targetVolume; int _currentVolume; int _currentVolumePercent; + bool _digitalMusic; ResourceContext *_digitalMusicContext; MidiParser *xmidiParser; diff --git a/engines/saga/render.cpp b/engines/saga/render.cpp index 382dc0f356..8f7e9e5b50 100644 --- a/engines/saga/render.cpp +++ b/engines/saga/render.cpp @@ -42,7 +42,8 @@ namespace Saga { const char *test_txt = "The quick brown fox jumped over the lazy dog. She sells sea shells down by the sea shore."; -const char *pauseString = "PAWS GAME"; +const char *pauseStringITE = "PAWS GAME"; +const char *pauseStringIHNM = "Game Paused"; Render::Render(SagaEngine *vm, OSystem *system) { _vm = vm; @@ -153,10 +154,17 @@ void Render::drawScene() { // Display "paused game" message, if applicable if (_flags & RF_RENDERPAUSE) { - textPoint.x = (backBufferSurface->w - _vm->_font->getStringWidth(kKnownFontPause, pauseString, 0, kFontOutline)) / 2; - textPoint.y = 90; + if (_vm->getGameType() == GType_ITE) { + textPoint.x = (backBufferSurface->w - _vm->_font->getStringWidth(kKnownFontPause, pauseStringITE, 0, kFontOutline)) / 2; + textPoint.y = 90; - _vm->_font->textDraw(kKnownFontPause, backBufferSurface, pauseString, textPoint, kITEColorBrightWhite, kITEColorBlack, kFontOutline); + _vm->_font->textDraw(kKnownFontPause, backBufferSurface, pauseStringITE, textPoint, _vm->KnownColor2ColorId(kKnownColorBrightWhite), _vm->KnownColor2ColorId(kKnownColorBlack), kFontOutline); + } else { + textPoint.x = (backBufferSurface->w - _vm->_font->getStringWidth(kKnownFontPause, pauseStringIHNM, 0, kFontOutline)) / 2; + textPoint.y = 90; + + _vm->_font->textDraw(kKnownFontPause, backBufferSurface, pauseStringIHNM, textPoint, _vm->KnownColor2ColorId(kKnownColorBrightWhite), _vm->KnownColor2ColorId(kKnownColorBlack), kFontOutline); + } } // Update user interface diff --git a/engines/saga/saga.cpp b/engines/saga/saga.cpp index 17fee5deb6..4f2a71c27c 100644 --- a/engines/saga/saga.cpp +++ b/engines/saga/saga.cpp @@ -532,4 +532,22 @@ void SagaEngine::syncSoundSettings() { _sound->setVolume(); } +void SagaEngine::pauseEngineIntern(bool pause) { + bool isPaused = (_render->getFlags() & RF_RENDERPAUSE); + if (isPaused == pause) + return; + + if (pause) { + _render->setFlag(RF_RENDERPAUSE); + if (!_music->hasDigitalMusic()) + _music->pause(); + } else { + _render->clearFlag(RF_RENDERPAUSE); + if (!_music->hasDigitalMusic()) + _music->resume(); + } + + _mixer->pauseAll(pause); +} + } // End of namespace Saga diff --git a/engines/saga/saga.h b/engines/saga/saga.h index 93e58b7fc7..6f861dad79 100644 --- a/engines/saga/saga.h +++ b/engines/saga/saga.h @@ -493,6 +493,7 @@ public: virtual Common::Error go(); virtual bool hasFeature(EngineFeature f) const; virtual void syncSoundSettings(); + virtual void pauseEngineIntern(bool pause); public: SagaEngine(OSystem *syst, const SAGAGameDescription *gameDesc); |