diff options
author | Travis Howell | 2004-10-18 06:40:36 +0000 |
---|---|---|
committer | Travis Howell | 2004-10-18 06:40:36 +0000 |
commit | 1922b330adeb553dc7f02fa93f2faa5328f176c3 (patch) | |
tree | 10068acf0a772459f3dff4ee4d0350de6e67bead | |
parent | a6da7109238d4bf70c51276d83cb2067f053417e (diff) | |
download | scummvm-rg350-1922b330adeb553dc7f02fa93f2faa5328f176c3.tar.gz scummvm-rg350-1922b330adeb553dc7f02fa93f2faa5328f176c3.tar.bz2 scummvm-rg350-1922b330adeb553dc7f02fa93f2faa5328f176c3.zip |
Add keyboard control for HE80+ games.
svn-id: r15604
-rw-r--r-- | scumm/input.cpp | 25 | ||||
-rw-r--r-- | scumm/script.cpp | 4 | ||||
-rw-r--r-- | scumm/scumm.cpp | 3 | ||||
-rw-r--r-- | scumm/scumm.h | 1 | ||||
-rw-r--r-- | scumm/vars.cpp | 3 |
5 files changed, 32 insertions, 4 deletions
diff --git a/scumm/input.cpp b/scumm/input.cpp index b8b10b975f..c8a33cbcc4 100644 --- a/scumm/input.cpp +++ b/scumm/input.cpp @@ -97,6 +97,31 @@ void ScummEngine::parseEvents() { _keyPressed = event.kbd.ascii; // Normal key press, pass on to the game. } + if (_heversion >= 80) { + // Keyboard is controlled via variable + int _keyState = 0; + + if (event.kbd.ascii == 276) // Left + _keyState = 1; + + if (event.kbd.ascii == 275) // Right + _keyState |= 2; + + if (event.kbd.ascii == 273) // Up + _keyState |= 4; + + if (event.kbd.ascii == 274) // Down + _keyState |= 8; + + if (event.kbd.flags == OSystem::KBD_SHIFT) + _keyState |= 16; + + if (event.kbd.flags == OSystem::KBD_CTRL) + _keyState |= 32; + + VAR(VAR_KEY_STATE) = _keyState; + } + if (_keyPressed >= 512) debugC(DEBUG_GENERAL, "_keyPressed > 512 (%d)", _keyPressed); else diff --git a/scumm/script.cpp b/scumm/script.cpp index 41cb9e61d2..1071aec186 100644 --- a/scumm/script.cpp +++ b/scumm/script.cpp @@ -548,7 +548,7 @@ int ScummEngine::readVar(uint var) { var &= 0xFFF; } - if (_heversion >= 72) + if (_heversion >= 80) checkRange(25, 0, var, "Local variable %d out of range(r)"); else checkRange(20, 0, var, "Local variable %d out of range(r)"); @@ -627,7 +627,7 @@ void ScummEngine::writeVar(uint var, int value) { var &= 0xFFF; } - if (_heversion >= 72) + if (_heversion >= 80) checkRange(25, 0, var, "Local variable %d out of range(w)"); else checkRange(20, 0, var, "Local variable %d out of range(w)"); diff --git a/scumm/scumm.cpp b/scumm/scumm.cpp index a3f609f03f..cc48f1d9e2 100644 --- a/scumm/scumm.cpp +++ b/scumm/scumm.cpp @@ -850,6 +850,7 @@ ScummEngine::ScummEngine(GameDetector *detector, OSystem *syst, const ScummGameS VAR_NUM_UNK = 0xFF; VAR_POLYGONS_ONLY = 0xFF; VAR_WINDOWS_VERSION = 0xFF; + VAR_KEY_STATE = 0xFF; VAR_WIZ_TCOLOR = 0xFF; // Use g_scumm from error() ONLY @@ -1089,7 +1090,7 @@ void ScummEngine::mainInit() { if (VAR_DEBUGMODE != 0xFF) { // This is NOT for the Mac version of Indy3/Loom VAR(VAR_DEBUGMODE) = _debugMode; - if (_heversion >= 80) + if (_heversion >= 80 && _debugMode) VAR(85) = 1; } diff --git a/scumm/scumm.h b/scumm/scumm.h index 56600da666..508c35dc79 100644 --- a/scumm/scumm.h +++ b/scumm/scumm.h @@ -1335,6 +1335,7 @@ public: byte VAR_NUM_UNK; byte VAR_POLYGONS_ONLY; byte VAR_WINDOWS_VERSION; + byte VAR_KEY_STATE; byte VAR_WIZ_TCOLOR; }; diff --git a/scumm/vars.cpp b/scumm/vars.cpp index 6f0bce6c5f..a07921dd3d 100644 --- a/scumm/vars.cpp +++ b/scumm/vars.cpp @@ -263,6 +263,7 @@ void ScummEngine_v72he::setupScummVars() { if (_heversion >= 80) VAR_WINDOWS_VERSION = 79; + VAR_KEY_STATE = 86; if (_heversion >= 90) { VAR_NUM_SPRITES = 106; VAR_WIZ_TCOLOR = 117; @@ -491,7 +492,7 @@ void ScummEngine::initScummVars() { VAR(VAR_V6_EMSSPACE) = 10000; VAR(VAR_NUM_GLOBAL_OBJS) = _numGlobalObjects - 1; } else if (_heversion >= 70) { - VAR(VAR_NUM_SOUND_CHANNELS) = 3; + VAR(VAR_NUM_SOUND_CHANNELS) = 8; VAR(VAR_MUSIC_CHANNEL) = 1; VAR(VAR_SOUND_CHANNEL) = 2; |