[Scummvm-cvs-logs] CVS: scummvm/sky sky.cpp,1.174,1.175 sky.h,1.65,1.66

Jonathan Gray khalek at users.sourceforge.net
Thu Mar 31 23:34:42 CEST 2005


Update of /cvsroot/scummvm/scummvm/sky
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21807

Modified Files:
	sky.cpp sky.h 
Log Message:
Implement pausing using the 'p' key like the original did.
Feature request #1145781.

Convert key handling from if statements to a case statement
while here.


Index: sky.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sky/sky.cpp,v
retrieving revision 1.174
retrieving revision 1.175
diff -u -d -r1.174 -r1.175
--- sky.cpp	25 Mar 2005 17:55:56 -0000	1.174
+++ sky.cpp	1 Apr 2005 07:33:39 -0000	1.175
@@ -113,7 +113,7 @@
 
 void *SkyEngine::_itemList[300];
 
-SystemVars SkyEngine::_systemVars = {0, 0, 0, 0, 4316, 0, 0, false, false };
+SystemVars SkyEngine::_systemVars = {0, 0, 0, 0, 4316, 0, 0, false, false, false };
 
 SkyEngine::SkyEngine(GameDetector *detector, OSystem *syst)
 	: Engine(syst), _fastMode(0) {
@@ -142,6 +142,14 @@
 
 void SkyEngine::handleKey(void) {
 
+	if (_keyPressed && _systemVars.paused) {
+		_skySound->fnUnPauseFx();
+		_systemVars.paused = false;
+		_skyScreen->setPaletteEndian((uint8 *)_skyCompact->fetchCpt(SkyEngine::_systemVars.currentPalette));
+		_keyFlags = _keyPressed = 0;
+		return;
+	}
+
 	if (_keyFlags == OSystem::KBD_CTRL) {
 		if (_keyPressed == 'f')
 			_fastMode ^= 1;
@@ -150,17 +158,32 @@
 		else if (_keyPressed == 'd')
 			_debugger->attach();
 	} else {
-		if (_keyPressed == '`' || _keyPressed == '~' || _keyPressed == '#')
+		switch (_keyPressed) {
+		case '`':
+		case '~':
+		case '#':
 			_debugger->attach();
-		
-		if (_keyPressed == 63)
+			break;
+		case 63:
 			_skyControl->doControlPanel();
+			break;
 
-		if ((_keyPressed == 27) && (!_systemVars.pastIntro))
-			_skyControl->restartGame();
+		case 27:
+			if (!_systemVars.pastIntro)
+				_skyControl->restartGame();
+			break;
 
-		if (_keyPressed == '.')
+		case '.':
 			_skyMouse->logicClick();
+			break;
+
+		case 'p':
+			_skyScreen->halvePalette();
+			_skySound->fnPauseFx();
+			_systemVars.paused = true;
+			break;
+
+		}
 	}
 	_keyFlags = _keyPressed = 0;
 }
@@ -211,6 +234,12 @@
 		_skySound->checkFxQueue();
 		_skyMouse->mouseEngine((uint16)_mouseX, (uint16)_mouseY);
 		handleKey();
+		while (_systemVars.paused) {
+			_system->updateScreen();			
+			delay(300);
+			handleKey();
+		}
+
 		_skyLogic->engine();
 		_skyScreen->recreate();
 		_skyScreen->spriteEngine();

Index: sky.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sky/sky.h,v
retrieving revision 1.65
retrieving revision 1.66
diff -u -d -r1.65 -r1.66
--- sky.h	1 Jan 2005 16:09:21 -0000	1.65
+++ sky.h	1 Apr 2005 07:33:39 -0000	1.66
@@ -39,6 +39,7 @@
 	uint16 currentMusic;
 	bool pastIntro;
 	bool quitting;
+	bool paused;
 };
 
 struct Compact;





More information about the Scummvm-git-logs mailing list