diff options
author | Travis Howell | 2009-03-10 00:26:40 +0000 |
---|---|---|
committer | Travis Howell | 2009-03-10 00:26:40 +0000 |
commit | 2809c23fc9f70ce6542dcd2d1ee713d67965754c (patch) | |
tree | 8175022aa6c3831de70eb28c89710ab7fd8e98e0 | |
parent | 940f19dc232b61092cc60f118053a4ad1551bee4 (diff) | |
download | scummvm-rg350-2809c23fc9f70ce6542dcd2d1ee713d67965754c.tar.gz scummvm-rg350-2809c23fc9f70ce6542dcd2d1ee713d67965754c.tar.bz2 scummvm-rg350-2809c23fc9f70ce6542dcd2d1ee713d67965754c.zip |
Add snap scroll option from original games (SCUMM3-5), and enable for earlier games too.
svn-id: r39283
-rw-r--r-- | engines/scumm/camera.cpp | 9 | ||||
-rw-r--r-- | engines/scumm/input.cpp | 16 | ||||
-rw-r--r-- | engines/scumm/scumm.cpp | 10 | ||||
-rw-r--r-- | engines/scumm/scumm.h | 3 |
4 files changed, 30 insertions, 8 deletions
diff --git a/engines/scumm/camera.cpp b/engines/scumm/camera.cpp index 524e9e78eb..5420580b47 100644 --- a/engines/scumm/camera.cpp +++ b/engines/scumm/camera.cpp @@ -105,12 +105,11 @@ void ScummEngine::moveCamera() { 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 @@ void ScummEngine::moveCamera() { } 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 @@ void ScummEngine::moveCamera() { 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 @@ void ScummEngine::moveCamera() { 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) diff --git a/engines/scumm/input.cpp b/engines/scumm/input.cpp index 77a7301913..fed41778d9 100644 --- a/engines/scumm/input.cpp +++ b/engines/scumm/input.cpp @@ -451,6 +451,7 @@ void ScummEngine::processKeyboard(Common::KeyState lastKeyHit) { 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 @@ void ScummEngine::processKeyboard(Common::KeyState lastKeyHit) { } 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) diff --git a/engines/scumm/scumm.cpp b/engines/scumm/scumm.cpp index 15fee4115c..70785c5102 100644 --- a/engines/scumm/scumm.cpp +++ b/engines/scumm/scumm.cpp @@ -108,7 +108,7 @@ ScummEngine::ScummEngine(OSystem *syst, const DetectorResult &dr) _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 @@ ScummEngine::ScummEngine(OSystem *syst, const DetectorResult &dr) _switchRoomEffect = 0; _doEffect = false; + _snapScroll = false; _currentLights = 0; _shakeEnabled = false; _shakeFrame = 0; @@ -559,6 +560,7 @@ ScummEngine::~ScummEngine() { delete _2byteFontPtr; delete _charset; + delete _messageDialog; delete _pauseDialog; delete _scummMenuDialog; delete _versionDialog; @@ -2306,6 +2308,12 @@ int ScummEngine_v7::runDialog(Dialog &dialog) { } #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); diff --git a/engines/scumm/scumm.h b/engines/scumm/scumm.h index e08453eed8..7a6339bcc9 100644 --- a/engines/scumm/scumm.h +++ b/engines/scumm/scumm.h @@ -517,6 +517,7 @@ public: protected: Dialog *_pauseDialog; + Dialog *_messageDialog; Dialog *_versionDialog; Dialog *_scummMenuDialog; @@ -524,6 +525,7 @@ protected: void confirmExitDialog(); void confirmRestartDialog(); void pauseDialog(); + void messageDialog(const char *message); void versionDialog(); void scummMenuDialog(); @@ -976,6 +978,7 @@ protected: byte _newEffect, _switchRoomEffect2, _switchRoomEffect; bool _doEffect; + bool _snapScroll; public: bool isLightOn() const; |