aboutsummaryrefslogtreecommitdiff
path: root/engines/scumm
diff options
context:
space:
mode:
authorMax Horn2006-05-13 17:30:04 +0000
committerMax Horn2006-05-13 17:30:04 +0000
commit0d6362ea485f89a940ffadd1c6fe954f94309c53 (patch)
tree1b6c0e09ff11ae5cb4d193333981304b6497c4d5 /engines/scumm
parent61c3f9d4aae5d7cbbc706a9fb1ecd0ef0f21bbf2 (diff)
downloadscummvm-rg350-0d6362ea485f89a940ffadd1c6fe954f94309c53.tar.gz
scummvm-rg350-0d6362ea485f89a940ffadd1c6fe954f94309c53.tar.bz2
scummvm-rg350-0d6362ea485f89a940ffadd1c6fe954f94309c53.zip
Patch #1091170: ALL, SCUMM: Subtitle speed control
svn-id: r22456
Diffstat (limited to 'engines/scumm')
-rw-r--r--engines/scumm/dialogs.cpp19
-rw-r--r--engines/scumm/dialogs.h4
-rw-r--r--engines/scumm/input.cpp3
-rw-r--r--engines/scumm/script.cpp2
-rw-r--r--engines/scumm/script_v8.cpp2
-rw-r--r--engines/scumm/scumm.cpp30
-rw-r--r--engines/scumm/scumm.h2
7 files changed, 41 insertions, 21 deletions
diff --git a/engines/scumm/dialogs.cpp b/engines/scumm/dialogs.cpp
index 18e2d3e3e1..17b86067f9 100644
--- a/engines/scumm/dialogs.cpp
+++ b/engines/scumm/dialogs.cpp
@@ -608,7 +608,7 @@ void MainMenuDialog::open() {
#pragma mark -
enum {
- kOKCmd = 'ok '
+ kOKCmd = 'ok '
};
enum {
@@ -653,8 +653,8 @@ ConfigDialog::ConfigDialog()
// Some misc options
//
- _subtitlesCheckbox = new GUI::CheckboxWidget(this, "scummconfig_subtitlesCheckbox", "Show subtitles", 0, 'S');
- _speechCheckbox = new GUI::CheckboxWidget(this, "scummconfig_speechCheckbox", "Enable speech", 0, 'E');
+ // SCUMM has a talkspeed range of 0-9
+ addSubtitleControls(this, "scummconfig_", 9);
//
// Add the buttons
@@ -683,19 +683,9 @@ ConfigDialog::~ConfigDialog() {
void ConfigDialog::open() {
GUI_OptionsDialog::open();
-
- // update checkboxes, too
- _subtitlesCheckbox->setState(ConfMan.getBool("subtitles", _domain));
- _speechCheckbox->setState(!ConfMan.getBool("speech_mute", _domain));
}
void ConfigDialog::close() {
- if (getResult()) {
- // Subtitles
- ConfMan.setBool("subtitles", _subtitlesCheckbox->getState(), _domain);
- ConfMan.setBool("speech_mute", !_speechCheckbox->getState(), _domain);
- }
-
GUI_OptionsDialog::close();
}
@@ -927,8 +917,9 @@ void ValueDisplayDialog::drawDialog() {
}
void ValueDisplayDialog::handleTickle() {
- if (getMillis() > _timer)
+ if (getMillis() > _timer) {
close();
+ }
}
void ValueDisplayDialog::handleKeyDown(uint16 ascii, int keycode, int modifiers) {
diff --git a/engines/scumm/dialogs.h b/engines/scumm/dialogs.h
index 33ef7ebd23..37b706b96e 100644
--- a/engines/scumm/dialogs.h
+++ b/engines/scumm/dialogs.h
@@ -140,10 +140,6 @@ public:
virtual void open();
virtual void close();
virtual void handleCommand(GUI::CommandSender *sender, uint32 cmd, uint32 data);
-
-protected:
- GUI::CheckboxWidget *_subtitlesCheckbox;
- GUI::CheckboxWidget *_speechCheckbox;
};
/**
diff --git a/engines/scumm/input.cpp b/engines/scumm/input.cpp
index 10492d04f9..73ba0ac926 100644
--- a/engines/scumm/input.cpp
+++ b/engines/scumm/input.cpp
@@ -445,6 +445,9 @@ void ScummEngine::processKbd(bool smushMode) {
// Display the talk speed
ValueDisplayDialog dlg("Text speed: ", 0, 9, 9 - _defaultTalkDelay, '+', '-');
_defaultTalkDelay = 9 - runDialog(dlg);
+
+ // Save the new talkspeed value to ConfMan
+ setTalkspeed(9 - _defaultTalkDelay);
if (VAR_CHARINC != 0xFF)
VAR(VAR_CHARINC) = _defaultTalkDelay;
diff --git a/engines/scumm/script.cpp b/engines/scumm/script.cpp
index fa014a4465..f3915ea4e1 100644
--- a/engines/scumm/script.cpp
+++ b/engines/scumm/script.cpp
@@ -617,7 +617,7 @@ void ScummEngine::writeVar(uint var, int value) {
}
if (var == VAR_CHARINC && ConfMan.hasKey("talkspeed")) {
- uint talkspeed = ConfMan.getInt("talkspeed");
+ uint talkspeed = getTalkspeed();
if (talkspeed <= 9)
VAR(VAR_CHARINC) = talkspeed;
} else {
diff --git a/engines/scumm/script_v8.cpp b/engines/scumm/script_v8.cpp
index c3be9a4af0..9bf3ba5b1e 100644
--- a/engines/scumm/script_v8.cpp
+++ b/engines/scumm/script_v8.cpp
@@ -420,7 +420,7 @@ void ScummEngine_v8::writeVar(uint var, int value) {
checkRange(_numVariables - 1, 0, var, "Variable %d out of range(w)");
if (var == VAR_CHARINC && ConfMan.hasKey("talkspeed")) {
- uint talkspeed = ConfMan.getInt("talkspeed");
+ uint talkspeed = getTalkspeed();
if (talkspeed <= 9)
VAR(VAR_CHARINC) = talkspeed;
} else
diff --git a/engines/scumm/scumm.cpp b/engines/scumm/scumm.cpp
index 4ec64eea15..4037482f14 100644
--- a/engines/scumm/scumm.cpp
+++ b/engines/scumm/scumm.cpp
@@ -499,6 +499,12 @@ ScummEngine::ScummEngine(OSystem *syst, const DetectorResult &dr)
VAR_SOUNDPARAM3 = 0xFF;
VAR_MOUSEPRESENT = 0xFF;
VAR_MEMORY_PERFORMANCE = 0xFF;
+
+ if (ConfMan.hasKey("talkspeed")) {
+ _defaultTalkDelay = 9 - getTalkspeed();
+ VAR_CHARINC = _defaultTalkDelay;
+ }
+
VAR_VIDEO_PERFORMANCE = 0xFF;
VAR_ROOM_FLAG = 0xFF;
VAR_GAME_LOADED = 0xFF;
@@ -1498,7 +1504,6 @@ void ScummEngine::updateSoundSettings() {
_mixer->setVolumeForSoundType(Audio::Mixer::kMusicSoundType, soundVolumeMusic);
_mixer->setVolumeForSoundType(Audio::Mixer::kSpeechSoundType, soundVolumeSpeech);
-
if (ConfMan.getBool("speech_mute"))
_voiceMode = 2;
else
@@ -1506,8 +1511,31 @@ void ScummEngine::updateSoundSettings() {
if (VAR_VOICE_MODE != 0xFF)
VAR(VAR_VOICE_MODE) = _voiceMode;
+
+ _defaultTalkDelay = 9 - getTalkspeed();
+ VAR(VAR_CHARINC) = _defaultTalkDelay;
}
+void ScummEngine::setTalkspeed(int talkspeed) {
+ /*if (talkspeed != 0)
+ if (talkspeed == 9)
+ talkspeed = 255;
+ else
+ talkspeed = (int)(talkspeed * 255.0 / 9.0 + 0.5);*/
+ ConfMan.setInt("talkspeed", (talkspeed * 255 + 9 / 2) / 9);
+}
+
+int ScummEngine::getTalkspeed() {
+ /*int talkspeed = ConfMan.getInt("talkspeed");
+
+ if (talkspeed != 0)
+ if (talkspeed == 255)
+ talkspeed = 9;
+ else
+ talkspeed = (int)(talkspeed * 9.0 / 255.0 + 0.5);
+ return talkspeed;*/
+ return (ConfMan.getInt("talkspeed") * 9 + 255 / 2) / 255;
+}
#pragma mark -
diff --git a/engines/scumm/scumm.h b/engines/scumm/scumm.h
index 3b19795dc6..e77418f28e 100644
--- a/engines/scumm/scumm.h
+++ b/engines/scumm/scumm.h
@@ -470,6 +470,8 @@ protected:
void loadCJKFont();
void setupMusic(int midi);
void updateSoundSettings();
+ void setTalkspeed(int talkspeed);
+ int getTalkspeed();
protected:
// Scumm main loop & helper functions.