aboutsummaryrefslogtreecommitdiff
path: root/engines/sherlock/tattoo
diff options
context:
space:
mode:
authorPaul Gilbert2015-07-23 21:47:18 -0400
committerPaul Gilbert2015-07-23 21:50:45 -0400
commit1018dad556b8fddd12852e9254b7c0feca65b8a6 (patch)
treeda04840284e606b547ef30a29633d41fd8e5e0e9 /engines/sherlock/tattoo
parent7734cea9c87d2527abb09c0024caeeb26a51beb2 (diff)
downloadscummvm-rg350-1018dad556b8fddd12852e9254b7c0feca65b8a6.tar.gz
scummvm-rg350-1018dad556b8fddd12852e9254b7c0feca65b8a6.tar.bz2
scummvm-rg350-1018dad556b8fddd12852e9254b7c0feca65b8a6.zip
SHERLOCK: RT: Implemented Options dialog rendering
Diffstat (limited to 'engines/sherlock/tattoo')
-rw-r--r--engines/sherlock/tattoo/tattoo.cpp1
-rw-r--r--engines/sherlock/tattoo/tattoo.h1
-rw-r--r--engines/sherlock/tattoo/tattoo_fixed_text.cpp12
-rw-r--r--engines/sherlock/tattoo/tattoo_fixed_text.h13
-rw-r--r--engines/sherlock/tattoo/tattoo_user_interface.cpp1
-rw-r--r--engines/sherlock/tattoo/widget_base.cpp4
-rw-r--r--engines/sherlock/tattoo/widget_base.h5
-rw-r--r--engines/sherlock/tattoo/widget_options.cpp154
-rw-r--r--engines/sherlock/tattoo/widget_options.h9
9 files changed, 198 insertions, 2 deletions
diff --git a/engines/sherlock/tattoo/tattoo.cpp b/engines/sherlock/tattoo/tattoo.cpp
index aa8404f4da..e7dd20ada4 100644
--- a/engines/sherlock/tattoo/tattoo.cpp
+++ b/engines/sherlock/tattoo/tattoo.cpp
@@ -39,6 +39,7 @@ TattooEngine::TattooEngine(OSystem *syst, const SherlockGameDescription *gameDes
_fastMode = false;
_allowFastMode = true;
_transparentMenus = true;
+ _textWindowsOn = true;
}
TattooEngine::~TattooEngine() {
diff --git a/engines/sherlock/tattoo/tattoo.h b/engines/sherlock/tattoo/tattoo.h
index 774e243733..6885f51e2e 100644
--- a/engines/sherlock/tattoo/tattoo.h
+++ b/engines/sherlock/tattoo/tattoo.h
@@ -82,6 +82,7 @@ public:
bool _runningProlog;
bool _fastMode, _allowFastMode;
bool _transparentMenus;
+ bool _textWindowsOn;
public:
TattooEngine(OSystem *syst, const SherlockGameDescription *gameDesc);
virtual ~TattooEngine();
diff --git a/engines/sherlock/tattoo/tattoo_fixed_text.cpp b/engines/sherlock/tattoo/tattoo_fixed_text.cpp
index 72c67570de..a4c38c8064 100644
--- a/engines/sherlock/tattoo/tattoo_fixed_text.cpp
+++ b/engines/sherlock/tattoo/tattoo_fixed_text.cpp
@@ -87,7 +87,17 @@ static const char *const FIXED_TEXT_ENGLISH[] = {
"Apply",
"Water",
- "Heat"
+ "Heat",
+ "Load Game",
+ "Save Game",
+ "Music",
+ "Sound Effects",
+ "Voices",
+ "Text Windows",
+ "Transparent Menus",
+ "Change Font Style",
+ "Off",
+ "On"
};
TattooFixedText::TattooFixedText(SherlockEngine *vm) : FixedText(vm) {
diff --git a/engines/sherlock/tattoo/tattoo_fixed_text.h b/engines/sherlock/tattoo/tattoo_fixed_text.h
index c26d787095..e8fea93e86 100644
--- a/engines/sherlock/tattoo/tattoo_fixed_text.h
+++ b/engines/sherlock/tattoo/tattoo_fixed_text.h
@@ -87,7 +87,18 @@ enum FixedTextId {
kFixedText_Apply,
kFixedText_Water,
- kFixedText_Heat
+ kFixedText_Heat,
+ kFixedText_LoadGame,
+ kFixedText_SaveGame,
+ kFixedText_Music,
+ kFixedText_SoundEffects,
+ kFixedText_Voices,
+ kFixedText_TextWindows,
+ kFixedText_TransparentMenus,
+ kFixedText_ChangeFont,
+ kFixedText_Off,
+ kFixedText_On,
+ kFixedText_Quit
};
class TattooFixedText: public FixedText {
diff --git a/engines/sherlock/tattoo/tattoo_user_interface.cpp b/engines/sherlock/tattoo/tattoo_user_interface.cpp
index 8352e2975c..528be5f14e 100644
--- a/engines/sherlock/tattoo/tattoo_user_interface.cpp
+++ b/engines/sherlock/tattoo/tattoo_user_interface.cpp
@@ -561,6 +561,7 @@ void TattooUserInterface::doInventory(int mode) {
}
void TattooUserInterface::doControls() {
+ _menuMode = OPTION_MODE;
_optionsWidget.load();
}
diff --git a/engines/sherlock/tattoo/widget_base.cpp b/engines/sherlock/tattoo/widget_base.cpp
index 9d95fed9bf..4f58125bb9 100644
--- a/engines/sherlock/tattoo/widget_base.cpp
+++ b/engines/sherlock/tattoo/widget_base.cpp
@@ -207,6 +207,10 @@ void WidgetBase::makeInfoArea() {
makeInfoArea(_surface);
}
+void WidgetBase::drawDialogRect(const Common::Rect &r, bool raised) {
+ static_cast<TattooUserInterface *>(_vm->_ui)->drawDialogRect(_surface, r, raised);
+}
+
void WidgetBase::checkTabbingKeys(int numOptions) {
}
diff --git a/engines/sherlock/tattoo/widget_base.h b/engines/sherlock/tattoo/widget_base.h
index fcf22cee8e..149f80e770 100644
--- a/engines/sherlock/tattoo/widget_base.h
+++ b/engines/sherlock/tattoo/widget_base.h
@@ -65,6 +65,11 @@ protected:
void makeInfoArea();
/**
+ * Draw a dialog rectangle
+ */
+ void drawDialogRect(const Common::Rect &r, bool raised = true);
+
+ /**
* Draw the scrollbar for the dialog
*/
void drawScrollBar(int index, int pageSize, int count);
diff --git a/engines/sherlock/tattoo/widget_options.cpp b/engines/sherlock/tattoo/widget_options.cpp
index 5b4c706a5c..16d1d1476b 100644
--- a/engines/sherlock/tattoo/widget_options.cpp
+++ b/engines/sherlock/tattoo/widget_options.cpp
@@ -22,20 +22,174 @@
#include "sherlock/tattoo/widget_options.h"
#include "sherlock/tattoo/tattoo.h"
+#include "sherlock/tattoo/tattoo_fixed_text.h"
+#include "sherlock/tattoo/tattoo_user_interface.h"
namespace Sherlock {
namespace Tattoo {
WidgetOptions::WidgetOptions(SherlockEngine *vm) : WidgetBase(vm) {
+ _midiSliderX = _digiSliderX = 0;
+ _selector = _oldSelector = -1;
}
void WidgetOptions::load() {
+ Events &events = *_vm->_events;
+ Music &music = *_vm->_music;
+ Sound &sound = *_vm->_sound;
+ 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();
+ // Setup the dialog
+ _surface.create(_bounds.width(), _bounds.height());
+ render();
}
void WidgetOptions::handleEvents() {
Events &events = *_vm->_events;
+ // TODO
+}
+
+void WidgetOptions::render(OptionRenderMode mode) {
+ TattooEngine &vm = *(TattooEngine *)_vm;
+ Music &music = *_vm->_music;
+ Sound &sound = *_vm->_sound;
+ TattooUserInterface &ui = *(TattooUserInterface *)_vm->_ui;
+ ImageFile &images = *ui._interfaceImages;
+ const char *const OFF_ON[2] = { FIXED(Off), FIXED(On) };
+
+ // Draw the border if necessary
+ if (mode == OP_ALL) {
+ _surface.fill(TRANSPARENCY);
+ makeInfoArea();
+
+ int yp = _surface.fontHeight() + 7;
+ for (int idx = 0; idx < 7; ++idx) {
+ _surface.transBlitFrom(images[4], Common::Point(0, yp - 1));
+ _surface.transBlitFrom(images[5], Common::Point(_surface.w() - images[5]._width, yp - 1));
+ _surface.hLine(3, yp, _surface.w() - 4, INFO_TOP);
+ _surface.hLine(3, yp + 1, _surface.w() - 4, INFO_MIDDLE);
+ _surface.hLine(3, yp + 2, _surface.w() - 4, INFO_BOTTOM);
+
+ yp += _surface.fontHeight() + 7;
+ if (idx == 1)
+ yp += _surface.fontHeight() + 7;
+ else if (idx == 2)
+ yp += (_surface.fontHeight() + 7) * 2;
+ }
+ }
+
+ // Now go through and display all the items that can be highlighted
+ for (int idx = 0, yp = 5; idx < 11; ++idx, yp += _surface.fontHeight() + 7) {
+ if (mode == OP_ALL || idx == _selector || idx == _oldSelector) {
+ if (mode == OP_NAMES)
+ _surface.fillRect(Common::Rect(4, yp, _surface.w() - 5, yp + _surface.fontHeight() - 1), TRANSPARENCY);
+ byte color = (idx == _selector) ? COMMAND_HIGHLIGHTED : INFO_TOP;
+ Common::String str;
+
+ switch (idx) {
+ case 0:
+ str = FIXED(LoadGame);
+ break;
+
+ case 1:
+ str = FIXED(SaveGame);
+ break;
+
+ case 2:
+ str = Common::String::format("%s %s", FIXED(Music), OFF_ON[music._musicOn]);
+ break;
+
+ case 3: {
+ int num = (_surface.fontHeight() + 4) & 0xfe;
+ int sliderY = yp + num / 2 - 8;
+
+ _surface.fillRect(Common::Rect(4, sliderY - (num - 6) / 2, _surface.w() - 5,
+ sliderY - (num - 6) / 2 + num - 1), TRANSPARENCY);
+ _surface.fillRect(Common::Rect(_surface.widestChar(), sliderY + 2,
+ _surface.w() - _surface.widestChar() - 1, sliderY + 3), INFO_MIDDLE);
+ drawDialogRect(Common::Rect(_surface.widestChar(), sliderY, _surface.w() - _surface.widestChar() * 2, 6));
+
+ _surface.fillRect(Common::Rect(_midiSliderX - 1, sliderY - (num - 6) / 2 + 2,
+ _midiSliderX + 1, sliderY - (num - 6) / 2 + num - 3), INFO_MIDDLE);
+ drawDialogRect(Common::Rect(_midiSliderX - 3, sliderY - (num - 6) / 2, 7, num));
+
+ if (_midiSliderX - 4 > _surface.widestChar())
+ _surface.fillRect(Common::Rect(_midiSliderX - 4, sliderY, _midiSliderX - 4, sliderY + 4), INFO_BOTTOM);
+ if (_midiSliderX + 4 < _surface.w() - _surface.widestChar())
+ _surface.fillRect(Common::Rect(_midiSliderX + 4, sliderY, _midiSliderX + 4, sliderY + 4), INFO_BOTTOM);
+ break;
+ }
+
+ case 4:
+ str = Common::String::format("%s %s", FIXED(SoundEffects), OFF_ON[sound._digitized]);
+ break;
+
+ case 5:
+ str = Common::String::format("%s %s", FIXED(Voices), OFF_ON[sound._voices]);
+ break;
+
+ case 6: {
+ int num = (_surface.fontHeight() + 4) & 0xfe;
+ int sliderY = yp + num / 2 - 8;
+
+ _surface.fillRect(Common::Rect(4, sliderY - (num - 6) / 2, _surface.w() - 5,
+ sliderY - (num - 6) / 2 + num - 1), TRANSPARENCY);
+ _surface.fillRect(Common::Rect(_surface.widestChar(), sliderY + 2, _surface.w() - _surface.widestChar() - 1,
+ sliderY + 3), INFO_MIDDLE);
+ drawDialogRect(Common::Rect(_surface.widestChar(), sliderY, _surface.w() - _surface.widestChar() * 2, 6));
+ _surface.fillRect(Common::Rect(_digiSliderX - 1, sliderY - (num - 6) / 2 + 2, _digiSliderX + 1,
+ sliderY - (num - 6) / 2 + num - 3), INFO_MIDDLE);
+ drawDialogRect(Common::Rect(_digiSliderX - 3, sliderY - (num - 6) / 2, 7, num));
+ if (_digiSliderX - 4 > _surface.widestChar())
+ _surface.fillRect(Common::Rect(_digiSliderX - 4, sliderY, _digiSliderX - 4, sliderY + 4), INFO_BOTTOM);
+ if (_digiSliderX + 4 < _surface.w() - _surface.widestChar())
+ _surface.fillRect(Common::Rect(_digiSliderX + 4, sliderY, _digiSliderX + 4, sliderY + 4), INFO_BOTTOM);
+ break;
+ }
+
+ case 7:
+ if (!sound._voices) {
+ color = INFO_BOTTOM;
+ str = Common::String::format("%s %s", FIXED(TextWindows), FIXED(On));
+ } else {
+ str = Common::String::format("%s %s", FIXED(TextWindows), OFF_ON[vm._textWindowsOn]);
+ }
+ break;
+
+ case 8:
+ str = FIXED(ChangeFont);
+ break;
+
+ case 9:
+ str = Common::String::format("%s %s", FIXED(TransparentMenus), OFF_ON[vm._transparentMenus]);
+ break;
+
+ case 10:
+ str = FIXED(Quit);
+ break;
+
+ default:
+ break;
+ }
+
+ // Unless we're doing one of the Slider Controls, print the text for the line
+ if (idx != 3 && idx != 6) {
+ int xp = (_surface.w() - _surface.stringWidth(str)) / 2;
+ _surface.writeString(str, Common::Point(xp, yp), color);
+ }
+ }
+ }
}
} // End of namespace Tattoo
diff --git a/engines/sherlock/tattoo/widget_options.h b/engines/sherlock/tattoo/widget_options.h
index 2edb47cb79..b76aed9bc8 100644
--- a/engines/sherlock/tattoo/widget_options.h
+++ b/engines/sherlock/tattoo/widget_options.h
@@ -32,11 +32,20 @@ class SherlockEngine;
namespace Tattoo {
+enum OptionRenderMode { OP_ALL = 0, OP_CONTENTS = 1, OP_NAMES = 2};
+
/**
* Handles displaying the options dialog
*/
class WidgetOptions : public WidgetBase {
private:
+ int _midiSliderX, _digiSliderX;
+ int _selector, _oldSelector;
+
+ /**
+ * Render the contents of the dialog onto the widget's surface
+ */
+ void render(OptionRenderMode mode = OP_ALL);
public:
WidgetOptions(SherlockEngine *vm);
virtual ~WidgetOptions() {}