aboutsummaryrefslogtreecommitdiff
path: root/engines/sherlock
diff options
context:
space:
mode:
Diffstat (limited to 'engines/sherlock')
-rw-r--r--engines/sherlock/tattoo/tattoo_talk.cpp2
-rw-r--r--engines/sherlock/tattoo/tattoo_user_interface.cpp38
-rw-r--r--engines/sherlock/tattoo/tattoo_user_interface.h3
-rw-r--r--engines/sherlock/tattoo/widget_base.cpp4
4 files changed, 23 insertions, 24 deletions
diff --git a/engines/sherlock/tattoo/tattoo_talk.cpp b/engines/sherlock/tattoo/tattoo_talk.cpp
index 8303fd42ad..dbeeaf8918 100644
--- a/engines/sherlock/tattoo/tattoo_talk.cpp
+++ b/engines/sherlock/tattoo/tattoo_talk.cpp
@@ -193,7 +193,7 @@ void TattooTalk::talkInterface(const byte *&str) {
}
// Display the text window
- ui.banishWindow();
+// ui.banishWindow();
ui._textWidget.load(Common::String((const char *)s, (const char *)str), _speaker);
ui._textWidget.summonWindow();
_wait = true;
diff --git a/engines/sherlock/tattoo/tattoo_user_interface.cpp b/engines/sherlock/tattoo/tattoo_user_interface.cpp
index 469badabc7..bffdb550cf 100644
--- a/engines/sherlock/tattoo/tattoo_user_interface.cpp
+++ b/engines/sherlock/tattoo/tattoo_user_interface.cpp
@@ -45,7 +45,6 @@ TattooUserInterface::TattooUserInterface(SherlockEngine *vm): UserInterface(vm),
_arrowZone = _oldArrowZone = -1;
_activeObj = -1;
_cAnimFramePause = 0;
- _widget = nullptr;
_scrollHighlight = SH_NONE;
_mask = _mask1 = nullptr;
_maskCounter = 0;
@@ -160,7 +159,6 @@ void TattooUserInterface::printObjectDesc(const Common::String &str, bool firstT
events.setCursor(MAGNIFY);
int savedSelector = _selector;
- freeMenu();
if (!_invLookFlag)
_windowOpen = false;
@@ -267,9 +265,9 @@ void TattooUserInterface::handleInput() {
if (!events.isCursorVisible())
_keyState.keycode = Common::KEYCODE_INVALID;
- // If there's an active widget/window, let it do event processing
- if (_widget)
- _widget->handleEvents();
+ // If there's any active widgets/windows, let the most recently open one do event processing
+ if (!_widgets.empty())
+ _widgets.back()->handleEvents();
// Handle input depending on what mode we're in
switch (_menuMode) {
@@ -294,9 +292,11 @@ void TattooUserInterface::drawInterface(int bufferNum) {
Screen &screen = *_vm->_screen;
TattooEngine &vm = *(TattooEngine *)_vm;
- if (_widget)
- _widget->draw();
+ // Draw any active on-screen widgets
+ for (Common::List<WidgetBase *>::iterator i = _widgets.begin(); i != _widgets.end(); ++i)
+ (*i)->draw();
+ // Handle drawing credits
if (vm._creditsActive)
vm.drawCredits();
@@ -316,9 +316,9 @@ void TattooUserInterface::doBgAnimRestoreUI() {
TattooScene &scene = *((TattooScene *)_vm->_scene);
Screen &screen = *_vm->_screen;
- // If there is any on-screen widget, then erase it
- if (_widget)
- _widget->erase();
+ // If there are any on-screen widgets, then erase them
+ for (Common::List<WidgetBase *>::iterator i = _widgets.begin(); i != _widgets.end(); ++i)
+ (*i)->erase();
// If there is a Text Tag being display, restore the area underneath it
_tooltipWidget.erase();
@@ -575,13 +575,6 @@ void TattooUserInterface::doQuitMenu() {
// TODO
}
-void TattooUserInterface::freeMenu() {
- if (_widget != nullptr) {
- _widget->banishWindow();
- _widget = nullptr;
- }
-}
-
void TattooUserInterface::putMessage(const char *formatStr, ...) {
// Create the string to display
va_list args;
@@ -844,9 +837,14 @@ void TattooUserInterface::drawDialogRect(Surface &s, const Common::Rect &r, bool
}
void TattooUserInterface::banishWindow(bool slideUp) {
- if (_widget != nullptr)
- _widget->banishWindow();
- _widget = nullptr;
+ if (!_widgets.empty())
+ _widgets.back()->banishWindow();
+}
+
+void TattooUserInterface::freeMenu() {
+ for (Common::List<WidgetBase *>::iterator i = _widgets.begin(); i != _widgets.end(); ++i)
+ (*i)->erase();
+ _widgets.clear();
}
void TattooUserInterface::clearWindow() {
diff --git a/engines/sherlock/tattoo/tattoo_user_interface.h b/engines/sherlock/tattoo/tattoo_user_interface.h
index 05d6741396..8dcfaddbd2 100644
--- a/engines/sherlock/tattoo/tattoo_user_interface.h
+++ b/engines/sherlock/tattoo/tattoo_user_interface.h
@@ -24,6 +24,7 @@
#define SHERLOCK_TATTOO_UI_H
#include "common/scummsys.h"
+#include "common/list.h"
#include "sherlock/saveload.h"
#include "sherlock/screen.h"
#include "sherlock/user_interface.h"
@@ -53,7 +54,7 @@ private:
WidgetSceneTooltip _tooltipWidget;
WidgetVerbs _verbsWidget;
WidgetMessage _messageWidget;
- WidgetBase *_widget;
+ Common::List<WidgetBase *> _widgets;
byte _lookupTable[PALETTE_COUNT];
byte _lookupTable1[PALETTE_COUNT];
private:
diff --git a/engines/sherlock/tattoo/widget_base.cpp b/engines/sherlock/tattoo/widget_base.cpp
index 4df25961e0..5f16e8800d 100644
--- a/engines/sherlock/tattoo/widget_base.cpp
+++ b/engines/sherlock/tattoo/widget_base.cpp
@@ -35,7 +35,7 @@ WidgetBase::WidgetBase(SherlockEngine *vm) : _vm(vm) {
void WidgetBase::summonWindow() {
TattooUserInterface &ui = *(TattooUserInterface *)_vm->_ui;
- ui._widget = this;
+ ui._widgets.push_back(this);
_outsideMenu = false;
draw();
@@ -46,7 +46,7 @@ void WidgetBase::banishWindow() {
erase();
_surface.free();
- ui._widget = nullptr;
+ ui._widgets.remove(this);
}
void WidgetBase::erase() {