[Scummvm-cvs-logs] SF.net SVN: scummvm: [27068] scummvm/trunk/engines/scumm
fingolfin at users.sourceforge.net
fingolfin at users.sourceforge.net
Sun Jun 3 19:32:43 CEST 2007
Revision: 27068
http://scummvm.svn.sourceforge.net/scummvm/?rev=27068&view=rev
Author: fingolfin
Date: 2007-06-03 10:32:42 -0700 (Sun, 03 Jun 2007)
Log Message:
-----------
Modified version of patch #1723779: SCUMM: Improved ctrl+t subtitle cycling
Modified Paths:
--------------
scummvm/trunk/engines/scumm/dialogs.cpp
scummvm/trunk/engines/scumm/dialogs.h
scummvm/trunk/engines/scumm/input.cpp
Modified: scummvm/trunk/engines/scumm/dialogs.cpp
===================================================================
--- scummvm/trunk/engines/scumm/dialogs.cpp 2007-06-03 16:14:57 UTC (rev 27067)
+++ scummvm/trunk/engines/scumm/dialogs.cpp 2007-06-03 17:32:42 UTC (rev 27068)
@@ -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 @@
_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) {
}
Modified: scummvm/trunk/engines/scumm/dialogs.h
===================================================================
--- scummvm/trunk/engines/scumm/dialogs.h 2007-06-03 16:14:57 UTC (rev 27067)
+++ scummvm/trunk/engines/scumm/dialogs.h 2007-06-03 17:32:42 UTC (rev 27068)
@@ -236,7 +236,27 @@
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 {
public:
Modified: scummvm/trunk/engines/scumm/input.cpp
===================================================================
--- scummvm/trunk/engines/scumm/input.cpp 2007-06-03 16:14:57 UTC (rev 27067)
+++ scummvm/trunk/engines/scumm/input.cpp 2007-06-03 17:32:42 UTC (rev 27068)
@@ -414,27 +414,23 @@
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 @@
if (VAR_VOICE_MODE != 0xFF)
VAR(VAR_VOICE_MODE) = _voiceMode;
- GUI::TimedMessageDialog dialog(buf, 1500);
- runDialog(dialog);
return;
}
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