mirror of
https://github.com/libretro/scummvm.git
synced 2025-02-04 18:06:26 +00:00
SHERLOCK: Implement configuration settings save/load
This commit is contained in:
parent
d9a42a80ff
commit
12d3976c38
@ -94,6 +94,9 @@ void SherlockEngine::initialize() {
|
||||
_sound = new Sound(this);
|
||||
_talk = new Talk(this);
|
||||
_ui = new UserInterface(this);
|
||||
|
||||
// Load game settings
|
||||
loadConfig();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -202,11 +205,48 @@ void SherlockEngine::setFlags(int flagNum) {
|
||||
_scene->checkSceneFlags(true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Load game configuration esttings
|
||||
*/
|
||||
void SherlockEngine::loadConfig() {
|
||||
// Load sound settings
|
||||
syncSoundSettings();
|
||||
|
||||
// Load other settings
|
||||
if (ConfMan.hasKey("font"))
|
||||
_screen->setFont(ConfMan.getInt("font"));
|
||||
if (ConfMan.hasKey("help_style"))
|
||||
_ui->_helpStyle = ConfMan.getInt("help_style");
|
||||
if (ConfMan.hasKey("window_style"))
|
||||
_ui->_windowStyle = ConfMan.getInt("window_style");
|
||||
if (ConfMan.hasKey("portraits_on"))
|
||||
_people->_portraitsOn = ConfMan.getBool("portraits_on");
|
||||
}
|
||||
|
||||
/**
|
||||
* Saves game configuration information
|
||||
*/
|
||||
void SherlockEngine::saveConfig() {
|
||||
// TODO
|
||||
ConfMan.setBool("mute", _sound->_digitized);
|
||||
ConfMan.setBool("music_mute", _sound->_music);
|
||||
ConfMan.setBool("speech_mute", _sound->_voices);
|
||||
|
||||
ConfMan.setInt("font", _screen->fontNumber());
|
||||
ConfMan.setInt("help_style", _ui->_helpStyle);
|
||||
ConfMan.setInt("window_style", _ui->_windowStyle);
|
||||
ConfMan.setBool("portraits_on", _people->_portraitsOn);
|
||||
|
||||
ConfMan.flushToDisk();
|
||||
}
|
||||
|
||||
/**
|
||||
* Called by the engine when sound settings are updated
|
||||
*/
|
||||
void SherlockEngine::syncSoundSettings() {
|
||||
Engine::syncSoundSettings();
|
||||
|
||||
// Load sound-related settings
|
||||
_sound->syncSoundSettings();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -74,6 +74,8 @@ private:
|
||||
void sceneLoop();
|
||||
|
||||
void handleInput();
|
||||
|
||||
void loadConfig();
|
||||
protected:
|
||||
virtual void initialize();
|
||||
|
||||
@ -117,6 +119,7 @@ public:
|
||||
virtual bool canSaveGameStateCurrently();
|
||||
virtual Common::Error loadGameState(int slot);
|
||||
virtual Common::Error saveGameState(int slot, const Common::String &desc);
|
||||
virtual void syncSoundSettings();
|
||||
|
||||
int getGameType() const;
|
||||
uint32 getGameID() const;
|
||||
|
@ -21,20 +21,34 @@
|
||||
*/
|
||||
|
||||
#include "sherlock/sound.h"
|
||||
#include "common/config-manager.h"
|
||||
|
||||
namespace Sherlock {
|
||||
|
||||
Sound::Sound(SherlockEngine *vm): _vm(vm) {
|
||||
_digitized = false;
|
||||
_music = false;
|
||||
_voices = 0;
|
||||
_soundOn = false;
|
||||
_musicOn = false;
|
||||
_speechOn = false;
|
||||
_voices = 0;
|
||||
_playingEpilogue = false;
|
||||
_music = false;
|
||||
_digitized = false;
|
||||
_diskSoundPlaying = false;
|
||||
_soundIsOn = nullptr;
|
||||
_digiBuf = nullptr;
|
||||
}
|
||||
|
||||
/**
|
||||
* Saves sound-related settings
|
||||
*/
|
||||
void Sound::syncSoundSettings() {
|
||||
_digitized = !ConfMan.getBool("mute");
|
||||
_music = !ConfMan.getBool("mute") && !ConfMan.getBool("music_mute");
|
||||
_voices = !ConfMan.getBool("mute") && !ConfMan.getBool("speech_mute") ? 1 : 0;
|
||||
|
||||
// TODO: For now, keep sound completely mute until sound is implemented
|
||||
_digitized = false;
|
||||
_music = false;
|
||||
_voices = 0;
|
||||
}
|
||||
|
||||
void Sound::loadSound(const Common::String &name, int priority) {
|
||||
|
@ -38,19 +38,20 @@ class Sound {
|
||||
private:
|
||||
SherlockEngine *_vm;
|
||||
public:
|
||||
bool _digitized;
|
||||
bool _music;
|
||||
int _voices;
|
||||
bool _soundOn;
|
||||
bool _musicOn;
|
||||
bool _speechOn;
|
||||
int _voices;
|
||||
bool _playingEpilogue;
|
||||
bool _music;
|
||||
bool _digitized;
|
||||
bool _diskSoundPlaying;
|
||||
byte *_soundIsOn;
|
||||
byte *_digiBuf;
|
||||
public:
|
||||
Sound(SherlockEngine *vm);
|
||||
|
||||
void syncSoundSettings();
|
||||
void loadSound(const Common::String &name, int priority);
|
||||
bool playSound(const Common::String &name, WaitType waitType = WAIT_RETURN_IMMEDIATELY);
|
||||
void cacheSound(const Common::String &name, int index);
|
||||
|
@ -85,7 +85,6 @@ private:
|
||||
int _bgFound;
|
||||
int _oldBgFound;
|
||||
int _keycode;
|
||||
int _helpStyle;
|
||||
int _lookHelp;
|
||||
int _help, _oldHelp;
|
||||
int _key, _oldKey;
|
||||
@ -137,6 +136,7 @@ public:
|
||||
int _invLookFlag;
|
||||
int _temp1;
|
||||
int _windowStyle;
|
||||
int _helpStyle;
|
||||
public:
|
||||
UserInterface(SherlockEngine *vm);
|
||||
~UserInterface();
|
||||
|
Loading…
x
Reference in New Issue
Block a user