[Scummvm-cvs-logs] SF.net SVN: scummvm: [32232] scummvm/trunk/engines/sword2
eriktorbjorn at users.sourceforge.net
eriktorbjorn at users.sourceforge.net
Fri May 23 19:54:48 CEST 2008
Revision: 32232
http://scummvm.svn.sourceforge.net/scummvm/?rev=32232&view=rev
Author: eriktorbjorn
Date: 2008-05-23 10:54:47 -0700 (Fri, 23 May 2008)
Log Message:
-----------
Initial implementation of pauseEngineIntern(). There are issues, though, since
the engine doesn't always allow the game to be paused, and some things (GUI,
movie cutscenes, credits, ...) are outside the main engine loop.
Modified Paths:
--------------
scummvm/trunk/engines/sword2/mouse.cpp
scummvm/trunk/engines/sword2/mouse.h
scummvm/trunk/engines/sword2/sword2.cpp
scummvm/trunk/engines/sword2/sword2.h
Modified: scummvm/trunk/engines/sword2/mouse.cpp
===================================================================
--- scummvm/trunk/engines/sword2/mouse.cpp 2008-05-23 13:37:56 UTC (rev 32231)
+++ scummvm/trunk/engines/sword2/mouse.cpp 2008-05-23 17:54:47 UTC (rev 32232)
@@ -1462,21 +1462,21 @@
_vm->_logic->writeVar(RESULT, 0);
}
-void Mouse::pauseGame() {
- // Make the mouse cursor normal. This is the only place where we are
- // allowed to clear the luggage this way.
+void Mouse::pauseEngine(bool pause) {
+ if (pause) {
+ // Make the mouse cursor normal. This is the only place where
+ // we are allowed to clear the luggage this way.
- clearPointerText();
- setLuggageAnim(NULL, 0);
- setMouse(0);
- setMouseTouching(1);
+ clearPointerText();
+ setLuggageAnim(NULL, 0);
+ setMouse(0);
+ setMouseTouching(1);
+ } else {
+ if (_vm->_logic->readVar(OBJECT_HELD) && _realLuggageItem)
+ setLuggage(_realLuggageItem);
+ }
}
-void Mouse::unpauseGame() {
- if (_vm->_logic->readVar(OBJECT_HELD) && _realLuggageItem)
- setLuggage(_realLuggageItem);
-}
-
#define MOUSEFLASHFRAME 6
void Mouse::decompressMouse(byte *decomp, byte *comp, uint8 frame, int width, int height, int pitch, int xOff, int yOff) {
Modified: scummvm/trunk/engines/sword2/mouse.h
===================================================================
--- scummvm/trunk/engines/sword2/mouse.h 2008-05-23 13:37:56 UTC (rev 32231)
+++ scummvm/trunk/engines/sword2/mouse.h 2008-05-23 17:54:47 UTC (rev 32232)
@@ -211,8 +211,7 @@
uint32 getMouseTouching() { return _mouseTouching; }
void setMouseTouching(uint32 touching) { _mouseTouching = touching; }
- void pauseGame();
- void unpauseGame();
+ void pauseEngine(bool pause);
void setMouse(uint32 res);
void setLuggage(uint32 res);
Modified: scummvm/trunk/engines/sword2/sword2.cpp
===================================================================
--- scummvm/trunk/engines/sword2/sword2.cpp 2008-05-23 13:37:56 UTC (rev 32231)
+++ scummvm/trunk/engines/sword2/sword2.cpp 2008-05-23 17:54:47 UTC (rev 32232)
@@ -392,7 +392,7 @@
#ifdef SWORD2_DEBUG
if (_stepOneCycle) {
- pauseGame();
+ pauseEngineIntern(true);
_stepOneCycle = false;
}
#endif
@@ -406,9 +406,9 @@
switch (ke->kbd.keycode) {
case Common::KEYCODE_p:
if (_gamePaused)
- unpauseGame();
+ pauseEngineIntern(false);
else
- pauseGame();
+ pauseEngineIntern(true);
break;
case Common::KEYCODE_c:
if (!_logic->readVar(DEMO) && !_mouse->isChoosing()) {
@@ -421,7 +421,7 @@
case Common::KEYCODE_SPACE:
if (_gamePaused) {
_stepOneCycle = true;
- unpauseGame();
+ pauseEngineIntern(false);
}
break;
case Common::KEYCODE_s:
@@ -689,53 +689,56 @@
}
}
-void Sword2Engine::pauseGame() {
- // Don't allow Pause while screen fading or while black
- if (_screen->getFadeStatus() != RDFADE_NONE)
- return;
+void Sword2Engine::pauseEngineIntern(bool pause) {
+ if (pause) {
+ // FIXME: We should never disallow pausing, and we need to do
+ // something about pausing during cutscene moves, credits, etc.
- _sound->pauseAllSound();
- _mouse->pauseGame();
+ // Don't allow Pause while screen fading or while black
+ if (_screen->getFadeStatus() != RDFADE_NONE)
+ return;
- // If render level is at max, turn it down because palette-matching
- // won't work when the palette is dimmed.
+ _sound->pauseAllSound();
+ _mouse->pauseEngine(true);
- if (_screen->getRenderLevel() == 3) {
- _screen->setRenderLevel(2);
- _graphicsLevelFudged = true;
- }
+ // If render level is at max, turn it down because palette-
+ // matching won't work when the palette is dimmed.
+ if (_screen->getRenderLevel() == 3) {
+ _screen->setRenderLevel(2);
+ _graphicsLevelFudged = true;
+ }
+
#ifdef SWORD2_DEBUG
- // Don't dim it if we're single-stepping through frames
- // dim the palette during the pause
+ // Don't dim it if we're single-stepping through frames
+ // dim the palette during the pause
- if (!_stepOneCycle)
+ if (!_stepOneCycle)
+ _screen->dimPalette();
+#else
_screen->dimPalette();
-#else
- _screen->dimPalette();
#endif
- _gamePaused = true;
-}
+ _gamePaused = true;
+ } else {
+ _mouse->pauseEngine(false);
+ _sound->unpauseAllSound();
-void Sword2Engine::unpauseGame() {
- _mouse->unpauseGame();
- _sound->unpauseAllSound();
+ // Put back game screen palette; see screen.cpp
+ _screen->setFullPalette(-1);
- // Put back game screen palette; see screen.cpp
- _screen->setFullPalette(-1);
+ // If graphics level at max, turn up again
+ if (_graphicsLevelFudged) {
+ _screen->setRenderLevel(3);
+ _graphicsLevelFudged = false;
+ }
- // If graphics level at max, turn up again
- if (_graphicsLevelFudged) {
- _screen->setRenderLevel(3);
- _graphicsLevelFudged = false;
+ _gamePaused = false;
+
+ // If mouse is about or we're in a chooser menu
+ if (!_mouse->getMouseStatus() || _mouse->isChoosing())
+ _mouse->setMouse(NORMAL_MOUSE_ID);
}
-
- _gamePaused = false;
-
- // If mouse is about or we're in a chooser menu
- if (!_mouse->getMouseStatus() || _mouse->isChoosing())
- _mouse->setMouse(NORMAL_MOUSE_ID);
}
uint32 Sword2Engine::getMillis() {
Modified: scummvm/trunk/engines/sword2/sword2.h
===================================================================
--- scummvm/trunk/engines/sword2/sword2.h 2008-05-23 13:37:56 UTC (rev 32231)
+++ scummvm/trunk/engines/sword2/sword2.h 2008-05-23 17:54:47 UTC (rev 32232)
@@ -113,8 +113,7 @@
uint32 calcChecksum(byte *buffer, uint32 size);
- void pauseGame();
- void unpauseGame();
+ virtual void pauseEngineIntern(bool pause);
uint32 _totalStartups;
uint32 _totalScreenManagers;
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