diff options
author | Paul Gilbert | 2009-05-31 11:37:21 +0000 |
---|---|---|
committer | Paul Gilbert | 2009-05-31 11:37:21 +0000 |
commit | 555d4038cc053c0c914dd1cb56746066446a1386 (patch) | |
tree | c70331c16c750f21f3d4e168ac58bb0fe0e0736b | |
parent | f94025f482ae9231dad845fcaeb9f08a5ad37746 (diff) | |
download | scummvm-rg350-555d4038cc053c0c914dd1cb56746066446a1386.tar.gz scummvm-rg350-555d4038cc053c0c914dd1cb56746066446a1386.tar.bz2 scummvm-rg350-555d4038cc053c0c914dd1cb56746066446a1386.zip |
Slowed down the game to match the original, and introduced the ability to alter game speed using the keypad +/- keys
svn-id: r41064
-rw-r--r-- | engines/cruise/cruise.cpp | 2 | ||||
-rw-r--r-- | engines/cruise/cruise.h | 7 | ||||
-rw-r--r-- | engines/cruise/cruise_main.cpp | 22 |
3 files changed, 27 insertions, 4 deletions
diff --git a/engines/cruise/cruise.cpp b/engines/cruise/cruise.cpp index 2ce5d55175..734f4b95c5 100644 --- a/engines/cruise/cruise.cpp +++ b/engines/cruise/cruise.cpp @@ -109,6 +109,8 @@ Common::Error CruiseEngine::run() { void CruiseEngine::initialize() { PCFadeFlag = 0; + _gameSpeed = GAME_FRAME_DELAY_1; + _speedFlag = false; /*volVar1 = 0; * fileData1 = 0; */ diff --git a/engines/cruise/cruise.h b/engines/cruise/cruise.h index 491a833788..1599c992ac 100644 --- a/engines/cruise/cruise.h +++ b/engines/cruise/cruise.h @@ -42,7 +42,8 @@ enum CruiseGameType { GType_CRUISE = 1 }; -#define GAME_FRAME_DELAY 40 +#define GAME_FRAME_DELAY_1 50 +#define GAME_FRAME_DELAY_2 100 #define MAX_LANGUAGE_STRINGS 25 @@ -63,13 +64,15 @@ private: Common::StringList _langStrings; CursorType _savedCursor; uint32 lastTick, lastTickDebug; + int _gameSpeed; + bool _speedFlag; void initialize(void); void deinitialise(void); bool loadLanguageStrings(); bool makeLoad(char *saveName); void mainLoop(); - + int processInput(void); protected: // Engine APIs virtual Common::Error run(); 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++; |