From 86a33cf4280aec06a160716ead325342d17a9839 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 26 Jul 2015 12:23:26 -0400 Subject: SHERLOCK: RT: Correct order of precedence of shapes in findBgShape --- engines/sherlock/scalpel/scalpel_scene.cpp | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'engines/sherlock/scalpel/scalpel_scene.cpp') diff --git a/engines/sherlock/scalpel/scalpel_scene.cpp b/engines/sherlock/scalpel/scalpel_scene.cpp index 9c36e84969..2f60cebefe 100644 --- a/engines/sherlock/scalpel/scalpel_scene.cpp +++ b/engines/sherlock/scalpel/scalpel_scene.cpp @@ -727,6 +727,27 @@ int ScalpelScene::closestZone(const Common::Point &pt) { return zone; } +int ScalpelScene::findBgShape(const Common::Point &pt) { + if (!_doBgAnimDone) + // New frame hasn't been drawn yet + return -1; + + for (int idx = (int)_bgShapes.size() - 1; idx >= 0; --idx) { + Object &o = _bgShapes[idx]; + if (o._type != INVALID && o._type != NO_SHAPE && o._type != HIDDEN + && o._aType <= PERSON) { + if (o.getNewBounds().contains(pt)) + return idx; + } + else if (o._type == NO_SHAPE) { + if (o.getNoShapeBounds().contains(pt)) + return idx; + } + } + + return -1; +} + } // End of namespace Scalpel } // End of namespace Sherlock -- cgit v1.2.3