diff options
author | Sven Hesse | 2008-05-23 20:40:28 +0000 |
---|---|---|
committer | Sven Hesse | 2008-05-23 20:40:28 +0000 |
commit | 62d0a0d1d1e3735e4898729493ea2dcaa7f85df4 (patch) | |
tree | c5ebbd4be0bf0093f574d35a60d5bfb421a2c4fa /engines/gob | |
parent | 4b06f42ff339cc79eb17aa75140987c1426e405a (diff) | |
download | scummvm-rg350-62d0a0d1d1e3735e4898729493ea2dcaa7f85df4.tar.gz scummvm-rg350-62d0a0d1d1e3735e4898729493ea2dcaa7f85df4.tar.bz2 scummvm-rg350-62d0a0d1d1e3735e4898729493ea2dcaa7f85df4.zip |
Implemented GobEngine::pauseEngineIntern()
svn-id: r32233
Diffstat (limited to 'engines/gob')
-rw-r--r-- | engines/gob/coktelvideo.cpp | 5 | ||||
-rw-r--r-- | engines/gob/coktelvideo.h | 7 | ||||
-rw-r--r-- | engines/gob/gob.cpp | 48 | ||||
-rw-r--r-- | engines/gob/gob.h | 5 | ||||
-rw-r--r-- | engines/gob/videoplayer.cpp | 9 | ||||
-rw-r--r-- | engines/gob/videoplayer.h | 2 |
6 files changed, 75 insertions, 1 deletions
diff --git a/engines/gob/coktelvideo.cpp b/engines/gob/coktelvideo.cpp index d6cbd5c2b5..729927eb94 100644 --- a/engines/gob/coktelvideo.cpp +++ b/engines/gob/coktelvideo.cpp @@ -340,6 +340,11 @@ void Imd::waitEndFrame() { g_system->delayMillis(_frameLength); } +void Imd::notifyPaused(uint32 duration) { + if (_soundStage == 2) + _soundStartTime += duration; +} + void Imd::copyCurrentFrame(byte *dest, uint16 left, uint16 top, uint16 width, uint16 height, uint16 x, uint16 y, uint16 pitch, int16 transp) { diff --git a/engines/gob/coktelvideo.h b/engines/gob/coktelvideo.h index 581ac2ae81..31b220cd56 100644 --- a/engines/gob/coktelvideo.h +++ b/engines/gob/coktelvideo.h @@ -134,7 +134,7 @@ public: /** Use an own memory block as video memory. */ virtual void setVideoMemory() = 0; - /** Play sound (if the IMD has sound). */ + /** Play sound (if the video has sound). */ virtual void enableSound(Audio::Mixer &mixer) = 0; /** Don't play sound or stop currently playing sound. */ virtual void disableSound() = 0; @@ -155,6 +155,9 @@ public: /** Wait for the frame to end. */ virtual void waitEndFrame() = 0; + /** Notifies the video that it was paused for duration ms. */ + virtual void notifyPaused(uint32 duration) = 0; + /** Copy the current frame. * * @param dest The memory to which to copy the current frame. @@ -213,6 +216,8 @@ public: State nextFrame(); void waitEndFrame(); + void notifyPaused(uint32 duration); + void copyCurrentFrame(byte *dest, uint16 left, uint16 top, uint16 width, uint16 height, uint16 x, uint16 y, uint16 pitch, int16 transp = -1); diff --git a/engines/gob/gob.cpp b/engines/gob/gob.cpp index 7926f6220e..9990ed5a8a 100644 --- a/engines/gob/gob.cpp +++ b/engines/gob/gob.cpp @@ -75,6 +75,8 @@ GobEngine::GobEngine(OSystem *syst) : Engine(syst) { _scenery = 0; _draw = 0; _util = 0; _video = 0; _saveLoad = 0; + _pauseStart = 0; + // Setup mixer _mixer->setVolumeForSoundType(Audio::Mixer::kSFXSoundType, ConfMan.getInt("sfx_volume")); _mixer->setVolumeForSoundType(Audio::Mixer::kMusicSoundType, ConfMan.getInt("music_volume")); @@ -248,6 +250,52 @@ int GobEngine::init() { return 0; } +void GobEngine::pauseEngineIntern(bool pause) { + if (pause) { + _pauseStart = _system->getMillis(); + } else { + uint32 duration = _system->getMillis() - _pauseStart; + + _vm->_vidPlayer->notifyPaused(duration); + + _vm->_game->_startTimeKey += duration; + _vm->_draw->_cursorTimeKey += duration; + if (_vm->_inter->_soundEndTimeKey != 0) + _vm->_inter->_soundEndTimeKey += duration; + } + + _mixer->pauseAll(pause); +} + +void GobEngine::pauseGame() { + Common::Event event; + Common::EventManager *eventMan = g_system->getEventManager(); + + pauseEngineIntern(true); + + bool end = false; + while (!end && !_quitRequested) { + if (eventMan->pollEvent(event)) { + switch (event.type) { + case Common::EVENT_KEYDOWN: + if (event.kbd.flags == Common::KBD_CTRL) + if (event.kbd.keycode == Common::KEYCODE_SPACE) + end = true; + break; + case Common::EVENT_QUIT: + _quitRequested = true; + break; + default: + break; + } + } + + _vm->_util->delay(15); + } + + pauseEngineIntern(false); +} + bool GobEngine::initGameParts() { _noMusic = MidiDriver::parseMusicDriver(ConfMan.get("music_driver")) == MD_NULL; diff --git a/engines/gob/gob.h b/engines/gob/gob.h index 812ae1edb9..ba4d8a17f5 100644 --- a/engines/gob/gob.h +++ b/engines/gob/gob.h @@ -178,9 +178,12 @@ private: int32 _features; Common::Platform _platform; + uint32 _pauseStart; + int go(); int init(); + void pauseEngineIntern(bool pause); bool initGameParts(); void deinitGameParts(); @@ -235,6 +238,8 @@ public: virtual ~GobEngine(); void initGame(const GOBGameDescription *gd); + + void pauseGame(); }; } // End of namespace Gob diff --git a/engines/gob/videoplayer.cpp b/engines/gob/videoplayer.cpp index c6910c1369..ebc4edfc27 100644 --- a/engines/gob/videoplayer.cpp +++ b/engines/gob/videoplayer.cpp @@ -634,4 +634,13 @@ void VideoPlayer::evalBgShading(CoktelVideo &video) { _vm->_sound->bgUnshade(); } +void VideoPlayer::notifyPaused(uint32 duration) { + if (_primaryVideo->isOpen()) + _primaryVideo->getVideo()->notifyPaused(duration); + + for (uint i = 0; i < _videoSlots.size(); i++) + if (_videoSlots[i] && _videoSlots[i]->isOpen()) + _videoSlots[i]->getVideo()->notifyPaused(duration); +} + } // End of namespace Gob diff --git a/engines/gob/videoplayer.h b/engines/gob/videoplayer.h index 278045b9e5..b7aa7313b0 100644 --- a/engines/gob/videoplayer.h +++ b/engines/gob/videoplayer.h @@ -83,6 +83,8 @@ public: void writeVideoInfo(const char *videoFile, int16 varX, int16 varY, int16 varFrames, int16 varWidth, int16 varHeight); + void notifyPaused(uint32 duration); + private: class Video { public: |