diff options
-rw-r--r-- | engines/sherlock/detection.cpp | 22 | ||||
-rw-r--r-- | engines/sherlock/detection_tables.h | 9 | ||||
-rw-r--r-- | engines/sherlock/sherlock.h | 20 | ||||
-rw-r--r-- | engines/sherlock/tattoo/tattoo.cpp | 16 | ||||
-rw-r--r-- | engines/sherlock/tattoo/tattoo.h | 7 | ||||
-rw-r--r-- | engines/sherlock/tattoo/widget_options.cpp | 41 | ||||
-rw-r--r-- | engines/sherlock/tattoo/widget_options.h | 1 |
7 files changed, 82 insertions, 34 deletions
diff --git a/engines/sherlock/detection.cpp b/engines/sherlock/detection.cpp index 35a810efb1..b60facb86d 100644 --- a/engines/sherlock/detection.cpp +++ b/engines/sherlock/detection.cpp @@ -62,6 +62,8 @@ static const PlainGameDescriptor sherlockGames[] = { #define GAMEOPTION_HELP_STYLE GUIO_GAMEOPTIONS3 #define GAMEOPTION_PORTRAITS_ON GUIO_GAMEOPTIONS4 #define GAMEOPTION_WINDOW_STYLE GUIO_GAMEOPTIONS5 +#define GAMEOPTION_TRANSPARENT_WINDOWS GUIO_GAMEOPTIONS6 +#define GAMEOPTION_TEXT_WINDOWS GUIO_GAMEOPTIONS7 static const ADExtraGuiOptionsMap optionsList[] = { { @@ -114,6 +116,26 @@ static const ADExtraGuiOptionsMap optionsList[] = { } }, + { + GAMEOPTION_TRANSPARENT_WINDOWS, + { + _s("Transparent windows"), + _s("Show windows with a partially transparent background"), + "transparent_windows", + true + } + }, + + { + GAMEOPTION_TEXT_WINDOWS, + { + _s("Text windows"), + _s("Show text windows during conversations"), + "text_windows", + true + } + }, + AD_EXTRA_GUI_OPTIONS_TERMINATOR }; diff --git a/engines/sherlock/detection_tables.h b/engines/sherlock/detection_tables.h index 991fc2055d..23d98c85c9 100644 --- a/engines/sherlock/detection_tables.h +++ b/engines/sherlock/detection_tables.h @@ -130,7 +130,8 @@ static const SherlockGameDescription gameDescriptions[] = { Common::EN_ANY, Common::kPlatformDOS, ADGF_UNSTABLE, - GUIO0() + GUIO4(GAMEOPTION_ORIGINAL_SAVES, GAMEOPTION_HELP_STYLE, GAMEOPTION_TEXT_WINDOWS, + GAMEOPTION_TRANSPARENT_WINDOWS) }, GType_RoseTattoo }, @@ -145,7 +146,8 @@ static const SherlockGameDescription gameDescriptions[] = { Common::EN_ANY, Common::kPlatformDOS, ADGF_UNSTABLE, - GUIO0() + GUIO4(GAMEOPTION_ORIGINAL_SAVES, GAMEOPTION_HELP_STYLE, GAMEOPTION_TEXT_WINDOWS, + GAMEOPTION_TRANSPARENT_WINDOWS) }, GType_RoseTattoo, }, @@ -160,7 +162,8 @@ static const SherlockGameDescription gameDescriptions[] = { Common::DE_DEU, Common::kPlatformDOS, ADGF_UNSTABLE, - GUIO0() + GUIO4(GAMEOPTION_ORIGINAL_SAVES, GAMEOPTION_HELP_STYLE, GAMEOPTION_TEXT_WINDOWS, + GAMEOPTION_TRANSPARENT_WINDOWS) }, GType_RoseTattoo, }, diff --git a/engines/sherlock/sherlock.h b/engines/sherlock/sherlock.h index 69000e1fbc..5f888f8c3d 100644 --- a/engines/sherlock/sherlock.h +++ b/engines/sherlock/sherlock.h @@ -87,11 +87,6 @@ private: * Handle all player input */ void handleInput(); - - /** - * Load game configuration esttings - */ - void loadConfig(); protected: /** * Does basic initialization of the game engine @@ -106,6 +101,11 @@ protected: * Returns a list of features the game itself supports */ virtual bool hasFeature(EngineFeature f) const; + + /** + * Load game configuration esttings + */ + virtual void loadConfig(); public: const SherlockGameDescription *_gameDescription; Animation *_animation; @@ -166,6 +166,11 @@ public: virtual void syncSoundSettings(); /** + * Saves game configuration information + */ + virtual void saveConfig(); + + /** * Returns whether the version is a demo */ virtual bool isDemo() const; @@ -210,11 +215,6 @@ public: void setFlagsDirect(int flagNum); /** - * Saves game configuration information - */ - void saveConfig(); - - /** * Synchronize the data for a savegame */ void synchronize(Serializer &s); diff --git a/engines/sherlock/tattoo/tattoo.cpp b/engines/sherlock/tattoo/tattoo.cpp index e7dd20ada4..028650ddb4 100644 --- a/engines/sherlock/tattoo/tattoo.cpp +++ b/engines/sherlock/tattoo/tattoo.cpp @@ -20,6 +20,7 @@ * */ +#include "common/config-manager.h" #include "engines/util.h" #include "sherlock/tattoo/tattoo.h" #include "sherlock/tattoo/tattoo_fixed_text.h" @@ -178,6 +179,21 @@ void TattooEngine::doHangManPuzzle() { _hangmanWidget.show(); } +void TattooEngine::loadConfig() { + SherlockEngine::loadConfig(); + + _transparentMenus = ConfMan.getBool("transparent_windows"); + _textWindowsOn = ConfMan.getBool("text_windows"); +} + +void TattooEngine::saveConfig() { + SherlockEngine::saveConfig(); + + ConfMan.setBool("transparent_windows", _transparentMenus); + ConfMan.setBool("text_windows", _textWindowsOn); + ConfMan.flushToDisk(); +} + } // End of namespace Tattoo } // End of namespace Sherlock diff --git a/engines/sherlock/tattoo/tattoo.h b/engines/sherlock/tattoo/tattoo.h index 923afa3d90..8a19746a0f 100644 --- a/engines/sherlock/tattoo/tattoo.h +++ b/engines/sherlock/tattoo/tattoo.h @@ -78,6 +78,11 @@ protected: * Starting a scene within the game */ virtual void startScene(); + + /** + * Load configuration options + */ + virtual void loadConfig(); public: bool _runningProlog; bool _fastMode, _allowFastMode; @@ -95,7 +100,7 @@ public: /** * Save the game configuration */ - void saveConfig() {} + virtual void saveConfig(); }; } // End of namespace Tattoo diff --git a/engines/sherlock/tattoo/widget_options.cpp b/engines/sherlock/tattoo/widget_options.cpp index 0135a157c8..eb18a8b03a 100644 --- a/engines/sherlock/tattoo/widget_options.cpp +++ b/engines/sherlock/tattoo/widget_options.cpp @@ -37,23 +37,9 @@ WidgetOptions::WidgetOptions(SherlockEngine *vm) : WidgetBase(vm) { void WidgetOptions::load() { Events &events = *_vm->_events; - Music &music = *_vm->_music; - Sound &sound = *_vm->_sound; TattooUserInterface &ui = *(TattooUserInterface *)_vm->_ui; - Common::Point mousePos = events.mousePos(); - - // Set bounds for the dialog - Common::String widestString = Common::String::format("%s %s", FIXED(TransparentMenus), FIXED(Off)); - _bounds = Common::Rect(_surface.stringWidth(widestString) + _surface.widestChar() * 2 + 6, - (_surface.fontHeight() + 7) * 11 + 3); - _bounds.moveTo(mousePos.x - _bounds.width() / 2, mousePos.y - _bounds.height() / 2); - - // Get slider positions - _midiSliderX = music._musicVolume * (_bounds.width() - _surface.widestChar() * 2) / 255 + _surface.widestChar(); - _digiSliderX = sound._soundVolume * (_bounds.width() - _surface.widestChar() * 2) / 255 + _surface.widestChar(); + _centerPos = events.mousePos(); - // Setup the dialog - _surface.create(_bounds.width(), _bounds.height()); render(); summonWindow(); @@ -127,7 +113,7 @@ void WidgetOptions::handleEvents() { _midiSliderX = _bounds.width() - _surface.widestChar(); int temp = music._musicVolume; - music._musicVolume = (_midiSliderX - _surface.widestChar()) * 127 / (_bounds.width() - _surface.widestChar() * 2); + music._musicVolume = (_midiSliderX - _surface.widestChar()) * 255 / (_bounds.width() - _surface.widestChar() * 2); if (music._musicVolume != temp) { music.setMIDIVolume(music._musicVolume); vm.saveConfig(); @@ -146,7 +132,7 @@ void WidgetOptions::handleEvents() { _digiSliderX = _bounds.width() - _surface.widestChar(); int temp = sound._soundVolume; - sound._soundVolume = (_digiSliderX - _surface.widestChar()) * 15 / (_bounds.width() - _surface.widestChar() * 2); + sound._soundVolume = (_digiSliderX - _surface.widestChar()) * 255 / (_bounds.width() - _surface.widestChar() * 2); if (sound._soundVolume != temp) { sound.setVolume(sound._soundVolume); vm.saveConfig(); @@ -165,7 +151,7 @@ void WidgetOptions::handleEvents() { events.clearEvents(); _outsideMenu = false; int temp = _selector; - _selector = 255; + _selector = -1; switch (temp) { case 0: @@ -224,7 +210,7 @@ void WidgetOptions::handleEvents() { fontNumber = 0; screen.setFont(fontNumber); - render(OP_CONTENTS); + render(OP_ALL); vm.saveConfig(); break; } @@ -233,7 +219,7 @@ void WidgetOptions::handleEvents() { // Toggle Transparent Menus vm._transparentMenus = !vm._transparentMenus; - render(OP_CONTENTS); + render(OP_NAMES); vm.saveConfig(); break; @@ -253,17 +239,32 @@ void WidgetOptions::handleEvents() { void WidgetOptions::render(OptionRenderMode mode) { TattooEngine &vm = *(TattooEngine *)_vm; + Events &events = *_vm->_events; Music &music = *_vm->_music; Sound &sound = *_vm->_sound; TattooUserInterface &ui = *(TattooUserInterface *)_vm->_ui; + Common::Point mousePos = events.mousePos(); ImageFile &images = *ui._interfaceImages; const char *const OFF_ON[2] = { FIXED(Off), FIXED(On) }; // Draw the border if necessary if (mode == OP_ALL) { + // Set bounds for the dialog + Common::String widestString = Common::String::format("%s %s", FIXED(TransparentMenus), FIXED(Off)); + _bounds = Common::Rect(_surface.stringWidth(widestString) + _surface.widestChar() * 2 + 6, + (_surface.fontHeight() + 7) * 11 + 3); + _bounds.moveTo(_centerPos.x - _bounds.width() / 2, _centerPos.y - _bounds.height() / 2); + + // Get slider positions + _midiSliderX = music._musicVolume * (_bounds.width() - _surface.widestChar() * 2) / 255 + _surface.widestChar(); + _digiSliderX = sound._soundVolume * (_bounds.width() - _surface.widestChar() * 2) / 255 + _surface.widestChar(); + + // Setup the dialog + _surface.create(_bounds.width(), _bounds.height()); _surface.fill(TRANSPARENCY); makeInfoArea(); + // Draw the lines separating options in the dialog int yp = _surface.fontHeight() + 7; for (int idx = 0; idx < 7; ++idx) { _surface.transBlitFrom(images[4], Common::Point(0, yp - 1)); diff --git a/engines/sherlock/tattoo/widget_options.h b/engines/sherlock/tattoo/widget_options.h index c2f1fccf53..b50a557f14 100644 --- a/engines/sherlock/tattoo/widget_options.h +++ b/engines/sherlock/tattoo/widget_options.h @@ -41,6 +41,7 @@ class WidgetOptions : public WidgetBase { private: int _midiSliderX, _digiSliderX; int _selector, _oldSelector; + Common::Point _centerPos; /** * Render the contents of the dialog onto the widget's surface |