aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonathan Gray2005-04-01 07:33:39 +0000
committerJonathan Gray2005-04-01 07:33:39 +0000
commit4e3bfc6a66a73b28244ea5ab95046f6855573976 (patch)
tree31a9fbebd0b277f24b7d3c0d6b05469fee4a5747
parent2d26bfcb4735255d67ff6ed595345adef2772faf (diff)
downloadscummvm-rg350-4e3bfc6a66a73b28244ea5ab95046f6855573976.tar.gz
scummvm-rg350-4e3bfc6a66a73b28244ea5ab95046f6855573976.tar.bz2
scummvm-rg350-4e3bfc6a66a73b28244ea5ab95046f6855573976.zip
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. svn-id: r17321
-rw-r--r--sky/sky.cpp43
-rw-r--r--sky/sky.h1
2 files changed, 37 insertions, 7 deletions
diff --git a/sky/sky.cpp b/sky/sky.cpp
index 0209c7cd37..10b5c4ec54 100644
--- a/sky/sky.cpp
+++ b/sky/sky.cpp
@@ -113,7 +113,7 @@ namespace Sky {
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::initVirgin() {
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 @@ void SkyEngine::handleKey(void) {
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 @@ int SkyEngine::go() {
_skySound->checkFxQueue();
_skyMouse->mouseEngine((uint16)_mouseX, (uint16)_mouseY);
handleKey();
+ while (_systemVars.paused) {
+ _system->updateScreen();
+ delay(300);
+ handleKey();
+ }
+
_skyLogic->engine();
_skyScreen->recreate();
_skyScreen->spriteEngine();
diff --git a/sky/sky.h b/sky/sky.h
index 4331a289d6..ed4d086b8c 100644
--- a/sky/sky.h
+++ b/sky/sky.h
@@ -39,6 +39,7 @@ struct SystemVars {
uint16 currentMusic;
bool pastIntro;
bool quitting;
+ bool paused;
};
struct Compact;