[Scummvm-cvs-logs] SF.net SVN: scummvm:[39283] scummvm/trunk/engines/scumm

Kirben at users.sourceforge.net Kirben at users.sourceforge.net
Tue Mar 10 01:26:40 CET 2009


Revision: 39283
          http://scummvm.svn.sourceforge.net/scummvm/?rev=39283&view=rev
Author:   Kirben
Date:     2009-03-10 00:26:40 +0000 (Tue, 10 Mar 2009)

Log Message:
-----------
Add snap scroll option from original games (SCUMM3-5), and enable for earlier games too.

Modified Paths:
--------------
    scummvm/trunk/engines/scumm/camera.cpp
    scummvm/trunk/engines/scumm/input.cpp
    scummvm/trunk/engines/scumm/scumm.cpp
    scummvm/trunk/engines/scumm/scumm.h

Modified: scummvm/trunk/engines/scumm/camera.cpp
===================================================================
--- scummvm/trunk/engines/scumm/camera.cpp	2009-03-10 00:19:44 UTC (rev 39282)
+++ scummvm/trunk/engines/scumm/camera.cpp	2009-03-10 00:26:40 UTC (rev 39283)
@@ -105,12 +105,11 @@
 	int pos = camera._cur.x;
 	int t;
 	Actor *a = NULL;
