diff options
Diffstat (limited to 'engines/sherlock')
-rw-r--r-- | engines/sherlock/tattoo/tattoo.cpp | 5 | ||||
-rw-r--r-- | engines/sherlock/tattoo/tattoo.h | 4 | ||||
-rw-r--r-- | engines/sherlock/tattoo/tattoo_journal.cpp | 92 | ||||
-rw-r--r-- | engines/sherlock/tattoo/tattoo_journal.h | 11 | ||||
-rw-r--r-- | engines/sherlock/tattoo/tattoo_user_interface.cpp | 6 | ||||
-rw-r--r-- | engines/sherlock/tattoo/tattoo_user_interface.h | 5 | ||||
-rw-r--r-- | engines/sherlock/tattoo/widget_base.cpp | 14 | ||||
-rw-r--r-- | engines/sherlock/tattoo/widget_base.h | 12 | ||||
-rw-r--r-- | engines/sherlock/tattoo/widget_inventory.cpp | 3 |
9 files changed, 119 insertions, 33 deletions
diff --git a/engines/sherlock/tattoo/tattoo.cpp b/engines/sherlock/tattoo/tattoo.cpp index bc4e7d5042..c6df9942a7 100644 --- a/engines/sherlock/tattoo/tattoo.cpp +++ b/engines/sherlock/tattoo/tattoo.cpp @@ -37,10 +37,10 @@ TattooEngine::TattooEngine(OSystem *syst, const SherlockGameDescription *gameDes _runningProlog = false; _fastMode = false; _allowFastMode = true; + _transparentMenus = true; } TattooEngine::~TattooEngine() { - WidgetBase::freeInterfaceImages(); } void TattooEngine::showOpening() { @@ -53,9 +53,6 @@ void TattooEngine::initialize() { // Initialize the base engine SherlockEngine::initialize(); - // Further initialization - WidgetBase::setInterfaceImages(new ImageFile("intrface.vgs")); - // Initialise the global flags _flags.resize(3200); _flags[1] = _flags[4] = _flags[76] = true; diff --git a/engines/sherlock/tattoo/tattoo.h b/engines/sherlock/tattoo/tattoo.h index d7d2115588..9ef2e0a563 100644 --- a/engines/sherlock/tattoo/tattoo.h +++ b/engines/sherlock/tattoo/tattoo.h @@ -32,7 +32,8 @@ namespace Tattoo { enum { INFO_TOP = 185, INFO_MIDDLE = 186, - INFO_BOTTOM = 188 + INFO_BOTTOM = 188, + MENU_BACKGROUND = 225 }; class TattooEngine : public SherlockEngine { @@ -57,6 +58,7 @@ public: bool _creditsActive; bool _runningProlog; bool _fastMode, _allowFastMode; + bool _transparentMenus; public: TattooEngine(OSystem *syst, const SherlockGameDescription *gameDesc); virtual ~TattooEngine(); diff --git a/engines/sherlock/tattoo/tattoo_journal.cpp b/engines/sherlock/tattoo/tattoo_journal.cpp index 104e2a8bfe..c4e0723f8a 100644 --- a/engines/sherlock/tattoo/tattoo_journal.cpp +++ b/engines/sherlock/tattoo/tattoo_journal.cpp @@ -23,7 +23,7 @@ #include "sherlock/tattoo/tattoo_journal.h" #include "sherlock/tattoo/tattoo_scene.h" #include "sherlock/tattoo/tattoo_user_interface.h" -#include "sherlock/sherlock.h" +#include "sherlock/tattoo/tattoo.h" namespace Sherlock { @@ -146,6 +146,96 @@ void TattooJournal::synchronize(Serializer &s) { } void TattooJournal::drawJournalControls(int mode) { + TattooEngine &vm = *(TattooEngine *)_vm; + Screen &screen = *_vm->_screen; + TattooUserInterface &ui = *(TattooUserInterface *)_vm->_ui; + ImageFile &images = *ui._interfaceImages; + + Common::Rect r(JOURNAL_BAR_WIDTH, !mode ? (BUTTON_SIZE + screen.fontHeight() + 13) : + (screen.fontHeight() + 4) * 2 + 9); + r.moveTo((SHERLOCK_SCREEN_WIDTH - r.width()) / 2, !mode ? (SHERLOCK_SCREEN_HEIGHT - r.height()) : + (SHERLOCK_SCREEN_HEIGHT - r.height()) / 2); + + Common::Rect inner = r; + inner.grow(-3); + + if (vm._transparentMenus) + ui.makeBGArea(inner); + else + screen._backBuffer1.fillRect(inner, MENU_BACKGROUND); + + // Draw the four corners of the info box + screen._backBuffer1.transBlitFrom(images[0], Common::Point(r.left, r.top)); + screen._backBuffer1.transBlitFrom(images[1], Common::Point(r.right - images[1]._width, r.top)); + screen._backBuffer1.transBlitFrom(images[1], Common::Point(r.left, r.bottom - images[1]._height)); + screen._backBuffer1.transBlitFrom(images[1], Common::Point(r.right - images[1]._width, r.bottom - images[1]._height)); + + // Draw the top of the info box + screen._backBuffer1.hLine(r.left + images[0]._width, r.top, r.right - images[0]._height, INFO_TOP); + screen._backBuffer1.hLine(r.left + images[0]._width, r.top + 1, r.right - images[0]._height, INFO_MIDDLE); + screen._backBuffer1.hLine(r.left + images[0]._width, r.top + 2, r.right - images[0]._height, INFO_BOTTOM); + + // Draw the bottom of the info box + screen._backBuffer1.hLine(r.left + images[0]._width, r.bottom - 3, r.right - images[0]._height, INFO_TOP); + screen._backBuffer1.hLine(r.left + images[0]._width, r.bottom - 2, r.right - images[0]._height, INFO_MIDDLE); + screen._backBuffer1.hLine(r.left + images[0]._width, r.bottom - 1, r.right - images[0]._height, INFO_BOTTOM); + + // Draw the left side of the info box + screen._backBuffer1.vLine(r.left, r.top + images[0]._height, r.bottom - images[2]._height, INFO_TOP); + screen._backBuffer1.vLine(r.left + 1, r.top + images[0]._height, r.bottom - images[2]._height, INFO_MIDDLE); + screen._backBuffer1.vLine(r.left + 2, r.top + images[0]._height, r.bottom - images[2]._height, INFO_BOTTOM); + + // Draw the right side of the info box + screen._backBuffer1.vLine(r.right - 3, r.top + images[0]._height, r.bottom - images[2]._height, INFO_TOP); + screen._backBuffer1.vLine(r.right - 2, r.top + images[0]._height, r.bottom - images[2]._height, INFO_MIDDLE); + screen._backBuffer1.vLine(r.right - 1, r.top + images[0]._height, r.bottom - images[2]._height, INFO_BOTTOM); + + // Draw the sides of the separator bar above the scroll bar + int yp = r.top + screen.fontHeight() + 7; + screen._backBuffer1.transBlitFrom(images[4], Common::Point(r.left, yp - 1)); + screen._backBuffer1.transBlitFrom(images[5], Common::Point(r.right - images[5]._width, yp - 1)); + + // Draw the bar above the scroll bar + screen._backBuffer1.hLine(r.left + images[4]._width, yp, r.right - images[5]._width, INFO_TOP); + screen._backBuffer1.hLine(r.left + images[4]._width, yp + 1, r.right - images[5]._width, INFO_MIDDLE); + screen._backBuffer1.hLine(r.left + images[4]._width, yp + 2, r.right - images[5]._width, INFO_BOTTOM); + + if (mode != 2) { + // Draw the Bars separating the Journal Commands + int xp = r.right / 3; + for (int idx = 0; idx < 2; ++idx) { + screen._backBuffer1.transBlitFrom(images[6], Common::Point(xp - 2, r.top + 1)); + screen._backBuffer1.transBlitFrom(images[7], Common::Point(xp - 2, yp - 1)); + + screen._backBuffer1.hLine(xp - 1, r.top + 4, yp - 2, INFO_TOP); + screen._backBuffer1.hLine(xp, r.top + 4, yp - 2, INFO_MIDDLE); + screen._backBuffer1.hLine(xp + 1, r.top + 4, yp - 2, INFO_BOTTOM); + xp = r.right / 3 * 2; + } + } + + int savedSelector = _oldSelector; + _oldSelector = 100; + + switch (mode) { + case 0: + highlightJournalControls(false); + break; + case 1: + highlightSearchControls(false); + break; + default: + break; + } + + _oldSelector = savedSelector; +} + +void TattooJournal::highlightJournalControls(bool slamIt) { + // TODO +} + +void TattooJournal::highlightSearchControls(bool slamIt) { // TODO } diff --git a/engines/sherlock/tattoo/tattoo_journal.h b/engines/sherlock/tattoo/tattoo_journal.h index b0898bcfd1..1eacde4056 100644 --- a/engines/sherlock/tattoo/tattoo_journal.h +++ b/engines/sherlock/tattoo/tattoo_journal.h @@ -33,6 +33,7 @@ namespace Tattoo { class TattooJournal : public Journal { private: ImageFile *_journalImages; + int _selector, _oldSelector; /** * Load the list of journal locations @@ -44,6 +45,16 @@ private: * @param mode 0: Normal journal buttons, 1: Search interface */ void drawJournalControls(int mode); + + /** + * Draw the journal controls used by the journal + */ + void highlightJournalControls(bool slamIt); + + /** + * Draw the journal controls used in search mode + */ + void highlightSearchControls(bool slamIt); public: TattooJournal(SherlockEngine *vm); virtual ~TattooJournal() {} diff --git a/engines/sherlock/tattoo/tattoo_user_interface.cpp b/engines/sherlock/tattoo/tattoo_user_interface.cpp index 84ebfe7837..234b6a5c13 100644 --- a/engines/sherlock/tattoo/tattoo_user_interface.cpp +++ b/engines/sherlock/tattoo/tattoo_user_interface.cpp @@ -51,6 +51,12 @@ TattooUserInterface::TattooUserInterface(SherlockEngine *vm): UserInterface(vm), _scrollHighlight = 0; _mask = _mask1 = nullptr; _maskCounter = 0; + + _interfaceImages = new ImageFile("intrface.vgs"); +} + +TattooUserInterface::~TattooUserInterface() { + delete _interfaceImages; } void TattooUserInterface::initScrollVars() { diff --git a/engines/sherlock/tattoo/tattoo_user_interface.h b/engines/sherlock/tattoo/tattoo_user_interface.h index 27039d9e4b..9adc9ccc8f 100644 --- a/engines/sherlock/tattoo/tattoo_user_interface.h +++ b/engines/sherlock/tattoo/tattoo_user_interface.h @@ -36,6 +36,8 @@ namespace Sherlock { namespace Tattoo { +#define BUTTON_SIZE 15 // Button width/height + class WidgetBase; class TattooUserInterface : public UserInterface { @@ -144,9 +146,10 @@ public: ImageFile *_mask, *_mask1; Common::Point _maskOffset; int _maskCounter; + ImageFile *_interfaceImages; public: TattooUserInterface(SherlockEngine *vm); - virtual ~TattooUserInterface() {} + virtual ~TattooUserInterface(); /** * Handles restoring any areas of the back buffer that were/are covered by UI elements diff --git a/engines/sherlock/tattoo/widget_base.cpp b/engines/sherlock/tattoo/widget_base.cpp index 682961fd4e..1df14ffe7d 100644 --- a/engines/sherlock/tattoo/widget_base.cpp +++ b/engines/sherlock/tattoo/widget_base.cpp @@ -29,17 +29,6 @@ namespace Sherlock { namespace Tattoo { -ImageFile *WidgetBase::_interfaceImages; - -void WidgetBase::setInterfaceImages(ImageFile *images) { - _interfaceImages = images; -} - -void WidgetBase::freeInterfaceImages() { - delete _interfaceImages; - _interfaceImages = nullptr; -} - WidgetBase::WidgetBase(SherlockEngine *vm) : _vm(vm) { } @@ -146,7 +135,8 @@ void WidgetBase::checkMenuPosition() { } void WidgetBase::makeInfoArea(Surface &s) { - ImageFile &images = *_interfaceImages; + TattooUserInterface &ui = *(TattooUserInterface *)_vm->_ui; + ImageFile &images = *ui._interfaceImages; // Draw the four corners of the Info Box s.transBlitFrom(images[0], Common::Point(0, 0)); diff --git a/engines/sherlock/tattoo/widget_base.h b/engines/sherlock/tattoo/widget_base.h index 9d2ddcfc23..3455074964 100644 --- a/engines/sherlock/tattoo/widget_base.h +++ b/engines/sherlock/tattoo/widget_base.h @@ -39,8 +39,6 @@ class WidgetBase { private: Common::Rect _oldBounds; protected: - static ImageFile *_interfaceImages; -protected: SherlockEngine *_vm; Common::Rect _bounds; Surface _surface; @@ -71,16 +69,6 @@ protected: */ virtual const Common::Point &getCurrentScroll() const; public: - /** - * Sets the interface images used for drawing the various types of window elements - */ - static void setInterfaceImages(ImageFile *images); - - /** - * Frees the interface images - */ - static void freeInterfaceImages(); -public: WidgetBase(SherlockEngine *vm); virtual ~WidgetBase() {} diff --git a/engines/sherlock/tattoo/widget_inventory.cpp b/engines/sherlock/tattoo/widget_inventory.cpp index 60da821a1f..931c6464d8 100644 --- a/engines/sherlock/tattoo/widget_inventory.cpp +++ b/engines/sherlock/tattoo/widget_inventory.cpp @@ -33,7 +33,6 @@ namespace Tattoo { #define INVENTORY_YSIZE 70 // Height of the box that surrounds inventory items #define NUM_INVENTORY_SHOWN 8 // Number of Inventory Items Shown #define MAX_INV_COMMANDS 10 // Maximum elements in dialog -#define BUTTON_SIZE 15 // Button width/height // TODO: Refactor into FixedText #define S_INV6 "Foolscap" @@ -482,7 +481,7 @@ void WidgetInventory::handleEvents() { makeInfoArea(_menuSurface); // Draw the Verb commands and the lines separating them - ImageFile &images = *_interfaceImages; + ImageFile &images = *ui._interfaceImages; for (int idx = 0; idx < (int)_inventCommands.size(); ++idx) { _menuSurface.writeString(_inventCommands[idx], Common::Point((_menuBounds.width() - _menuSurface.stringWidth(_inventCommands[idx])) / 2, (_menuSurface.fontHeight() + 7) * idx + 5), INFO_TOP); |