[Scummvm-cvs-logs] SF.net SVN: scummvm:[41064] scummvm/trunk/engines/cruise

dreammaster at users.sourceforge.net dreammaster at users.sourceforge.net
Sun May 31 13:37:21 CEST 2009


Revision: 41064
          http://scummvm.svn.sourceforge.net/scummvm/?rev=41064&view=rev
Author:   dreammaster
Date:     2009-05-31 11:37:21 +0000 (Sun, 31 May 2009)

Log Message:
-----------
Slowed down the game to match the original, and introduced the ability to alter game speed using the keypad +/- keys

Modified Paths:
--------------
    scummvm/trunk/engines/cruise/cruise.cpp
    scummvm/trunk/engines/cruise/cruise.h
    scummvm/trunk/engines/cruise/cruise_main.cpp

Modified: scummvm/trunk/engines/cruise/cruise.cpp
===================================================================
--- scummvm/trunk/engines/cruise/cruise.cpp	2009-05-31 10:14:41 UTC (rev 41063)
+++ scummvm/trunk/engines/cruise/cruise.cpp	2009-05-31 11:37:21 UTC (rev 41064)
@@ -109,6 +109,8 @@
 
 void CruiseEngine::initialize() {
 	PCFadeFlag = 0;
+	_gameSpeed = GAME_FRAME_DELAY_1;
+	_speedFlag = false;
 
 	/*volVar1 = 0;
 	 * fileData1 = 0; */

Modified: scummvm/trunk/engines/cruise/cruise.h
===================================================================
--- scummvm/trunk/engines/cruise/cruise.h	2009-05-31 10:14:41 UTC (rev 41063)
+++ scummvm/trunk/engines/cruise/cruise.h	2009-05-31 11:37:21 UTC (rev 41064)
@@ -42,7 +42,8 @@
 	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 @@
 	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();

Modified: scummvm/trunk/engines/cruise/cruise_main.cpp
===================================================================
--- scummvm/trunk/engines/cruise/cruise_main.cpp	2009-05-31 10:14:41 UTC (rev 41063)
+++ scummvm/trunk/engines/cruise/cruise_main.cpp	2009-05-31 11:37:21 UTC (rev 41064)
@@ -1273,7 +1273,7 @@
 	return false;
 }
 
-int processInput(void) {
+int CruiseEngine::processInput(void) {
 	int16 mouseX = 0;
 	int16 mouseY = 0;
 	int16 button = 0;
@@ -1351,6 +1351,18 @@
 		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 @@
 
 		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 @@
 
 		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++;


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