aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorMax Horn2006-10-07 13:11:51 +0000
committerMax Horn2006-10-07 13:11:51 +0000
commitf3e410a2acd1f1b39f5236ed92170ac05a00629e (patch)
tree5a35876f28964c06deccd070b6a4a5c4d35dce5e /engines
parentc3fb1fbcd44afbc7b66d6973d194246e0ff7352e (diff)
downloadscummvm-rg350-f3e410a2acd1f1b39f5236ed92170ac05a00629e.tar.gz
scummvm-rg350-f3e410a2acd1f1b39f5236ed92170ac05a00629e.tar.bz2
scummvm-rg350-f3e410a2acd1f1b39f5236ed92170ac05a00629e.zip
Further split processKeyboard code, moving stuff specific to some SCUMM version into the resp. subclass of ScummEngine
svn-id: r24166
Diffstat (limited to 'engines')
-rw-r--r--engines/scumm/input.cpp99
-rw-r--r--engines/scumm/intern.h4
2 files changed, 64 insertions, 39 deletions
diff --git a/engines/scumm/input.cpp b/engines/scumm/input.cpp
index a25a23ebfe..00fad51dac 100644
--- a/engines/scumm/input.cpp
+++ b/engines/scumm/input.cpp
@@ -221,11 +221,6 @@ void ScummEngine::clearClickedStatus() {
void ScummEngine::processInput(bool smushMode) {
_lastKeyHit = _keyPressed;
_keyPressed = 0;
- if (((_game.version <= 2) || (_game.platform == Common::kPlatformFMTowns && _game.version == 3)) && 315 <= _lastKeyHit && _lastKeyHit < 315+12) {
- // Convert F-Keys for V1/V2 games (they start at 1 instead of at 315)
- _lastKeyHit -= 314;
- }
-
//
// Clip the mouse coordinates, and compute _virtualMouse.x (and clip it, too)
@@ -327,6 +322,7 @@ void ScummEngine_v8::processKeyboard(bool smushMode) {
return;
}
+ // Fall back to V6 behavior
ScummEngine_v6::processKeyboard(smushMode);
}
@@ -365,39 +361,80 @@ void ScummEngine_v6::processKeyboard(bool smushMode) {
runDialog(dialog);
return;
}
+
+ // COMI version string is hard coded
+ // Dig/FT version strings are partly hard coded too
+ if (_game.version == 7 && _lastKeyHit == VAR(VAR_VERSION_KEY)) {
+ versionDialog();
+ return;
+ }
+
+ // Fall back to default behavior
+ ScummEngine::processKeyboard(smushMode);
}
-void ScummEngine::processKeyboard(bool smushMode) {
- int saveloadkey;
+void ScummEngine_v2::processKeyboard(bool smushMode) {
+ if ((_game.platform == Common::kPlatformC64 && _game.id == GID_MANIAC && _lastKeyHit == 27) ||
+ (VAR_CUTSCENEEXIT_KEY != 0xFF && _lastKeyHit == VAR(VAR_CUTSCENEEXIT_KEY))) {
- if (VAR_RESTART_KEY != 0xFF && _lastKeyHit == VAR(VAR_RESTART_KEY) ||
- (((_game.version <= 2) || (_game.platform == Common::kPlatformFMTowns && _game.version == 3)) && _lastKeyHit == 8)) {
+ abortCutscene();
+ } else if (_lastKeyHit == ' ') { // space
+ pauseGame();
+ return;
+ } else if (_lastKeyHit == 314+5) { // F5
+ mainMenuDialog();
+ return;
+ } else if (_lastKeyHit == 314+8) { // F8
confirmRestartDialog();
return;
+ } else {
+ // Fall back to default behavior
+ ScummEngine::processKeyboard(smushMode);
}
- if ((VAR_PAUSE_KEY != 0xFF && _lastKeyHit == VAR(VAR_PAUSE_KEY)) ||
- (VAR_PAUSE_KEY == 0xFF && _lastKeyHit == ' ')) {
- pauseGame();
- return;
+ // Store the input type. So far we can't distinguish
+ // between 1, 3 and 5.
+ // 1) Verb 2) Scene 3) Inv. 4) Key
+ // 5) Sentence Bar
+
+ if (VAR_KEYPRESS != 0xFF && _lastKeyHit) { // Key Input
+ if (315 <= _lastKeyHit && _lastKeyHit < 315+12) {
+ // Convert F-Keys for V1/V2 games (they start at 1 instead of at 315)
+ _lastKeyHit -= 314;
+ }
+ VAR(VAR_KEYPRESS) = _lastKeyHit;
}
+}
- // COMI version string is hard coded
- // Dig/FT version strings are partly hard coded too
- if (_game.version == 7 && _lastKeyHit == VAR(VAR_VERSION_KEY)) {
- versionDialog();
- return;
+void ScummEngine_v3::processKeyboard(bool smushMode) {
+ if (_game.platform == Common::kPlatformFMTowns && _lastKeyHit == 314+8) { // F8
+ confirmRestartDialog();
+ } else {
+ // Fall back to default behavior
+ ScummEngine::processKeyboard(smushMode);
}
+}
- if ((_game.version <= 2) || (_game.platform == Common::kPlatformFMTowns && _game.version == 3))
- saveloadkey = 5; // F5
- else if ((_game.version <= 3) || (_game.id == GID_SAMNMAX) || (_game.id == GID_CMI) || (_game.heversion >= 72))
+void ScummEngine::processKeyboard(bool smushMode) {
+ int saveloadkey;
+
+ if ((_game.version <= 3) || (_game.id == GID_SAMNMAX) || (_game.id == GID_CMI) || (_game.heversion >= 72))
saveloadkey = 319; // F5
else
saveloadkey = VAR(VAR_MAINMENU_KEY);
- if ((_game.platform == Common::kPlatformC64 && _game.id == GID_MANIAC && _lastKeyHit == 27) ||
- (VAR_CUTSCENEEXIT_KEY != 0xFF && _lastKeyHit == VAR(VAR_CUTSCENEEXIT_KEY))) {
+
+ if (VAR_RESTART_KEY != 0xFF && _lastKeyHit == VAR(VAR_RESTART_KEY)) {
+ confirmRestartDialog();
+ return;
+ }
+
+ if (VAR_PAUSE_KEY != 0xFF && _lastKeyHit == VAR(VAR_PAUSE_KEY)) {
+ pauseGame();
+ return;
+ }
+
+ if (VAR_CUTSCENEEXIT_KEY != 0xFF && _lastKeyHit == VAR(VAR_CUTSCENEEXIT_KEY)) {
#ifndef DISABLE_SCUMM_7_8
// Skip cutscene (or active SMUSH video). For the V2 games, which
// normally use F4 for this, we add in a hack that makes escape work,
@@ -411,13 +448,6 @@ void ScummEngine::processKeyboard(bool smushMode) {
#endif
if (!smushMode || _smushVideoShouldFinish)
abortCutscene();
- if (_game.version <= 2) {
- // Ensure that the input script also sees the key press.
- // This is necessary so you can abort the airplane travel
- // in Zak.
- if (VAR_KEYPRESS != 0xFF)
- VAR(VAR_KEYPRESS) = VAR(VAR_CUTSCENEEXIT_KEY);
- }
} else if (_lastKeyHit == saveloadkey) {
if (VAR_SAVELOAD_SCRIPT != 0xFF && _currentRoom != 0)
runScript(VAR(VAR_SAVELOAD_SCRIPT), 0, 0, 0);
@@ -466,15 +496,6 @@ void ScummEngine::processKeyboard(bool smushMode) {
VAR(VAR_CHARINC) = _defaultTalkDelay;
} else if (_lastKeyHit == '~' || _lastKeyHit == '#') { // Debug console
_debugger->attach();
- } else if (_game.version <= 2) {
- // Store the input type. So far we can't distinguish
- // between 1, 3 and 5.
- // 1) Verb 2) Scene 3) Inv. 4) Key
- // 5) Sentence Bar
-
- if (VAR_KEYPRESS != 0xFF && _lastKeyHit) { // Key Input
- VAR(VAR_KEYPRESS) = _lastKeyHit;
- }
}
_mouseAndKeyboardStat = _lastKeyHit;
diff --git a/engines/scumm/intern.h b/engines/scumm/intern.h
index c899847324..dd838c7053 100644
--- a/engines/scumm/intern.h
+++ b/engines/scumm/intern.h
@@ -229,6 +229,8 @@ public:
protected:
virtual void readRoomsOffsets();
virtual void loadCharset(int no);
+
+ virtual void processKeyboard(bool smushMode);
};
/**
@@ -286,6 +288,8 @@ protected:
virtual void resetScummVars();
virtual void decodeParseString();
+ virtual void processKeyboard(bool smushMode);
+
virtual void readIndexFile();
void readClassicIndexFile(); // V1
void readEnhancedIndexFile(); // V2