-	const bool snapToX = (VAR_CAMERA_FAST_X != 0xFF && VAR(VAR_CAMERA_FAST_X));
 
 	camera._cur.x &= 0xFFF8;
 
 	if (VAR_CAMERA_MIN_X != 0xFF && camera._cur.x < VAR(VAR_CAMERA_MIN_X)) {
-		if (snapToX)
+		if (_snapScroll)
 			camera._cur.x = (short) VAR(VAR_CAMERA_MIN_X);
 		else
 			camera._cur.x += 8;
@@ -119,7 +118,7 @@
 	}
 
 	if (VAR_CAMERA_MAX_X != 0xFF && camera._cur.x > VAR(VAR_CAMERA_MAX_X)) {
-		if (snapToX)
+		if (_snapScroll)
 			camera._cur.x = (short) VAR(VAR_CAMERA_MAX_X);
 		else
 			camera._cur.x -= 8;
@@ -134,7 +133,7 @@
 		t = actorx / 8 - _screenStartStrip;
 
 		if (t < camera._leftTrigger || t > camera._rightTrigger) {
-			if (snapToX) {
+			if (_snapScroll) {
 				if (t > 40-5)
 					camera._dest.x = actorx + 80;
 				if (t < 5)
@@ -155,7 +154,7 @@
 	if (VAR_CAMERA_MAX_X != 0xFF && camera._dest.x > VAR(VAR_CAMERA_MAX_X))
 		camera._dest.x = (short) VAR(VAR_CAMERA_MAX_X);
 
-	if (snapToX) {
+	if (_snapScroll) {
 		camera._cur.x = camera._dest.x;
 	} else {
 		if (camera._cur.x < camera._dest.x)

Modified: scummvm/trunk/engines/scumm/input.cpp
===================================================================
--- scummvm/trunk/engines/scumm/input.cpp	2009-03-10 00:19:44 UTC (rev 39282)
+++ scummvm/trunk/engines/scumm/input.cpp	2009-03-10 00:26:40 UTC (rev 39283)
@@ -451,6 +451,7 @@
 	bool talkstopKeyEnabled = (VAR_TALKSTOP_KEY == 0xFF || VAR(VAR_TALKSTOP_KEY) != 0);
 	bool cutsceneExitKeyEnabled = (VAR_CUTSCENEEXIT_KEY == 0xFF || VAR(VAR_CUTSCENEEXIT_KEY) != 0);
 	bool mainmenuKeyEnabled = (VAR_MAINMENU_KEY == 0xFF || VAR(VAR_MAINMENU_KEY) != 0);
+	bool snapScrollKeyEnabled = (_game.version <= 2 || VAR_CAMERA_FAST_X != 0xFF);
 
 	// In FM-TOWNS games F8 / restart is always enabled
 	if (_game.platform == Common::kPlatformFMTowns)
@@ -485,10 +486,21 @@
 	} else if (cutsceneExitKeyEnabled && (lastKeyHit.keycode == Common::KEYCODE_ESCAPE && lastKeyHit.flags == 0)) {
 		abortCutscene();
 
-		// FIXME: Is the following line really necessary?
-		if (VAR_CUTSCENEEXIT_KEY != 0xFF)
+		// VAR_CUTSCENEEXIT_KEY doesn't exist in SCUMM0
+		if (VAR_CUTSCENEEXIT_KEY != 0xFF) {
 			_mouseAndKeyboardStat = VAR(VAR_CUTSCENEEXIT_KEY);
+		}
+	} else if (snapScrollKeyEnabled && lastKeyHit.keycode == Common::KEYCODE_r &&
+		lastKeyHit.flags == Common::KBD_CTRL) {
+		_snapScroll ^= 1;
+		if (_snapScroll) {
+			messageDialog((const char *)"Snap scroll on");
+		} else {
+			messageDialog((const char *)"Snap scroll off");
+		}	
 
+		if (VAR_CAMERA_FAST_X != 0xFF)
+			VAR(VAR_CAMERA_FAST_X) = _snapScroll;
 	} else if (lastKeyHit.ascii == '[' || lastKeyHit.ascii == ']') { // Change music volume
 		int vol = ConfMan.getInt("music_volume") / 16;
 		if (lastKeyHit.ascii == ']' && vol < 16)

Modified: scummvm/trunk/engines/scumm/scumm.cpp
===================================================================
--- scummvm/trunk/engines/scumm/scumm.cpp	2009-03-10 00:19:44 UTC (rev 39282)
+++ scummvm/trunk/engines/scumm/scumm.cpp	2009-03-10 00:26:40 UTC (rev 39283)
@@ -108,7 +108,7 @@
 	  _language(dr.language),
 	  _debugger(0),
 	  _currentScript(0xFF), // Let debug() work on init stage
-	  _pauseDialog(0), _scummMenuDialog(0), _versionDialog(0) {
+	  _messageDialog(0), _pauseDialog(0), _scummMenuDialog(0), _versionDialog(0) {
 
 	if (_game.platform == Common::kPlatformNES) {
 		_gdi = new GdiNES(this);
@@ -250,6 +250,7 @@
 	_switchRoomEffect = 0;
 
 	_doEffect = false;
+	_snapScroll = false;
 	_currentLights = 0;
 	_shakeEnabled = false;
 	_shakeFrame = 0;
@@ -559,6 +560,7 @@
 
 	delete _2byteFontPtr;
 	delete _charset;
+	delete _messageDialog;
 	delete _pauseDialog;
 	delete _scummMenuDialog;
 	delete _versionDialog;
@@ -2306,6 +2308,12 @@
 }
 #endif
 
+void ScummEngine::messageDialog(const char *message) {
+	if (!_messageDialog)
+		_messageDialog = new InfoDialog(this, message);
+	runDialog(*_messageDialog);
+}
+
 void ScummEngine::pauseDialog() {
 	if (!_pauseDialog)
 		_pauseDialog = new PauseDialog(this, 4);

Modified: scummvm/trunk/engines/scumm/scumm.h
===================================================================
--- scummvm/trunk/engines/scumm/scumm.h	2009-03-10 00:19:44 UTC (rev 39282)
+++ scummvm/trunk/engines/scumm/scumm.h	2009-03-10 00:26:40 UTC (rev 39283)
@@ -517,6 +517,7 @@
 
 protected:
 	Dialog *_pauseDialog;
+	Dialog *_messageDialog;
 	Dialog *_versionDialog;
 	Dialog *_scummMenuDialog;
 
@@ -524,6 +525,7 @@
 	void confirmExitDialog();
 	void confirmRestartDialog();
 	void pauseDialog();
+	void messageDialog(const char *message);
 	void versionDialog();
 	void scummMenuDialog();
 
@@ -976,6 +978,7 @@
 	byte _newEffect, _switchRoomEffect2, _switchRoomEffect;
 	bool _doEffect;
 
+	bool _snapScroll;
 public:
 	bool isLightOn() const;
 


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