aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/sherlock/tattoo/widget_base.cpp11
-rw-r--r--engines/sherlock/tattoo/widget_talk.cpp20
2 files changed, 4 insertions, 27 deletions
diff --git a/engines/sherlock/tattoo/widget_base.cpp b/engines/sherlock/tattoo/widget_base.cpp
index 9b8569c590..5d81c40cc5 100644
--- a/engines/sherlock/tattoo/widget_base.cpp
+++ b/engines/sherlock/tattoo/widget_base.cpp
@@ -218,7 +218,7 @@ void WidgetBase::drawScrollBar(int index, int pageSize, int count) {
_surface.fillRect(Common::Rect(r.right / 2 - 3, r.top + 1 + BUTTON_SIZE / 2,
r.right / 2 + 3, r.top + 1 + BUTTON_SIZE / 2), color);
- color = (index + NUM_INVENTORY_SHOWN) < count ? INFO_BOTTOM + 2 : INFO_BOTTOM;
+ color = (index + pageSize) < count ? INFO_BOTTOM + 2 : INFO_BOTTOM;
_surface.fillRect(Common::Rect(r.right / 2 - 3, r.bottom - 1 - BUTTON_SIZE + BUTTON_SIZE / 2,
r.right / 2 + 3, r.bottom - 1 - BUTTON_SIZE + BUTTON_SIZE / 2), color);
_surface.fillRect(Common::Rect(r.right / 2 - 2, r.bottom - 1 - BUTTON_SIZE + 1 + BUTTON_SIZE / 2,
@@ -229,15 +229,10 @@ void WidgetBase::drawScrollBar(int index, int pageSize, int count) {
r.right / 2, r.bottom - 1 - BUTTON_SIZE + 3 + BUTTON_SIZE / 2), color);
// Draw the scroll position bar
- int idx = count;
- if (idx % (NUM_INVENTORY_SHOWN / 2))
- idx = (idx + (NUM_INVENTORY_SHOWN / 2)) / (NUM_INVENTORY_SHOWN / 2) * (NUM_INVENTORY_SHOWN / 2);
- int barHeight = NUM_INVENTORY_SHOWN * (_bounds.height() - BUTTON_SIZE * 2) / idx;
+ int barHeight = (_bounds.height() - BUTTON_SIZE * 2) * pageSize / count;
barHeight = CLIP(barHeight, BUTTON_SIZE, _bounds.height() - BUTTON_SIZE * 2);
+ int barY = (r.height() - BUTTON_SIZE * 2 - barHeight) * index / pageSize + r.top + BUTTON_SIZE;
- int barY = (idx<= NUM_INVENTORY_SHOWN) ? r.top + BUTTON_SIZE :
- (r.height() - BUTTON_SIZE * 2 - barHeight) * FIXED_INT_MULTIPLIER / (idx- NUM_INVENTORY_SHOWN)
- * index / FIXED_INT_MULTIPLIER + r.top + BUTTON_SIZE;
_surface.fillRect(Common::Rect(r.left + 2, barY + 2, r.right - 2, barY + barHeight - 3), INFO_MIDDLE);
ui.drawDialogRect(_surface, Common::Rect(r.left, barY, r.right, barY + barHeight), true);
}
diff --git a/engines/sherlock/tattoo/widget_talk.cpp b/engines/sherlock/tattoo/widget_talk.cpp
index 8db44aa453..6e4ef19928 100644
--- a/engines/sherlock/tattoo/widget_talk.cpp
+++ b/engines/sherlock/tattoo/widget_talk.cpp
@@ -78,18 +78,10 @@ void WidgetTalk::getTalkWindowSize() {
// Set up the height to a constrained amount, and add extra width for the scrollbar
width += BUTTON_SIZE + 3;
height = (_surface.fontHeight() + 1) * 6 + 9;
- _scroll = false;
+ _scroll = true;
}
_bounds = Common::Rect(width, height);
-
- // Allocate a surface for the window
- _surface.create(_bounds.width(), _bounds.height());
- _surface.fill(TRANSPARENCY);
-
- // Form the background for the new window
- makeInfoArea();
- render(HL_CHANGED_HIGHLIGHTS);
}
void WidgetTalk::load() {
@@ -124,16 +116,6 @@ void WidgetTalk::load() {
// Form the background for the new window
makeInfoArea();
-
- // If a scrollbar is needed, draw it in
- if (_scroll) {
- int xp = _surface.w() - BUTTON_SIZE - 6;
- _surface.vLine(xp, 3, _surface.h() - 4, INFO_TOP);
- _surface.vLine(xp + 1, 3, _surface.h() - 4, INFO_MIDDLE);
- _surface.vLine(xp + 2, 3, _surface.h() - 4, INFO_BOTTOM);
- _surface.transBlitFrom(images[6], Common::Point(xp - 1, 1));
- _surface.transBlitFrom(images[7], Common::Point(xp - 1, _surface.h() - 4));
- }
}
void WidgetTalk::handleEvents() {