aboutsummaryrefslogtreecommitdiff
path: root/engines/scumm
diff options
context:
space:
mode:
authorMax Horn2007-06-03 17:32:42 +0000
committerMax Horn2007-06-03 17:32:42 +0000
commitcd6f145577453c8025b9b4cb2b062fe80d5034f7 (patch)
treea394fadf68dc226c7781a843ba2a9de7f79f1b1d /engines/scumm
parent66f9032d014c4a1bd0076a93b97412549614152a (diff)
downloadscummvm-rg350-cd6f145577453c8025b9b4cb2b062fe80d5034f7.tar.gz
scummvm-rg350-cd6f145577453c8025b9b4cb2b062fe80d5034f7.tar.bz2
scummvm-rg350-cd6f145577453c8025b9b4cb2b062fe80d5034f7.zip
Modified version of patch #1723779: SCUMM: Improved ctrl+t subtitle cycling
svn-id: r27068
Diffstat (limited to 'engines/scumm')
-rw-r--r--engines/scumm/dialogs.cpp43
-rw-r--r--engines/scumm/dialogs.h20
-rw-r--r--engines/scumm/input.cpp16
3 files changed, 68 insertions, 11 deletions
diff --git a/engines/scumm/dialogs.cpp b/engines/scumm/dialogs.cpp
index 7541edd0b4..1a59fba5d3 100644
--- a/engines/scumm/dialogs.cpp
+++ b/engines/scumm/dialogs.cpp
@@ -27,6 +27,7 @@
#include "common/config-manager.h"
#include "common/savefile.h"
#include "common/system.h"
+#include "common/events.h"
#include "graphics/scaler.h"
@@ -920,6 +921,48 @@ void ValueDisplayDialog::open() {
_timer = getMillis() + kDisplayDelay;
}
+SubtitleSettingsDialog::SubtitleSettingsDialog(ScummEngine *scumm, int value)
+ : InfoDialog(scumm, ""), _value(value) {
+
+}
+
+void SubtitleSettingsDialog::handleTickle() {
+ InfoDialog::handleTickle();
+ if (getMillis() > _timer)
+ close();
+}
+
+void SubtitleSettingsDialog::handleKeyDown(uint16 ascii, int keycode, int modifiers) {
+ if (keycode == 't' && modifiers == Common::KBD_CTRL) {
+ cycleValue();
+
+ reflowLayout();
+ draw();
+ } else {
+ close();
+ }
+}
+
+void SubtitleSettingsDialog::open() {
+ cycleValue();
+ InfoDialog::open();
+}
+
+void SubtitleSettingsDialog::cycleValue() {
+ static const char* subtitleDesc[] = {
+ "Speech Only",
+ "Speech and Subtitles",
+ "Subtitles Only"
+ };
+
+ _value = (_value + 1) % 3;
+
+ setInfoText(subtitleDesc[_value]);
+
+ setResult(_value);
+ _timer = getMillis() + 1500;
+}
+
Indy3IQPointsDialog::Indy3IQPointsDialog(ScummEngine *scumm, char* text)
: InfoDialog(scumm, text) {
}
diff --git a/engines/scumm/dialogs.h b/engines/scumm/dialogs.h
index 73c02ea32f..0729680ae4 100644
--- a/engines/scumm/dialogs.h
+++ b/engines/scumm/dialogs.h
@@ -236,6 +236,26 @@ protected:
uint32 _timer;
};
+/**
+ * A dialog used to display and cycle subtitle settings.
+ * Automatically closes after a brief time has passed.
+ */
+class SubtitleSettingsDialog : public InfoDialog {
+public:
+ SubtitleSettingsDialog(ScummEngine *scumm, int value);
+
+ virtual void open();
+ virtual void handleTickle();
+ virtual void handleMouseDown(int x, int y, int button, int clickCount) {
+ close();
+ }
+ virtual void handleKeyDown(uint16 ascii, int keycode, int modifiers);
+protected:
+ int _value;
+ uint32 _timer;
+
+ void cycleValue();
+};
//The Indy IQ dialog
class Indy3IQPointsDialog : public InfoDialog {
diff --git a/engines/scumm/input.cpp b/engines/scumm/input.cpp
index 50307ebc57..64c2169f53 100644
--- a/engines/scumm/input.cpp
+++ b/engines/scumm/input.cpp
@@ -414,27 +414,23 @@ void ScummEngine_v7::processKeyboard(int lastKeyHit) {
void ScummEngine_v6::processKeyboard(int lastKeyHit) {
if (lastKeyHit == 20) {
- // FIXME: What key is '20' supposed to indicate? I can't trigger
- // it with my keyboard, it seems...
- char buf[256];
+ // FIXME: The 20 seems to indicate Ctrl-T. Of course this is a
+ // rather ugly way to detect it -- modifier + ascii code would
+ // be a *lot* cleaner...
- _voiceMode++;
- if (_voiceMode == 3)
- _voiceMode = 0;
+ SubtitleSettingsDialog dialog(this, _voiceMode);
+ _voiceMode = runDialog(dialog);
switch (_voiceMode) {
case 0:
- sprintf(buf, "Speech Only");
ConfMan.setBool("speech_mute", false);
ConfMan.setBool("subtitles", false);
break;
case 1:
- sprintf(buf, "Speech and Subtitles");
ConfMan.setBool("speech_mute", false);
ConfMan.setBool("subtitles", true);
break;
case 2:
- sprintf(buf, "Subtitles Only");
ConfMan.setBool("speech_mute", true);
ConfMan.setBool("subtitles", true);
break;
@@ -443,8 +439,6 @@ void ScummEngine_v6::processKeyboard(int lastKeyHit) {
if (VAR_VOICE_MODE != 0xFF)
VAR(VAR_VOICE_MODE) = _voiceMode;
- GUI::TimedMessageDialog dialog(buf, 1500);
- runDialog(dialog);
return;
}