aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Gilbert2015-07-04 11:28:55 -0400
committerPaul Gilbert2015-07-04 11:28:55 -0400
commit9ca62e6f619fc45b6d305ed46eea439cf78855c9 (patch)
tree8bb7327818292b230183bb73f23792440ef95bdb
parent39544c1728524f3ebc729c8d90ca0f191078d3a4 (diff)
downloadscummvm-rg350-9ca62e6f619fc45b6d305ed46eea439cf78855c9.tar.gz
scummvm-rg350-9ca62e6f619fc45b6d305ed46eea439cf78855c9.tar.bz2
scummvm-rg350-9ca62e6f619fc45b6d305ed46eea439cf78855c9.zip
SHERLOCK: RT: Consolidate scroll position into the Screen class
-rw-r--r--engines/sherlock/screen.cpp19
-rw-r--r--engines/sherlock/screen.h14
-rw-r--r--engines/sherlock/surface.cpp2
-rw-r--r--engines/sherlock/surface.h2
-rw-r--r--engines/sherlock/tattoo/tattoo_map.cpp24
-rw-r--r--engines/sherlock/tattoo/tattoo_map.h7
-rw-r--r--engines/sherlock/tattoo/tattoo_scene.cpp12
-rw-r--r--engines/sherlock/tattoo/tattoo_user_interface.cpp76
-rw-r--r--engines/sherlock/tattoo/tattoo_user_interface.h2
-rw-r--r--engines/sherlock/tattoo/widget_base.cpp24
-rw-r--r--engines/sherlock/tattoo/widget_base.h5
-rw-r--r--engines/sherlock/tattoo/widget_tooltip.cpp13
-rw-r--r--engines/sherlock/tattoo/widget_tooltip.h5
-rw-r--r--engines/sherlock/tattoo/widget_verbs.cpp3
14 files changed, 70 insertions, 138 deletions
diff --git a/engines/sherlock/screen.cpp b/engines/sherlock/screen.cpp
index 404b3d5984..b16518cf95 100644
--- a/engines/sherlock/screen.cpp
+++ b/engines/sherlock/screen.cpp
@@ -359,18 +359,8 @@ void Screen::slamArea(int16 xp, int16 yp, int16 width, int16 height) {
void Screen::slamRect(const Common::Rect &r) {
if (r.width() && r.height() > 0) {
- Common::Rect tempRect = r;
- tempRect.clip(Common::Rect(0, 0, this->w(), this->h()));
-
- if (tempRect.isValidRect())
- blitFrom(*_backBuffer, Common::Point(tempRect.left, tempRect.top), tempRect);
- }
-}
-
-void Screen::slamRect(const Common::Rect &r, const Common::Point &currentScroll) {
- if (r.width() && r.height() > 0) {
Common::Rect srcRect = r, destRect = r;
- srcRect.translate(currentScroll.x, currentScroll.y);
+ srcRect.translate(_currentScroll.x, _currentScroll.y);
if (destRect.left < 0) {
srcRect.left += -destRect.left;
@@ -464,14 +454,13 @@ void Screen::flushImage(ImageFrame *frame, const Common::Point &pt, Common::Rect
newBounds = Common::Rect(newPos.x, newPos.y, newPos.x + newSize.x, newPos.y + newSize.y);
}
-void Screen::blockMove(const Common::Rect &r, const Common::Point &scrollPos) {
+void Screen::blockMove(const Common::Rect &r) {
Common::Rect bounds = r;
- bounds.translate(scrollPos.x, scrollPos.y);
slamRect(bounds);
}
-void Screen::blockMove(const Common::Point &scrollPos) {
- blockMove(Common::Rect(0, 0, w(), h()), scrollPos);
+void Screen::blockMove() {
+ blockMove(Common::Rect(0, 0, w(), h()));
}
void Screen::print(const Common::Point &pt, byte color, const char *formatStr, ...) {
diff --git a/engines/sherlock/screen.h b/engines/sherlock/screen.h
index 6146e4f177..2e0cef72ca 100644
--- a/engines/sherlock/screen.h
+++ b/engines/sherlock/screen.h
@@ -82,6 +82,7 @@ public:
byte _sMap[PALETTE_SIZE];
byte _tMap[PALETTE_SIZE];
bool _flushScreen;
+ Common::Point _currentScroll;
public:
static Screen *init(SherlockEngine *vm);
Screen(SherlockEngine *vm);
@@ -166,11 +167,6 @@ public:
void slamRect(const Common::Rect &r);
/**
- * Copies a given area to the screen
- */
- void slamRect(const Common::Rect &r, const Common::Point &currentScroll);
-
- /**
* Copy an image from the back buffer to the screen, taking care of both the
* new area covered by the shape as well as the old area, which must be restored
*/
@@ -190,14 +186,14 @@ public:
void flushImage(ImageFrame *frame, const Common::Point &pt, Common::Rect &newBounds, int scaleVal);
/**
- * Copies data from the back buffer to the screen, taking into account scrolling position
+ * Copies data from the back buffer to the screen
*/
- void blockMove(const Common::Rect &r, const Common::Point &scrollPos);
+ void blockMove(const Common::Rect &r);
/**
- * Copies the entire screen from the back buffer, taking into account scrolling position
+ * Copies the entire screen from the back buffer
*/
- void blockMove(const Common::Point &scorllPos);
+ void blockMove();
/**
* Fills an area on the back buffer, and then copies it to the screen
diff --git a/engines/sherlock/surface.cpp b/engines/sherlock/surface.cpp
index 276c83d14a..729b4e8c44 100644
--- a/engines/sherlock/surface.cpp
+++ b/engines/sherlock/surface.cpp
@@ -292,7 +292,7 @@ void Surface::writeFancyString(const Common::String &str, const Common::Point &p
writeString(str, Common::Point(pt.x + 1, pt.y + 1), overrideColor2);
}
-void Surface::maskArea(const ImageFrame &src, const Common::Point &pt, int scrollX) {
+void Surface::maskArea(const ImageFrame &src, const Common::Point &pt) {
// TODO
error("TODO: maskArea");
}
diff --git a/engines/sherlock/surface.h b/engines/sherlock/surface.h
index 80cf0ff287..38e3339617 100644
--- a/engines/sherlock/surface.h
+++ b/engines/sherlock/surface.h
@@ -142,7 +142,7 @@ public:
void fill(uint16 color);
- void maskArea(const ImageFrame &src, const Common::Point &pt, int scrollX);
+ void maskArea(const ImageFrame &src, const Common::Point &pt);
/**
* Clear the surface
diff --git a/engines/sherlock/tattoo/tattoo_map.cpp b/engines/sherlock/tattoo/tattoo_map.cpp
index bc7dafdbb2..943196815b 100644
--- a/engines/sherlock/tattoo/tattoo_map.cpp
+++ b/engines/sherlock/tattoo/tattoo_map.cpp
@@ -121,7 +121,7 @@ int TattooMap::show() {
// Set initial scroll position
_targetScroll = _bigPos;
- _currentScroll = Common::Point(-1, -1);
+ screen._currentScroll = Common::Point(-1, -1);
do {
// Allow for event processing and get the current mouse position
@@ -192,15 +192,14 @@ int TattooMap::show() {
}
// Handle any scrolling of the map
- if (_currentScroll != _targetScroll) {
+ if (screen._currentScroll != _targetScroll) {
// If there is a Text description being displayed, restore the area under it
_mapTooltip.erase();
- _currentScroll = _targetScroll;
+ screen._currentScroll = _targetScroll;
checkMapNames(false);
- slamRect(Common::Rect(_currentScroll.x, _currentScroll.y, _currentScroll.x + SHERLOCK_SCREEN_WIDTH,
- _currentScroll.y + SHERLOCK_SCREEN_HEIGHT));
+ screen.slamArea(0, 0, SHERLOCK_SCREEN_WIDTH, SHERLOCK_SCREEN_HEIGHT);
}
// Handling if a location has been clicked on
@@ -209,7 +208,7 @@ int TattooMap::show() {
_mapTooltip.erase();
// Save the current scroll position on the map
- _bigPos = _currentScroll;
+ _bigPos = screen._currentScroll;
showCloseUp(_bgFound);
result = _bgFound + 1;
@@ -306,7 +305,8 @@ void TattooMap::drawMapIcons() {
void TattooMap::checkMapNames(bool slamIt) {
Events &events = *_vm->_events;
- Common::Point mousePos = events.mousePos() + _currentScroll;
+ Screen &screen = *_vm->_screen;
+ Common::Point mapPos = events.mousePos() + screen._currentScroll;
// See if the mouse is pointing at any of the map locations
_bgFound = -1;
@@ -318,7 +318,7 @@ void TattooMap::checkMapNames(bool slamIt) {
Common::Rect r(mapEntry.x - img._width / 2, mapEntry.y - img._height / 2,
mapEntry.x + img._width / 2, mapEntry.y + img._height / 2);
- if (r.contains(mousePos)) {
+ if (r.contains(mapPos)) {
_bgFound = idx;
break;
}
@@ -419,14 +419,6 @@ void TattooMap::showCloseUp(int closeUpNum) {
events.wait(2);
}
-void TattooMap::slamRect(const Common::Rect &bounds) {
- Screen &screen = *_vm->_screen;
- Common::Rect r = bounds;
- r.translate(-_currentScroll.x, -_currentScroll.y);
-
- screen.blitFrom(screen._backBuffer1, Common::Point(r.left, r.top), bounds);
-}
-
} // End of namespace Tattoo
} // End of namespace Sherlock
diff --git a/engines/sherlock/tattoo/tattoo_map.h b/engines/sherlock/tattoo/tattoo_map.h
index 86db7b04d3..1c7173bdb0 100644
--- a/engines/sherlock/tattoo/tattoo_map.h
+++ b/engines/sherlock/tattoo/tattoo_map.h
@@ -76,13 +76,6 @@ private:
* This will load a specified close up and zoom it up to the middle of the screen
*/
void showCloseUp(int closeUpNum);
-
- /**
- * Copies an area of the map to the screen, taking into account scrolling
- */
- void slamRect(const Common::Rect &bounds);
-public:
- Common::Point _currentScroll;
public:
TattooMap(SherlockEngine *vm);
virtual ~TattooMap() {}
diff --git a/engines/sherlock/tattoo/tattoo_scene.cpp b/engines/sherlock/tattoo/tattoo_scene.cpp
index c8b769a76f..2d82b2f641 100644
--- a/engines/sherlock/tattoo/tattoo_scene.cpp
+++ b/engines/sherlock/tattoo/tattoo_scene.cpp
@@ -109,11 +109,10 @@ bool TattooScene::loadScene(const Common::String &filename) {
void TattooScene::drawAllShapes() {
TattooPeople &people = *(TattooPeople *)_vm->_people;
Screen &screen = *_vm->_screen;
- TattooUserInterface &ui = *(TattooUserInterface *)_vm->_ui;
ShapeList shapeList;
// Draw all objects and animations that are set to behind
- screen.setDisplayBounds(Common::Rect(ui._currentScroll.x, 0, ui._currentScroll.x + SHERLOCK_SCREEN_WIDTH, SHERLOCK_SCREEN_HEIGHT));
+ screen.setDisplayBounds(Common::Rect(0, 0, SHERLOCK_SCREEN_WIDTH, SHERLOCK_SCREEN_HEIGHT));
// Draw all active shapes which are behind the person
for (uint idx = 0; idx < _bgShapes.size(); ++idx) {
@@ -355,7 +354,7 @@ void TattooScene::doBgAnim() {
events.wait(3);
if (screen._flushScreen) {
- screen.slamRect(Common::Rect(0, 0, SHERLOCK_SCREEN_WIDTH, SHERLOCK_SCREEN_HEIGHT), ui._currentScroll);
+ screen.slamRect(Common::Rect(0, 0, SHERLOCK_SCREEN_WIDTH, SHERLOCK_SCREEN_HEIGHT));
screen._flushScreen = false;
}
@@ -468,7 +467,6 @@ void TattooScene::updateBackground() {
void TattooScene::doBgAnimDrawSprites() {
TattooPeople &people = *(TattooPeople *)_vm->_people;
Screen &screen = *_vm->_screen;
- TattooUserInterface &ui = *(TattooUserInterface *)_vm->_ui;
for (int idx = 0; idx < MAX_CHARACTERS; ++idx) {
TattooPerson &person = people[idx];
@@ -534,10 +532,8 @@ void TattooScene::doBgAnimDrawSprites() {
if (_activeCAnim._zPlacement != REMOVE) {
screen.flushImage(&_activeCAnim._imageFrame, _activeCAnim._position, _activeCAnim._oldBounds, _activeCAnim._scaleVal);
} else {
- screen.slamArea(_activeCAnim._removeBounds.left - ui._currentScroll.x, _activeCAnim._removeBounds.top,
- _activeCAnim._removeBounds.width(), _activeCAnim._removeBounds.height());
- _activeCAnim._removeBounds.left = _activeCAnim._removeBounds.top = 0;
- _activeCAnim._removeBounds.right = _activeCAnim._removeBounds.bottom = 0;
+ screen.slamRect(_activeCAnim._removeBounds);
+ _activeCAnim._removeBounds = Common::Rect(0, 0, 0, 0);
_activeCAnim._zPlacement = -1; // Reset _zPlacement so we don't REMOVE again
}
}
diff --git a/engines/sherlock/tattoo/tattoo_user_interface.cpp b/engines/sherlock/tattoo/tattoo_user_interface.cpp
index 190e69a686..832f707039 100644
--- a/engines/sherlock/tattoo/tattoo_user_interface.cpp
+++ b/engines/sherlock/tattoo/tattoo_user_interface.cpp
@@ -58,9 +58,10 @@ TattooUserInterface::~TattooUserInterface() {
}
void TattooUserInterface::initScrollVars() {
- _scrollSize = _vm->_screen->_backBuffer1.w() - SHERLOCK_SCREEN_WIDTH;
- _currentScroll.x = _currentScroll.y = 0;
- _targetScroll.x = _targetScroll.y = 0;
+ Screen &screen = *_vm->_screen;
+ _scrollSize = screen._backBuffer1.w() - SHERLOCK_SCREEN_WIDTH;
+ _targetScroll = Common::Point(0, 0);
+ screen._currentScroll = Common::Point(0, 0);
}
void TattooUserInterface::lookAtObject() {
@@ -229,7 +230,8 @@ void TattooUserInterface::handleInput() {
TattooEngine &vm = *(TattooEngine *)_vm;
Events &events = *_vm->_events;
TattooScene &scene = *(TattooScene *)_vm->_scene;
- Common::Point mousePos = events.mousePos() + _currentScroll;
+ Screen &screen = *_vm->_screen;
+ Common::Point mousePos = events.mousePos() + screen._currentScroll;
events.pollEventsAndWait();
_keyState.keycode = Common::KEYCODE_INVALID;
@@ -302,7 +304,7 @@ void TattooUserInterface::drawInterface(int bufferNum) {
screen._flushScreen = true;
if (screen._flushScreen)
- screen.blockMove(_currentScroll);
+ screen.blockMove();
// Handle drawing the text tooltip if necessary
_tooltipWidget.draw();
@@ -332,18 +334,18 @@ void TattooUserInterface::doScroll() {
Screen &screen = *_vm->_screen;
// If we're already at the target scroll position, nothing needs to be done
- if (_targetScroll.x == _currentScroll.x)
+ if (_targetScroll.x == screen._currentScroll.x)
return;
screen._flushScreen = true;
- if (_targetScroll.x > _currentScroll.x) {
- _currentScroll.x += _scrollSpeed;
- if (_currentScroll.x > _targetScroll.x)
- _currentScroll.x = _targetScroll.x;
- } else if (_targetScroll.x < _currentScroll.x) {
- _currentScroll.x -= _scrollSpeed;
- if (_currentScroll.x < _targetScroll.x)
- _currentScroll.x = _targetScroll.x;
+ if (_targetScroll.x > screen._currentScroll.x) {
+ screen._currentScroll.x += _scrollSpeed;
+ if (screen._currentScroll.x > _targetScroll.x)
+ screen._currentScroll.x = _targetScroll.x;
+ } else if (_targetScroll.x < screen._currentScroll.x) {
+ screen._currentScroll.x -= _scrollSpeed;
+ if (screen._currentScroll.x < _targetScroll.x)
+ screen._currentScroll.x = _targetScroll.x;
}
}
@@ -352,6 +354,7 @@ void TattooUserInterface::doStandardControl() {
Events &events = *_vm->_events;
People &people = *_vm->_people;
TattooScene &scene = *(TattooScene *)_vm->_scene;
+ Screen &screen = *_vm->_screen;
Talk &talk = *_vm->_talk;
Common::Point mousePos = events.mousePos();
bool noDesc = false;
@@ -472,7 +475,7 @@ void TattooUserInterface::doStandardControl() {
events._pressed = events._released = false;
} else {
// Walk to where the mouse was clicked
- people[HOLMES]._walkDest = Common::Point(mousePos.x + _currentScroll.x, mousePos.y);
+ people[HOLMES]._walkDest = mousePos + screen._currentScroll;
people[HOLMES].goAllTheWay();
}
}
@@ -529,13 +532,14 @@ void TattooUserInterface::doLabControl() {
void TattooUserInterface::displayObjectNames() {
Events &events = *_vm->_events;
Scene &scene = *_vm->_scene;
- Common::Point mousePos = events.mousePos() + _currentScroll;
+ Screen &screen = *_vm->_screen;
+ Common::Point scenePos = events.mousePos() + screen._currentScroll;
_arrowZone = -1;
if (_bgFound == -1 || scene._currentScene == 90) {
for (uint idx = 0; idx < scene._exits.size() && _arrowZone == -1; ++idx) {
Exit &exit = scene._exits[idx];
- if (exit.contains(mousePos))
+ if (exit.contains(scenePos))
_arrowZone = idx;
}
}
@@ -660,11 +664,7 @@ void TattooUserInterface::doBgAnimEraseBackground() {
static const int16 OFFSETS[16] = { -1, -2, -3, -3, -2, -1, -1, 0, 1, 2, 3, 3, 2, 1, 0, 0 };
if (_mask != nullptr) {
- if (screen._backBuffer1.w() > screen.w())
- screen.blitFrom(screen._backBuffer1, Common::Point(0, 0), Common::Rect(_currentScroll.x, 0,
- _currentScroll.x + screen.w(), screen.h()));
- else
- screen.blitFrom(screen._backBuffer1);
+ screen.slamArea(0, 0, SHERLOCK_SCREEN_WIDTH, SHERLOCK_SCREEN_HEIGHT);
switch (scene._currentScene) {
case 7:
@@ -737,7 +737,7 @@ void TattooUserInterface::doBgAnimEraseBackground() {
}
// Adjust the Target Scroll if needed
- if ((people[people._walkControl]._position.x / FIXED_INT_MULTIPLIER - _currentScroll.x) <
+ if ((people[people._walkControl]._position.x / FIXED_INT_MULTIPLIER - screen._currentScroll.x) <
(SHERLOCK_SCREEN_WIDTH / 8) && people[people._walkControl]._delta.x < 0) {
_targetScroll.x = (short)(people[people._walkControl]._position.x / FIXED_INT_MULTIPLIER -
@@ -746,8 +746,8 @@ void TattooUserInterface::doBgAnimEraseBackground() {
_targetScroll.x = 0;
}
- if ((people[people._walkControl]._position.x / FIXED_INT_MULTIPLIER - _currentScroll.x) > (SHERLOCK_SCREEN_WIDTH / 4 * 3)
- && people[people._walkControl]._delta.x > 0)
+ if ((people[people._walkControl]._position.x / FIXED_INT_MULTIPLIER - screen._currentScroll.x) >
+ (SHERLOCK_SCREEN_WIDTH / 4 * 3) && people[people._walkControl]._delta.x > 0)
_targetScroll.x = (short)(people[people._walkControl]._position.x / FIXED_INT_MULTIPLIER -
SHERLOCK_SCREEN_WIDTH / 4 * 3 + 250);
@@ -765,34 +765,34 @@ void TattooUserInterface::drawMaskArea(bool mode) {
if (_mask != nullptr) {
switch (scene._currentScene) {
case 7:
- screen._backBuffer1.maskArea((*_mask)[0], Common::Point(_maskOffset.x - SHERLOCK_SCREEN_WIDTH, 110), _currentScroll.x);
- screen._backBuffer1.maskArea((*_mask)[0], Common::Point(_maskOffset.x, 110), _currentScroll.x);
- screen._backBuffer1.maskArea((*_mask)[0], Common::Point(_maskOffset.x + SHERLOCK_SCREEN_WIDTH, 110), _currentScroll.x);
+ screen._backBuffer1.maskArea((*_mask)[0], Common::Point(_maskOffset.x - SHERLOCK_SCREEN_WIDTH, 110));
+ screen._backBuffer1.maskArea((*_mask)[0], Common::Point(_maskOffset.x, 110));
+ screen._backBuffer1.maskArea((*_mask)[0], Common::Point(_maskOffset.x + SHERLOCK_SCREEN_WIDTH, 110));
break;
case 8:
- screen._backBuffer1.maskArea((*_mask)[0], Common::Point(_maskOffset.x - SHERLOCK_SCREEN_WIDTH, 180), _currentScroll.x);
- screen._backBuffer1.maskArea((*_mask)[0], Common::Point(_maskOffset.x, 180), _currentScroll.x);
- screen._backBuffer1.maskArea((*_mask)[0], Common::Point(_maskOffset.x + SHERLOCK_SCREEN_WIDTH, 180), _currentScroll.x);
+ screen._backBuffer1.maskArea((*_mask)[0], Common::Point(_maskOffset.x - SHERLOCK_SCREEN_WIDTH, 180));
+ screen._backBuffer1.maskArea((*_mask)[0], Common::Point(_maskOffset.x, 180));
+ screen._backBuffer1.maskArea((*_mask)[0], Common::Point(_maskOffset.x + SHERLOCK_SCREEN_WIDTH, 180));
if (!_vm->readFlags(880))
- screen._backBuffer1.maskArea((*_mask1)[0], Common::Point(940, 300), _currentScroll.x);
+ screen._backBuffer1.maskArea((*_mask1)[0], Common::Point(940, 300));
break;
case 18:
- screen._backBuffer1.maskArea((*_mask)[0], Common::Point(xp, 203), _currentScroll.x);
+ screen._backBuffer1.maskArea((*_mask)[0], Common::Point(xp, 203));
if (!_vm->readFlags(189))
- screen._backBuffer1.maskArea((*_mask1)[0], Common::Point(124 + xp, 239), _currentScroll.x);
+ screen._backBuffer1.maskArea((*_mask1)[0], Common::Point(124 + xp, 239));
break;
case 53:
- screen._backBuffer1.maskArea((*_mask)[0], Common::Point(_maskOffset.x, 110), _currentScroll.x);
+ screen._backBuffer1.maskArea((*_mask)[0], Common::Point(_maskOffset.x, 110));
if (mode)
- screen._backBuffer1.maskArea((*_mask)[0], Common::Point(_maskOffset.x - SHERLOCK_SCREEN_WIDTH, 110), _currentScroll.x);
+ screen._backBuffer1.maskArea((*_mask)[0], Common::Point(_maskOffset.x - SHERLOCK_SCREEN_WIDTH, 110));
break;
case 68:
- screen._backBuffer1.maskArea((*_mask)[0], Common::Point(xp, 203), _currentScroll.x);
- screen._backBuffer1.maskArea((*_mask1)[0], Common::Point(124 + xp, 239), _currentScroll.x);
+ screen._backBuffer1.maskArea((*_mask)[0], Common::Point(xp, 203));
+ screen._backBuffer1.maskArea((*_mask1)[0], Common::Point(124 + xp, 239));
break;
}
}
diff --git a/engines/sherlock/tattoo/tattoo_user_interface.h b/engines/sherlock/tattoo/tattoo_user_interface.h
index 8027a203b4..76e72a0c24 100644
--- a/engines/sherlock/tattoo/tattoo_user_interface.h
+++ b/engines/sherlock/tattoo/tattoo_user_interface.h
@@ -103,7 +103,7 @@ private:
*/
void freeMenu();
public:
- Common::Point _currentScroll, _targetScroll;
+ Common::Point _targetScroll;
int _scrollSize, _scrollSpeed;
bool _drawMenu;
int _arrowZone, _oldArrowZone;
diff --git a/engines/sherlock/tattoo/widget_base.cpp b/engines/sherlock/tattoo/widget_base.cpp
index f958e42774..10b8ad8dec 100644
--- a/engines/sherlock/tattoo/widget_base.cpp
+++ b/engines/sherlock/tattoo/widget_base.cpp
@@ -51,16 +51,11 @@ void WidgetBase::banishWindow() {
void WidgetBase::erase() {
Screen &screen = *_vm->_screen;
- const Common::Point &currentScroll = getCurrentScroll();
if (_oldBounds.width() > 0) {
- // Get the bounds to copy from the back buffers, adjusted for scroll position
- Common::Rect oldBounds = _oldBounds;
- oldBounds.translate(currentScroll.x, currentScroll.y);
-
// Restore the affected area from the secondary back buffer into the first one, and then copy to screen
- screen._backBuffer1.blitFrom(screen._backBuffer2, Common::Point(oldBounds.left, oldBounds.top), oldBounds);
- screen.blitFrom(screen._backBuffer1, Common::Point(_oldBounds.left, _oldBounds.top), oldBounds);
+ screen._backBuffer1.blitFrom(screen._backBuffer2, Common::Point(_oldBounds.left, _oldBounds.top), _oldBounds);
+ screen.slamRect(_oldBounds);
// Reset the old bounds so it won't be erased again
_oldBounds = Common::Rect(0, 0, 0, 0);
@@ -69,7 +64,6 @@ void WidgetBase::erase() {
void WidgetBase::draw() {
Screen &screen = *_vm->_screen;
- const Common::Point &currentScroll = getCurrentScroll();
// If there was a previously drawn frame in a different position that hasn't yet been erased, then erase it
if (_oldBounds.width() > 0 && _oldBounds != _bounds)
@@ -78,16 +72,13 @@ void WidgetBase::draw() {
if (_bounds.width() > 0 && !_surface.empty()) {
// Get the area to draw, adjusted for scroll position
restrictToScreen();
- Common::Rect bounds = _bounds;
- bounds.translate(currentScroll.x, currentScroll.y);
-
// Draw the background for the widget
drawBackground();
// Draw the widget onto the back buffer and then slam it to the screen
- screen._backBuffer1.transBlitFrom(_surface, Common::Point(bounds.left, bounds.top));
- screen.blitFrom(screen._backBuffer1, Common::Point(_bounds.left, _bounds.top), bounds);
+ screen._backBuffer1.transBlitFrom(_surface, Common::Point(_bounds.left, _bounds.top));
+ screen.slamRect(_bounds);
// Store a copy of the drawn area for later erasing
_oldBounds = _bounds;
@@ -100,8 +91,6 @@ void WidgetBase::drawBackground() {
TattooUserInterface &ui = *(TattooUserInterface *)_vm->_ui;
Common::Rect bounds = _bounds;
- const Common::Point &currentScroll = getCurrentScroll();
- bounds.translate(currentScroll.x, currentScroll.y);
if (vm._transparentMenus) {
ui.makeBGArea(bounds);
@@ -197,11 +186,6 @@ void WidgetBase::makeInfoArea() {
makeInfoArea(_surface);
}
-const Common::Point &WidgetBase::getCurrentScroll() const {
- TattooUserInterface &ui = *(TattooUserInterface *)_vm->_ui;
- return ui._currentScroll;
-}
-
void WidgetBase::checkTabbingKeys(int numOptions) {
}
diff --git a/engines/sherlock/tattoo/widget_base.h b/engines/sherlock/tattoo/widget_base.h
index a6c11bdb64..e94dbdd742 100644
--- a/engines/sherlock/tattoo/widget_base.h
+++ b/engines/sherlock/tattoo/widget_base.h
@@ -75,11 +75,6 @@ protected:
void handleScrollbarEvents(int index, int pageSize, int count);
/**
- * Returns the current scroll position
- */
- virtual const Common::Point &getCurrentScroll() const;
-
- /**
* Handle drawing the background on the area the widget is going to cover
*/
virtual void drawBackground();
diff --git a/engines/sherlock/tattoo/widget_tooltip.cpp b/engines/sherlock/tattoo/widget_tooltip.cpp
index 5c4478d32b..80ac048874 100644
--- a/engines/sherlock/tattoo/widget_tooltip.cpp
+++ b/engines/sherlock/tattoo/widget_tooltip.cpp
@@ -33,7 +33,6 @@ namespace Tattoo {
void WidgetTooltipBase::draw() {
Screen &screen = *_vm->_screen;
- const Common::Point &currentScroll = getCurrentScroll();
// If there was a previously drawn frame in a different position that hasn't yet been erased, then erase it
if (_oldBounds.width() > 0 && _oldBounds != _bounds)
@@ -41,7 +40,7 @@ void WidgetTooltipBase::draw() {
if (_bounds.width() > 0 && !_surface.empty()) {
// Blit the affected area to the screen
- screen.slamRect(_bounds, currentScroll);
+ screen.slamRect(_bounds);
// Draw the widget directly onto the screen. Unlike other widgets, we don't draw to the back buffer,
// since nothing should be drawing on top of tooltips, so there's no need to store in the back buffer
@@ -54,11 +53,10 @@ void WidgetTooltipBase::draw() {
void WidgetTooltipBase::erase() {
Screen &screen = *_vm->_screen;
- const Common::Point &currentScroll = getCurrentScroll();
if (_oldBounds.width() > 0) {
// Restore the affected area from the back buffer to the screen
- screen.slamRect(_oldBounds, currentScroll);
+ screen.slamRect(_oldBounds);
// Reset the old bounds so it won't be erased again
_oldBounds = Common::Rect(0, 0, 0, 0);
@@ -214,13 +212,6 @@ void WidgetSceneTooltip::handleEvents() {
WidgetTooltip::handleEvents();
}
-/*----------------------------------------------------------------*/
-
-const Common::Point &WidgetMapTooltip::getCurrentScroll() const {
- TattooMap &map = *(TattooMap *)_vm->_map;
- return map._currentScroll;
-}
-
} // End of namespace Tattoo
} // End of namespace Sherlock
diff --git a/engines/sherlock/tattoo/widget_tooltip.h b/engines/sherlock/tattoo/widget_tooltip.h
index 38d3ad9efd..a7758d4863 100644
--- a/engines/sherlock/tattoo/widget_tooltip.h
+++ b/engines/sherlock/tattoo/widget_tooltip.h
@@ -76,11 +76,6 @@ public:
};
class WidgetMapTooltip : public WidgetTooltip {
-protected:
- /**
- * Returns the current scroll position
- */
- virtual const Common::Point &getCurrentScroll() const;
public:
WidgetMapTooltip(SherlockEngine *vm) : WidgetTooltip(vm) {}
};
diff --git a/engines/sherlock/tattoo/widget_verbs.cpp b/engines/sherlock/tattoo/widget_verbs.cpp
index 8da60bc622..fff984a3ff 100644
--- a/engines/sherlock/tattoo/widget_verbs.cpp
+++ b/engines/sherlock/tattoo/widget_verbs.cpp
@@ -153,10 +153,11 @@ void WidgetVerbs::handleEvents() {
FixedText &fixedText = *_vm->_fixedText;
People &people = *_vm->_people;
TattooScene &scene = *(TattooScene *)_vm->_scene;
+ Screen &screen = *_vm->_screen;
Talk &talk = *_vm->_talk;
TattooUserInterface &ui = *(TattooUserInterface *)_vm->_ui;
Common::Point mousePos = events.mousePos();
- Common::Point scenePos = mousePos + ui._currentScroll;
+ Common::Point scenePos = mousePos + screen._currentScroll;
bool noDesc = false;
Common::String strLook = fixedText.getText(kFixedText_Look);