The Kyra settings are now stored in the config file instead of the savegames.
The settings in older savegames are ignored. svn-id: r22705
This commit is contained in:
parent
e06ee0c490
commit
b17f0e8b6d
7 changed files with 118 additions and 22 deletions
4
README
4
README
|
@ -1319,6 +1319,10 @@ Simon the Sorcerer 1 & 2 add the following non-standard keywords:
|
|||
sfx_mute bool If true, sound effects are muted
|
||||
[Simon the Sorcerer 2 only]
|
||||
|
||||
The Legend of Kyrandia adds the following non-standard keyword:
|
||||
|
||||
walkspeed int The walk speed (0-4)
|
||||
|
||||
9.0) Compiling:
|
||||
---- ----------
|
||||
You need SDL-1.2.2 or newer (older versions may work, but are unsupported), and
|
||||
|
|
|
@ -142,3 +142,8 @@ Simon the Sorcerer 1 \& 2 add the following non-standard keywords:\\
|
|||
music\_mute &bool &If true, music is muted\\
|
||||
sfx\_mute &bool &If true, sound effects are muted\\
|
||||
\end{tabular}
|
||||
|
||||
The Legend of Kyrandia adds the following non-standard keyword:\\
|
||||
\begin{tabular}[h]{lll}
|
||||
walkspeed &int &The walk speed (0-4)\\
|
||||
\end{tabular}
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -274,11 +274,8 @@ int KyraEngine::init() {
|
|||
assert(_movFacingTable);
|
||||
_movFacingTable[0] = 8;
|
||||
|
||||
_configTextspeed = 1;
|
||||
_configWalkspeed = 2;
|
||||
_configMusic = true;
|
||||
_configSounds = true;
|
||||
_configVoice = 1;
|
||||
registerDefaultSettings();
|
||||
readSettings();
|
||||
|
||||
_skipFlag = false;
|
||||
|
||||
|
|
|
@ -295,6 +295,10 @@ public:
|
|||
void quitGame();
|
||||
void loadBitmap(const char *filename, int tempPage, int dstPage, uint8 *palData);
|
||||
|
||||
void registerDefaultSettings();
|
||||
void readSettings();
|
||||
void writeSettings();
|
||||
|
||||
void snd_playTheme(int file, int track = 0);
|
||||
void snd_playVoiceFile(int id);
|
||||
void snd_voiceWaitForFinish(bool ingame = true);
|
||||
|
@ -675,6 +679,7 @@ protected:
|
|||
int gui_controlsChangeWalk(Button *button);
|
||||
int gui_controlsChangeText(Button *button);
|
||||
int gui_controlsChangeVoice(Button *button);
|
||||
int gui_controlsApply(Button *button);
|
||||
|
||||
bool gui_quitConfirm(const char *str);
|
||||
void gui_getInput();
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
#include "kyra/screen.h"
|
||||
#include "kyra/resource.h"
|
||||
|
||||
#define CURRENT_VERSION 4
|
||||
#define CURRENT_VERSION 5
|
||||
|
||||
namespace Kyra {
|
||||
void KyraEngine::loadGame(const char *fileName) {
|
||||
|
@ -180,12 +180,15 @@ void KyraEngine::loadGame(const char *fileName) {
|
|||
snd_playWanderScoreViaMap(_lastMusicCommand, 1);
|
||||
}
|
||||
|
||||
if (version >= 4) {
|
||||
_configTextspeed = in->readByte();
|
||||
_configWalkspeed = in->readByte();
|
||||
_configMusic = in->readByte() != 0;
|
||||
_configSounds = in->readByte() != 0;
|
||||
_configVoice = in->readByte();
|
||||
// Version 4 stored settings in the savegame. As of version 5, they are
|
||||
// handled by the config manager.
|
||||
|
||||
if (version == 4) {
|
||||
in->readByte(); // Text speed
|
||||
in->readByte(); // Walk speed
|
||||
in->readByte(); // Music
|
||||
in->readByte(); // Sound
|
||||
in->readByte(); // Voice
|
||||
}
|
||||
|
||||
loadMainScreen(8);
|
||||
|
@ -317,12 +320,6 @@ void KyraEngine::saveGame(const char *fileName, const char *saveName) {
|
|||
|
||||
out->writeSint16BE(_lastMusicCommand);
|
||||
|
||||
out->writeByte(_configTextspeed);
|
||||
out->writeByte(_configWalkspeed);
|
||||
out->writeByte(_configMusic);
|
||||
out->writeByte(_configSounds);
|
||||
out->writeByte(_configVoice);
|
||||
|
||||
out->flush();
|
||||
|
||||
// check for errors
|
||||
|
|
|
@ -1178,7 +1178,7 @@ Menu KyraEngine::_menu[] = {
|
|||
248, 249, 250, &KyraEngine::gui_controlsChangeText, -1, 0, 34, 100, 0, 0 },
|
||||
|
||||
{1, 0, 0, 0, 64, 0, 127, 92, 15, 252, 253, -1, 255,
|
||||
248, 249, 250, &KyraEngine::gui_cancelSubMenu, -1, -0, 0, 0, 0, 0}
|
||||
248, 249, 250, &KyraEngine::gui_controlsApply, -1, -0, 0, 0, 0, 0}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue