[Scummvm-cvs-logs] SF.net SVN: scummvm:[34956] scummvm/trunk/engines/sword2

eriktorbjorn at users.sourceforge.net eriktorbjorn at users.sourceforge.net
Sun Nov 9 14:50:41 CET 2008


Revision: 34956
          http://scummvm.svn.sourceforge.net/scummvm/?rev=34956&view=rev
Author:   eriktorbjorn
Date:     2008-11-09 13:50:41 +0000 (Sun, 09 Nov 2008)

Log Message:
-----------
Fixed pausing during credits.

Modified Paths:
--------------
    scummvm/trunk/engines/sword2/screen.cpp
    scummvm/trunk/engines/sword2/screen.h
    scummvm/trunk/engines/sword2/sword2.cpp

Modified: scummvm/trunk/engines/sword2/screen.cpp
===================================================================
--- scummvm/trunk/engines/sword2/screen.cpp	2008-11-09 13:28:59 UTC (rev 34955)
+++ scummvm/trunk/engines/sword2/screen.cpp	2008-11-09 13:50:41 UTC (rev 34956)
@@ -99,6 +99,9 @@
 	_layer = 0;
 
 	_dimPalette = false;
+
+	_pauseTicks = 0;
+	_pauseStartTick = 0;
 }
 
 Screen::~Screen() {
@@ -108,6 +111,14 @@
 	free(_lightMask);
 }
 
+void Screen::pauseScreen(bool pause) {
+	if (pause) {
+		_pauseStartTick = _vm->_system->getMillis();
+	} else {
+		_pauseTicks += (_vm->_system->getMillis() - _pauseStartTick);
+	}
+}
+
 /**
  * @return the graphics detail setting
  */
@@ -1029,6 +1040,8 @@
 	int scrollSteps = lineTop + CREDITS_FONT_HEIGHT;
 	uint32 musicStart = _vm->getMillis();
 
+	_pauseTicks = 0;
+
 	// Ideally the music should last just a tiny bit longer than the
 	// credits. Note that musicTimeRemaining() will return 0 if the music
 	// is muted, so we need a sensible fallback for that case.
@@ -1104,7 +1117,7 @@
 		if (abortCredits && getFadeStatus() == RDFADE_BLACK)
 			break;
 
-		_vm->sleepUntil(musicStart + (musicLength * scrollPos) / scrollSteps);
+		_vm->sleepUntil(musicStart + (musicLength * scrollPos) / scrollSteps + _pauseTicks);
 		scrollPos++;
 	}
 

Modified: scummvm/trunk/engines/sword2/screen.h
===================================================================
--- scummvm/trunk/engines/sword2/screen.h	2008-11-09 13:28:59 UTC (rev 34955)
+++ scummvm/trunk/engines/sword2/screen.h	2008-11-09 13:50:41 UTC (rev 34956)
@@ -352,10 +352,15 @@
 
 	bool _dimPalette;
 
+	uint32 _pauseTicks;
+	uint32 _pauseStartTick;
+
 public:
 	Screen(Sword2Engine *vm, int16 width, int16 height);
 	~Screen();
 
+	void pauseScreen(bool pause);
+
 	int8 getRenderLevel();
 	void setRenderLevel(int8 level);
 

Modified: scummvm/trunk/engines/sword2/sword2.cpp
===================================================================
--- scummvm/trunk/engines/sword2/sword2.cpp	2008-11-09 13:28:59 UTC (rev 34955)
+++ scummvm/trunk/engines/sword2/sword2.cpp	2008-11-09 13:50:41 UTC (rev 34956)
@@ -743,8 +743,7 @@
 
 void Sword2Engine::pauseEngineIntern(bool pause) {
 	if (pause) {
-		// FIXME: We should never disallow pausing, and we need to do
-		// something about pausing during credits, etc.
+		// FIXME: We should never disallow pausing.
 
 		// Don't allow Pause while screen fading or while black
 		if (_screen->getFadeStatus() != RDFADE_NONE)
@@ -753,6 +752,7 @@
 		_sound->pauseAllSound();
 		_mouse->pauseEngine(true);
 		_logic->pauseMovie(true);
+		_screen->pauseScreen(true);
 
 #ifdef SWORD2_DEBUG
 		// Don't dim it if we're single-stepping through frames
@@ -768,6 +768,7 @@
 	} else {
 		_mouse->pauseEngine(false);
 		_logic->pauseMovie(false);
+		_screen->pauseScreen(false);
 		_sound->unpauseAllSound();
 
 		_screen->dimPalette(false);


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