From 555d4038cc053c0c914dd1cb56746066446a1386 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 31 May 2009 11:37:21 +0000 Subject: Slowed down the game to match the original, and introduced the ability to alter game speed using the keypad +/- keys svn-id: r41064 --- engines/cruise/cruise_main.cpp | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) (limited to 'engines/cruise/cruise_main.cpp') diff --git a/engines/cruise/cruise_main.cpp b/engines/cruise/cruise_main.cpp index 752c8ded50..03ee9a08c3 100644 --- a/engines/cruise/cruise_main.cpp +++ b/engines/cruise/cruise_main.cpp @@ -1273,7 +1273,7 @@ bool checkInput(int16 *buttonPtr) { return false; } -int processInput(void) { +int CruiseEngine::processInput(void) { int16 mouseX = 0; int16 mouseY = 0; int16 button = 0; @@ -1351,6 +1351,18 @@ int processInput(void) { return 0; } + // Handle any changes in game speed + if (_speedFlag) { + if ((keyboardCode == Common::KEYCODE_KP_PLUS) && (_gameSpeed >= 30)) { + _gameSpeed -= 10; + keyboardCode = Common::KEYCODE_INVALID; + } + if ((keyboardCode == Common::KEYCODE_KP_MINUS) && (_gameSpeed <= 200)) { + _gameSpeed += 10; + keyboardCode = Common::KEYCODE_INVALID; + } + } + if (!userEnabled) { return 0; } @@ -1735,7 +1747,7 @@ void CruiseEngine::mainLoop(void) { if (!bFastMode) { // Delay for the specified amount of time, but still respond to events - while (currentTick < lastTick + GAME_FRAME_DELAY) { + while (currentTick < lastTick + _gameSpeed) { g_system->delayMillis(10); currentTick = g_system->getMillis(); @@ -1760,6 +1772,12 @@ void CruiseEngine::mainLoop(void) { lastTick = g_system->getMillis(); + // Handle switchover in game speed after intro + if (!_speedFlag && canLoadGameStateCurrently()) { + _speedFlag = true; + _gameSpeed = GAME_FRAME_DELAY_2; + } + // Handle the next frame // frames++; -- cgit v1.2.3