From 70245181f1fce247ba2f9ffbbd93c4032358d29f Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Mon, 13 Sep 2010 23:35:55 +0000 Subject: SCUMM: Fix for bug #3064655 "Restart with F8 key not working properly". svn-id: r52715 --- engines/scumm/dialogs.cpp | 17 ++++++++++++++--- engines/scumm/dialogs.h | 3 +++ 2 files changed, 17 insertions(+), 3 deletions(-) (limited to 'engines/scumm') diff --git a/engines/scumm/dialogs.cpp b/engines/scumm/dialogs.cpp index 1e0bf6d4be..a48e54c05a 100644 --- a/engines/scumm/dialogs.cpp +++ b/engines/scumm/dialogs.cpp @@ -473,14 +473,25 @@ void PauseDialog::handleKeyDown(Common::KeyState state) { } ConfirmDialog::ConfirmDialog(ScummEngine *scumm, int res) - : InfoDialog(scumm, res) { + : InfoDialog(scumm, res), _yesKey('y'), _noKey('n') { + + if (_message.lastChar() != ')') { + _yesKey = _message.lastChar(); + _message.deleteLastChar(); + + if (_yesKey >= 'A' && _yesKey <= 'Z') + _yesKey += 'a' - 'A'; + + _text->setLabel(_message); + reflowLayout(); + } } void ConfirmDialog::handleKeyDown(Common::KeyState state) { - if (state.keycode == Common::KEYCODE_n) { + if (state.keycode == Common::KEYCODE_n || state.ascii == _noKey) { setResult(0); close(); - } else if (state.keycode == Common::KEYCODE_y) { + } else if (state.keycode == Common::KEYCODE_y || state.ascii == _yesKey) { setResult(1); close(); } else diff --git a/engines/scumm/dialogs.h b/engines/scumm/dialogs.h index 41a8ec83c1..0e6e18905f 100644 --- a/engines/scumm/dialogs.h +++ b/engines/scumm/dialogs.h @@ -118,6 +118,9 @@ class ConfirmDialog : public InfoDialog { public: ConfirmDialog(ScummEngine *scumm, int res); virtual void handleKeyDown(Common::KeyState state); + +protected: + char _yesKey, _noKey; }; /** -- cgit v1.2.3