mirror of
https://github.com/libretro/scummvm.git
synced 2025-01-21 01:05:59 +00:00
Further split processKeyboard code, moving stuff specific to some SCUMM version into the resp. subclass of ScummEngine
svn-id: r24166
This commit is contained in:
parent
c3fb1fbcd4
commit
f3e410a2ac
@ -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,22 +361,6 @@ void ScummEngine_v6::processKeyboard(bool smushMode) {
|
||||
runDialog(dialog);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
void ScummEngine::processKeyboard(bool smushMode) {
|
||||
int saveloadkey;
|
||||
|
||||
if (VAR_RESTART_KEY != 0xFF && _lastKeyHit == VAR(VAR_RESTART_KEY) ||
|
||||
(((_game.version <= 2) || (_game.platform == Common::kPlatformFMTowns && _game.version == 3)) && _lastKeyHit == 8)) {
|
||||
confirmRestartDialog();
|
||||
return;
|
||||
}
|
||||
|
||||
if ((VAR_PAUSE_KEY != 0xFF && _lastKeyHit == VAR(VAR_PAUSE_KEY)) ||
|
||||
(VAR_PAUSE_KEY == 0xFF && _lastKeyHit == ' ')) {
|
||||
pauseGame();
|
||||
return;
|
||||
}
|
||||
|
||||
// COMI version string is hard coded
|
||||
// Dig/FT version strings are partly hard coded too
|
||||
@ -389,15 +369,72 @@ void ScummEngine::processKeyboard(bool smushMode) {
|
||||
return;
|
||||
}
|
||||
|
||||
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))
|
||||
// Fall back to default behavior
|
||||
ScummEngine::processKeyboard(smushMode);
|
||||
}
|
||||
|
||||
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))) {
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
// 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;
|
||||
}
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
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;
|
||||
|
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user