[Scummvm-cvs-logs] SF.net SVN: scummvm: [32233] scummvm/trunk/engines/gob

drmccoy at users.sourceforge.net drmccoy at users.sourceforge.net
Fri May 23 22:40:29 CEST 2008


Revision: 32233
          http://scummvm.svn.sourceforge.net/scummvm/?rev=32233&view=rev
Author:   drmccoy
Date:     2008-05-23 13:40:28 -0700 (Fri, 23 May 2008)

Log Message:
-----------
Implemented GobEngine::pauseEngineIntern()

Modified Paths:
--------------
    scummvm/trunk/engines/gob/coktelvideo.cpp
    scummvm/trunk/engines/gob/coktelvideo.h
    scummvm/trunk/engines/gob/gob.cpp
    scummvm/trunk/engines/gob/gob.h
    scummvm/trunk/engines/gob/videoplayer.cpp
    scummvm/trunk/engines/gob/videoplayer.h

Modified: scummvm/trunk/engines/gob/coktelvideo.cpp
===================================================================
--- scummvm/trunk/engines/gob/coktelvideo.cpp	2008-05-23 17:54:47 UTC (rev 32232)
+++ scummvm/trunk/engines/gob/coktelvideo.cpp	2008-05-23 20:40:28 UTC (rev 32233)
@@ -340,6 +340,11 @@
 		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) {

Modified: scummvm/trunk/engines/gob/coktelvideo.h
===================================================================
--- scummvm/trunk/engines/gob/coktelvideo.h	2008-05-23 17:54:47 UTC (rev 32232)
+++ scummvm/trunk/engines/gob/coktelvideo.h	2008-05-23 20:40:28 UTC (rev 32233)
@@ -134,7 +134,7 @@
 	/** 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 @@
 	/** 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 @@
 	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);

Modified: scummvm/trunk/engines/gob/gob.cpp
===================================================================
--- scummvm/trunk/engines/gob/gob.cpp	2008-05-23 17:54:47 UTC (rev 32232)
+++ scummvm/trunk/engines/gob/gob.cpp	2008-05-23 20:40:28 UTC (rev 32233)
@@ -75,6 +75,8 @@
 	_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 @@
 	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;
 

Modified: scummvm/trunk/engines/gob/gob.h
===================================================================
--- scummvm/trunk/engines/gob/gob.h	2008-05-23 17:54:47 UTC (rev 32232)
+++ scummvm/trunk/engines/gob/gob.h	2008-05-23 20:40:28 UTC (rev 32233)
@@ -178,9 +178,12 @@
 	int32 _features;
 	Common::Platform _platform;
 
+	uint32 _pauseStart;
+
 	int go();
 	int init();
 
+	void pauseEngineIntern(bool pause);
 	bool initGameParts();
 	void deinitGameParts();
 
@@ -235,6 +238,8 @@
 	virtual ~GobEngine();
 
 	void initGame(const GOBGameDescription *gd);
+
+	void pauseGame();
 };
 
 } // End of namespace Gob

Modified: scummvm/trunk/engines/gob/videoplayer.cpp
===================================================================
--- scummvm/trunk/engines/gob/videoplayer.cpp	2008-05-23 17:54:47 UTC (rev 32232)
+++ scummvm/trunk/engines/gob/videoplayer.cpp	2008-05-23 20:40:28 UTC (rev 32233)
@@ -634,4 +634,13 @@
 		_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

Modified: scummvm/trunk/engines/gob/videoplayer.h
===================================================================
--- scummvm/trunk/engines/gob/videoplayer.h	2008-05-23 17:54:47 UTC (rev 32232)
+++ scummvm/trunk/engines/gob/videoplayer.h	2008-05-23 20:40:28 UTC (rev 32233)
@@ -83,6 +83,8 @@
 	void writeVideoInfo(const char *videoFile, int16 varX, int16 varY,
 			int16 varFrames, int16 varWidth, int16 varHeight);
 
+	void notifyPaused(uint32 duration);
+
 private:
 	class Video {
 		public:


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list