aboutsummaryrefslogtreecommitdiff
path: root/engines/kyra/gui.cpp
diff options
context:
space:
mode:
authorTorbjörn Andersson2006-05-28 09:21:32 +0000
committerTorbjörn Andersson2006-05-28 09:21:32 +0000
commitb17f0e8b6d2073fa91bbd6096bad367531d18baa (patch)
tree86a2486745237af72b639529f6673c7adb91df6c /engines/kyra/gui.cpp
parente06ee0c4902ce0627b9461da6a39ff331379943a (diff)
downloadscummvm-rg350-b17f0e8b6d2073fa91bbd6096bad367531d18baa.tar.gz
scummvm-rg350-b17f0e8b6d2073fa91bbd6096bad367531d18baa.tar.bz2
scummvm-rg350-b17f0e8b6d2073fa91bbd6096bad367531d18baa.zip
The Kyra settings are now stored in the config file instead of the savegames.
The settings in older savegames are ignored. svn-id: r22705
Diffstat (limited to 'engines/kyra/gui.cpp')
-rw-r--r--engines/kyra/gui.cpp94
1 files changed, 91 insertions, 3 deletions
diff --git a/engines/kyra/gui.cpp b/engines/kyra/gui.cpp
index 4fd520e785..e86dd7304c 100644
--- a/engines/kyra/gui.cpp
+++ b/engines/kyra/gui.cpp
@@ -26,11 +26,92 @@
#include "kyra/text.h"
#include "kyra/animator.h"
+#include "common/config-manager.h"
#include "common/savefile.h"
#include "common/system.h"
namespace Kyra {
+void KyraEngine::registerDefaultSettings() {
+ // Most settings already have sensible defaults. This one, however, is
+ // specific to the Kyra engine.
+ ConfMan.registerDefault("walkspeed", 2);
+}
+
+void KyraEngine::readSettings() {
+ int talkspeed = ConfMan.getInt("talkspeed");
+
+ // The default talk speed is 60. This should be mapped to "Normal".
+
+ if (talkspeed == 0)
+ _configTextspeed = 3; // Clickable
+ if (talkspeed <= 50)
+ _configTextspeed = 0; // Slow
+ else if (talkspeed <= 150)
+ _configTextspeed = 1; // Normal
+ else
+ _configTextspeed = 2; // Fast
+
+ _configWalkspeed = ConfMan.getInt("walkspeed");
+ _configMusic = ConfMan.getBool("music_mute") ? 0 : 1;
+ _configSounds = ConfMan.getBool("sfx_mute") ? 0 : 1;
+
+ bool speechMute = ConfMan.getBool("speech_mute");
+ bool subtitles = ConfMan.getBool("subtitles");
+
+ if (!speechMute && subtitles)
+ _configVoice = 2; // Voice & Text
+ else if (!speechMute && !subtitles)
+ _configVoice = 1; // Voice only
+ else
+ _configVoice = 0; // Text only
+}
+
+void KyraEngine::writeSettings() {
+ bool speechMute, subtitles;
+ int talkspeed;
+
+ switch (_configTextspeed) {
+ case 0: // Slow
+ talkspeed = 1;
+ break;
+ case 1: // Normal
+ talkspeed = 60;
+ break;
+ case 2: // Fast
+ talkspeed = 255;
+ break;
+ default: // Clickable
+ talkspeed = 0;
+ break;
+ }
+
+ ConfMan.setInt("talkspeed", talkspeed);
+ ConfMan.setInt("walkspeed", _configWalkspeed);
+ ConfMan.setBool("music_mute", _configMusic == 0);
+ ConfMan.setBool("sfx_mute", _configSounds == 0);
+
+ switch (_configVoice) {
+ case 0: // Text only
+ speechMute = true;
+ subtitles = true;
+ break;
+ case 1: // Voice only
+ speechMute = false;
+ subtitles = false;
+ break;
+ default: // Voice & Text
+ speechMute = false;
+ subtitles = true;
+ break;
+ }
+
+ ConfMan.setBool("speech_mute", speechMute);
+ ConfMan.setBool("subtitles", subtitles);
+
+ ConfMan.flushToDisk();
+}
+
void KyraEngine::initMainButtonList() {
_haveScrollButtons = false;
_buttonList = &_buttonData[0];
@@ -385,7 +466,6 @@ void KyraEngine::processMenuButton(Button *button) {
button->flags2 &= 0xfb;
processButton(button);
-
}
int KyraEngine::drawBoxCallback(Button *button) {
@@ -1071,6 +1151,8 @@ int KyraEngine::gui_quitConfirmNo(Button *button) {
int KyraEngine::gui_gameControlsMenu(Button *button) {
debugC(9, kDebugLevelGUI, "KyraEngine::gui_gameControlsMenu()");
+ readSettings();
+
_screen->loadPageFromDisk("SEENPAGE.TMP", 0);
_screen->savePageToDisk("SEENPAGE.TMP", 0);
@@ -1169,10 +1251,10 @@ void KyraEngine::gui_setupControls(Menu &menu) {
menu.item[3].itemString = _configStrings[5]; //"Text only"
break;
case 1:
- menu.item[3].itemString = _configStrings[6]; //"Voice & Text"
+ menu.item[3].itemString = _configStrings[6]; //"Voice only"
break;
case 2:
- menu.item[3].itemString = _configStrings[7]; //"Voice only"
+ menu.item[3].itemString = _configStrings[7]; //"Voice & Text"
break;
default:
menu.item[3].itemString = "ERROR";
@@ -1248,6 +1330,12 @@ int KyraEngine::gui_controlsChangeVoice(Button *button) {
return 0;
}
+int KyraEngine::gui_controlsApply(Button *button) {
+ debugC(9, kDebugLevelGUI, "KyraEngine::gui_controlsApply()");
+ writeSettings();
+ return gui_cancelSubMenu(button);
+}
+
int KyraEngine::gui_scrollUp(Button *button) {
debugC(9, kDebugLevelGUI, "KyraEngine::gui_scrollUp()");
processMenuButton(button);