From a5edfcc3f5e59a8bb68b6bcbc8d7b6ce72ec633a Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Fri, 24 Apr 2015 01:35:51 -0500 Subject: SHERLOCK: Fix restoring background as player icon moves on map --- engines/sherlock/map.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'engines/sherlock/map.cpp') diff --git a/engines/sherlock/map.cpp b/engines/sherlock/map.cpp index 6e9982eb62..c3a5ba7b17 100644 --- a/engines/sherlock/map.cpp +++ b/engines/sherlock/map.cpp @@ -286,7 +286,7 @@ void Map::setupSprites() { _shapes = new ImageFile("mapicon.vgs"); _iconShapes = new ImageFile("overicon.vgs"); - + _iconSave.create((*_shapes)[4]._width, (*_shapes)[4]._height); Person &p = people[AL]; p._description = " "; p._type = CHARACTER; @@ -317,6 +317,7 @@ void Map::freeSprites() { delete _mapCursors; delete _shapes; delete _iconShapes; + _iconSave.free(); } /** @@ -523,9 +524,11 @@ void Map::saveIcon(ImageFrame *src, const Common::Point &pt) { return; } - _iconSave.create(size.x, size.y); + assert(size.x <= _iconSave.w && size.y <= _iconSave.h); _iconSave.blitFrom(screen._backBuffer1, Common::Point(0, 0), Common::Rect(pos.x, pos.y, pos.x + size.x, pos.y + size.y)); + _savedPos = pos; + _savedSize = size; } /** @@ -536,7 +539,7 @@ void Map::restoreIcon() { if (_savedPos.x >= 0 && _savedPos.y >= 0 && _savedPos.x <= SHERLOCK_SCREEN_WIDTH && _savedPos.y < SHERLOCK_SCREEN_HEIGHT) - screen._backBuffer1.blitFrom(_iconSave, _savedPos); + screen._backBuffer1.blitFrom(_iconSave, _savedPos, Common::Rect(0, 0, _savedSize.x, _savedSize.y)); } /** -- cgit v1.2.3