[Scummvm-cvs-logs] SF.net SVN: scummvm: [24166] scummvm/trunk/engines/scumm
fingolfin at users.sourceforge.net
fingolfin at users.sourceforge.net
Sat Oct 7 15:11:55 CEST 2006
Revision: 24166
http://svn.sourceforge.net/scummvm/?rev=24166&view=rev
Author: fingolfin
Date: 2006-10-07 06:11:51 -0700 (Sat, 07 Oct 2006)
Log Message:
-----------
Further split processKeyboard code, moving stuff specific to some SCUMM version into the resp. subclass of ScummEngine
Modified Paths:
--------------
scummvm/trunk/engines/scumm/input.cpp
scummvm/trunk/engines/scumm/intern.h
Modified: scummvm/trunk/engines/scumm/input.cpp
===================================================================
--- scummvm/trunk/engines/scumm/input.cpp 2006-10-07 12:33:22 UTC (rev 24165)
+++ scummvm/trunk/engines/scumm/input.cpp 2006-10-07 13:11:51 UTC (rev 24166)
@@ -221,12 +221,7 @@
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 @@
return;
}
+ // Fall back to V6 behavior
ScummEngine_v6::processKeyboard(smushMode);
}
@@ -365,39 +361,80 @@
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 @@
#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 @@
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;
Modified: scummvm/trunk/engines/scumm/intern.h
===================================================================
--- scummvm/trunk/engines/scumm/intern.h 2006-10-07 12:33:22 UTC (rev 24165)
+++ scummvm/trunk/engines/scumm/intern.h 2006-10-07 13:11:51 UTC (rev 24166)
@@ -229,6 +229,8 @@
protected:
virtual void readRoomsOffsets();
virtual void loadCharset(int no);
+
+ virtual void processKeyboard(bool smushMode);
};
/**
@@ -286,6 +288,8 @@
virtual void resetScummVars();
virtual void decodeParseString();
+ virtual void processKeyboard(bool smushMode);
+
virtual void readIndexFile();
void readClassicIndexFile(); // V1
void readEnhancedIndexFile(); // V2
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