diff options
author | Paul Gilbert | 2015-07-01 21:10:57 -0400 |
---|---|---|
committer | Paul Gilbert | 2015-07-01 21:10:57 -0400 |
commit | dc4689e4b901971448f2625a96d5708a0c6e8ddf (patch) | |
tree | 3b8ef050736472384bd56a93546d22e1a519865f /engines/sherlock/scalpel/scalpel_scene.cpp | |
parent | 121ee4d40c2cd203d1a0dfef2b8e1d8d83b0b43f (diff) | |
download | scummvm-rg350-dc4689e4b901971448f2625a96d5708a0c6e8ddf.tar.gz scummvm-rg350-dc4689e4b901971448f2625a96d5708a0c6e8ddf.tar.bz2 scummvm-rg350-dc4689e4b901971448f2625a96d5708a0c6e8ddf.zip |
SHERLOCK: Split up closestZone versions for each game
Diffstat (limited to 'engines/sherlock/scalpel/scalpel_scene.cpp')
-rw-r--r-- | engines/sherlock/scalpel/scalpel_scene.cpp | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/engines/sherlock/scalpel/scalpel_scene.cpp b/engines/sherlock/scalpel/scalpel_scene.cpp index fa820d95fd..4e6e9e4c7c 100644 --- a/engines/sherlock/scalpel/scalpel_scene.cpp +++ b/engines/sherlock/scalpel/scalpel_scene.cpp @@ -702,6 +702,25 @@ int ScalpelScene::startCAnim(int cAnimNum, int playRate) { return 1; } +int ScalpelScene::closestZone(const Common::Point &pt) { + int dist = 1000; + int zone = -1; + + for (uint idx = 0; idx < _zones.size(); ++idx) { + Common::Point zc((_zones[idx].left + _zones[idx].right) / 2, + (_zones[idx].top + _zones[idx].bottom) / 2); + int d = ABS(zc.x - pt.x) + ABS(zc.y - pt.y); + + if (d < dist) { + // Found a closer zone + dist = d; + zone = idx; + } + } + + return zone; +} + } // End of namespace Scalpel } // End of namespace Sherlock |