Some more processKeyboard splitting
svn-id: r24167
This commit is contained in:
parent
f3e410a2ac
commit
5f0874ef63
2 changed files with 99 additions and 91 deletions
|
@ -314,6 +314,7 @@ void ScummEngine::processInput(bool smushMode) {
|
||||||
processKeyboard(smushMode);
|
processKeyboard(smushMode);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef DISABLE_SCUMM_7_8
|
||||||
void ScummEngine_v8::processKeyboard(bool smushMode) {
|
void ScummEngine_v8::processKeyboard(bool smushMode) {
|
||||||
// If a key script was specified (a V8 feature), and it's trigger
|
// If a key script was specified (a V8 feature), and it's trigger
|
||||||
// key was pressed, run it.
|
// key was pressed, run it.
|
||||||
|
@ -322,9 +323,38 @@ void ScummEngine_v8::processKeyboard(bool smushMode) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Fall back to V7 behavior
|
||||||
|
ScummEngine_v7::processKeyboard(smushMode);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ScummEngine_v7::processKeyboard(bool smushMode) {
|
||||||
|
|
||||||
|
// 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;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (VAR_CUTSCENEEXIT_KEY != 0xFF && _lastKeyHit == VAR(VAR_CUTSCENEEXIT_KEY)) {
|
||||||
|
// Skip cutscene (or active SMUSH video).
|
||||||
|
if (smushMode) {
|
||||||
|
if (_game.id == GID_FT)
|
||||||
|
_insane->escapeKeyHandler();
|
||||||
|
else
|
||||||
|
_smushVideoShouldFinish = true;
|
||||||
|
}
|
||||||
|
if (!smushMode || _smushVideoShouldFinish)
|
||||||
|
abortCutscene();
|
||||||
|
|
||||||
|
_mouseAndKeyboardStat = _lastKeyHit;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Fall back to V6 behavior
|
// Fall back to V6 behavior
|
||||||
ScummEngine_v6::processKeyboard(smushMode);
|
ScummEngine_v6::processKeyboard(smushMode);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
void ScummEngine_v6::processKeyboard(bool smushMode) {
|
void ScummEngine_v6::processKeyboard(bool smushMode) {
|
||||||
if (_lastKeyHit == 20) {
|
if (_lastKeyHit == 20) {
|
||||||
|
@ -362,31 +392,22 @@ void ScummEngine_v6::processKeyboard(bool smushMode) {
|
||||||
return;
|
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
|
// Fall back to default behavior
|
||||||
ScummEngine::processKeyboard(smushMode);
|
ScummEngine::processKeyboard(smushMode);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ScummEngine_v2::processKeyboard(bool smushMode) {
|
void ScummEngine_v2::processKeyboard(bool smushMode) {
|
||||||
if ((_game.platform == Common::kPlatformC64 && _game.id == GID_MANIAC && _lastKeyHit == 27) ||
|
if (_lastKeyHit == ' ') { // space
|
||||||
(VAR_CUTSCENEEXIT_KEY != 0xFF && _lastKeyHit == VAR(VAR_CUTSCENEEXIT_KEY))) {
|
|
||||||
|
|
||||||
abortCutscene();
|
|
||||||
} else if (_lastKeyHit == ' ') { // space
|
|
||||||
pauseGame();
|
pauseGame();
|
||||||
return;
|
|
||||||
} else if (_lastKeyHit == 314+5) { // F5
|
} else if (_lastKeyHit == 314+5) { // F5
|
||||||
mainMenuDialog();
|
mainMenuDialog();
|
||||||
return;
|
|
||||||
} else if (_lastKeyHit == 314+8) { // F8
|
} else if (_lastKeyHit == 314+8) { // F8
|
||||||
confirmRestartDialog();
|
confirmRestartDialog();
|
||||||
return;
|
} else {
|
||||||
|
|
||||||
|
if ((_game.platform == Common::kPlatformC64 && _game.id == GID_MANIAC && _lastKeyHit == 27) ||
|
||||||
|
(VAR_CUTSCENEEXIT_KEY != 0xFF && _lastKeyHit == 314+VAR(VAR_CUTSCENEEXIT_KEY))) {
|
||||||
|
abortCutscene();
|
||||||
} else {
|
} else {
|
||||||
// Fall back to default behavior
|
// Fall back to default behavior
|
||||||
ScummEngine::processKeyboard(smushMode);
|
ScummEngine::processKeyboard(smushMode);
|
||||||
|
@ -404,6 +425,7 @@ void ScummEngine_v2::processKeyboard(bool smushMode) {
|
||||||
}
|
}
|
||||||
VAR(VAR_KEYPRESS) = _lastKeyHit;
|
VAR(VAR_KEYPRESS) = _lastKeyHit;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ScummEngine_v3::processKeyboard(bool smushMode) {
|
void ScummEngine_v3::processKeyboard(bool smushMode) {
|
||||||
|
@ -423,32 +445,7 @@ void ScummEngine::processKeyboard(bool smushMode) {
|
||||||
else
|
else
|
||||||
saveloadkey = VAR(VAR_MAINMENU_KEY);
|
saveloadkey = VAR(VAR_MAINMENU_KEY);
|
||||||
|
|
||||||
|
if (_lastKeyHit == saveloadkey) {
|
||||||
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,
|
|
||||||
// too (just for convenience).
|
|
||||||
if (smushMode) {
|
|
||||||
if (_game.id == GID_FT)
|
|
||||||
_insane->escapeKeyHandler();
|
|
||||||
else
|
|
||||||
_smushVideoShouldFinish = true;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
if (!smushMode || _smushVideoShouldFinish)
|
|
||||||
abortCutscene();
|
|
||||||
} else if (_lastKeyHit == saveloadkey) {
|
|
||||||
if (VAR_SAVELOAD_SCRIPT != 0xFF && _currentRoom != 0)
|
if (VAR_SAVELOAD_SCRIPT != 0xFF && _currentRoom != 0)
|
||||||
runScript(VAR(VAR_SAVELOAD_SCRIPT), 0, 0, 0);
|
runScript(VAR(VAR_SAVELOAD_SCRIPT), 0, 0, 0);
|
||||||
|
|
||||||
|
@ -456,12 +453,21 @@ void ScummEngine::processKeyboard(bool smushMode) {
|
||||||
|
|
||||||
if (VAR_SAVELOAD_SCRIPT != 0xFF && _currentRoom != 0)
|
if (VAR_SAVELOAD_SCRIPT != 0xFF && _currentRoom != 0)
|
||||||
runScript(VAR(VAR_SAVELOAD_SCRIPT2), 0, 0, 0);
|
runScript(VAR(VAR_SAVELOAD_SCRIPT2), 0, 0, 0);
|
||||||
return;
|
|
||||||
|
} else if (VAR_RESTART_KEY != 0xFF && _lastKeyHit == VAR(VAR_RESTART_KEY)) {
|
||||||
|
confirmRestartDialog();
|
||||||
|
|
||||||
|
} else if (VAR_PAUSE_KEY != 0xFF && _lastKeyHit == VAR(VAR_PAUSE_KEY)) {
|
||||||
|
pauseGame();
|
||||||
|
|
||||||
} else if (VAR_TALKSTOP_KEY != 0xFF && _lastKeyHit == VAR(VAR_TALKSTOP_KEY)) {
|
} else if (VAR_TALKSTOP_KEY != 0xFF && _lastKeyHit == VAR(VAR_TALKSTOP_KEY)) {
|
||||||
_talkDelay = 0;
|
_talkDelay = 0;
|
||||||
if (_sound->_sfxMode & 2)
|
if (_sound->_sfxMode & 2)
|
||||||
stopTalk();
|
stopTalk();
|
||||||
return;
|
|
||||||
|
} else {
|
||||||
|
if (VAR_CUTSCENEEXIT_KEY != 0xFF && _lastKeyHit == VAR(VAR_CUTSCENEEXIT_KEY)) {
|
||||||
|
abortCutscene();
|
||||||
} else if (_lastKeyHit == '[' || _lastKeyHit == ']') { // Change music volume
|
} else if (_lastKeyHit == '[' || _lastKeyHit == ']') { // Change music volume
|
||||||
int vol = ConfMan.getInt("music_volume") / 16;
|
int vol = ConfMan.getInt("music_volume") / 16;
|
||||||
if (_lastKeyHit == ']' && vol < 16)
|
if (_lastKeyHit == ']' && vol < 16)
|
||||||
|
@ -499,6 +505,7 @@ void ScummEngine::processKeyboard(bool smushMode) {
|
||||||
}
|
}
|
||||||
|
|
||||||
_mouseAndKeyboardStat = _lastKeyHit;
|
_mouseAndKeyboardStat = _lastKeyHit;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
} // End of namespace Scumm
|
} // End of namespace Scumm
|
||||||
|
|
|
@ -857,6 +857,7 @@ public:
|
||||||
protected:
|
protected:
|
||||||
virtual void scummLoop_handleSound();
|
virtual void scummLoop_handleSound();
|
||||||
virtual void scummLoop_handleDrawing();
|
virtual void scummLoop_handleDrawing();
|
||||||
|
virtual void processKeyboard(bool smushMode);
|
||||||
|
|
||||||
virtual void setupScummVars();
|
virtual void setupScummVars();
|
||||||
virtual void resetScummVars();
|
virtual void resetScummVars();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue