aboutsummaryrefslogtreecommitdiff
path: root/engines/sherlock
diff options
context:
space:
mode:
authorPaul Gilbert2015-06-21 17:23:26 -0400
committerPaul Gilbert2015-06-21 17:23:26 -0400
commit5a5a225216111b9507595a2ccfd37c3a518aa3a4 (patch)
tree36cef2a6e4c7874454d0a02d7efe1667e1ed05a2 /engines/sherlock
parent0a8630ab46567e137358807208158d080be556e6 (diff)
downloadscummvm-rg350-5a5a225216111b9507595a2ccfd37c3a518aa3a4.tar.gz
scummvm-rg350-5a5a225216111b9507595a2ccfd37c3a518aa3a4.tar.bz2
scummvm-rg350-5a5a225216111b9507595a2ccfd37c3a518aa3a4.zip
SHERLOCK: RT: Implemented further journal draw methods
Diffstat (limited to 'engines/sherlock')
-rw-r--r--engines/sherlock/journal.cpp4
-rw-r--r--engines/sherlock/journal.h5
-rw-r--r--engines/sherlock/scalpel/scalpel_journal.cpp14
-rw-r--r--engines/sherlock/scalpel/scalpel_journal.h4
-rw-r--r--engines/sherlock/surface.cpp1
-rw-r--r--engines/sherlock/tattoo/tattoo_journal.cpp185
-rw-r--r--engines/sherlock/tattoo/tattoo_journal.h8
-rw-r--r--engines/sherlock/tattoo/tattoo_user_interface.cpp33
-rw-r--r--engines/sherlock/tattoo/tattoo_user_interface.h5
-rw-r--r--engines/sherlock/tattoo/widget_inventory.cpp40
-rw-r--r--engines/sherlock/tattoo/widget_inventory.h5
11 files changed, 236 insertions, 68 deletions
diff --git a/engines/sherlock/journal.cpp b/engines/sherlock/journal.cpp
index 665f0e59c5..acc99e462d 100644
--- a/engines/sherlock/journal.cpp
+++ b/engines/sherlock/journal.cpp
@@ -76,7 +76,7 @@ bool Journal::drawJournal(int direction, int howFar) {
if (endJournal) {
// If moving forward or backwards, clear the page before printing
if (direction)
- drawJournalFrame();
+ drawFrame();
screen.gPrint(Common::Point(235, 21), PEN_COLOR, "Page %d", _page);
return false;
@@ -193,7 +193,7 @@ bool Journal::drawJournal(int direction, int howFar) {
if (direction) {
events.setCursor(ARROW);
- drawJournalFrame();
+ drawFrame();
}
Common::String fixedText_Page = fixedText.getText(kFixedText_Journal_Page);
diff --git a/engines/sherlock/journal.h b/engines/sherlock/journal.h
index 18bc54173f..93fdf25098 100644
--- a/engines/sherlock/journal.h
+++ b/engines/sherlock/journal.h
@@ -47,8 +47,6 @@ struct JournalEntry {
};
class Journal {
-private:
-
protected:
SherlockEngine *_vm;
Common::StringArray _directory;
@@ -62,7 +60,6 @@ protected:
int _sub;
Common::String _find;
-
Journal(SherlockEngine *vm);
/**
@@ -84,7 +81,7 @@ public:
/**
* Draw the journal background, frame, and interface buttons
*/
- virtual void drawJournalFrame() = 0;
+ virtual void drawFrame() = 0;
/**
* Records statements that are said, in the order which they are said. The player
diff --git a/engines/sherlock/scalpel/scalpel_journal.cpp b/engines/sherlock/scalpel/scalpel_journal.cpp
index fc517dcd72..12ebe6f0f2 100644
--- a/engines/sherlock/scalpel/scalpel_journal.cpp
+++ b/engines/sherlock/scalpel/scalpel_journal.cpp
@@ -66,7 +66,7 @@ ScalpelJournal::ScalpelJournal(SherlockEngine *vm) : Journal(vm) {
if (_vm->_interactiveFl) {
// Load the journal directory and location names
- loadJournalLocations();
+ loadLocations();
}
}
@@ -100,7 +100,7 @@ void ScalpelJournal::record(int converseNum, int statementNum, bool replyOnly) {
}
}
-void ScalpelJournal::loadJournalLocations() {
+void ScalpelJournal::loadLocations() {
Resources &res = *_vm->_res;
_directory.clear();
@@ -144,7 +144,7 @@ void ScalpelJournal::loadJournalLocations() {
delete loc;
}
-void ScalpelJournal::drawJournalFrame() {
+void ScalpelJournal::drawFrame() {
FixedText &fixedText = *_vm->_fixedText;
Resources &res = *_vm->_res;
Screen &screen = *_vm->_screen;
@@ -213,7 +213,7 @@ void ScalpelJournal::drawJournalFrame() {
void ScalpelJournal::drawInterface() {
Screen &screen = *_vm->_screen;
- drawJournalFrame();
+ drawFrame();
if (_journal.empty()) {
_up = _down = 0;
@@ -437,7 +437,7 @@ bool ScalpelJournal::handleEvents(int key) {
_sub = savedSub;
_page = savedPage;
- drawJournalFrame();
+ drawFrame();
drawJournal(0, 0);
notFound = true;
} else {
@@ -458,7 +458,7 @@ bool ScalpelJournal::handleEvents(int key) {
_up = _down = false;
_page = 1;
- drawJournalFrame();
+ drawFrame();
drawJournal(0, 0);
doArrows();
screen.slamArea(0, 0, SHERLOCK_SCREEN_WIDTH, SHERLOCK_SCREEN_HEIGHT);
@@ -647,7 +647,7 @@ int ScalpelJournal::getSearchString(bool printError) {
}
// Redisplay the journal screen
- drawJournalFrame();
+ drawFrame();
drawJournal(0, 0);
screen.slamArea(0, 0, SHERLOCK_SCREEN_WIDTH, SHERLOCK_SCREEN_HEIGHT);
diff --git a/engines/sherlock/scalpel/scalpel_journal.h b/engines/sherlock/scalpel/scalpel_journal.h
index fdf92819e7..9790461dbe 100644
--- a/engines/sherlock/scalpel/scalpel_journal.h
+++ b/engines/sherlock/scalpel/scalpel_journal.h
@@ -48,7 +48,7 @@ private:
/**
* Load the list of journal locations
*/
- void loadJournalLocations();
+ void loadLocations();
/**
* Display the arrows that can be used to scroll up and down pages
@@ -81,7 +81,7 @@ public:
/**
* Draw the journal background, frame, and interface buttons
*/
- virtual void drawJournalFrame();
+ virtual void drawFrame();
/**
* Records statements that are said, in the order which they are said. The player
diff --git a/engines/sherlock/surface.cpp b/engines/sherlock/surface.cpp
index 60790df6b2..276c83d14a 100644
--- a/engines/sherlock/surface.cpp
+++ b/engines/sherlock/surface.cpp
@@ -297,5 +297,4 @@ void Surface::maskArea(const ImageFrame &src, const Common::Point &pt, int scrol
error("TODO: maskArea");
}
-
} // End of namespace Sherlock
diff --git a/engines/sherlock/tattoo/tattoo_journal.cpp b/engines/sherlock/tattoo/tattoo_journal.cpp
index c4e0723f8a..c5779ced59 100644
--- a/engines/sherlock/tattoo/tattoo_journal.cpp
+++ b/engines/sherlock/tattoo/tattoo_journal.cpp
@@ -31,10 +31,14 @@ namespace Tattoo {
#define JOURNAL_BAR_WIDTH 450
+static const char *const JOURNAL_COMMANDS[2] = { "Close Journal", "Search Journal" };
+
+static const char *const JOURNAL_SEARCH_COMMANDS[3] = { "Abort Search", "Search Backwards", "Search Forwards" };
+
TattooJournal::TattooJournal(SherlockEngine *vm) : Journal(vm) {
_journalImages = nullptr;
- loadJournalLocations();
+ loadLocations();
}
void TattooJournal::show() {
@@ -69,7 +73,7 @@ void TattooJournal::show() {
delete _journalImages;
}
-void TattooJournal::loadJournalLocations() {
+void TattooJournal::loadLocations() {
Resources &res = *_vm->_res;
_directory.clear();
@@ -133,11 +137,11 @@ void TattooJournal::loadJournalLocations() {
delete loc;
}
-void TattooJournal::drawJournalFrame() {
+void TattooJournal::drawFrame() {
Screen &screen = *_vm->_screen;
screen._backBuffer1.blitFrom((*_journalImages)[0], Common::Point(0, 0));
- drawJournalControls(0);
+ drawControls(0);
}
@@ -145,7 +149,7 @@ void TattooJournal::synchronize(Serializer &s) {
// TODO
}
-void TattooJournal::drawJournalControls(int mode) {
+void TattooJournal::drawControls(int mode) {
TattooEngine &vm = *(TattooEngine *)_vm;
Screen &screen = *_vm->_screen;
TattooUserInterface &ui = *(TattooUserInterface *)_vm->_ui;
@@ -232,11 +236,178 @@ void TattooJournal::drawJournalControls(int mode) {
}
void TattooJournal::highlightJournalControls(bool slamIt) {
- // TODO
+ Events &events = *_vm->_events;
+ Screen &screen = *_vm->_screen;
+ Common::Point mousePos = events.mousePos();
+ Common::Rect r(JOURNAL_BAR_WIDTH, BUTTON_SIZE + screen.fontHeight() + 13);
+ r.moveTo((SHERLOCK_SCREEN_WIDTH - r.width()) / 2, SHERLOCK_SCREEN_HEIGHT - r.height());
+
+ // Calculate the Scroll Position Bar
+ int numPages = (_maxPage + LINES_PER_PAGE) / LINES_PER_PAGE;
+ int barWidth = (r.width() - BUTTON_SIZE * 2 - 6) / numPages;
+ barWidth = CLIP(barWidth, BUTTON_SIZE, r.width() - BUTTON_SIZE * 2 - 6);
+
+ int barX = (numPages <= 1) ? r.left + 3 + BUTTON_SIZE : (r.width() - BUTTON_SIZE * 2 - 6 - barWidth)
+ * FIXED_INT_MULTIPLIER / (numPages - 1) * (_page - 1) / FIXED_INT_MULTIPLIER + r.left + 3 + BUTTON_SIZE;
+
+ // See if the mouse is over any of the Journal Controls
+ Common::Rect bounds(r.left, r.top, r.right - 3, r.top + screen.fontHeight() + 7);
+ _selector = -1;
+ if (bounds.contains(mousePos))
+ _selector = (mousePos.x - r.left) / (r.width() / 3);
+
+ else if (events._pressed) {
+ if (Common::Rect(r.left, r.top + screen.fontHeight() + 10, r.left + BUTTON_SIZE, r.top +
+ screen.fontHeight() + 10 + BUTTON_SIZE).contains(mousePos))
+ // Press on the Scroll Left button
+ _selector = 3;
+ else if (Common::Rect(r.left + BUTTON_SIZE + 3, r.top + screen.fontHeight() + 10,
+ r.left + BUTTON_SIZE + 3 + (barX - r.left - BUTTON_SIZE - 3), r.top + screen.fontHeight() +
+ 10 + BUTTON_SIZE).contains(mousePos))
+ // Press on the Page Left button
+ _selector = 4;
+ else if (Common::Rect(barX + barWidth, r.top + screen.fontHeight() + 10,
+ barX + barWidth + (r.right - BUTTON_SIZE - 3 - barX - barWidth),
+ r.top + screen.fontHeight() + 10 + BUTTON_SIZE).contains(mousePos))
+ // Press on the Page Right button
+ _selector = 5;
+ else if (Common::Rect(r.right - BUTTON_SIZE - 3, r.top + screen.fontHeight() + 10, r.right - 3,
+ r.top + screen.fontHeight() + 10 + BUTTON_SIZE).contains(mousePos))
+ // Press of the Scroll Right button
+ _selector = 6;
+ }
+
+ // See if the Search was selected, but is not available
+ if (_journal.empty() && (_selector == 1 || _selector == 2))
+ _selector = -1;
+
+ if (_selector == 4 && _oldSelector == 5)
+ _selector = 5;
+ else if (_selector == 5 && _oldSelector == 4)
+ _selector = 4;
+
+ // See if they're pointing at a different control
+ if (_selector != _oldSelector) {
+ // Print the Journal commands
+ int xp = r.left + r.width() / 6;
+ byte color = (_selector == 0) ? COMMAND_HIGHLIGHTED : INFO_TOP;
+
+ screen.gPrint(Common::Point(xp - screen.stringWidth(JOURNAL_COMMANDS[0]) / 2, r.top),
+ color, "%s", JOURNAL_COMMANDS[0]);
+ xp += r.width() / 3;
+
+ if (!_journal.empty())
+ color = (_selector == 1) ? COMMAND_HIGHLIGHTED : INFO_TOP;
+ else
+ color = INFO_BOTTOM;
+ screen.gPrint(Common::Point(xp - screen.stringWidth(JOURNAL_COMMANDS[0]) / 2, r.top + 5),
+ color, "%s", JOURNAL_COMMANDS[1]);
+
+ drawScrollBar();
+
+ if (slamIt)
+ screen.slamRect(r);
+
+ _oldSelector = _selector;
+ }
}
void TattooJournal::highlightSearchControls(bool slamIt) {
- // TODO
+ Events &events = *_vm->_events;
+ Screen &screen = *_vm->_screen;
+ Common::Point mousePos = events.mousePos();
+ Common::Rect r(JOURNAL_BAR_WIDTH, (screen.fontHeight() + 4) * 2 + 9);
+ r.moveTo((SHERLOCK_SCREEN_WIDTH - r.width()) / 2, (SHERLOCK_SCREEN_HEIGHT - r.height()) / 2);
+
+ // See if the mouse is over any of the Journal Controls
+ _selector = -1;
+ if (Common::Rect(r.left + 3, r.top + 3, r.right - 3, r.top + 7 + screen.fontHeight()).contains(mousePos))
+ _selector = (mousePos.x - r.left) / (r.width() / 3);
+
+ // See if they're pointing at a different control
+ if (_selector != _oldSelector) {
+ // Print the search commands
+ int xp = r.left + r.width() / 6;
+
+ for (int idx = 0; idx < 3; ++idx) {
+ byte color = (_selector == idx) ? COMMAND_HIGHLIGHTED : INFO_TOP;
+ screen.gPrint(Common::Point(xp - screen.stringWidth(JOURNAL_SEARCH_COMMANDS[idx]) / 2,
+ r.top + 5), color, "%s", JOURNAL_SEARCH_COMMANDS[idx]);
+ xp += r.width() / 3;
+ }
+
+ if (slamIt)
+ screen.slamRect(r);
+
+ _oldSelector = _selector;
+ }
+}
+
+void TattooJournal::drawScrollBar() {
+ Events &events = *_vm->_events;
+ Screen &screen = *_vm->_screen;
+ TattooUserInterface &ui = *(TattooUserInterface *)_vm->_ui;
+ Common::Point mousePos = events.mousePos();
+ bool raised;
+ byte color;
+
+ Common::Rect r(JOURNAL_BAR_WIDTH, BUTTON_SIZE + screen.fontHeight() + 13);
+ r.moveTo((SHERLOCK_SCREEN_WIDTH - r.width()) / 2, SHERLOCK_SCREEN_HEIGHT - r.height());
+
+ // Calculate the Scroll Position Bar
+ int numPages = (_maxPage + LINES_PER_PAGE) / LINES_PER_PAGE;
+ int barWidth = (r.width() - BUTTON_SIZE * 2 - 6) / numPages;
+ barWidth = CLIP(barWidth, BUTTON_SIZE, r.width() - BUTTON_SIZE * 2 - 6);
+ int barX;
+ if (numPages <= 1) {
+ barX = r.left + 3 + BUTTON_SIZE;
+ } else {
+ barX = (r.width() - BUTTON_SIZE * 2 - 6 - barWidth) * FIXED_INT_MULTIPLIER / (numPages - 1) *
+ (_page - 1) / FIXED_INT_MULTIPLIER + r.left + 3 + BUTTON_SIZE;
+ if (barX + BUTTON_SIZE > r.left + r.width() - BUTTON_SIZE - 3)
+ barX = r.right - BUTTON_SIZE * 2 - 3;
+ }
+
+ // Draw the scroll bar here
+ // Draw the Scroll Left button
+ raised = _selector != 3;
+ screen._backBuffer1.fillRect(Common::Rect(r.left, r.top + screen.fontHeight() + 12, r.left + BUTTON_SIZE,
+ r.top + screen.fontHeight() + BUTTON_SIZE + 9), INFO_MIDDLE);
+ ui.drawDialogRect(screen._backBuffer1, Common::Rect(r.left + 3, r.top + screen.fontHeight() + 10, r.left + 3 + BUTTON_SIZE,
+ r.top + screen.fontHeight() + 10 + BUTTON_SIZE), raised);
+
+ color = (_page > 1) ? INFO_BOTTOM + 2 : INFO_BOTTOM;
+ screen._backBuffer1.vLine(r.left + 1 + BUTTON_SIZE / 2, r.top + screen.fontHeight() + 10 + BUTTON_SIZE / 2,
+ r.top + screen.fontHeight() + 10 + BUTTON_SIZE / 2, color);
+ screen._backBuffer1.vLine(r.left + 2 + BUTTON_SIZE / 2, r.top + screen.fontHeight() + 9 + BUTTON_SIZE / 2,
+ r.top + screen.fontHeight() + 11 + BUTTON_SIZE / 2, color);
+ screen._backBuffer1.vLine(r.left + 3 + BUTTON_SIZE / 2, r.top + screen.fontHeight() + 8 + BUTTON_SIZE / 2,
+ r.top + screen.fontHeight() + 12 + BUTTON_SIZE / 2, color);
+ screen._backBuffer1.vLine(r.left + 4 + BUTTON_SIZE / 2, r.top + screen.fontHeight() + 7 + BUTTON_SIZE / 2,
+ r.top + screen.fontHeight() + 13 + BUTTON_SIZE / 2, color);
+
+ // Draw the Scroll Right button
+ raised = _selector != 6;
+ screen._backBuffer1.fillRect(Common::Rect(r.right - BUTTON_SIZE - 1, r.top + screen.fontHeight() + 12,
+ r.right - 5, r.top + screen.fontHeight() + BUTTON_SIZE + 9), INFO_MIDDLE);
+ ui.drawDialogRect(screen._backBuffer1, Common::Rect(r.right - BUTTON_SIZE - 3, r.top + screen.fontHeight() + 10, r.right - 3,
+ r.top + screen.fontHeight() + BUTTON_SIZE + 9), raised);
+
+ color = _down ? INFO_BOTTOM + 2 : INFO_BOTTOM;
+ screen._backBuffer1.vLine(r.right - 1 - BUTTON_SIZE + BUTTON_SIZE / 2, r.top + screen.fontHeight() + 10 + BUTTON_SIZE / 2,
+ r.top + screen.fontHeight() + 10 + BUTTON_SIZE / 2, color);
+ screen._backBuffer1.vLine(r.right - 2 - BUTTON_SIZE + BUTTON_SIZE / 2, r.top + screen.fontHeight() + 9 + BUTTON_SIZE / 2,
+ r.top + screen.fontHeight() + 11 + BUTTON_SIZE / 2, color);
+ screen._backBuffer1.vLine(r.right - 3 - BUTTON_SIZE + BUTTON_SIZE / 2, r.top + screen.fontHeight() + 8 + BUTTON_SIZE / 2,
+ r.top + screen.fontHeight() + 12 + BUTTON_SIZE / 2, color);
+ screen._backBuffer1.vLine(r.right - 4 - BUTTON_SIZE + BUTTON_SIZE / 2, r.top + screen.fontHeight() + 7 + BUTTON_SIZE / 2,
+ r.top + screen.fontHeight() + 13 + BUTTON_SIZE / 2, color);
+
+ // Draw the scroll bar
+ screen._backBuffer1.fillRect(Common::Rect(barX + 2, r.top + screen.fontHeight() + 12, barX + barWidth - 3,
+ r.top + screen.fontHeight() + BUTTON_SIZE + 9), INFO_MIDDLE);
+ ui.drawDialogRect(screen._backBuffer1, Common::Rect(barX, r.top + screen.fontHeight() + 10, barX + barWidth,
+ r.top + screen.fontHeight() + 10 + BUTTON_SIZE), true);
}
} // End of namespace Tattoo
diff --git a/engines/sherlock/tattoo/tattoo_journal.h b/engines/sherlock/tattoo/tattoo_journal.h
index 1eacde4056..f9ed7afa2b 100644
--- a/engines/sherlock/tattoo/tattoo_journal.h
+++ b/engines/sherlock/tattoo/tattoo_journal.h
@@ -38,13 +38,13 @@ private:
/**
* Load the list of journal locations
*/
- void loadJournalLocations();
+ void loadLocations();
/**
* Displays the controls used by the journal
* @param mode 0: Normal journal buttons, 1: Search interface
*/
- void drawJournalControls(int mode);
+ void drawControls(int mode);
/**
* Draw the journal controls used by the journal
@@ -55,6 +55,8 @@ private:
* Draw the journal controls used in search mode
*/
void highlightSearchControls(bool slamIt);
+
+ void drawScrollBar();
public:
TattooJournal(SherlockEngine *vm);
virtual ~TattooJournal() {}
@@ -67,7 +69,7 @@ public:
/**
* Draw the journal background, frame, and interface buttons
*/
- virtual void drawJournalFrame();
+ virtual void drawFrame();
/**
* Synchronize the data for a savegame
diff --git a/engines/sherlock/tattoo/tattoo_user_interface.cpp b/engines/sherlock/tattoo/tattoo_user_interface.cpp
index 234b6a5c13..696e38f5c6 100644
--- a/engines/sherlock/tattoo/tattoo_user_interface.cpp
+++ b/engines/sherlock/tattoo/tattoo_user_interface.cpp
@@ -880,6 +880,39 @@ void TattooUserInterface::makeBGArea(const Common::Rect &r) {
}
}
+void TattooUserInterface::drawDialogRect(Surface &s, const Common::Rect &r, bool raised) {
+ switch (raised) {
+ case true:
+ // Draw Left
+ s.vLine(r.left, r.top, r.bottom - 1, INFO_TOP);
+ s.vLine(r.left + 1, r.top, r.bottom - 2, INFO_TOP);
+ // Draw Top
+ s.hLine(r.left + 2, r.top, r.right - 1, INFO_TOP);
+ s.hLine(r.left + 2, r.top + 1, r.right - 2, INFO_TOP);
+ // Draw Right
+ s.vLine(r.right - 1, r.top + 1, r.bottom - 1, INFO_BOTTOM);
+ s.vLine(r.right - 2, r.top + 2, r.bottom - 1, INFO_BOTTOM);
+ // Draw Bottom
+ s.hLine(r.left + 1, r.bottom - 1, r.right - 3, INFO_BOTTOM);
+ s.hLine(r.left + 2, r.bottom - 2, r.right - 3, INFO_BOTTOM);
+ break;
+
+ case false:
+ // Draw Left
+ s.vLine(r.left, r.top, r.bottom - 1, INFO_BOTTOM);
+ s.vLine(r.left + 1, r.top, r.bottom - 2, INFO_BOTTOM);
+ // Draw Top
+ s.hLine(r.left + 2, r.top, r.right - 1, INFO_BOTTOM);
+ s.hLine(r.left + 2, r.top + 1, r.right - 2, INFO_BOTTOM);
+ // Draw Right
+ s.vLine(r.right - 1, r.top + 1, r.bottom - 1, INFO_TOP);
+ s.vLine(r.right - 2, r.top + 2, r.bottom - 1, INFO_TOP);
+ // Draw Bottom
+ s.hLine(r.left + 1, r.bottom - 1, r.right - 3, INFO_TOP);
+ s.hLine(r.left + 2, r.bottom - 2, r.right - 3, INFO_TOP);
+ break;
+ }
+}
} // End of namespace Tattoo
diff --git a/engines/sherlock/tattoo/tattoo_user_interface.h b/engines/sherlock/tattoo/tattoo_user_interface.h
index 9adc9ccc8f..2ff046bef7 100644
--- a/engines/sherlock/tattoo/tattoo_user_interface.h
+++ b/engines/sherlock/tattoo/tattoo_user_interface.h
@@ -216,6 +216,11 @@ public:
* Translate a given area of the back buffer to greyscale shading
*/
void makeBGArea(const Common::Rect &r);
+
+ /**
+ * Draws all the dialog rectangles for any items that need them
+ */
+ void drawDialogRect(Surface &s, const Common::Rect &r, bool raised);
public:
/**
* Resets the user interface
diff --git a/engines/sherlock/tattoo/widget_inventory.cpp b/engines/sherlock/tattoo/widget_inventory.cpp
index 931c6464d8..ac30fe3c9c 100644
--- a/engines/sherlock/tattoo/widget_inventory.cpp
+++ b/engines/sherlock/tattoo/widget_inventory.cpp
@@ -125,11 +125,11 @@ void WidgetInventory::drawScrollBar() {
raised = ui._scrollHighlight != 1;
_surface.fillRect(Common::Rect(r.left + 2, r.top + 2, r.right - 2, r.top + BUTTON_SIZE - 2), INFO_MIDDLE);
- drawDialogRect(Common::Rect(r.left, r.top, r.left + BUTTON_SIZE, r.top + BUTTON_SIZE), raised);
+ ui.drawDialogRect(_surface, Common::Rect(r.left, r.top, r.left + BUTTON_SIZE, r.top + BUTTON_SIZE), raised);
raised = ui._scrollHighlight != 5;
_surface.fillRect(Common::Rect(r.left + 2, r.bottom - BUTTON_SIZE + 2, r.right - 2, r.bottom - 2), INFO_MIDDLE);
- drawDialogRect(Common::Rect(r.left, r.bottom - BUTTON_SIZE, r.right, r.bottom), raised);
+ ui.drawDialogRect(_surface, Common::Rect(r.left, r.bottom - BUTTON_SIZE, r.right, r.bottom), raised);
// Draw the arrows on the scroll buttons
byte color = inv._invIndex? INFO_BOTTOM + 2 : INFO_BOTTOM;
@@ -162,41 +162,7 @@ void WidgetInventory::drawScrollBar() {
(r.height() - BUTTON_SIZE * 2 - barHeight) * FIXED_INT_MULTIPLIER / (idx- NUM_INVENTORY_SHOWN)
* inv._invIndex / FIXED_INT_MULTIPLIER + r.top + BUTTON_SIZE;
_surface.fillRect(Common::Rect(r.left + 2, barY + 2, r.right - 2, barY + barHeight - 3), INFO_MIDDLE);
- drawDialogRect(Common::Rect(r.left, barY, r.right, barY + barHeight), true);
-}
-
-void WidgetInventory::drawDialogRect(const Common::Rect &r, bool raised) {
- switch (raised) {
- case true:
- // Draw Left
- _surface.vLine(r.left, r.top, r.bottom - 1, INFO_TOP);
- _surface.vLine(r.left + 1, r.top, r.bottom - 2, INFO_TOP);
- // Draw Top
- _surface.hLine(r.left + 2, r.top, r.right - 1, INFO_TOP);
- _surface.hLine(r.left + 2, r.top + 1, r.right - 2, INFO_TOP);
- // Draw Right
- _surface.vLine(r.right - 1, r.top + 1,r.bottom - 1, INFO_BOTTOM);
- _surface.vLine(r.right - 2, r.top + 2, r.bottom - 1, INFO_BOTTOM);
- // Draw Bottom
- _surface.hLine(r.left + 1, r.bottom - 1, r.right - 3, INFO_BOTTOM);
- _surface.hLine(r.left + 2, r.bottom - 2, r.right - 3, INFO_BOTTOM);
- break;
-
- case false:
- // Draw Left
- _surface.vLine(r.left, r.top, r.bottom - 1, INFO_BOTTOM);
- _surface.vLine(r.left + 1, r.top, r.bottom - 2, INFO_BOTTOM);
- // Draw Top
- _surface.hLine(r.left + 2, r.top, r.right - 1, INFO_BOTTOM);
- _surface.hLine(r.left + 2, r.top + 1, r.right - 2, INFO_BOTTOM);
- // Draw Right
- _surface.vLine(r.right - 1, r.top + 1, r.bottom - 1, INFO_TOP);
- _surface.vLine(r.right - 2, r.top + 2, r.bottom - 1, INFO_TOP);
- // Draw Bottom
- _surface.hLine(r.left + 1, r.bottom - 1, r.right - 3, INFO_TOP);
- _surface.hLine(r.left + 2, r.bottom - 2, r.right - 3, INFO_TOP);
- break;
- }
+ ui.drawDialogRect(_surface, Common::Rect(r.left, barY, r.right, barY + barHeight), true);
}
void WidgetInventory::handleEvents() {
diff --git a/engines/sherlock/tattoo/widget_inventory.h b/engines/sherlock/tattoo/widget_inventory.h
index 29bcdaa0ea..b3e914caf7 100644
--- a/engines/sherlock/tattoo/widget_inventory.h
+++ b/engines/sherlock/tattoo/widget_inventory.h
@@ -58,11 +58,6 @@ private:
void drawScrollBar();
/**
- * Draws all the dialog rectangles for any items that need them
- */
- void drawDialogRect(const Common::Rect &r, bool raised);
-
- /**
* Displays the description of any inventory item the moues cursor is over
*/
void updateDescription();