diff options
author | Paul Gilbert | 2015-07-10 08:23:12 -0400 |
---|---|---|
committer | Paul Gilbert | 2015-07-10 08:23:12 -0400 |
commit | 8c00644cf269d788ee7ebfc291373e049257ba23 (patch) | |
tree | 3dc5e78b90bc8edec45157e30e95ecd6e389f064 /engines/sherlock/tattoo | |
parent | 138ec332d2190fcc44707c7d14114f85b1813f7c (diff) | |
download | scummvm-rg350-8c00644cf269d788ee7ebfc291373e049257ba23.tar.gz scummvm-rg350-8c00644cf269d788ee7ebfc291373e049257ba23.tar.bz2 scummvm-rg350-8c00644cf269d788ee7ebfc291373e049257ba23.zip |
SHERLOCK: RT: Fix interacting with characters
Diffstat (limited to 'engines/sherlock/tattoo')
-rw-r--r-- | engines/sherlock/tattoo/tattoo_scene.cpp | 33 | ||||
-rw-r--r-- | engines/sherlock/tattoo/tattoo_scene.h | 6 |
2 files changed, 39 insertions, 0 deletions
diff --git a/engines/sherlock/tattoo/tattoo_scene.cpp b/engines/sherlock/tattoo/tattoo_scene.cpp index f8ca2651c6..badc58d86f 100644 --- a/engines/sherlock/tattoo/tattoo_scene.cpp +++ b/engines/sherlock/tattoo/tattoo_scene.cpp @@ -708,6 +708,39 @@ void TattooScene::setNPCPath(int npc) { talk.talkTo(pathFile); } +int TattooScene::findBgShape(const Common::Point &pt) { + People &people = *_vm->_people; + + if (!_doBgAnimDone) + // New frame hasn't been drawn yet + return -1; + + int result = Scene::findBgShape(pt); + if (result == -1) { + // No shape found, so check whether a character is highlighted + for (int idx = 1; idx < MAX_CHARACTERS && result == -1; ++idx) { + Person &person = people[idx]; + + if (person._type == CHARACTER) { + int scaleVal = getScaleVal(person._position); + Common::Rect charRect; + + if (scaleVal == SCALE_THRESHOLD) + charRect = Common::Rect(person.frameWidth(), person.frameHeight()); + else + charRect = Common::Rect(person._imageFrame->sDrawXSize(scaleVal), person._imageFrame->sDrawYSize(scaleVal)); + charRect.moveTo(person._position.x / FIXED_INT_MULTIPLIER, person._position.y / FIXED_INT_MULTIPLIER + - charRect.height()); + + if (charRect.contains(pt)) + result = 1000 + idx; + } + } + } + + return result; +} + void TattooScene::synchronize(Serializer &s) { TattooEngine &vm = *(TattooEngine *)_vm; Scene::synchronize(s); diff --git a/engines/sherlock/tattoo/tattoo_scene.h b/engines/sherlock/tattoo/tattoo_scene.h index 695fef3d49..432233f501 100644 --- a/engines/sherlock/tattoo/tattoo_scene.h +++ b/engines/sherlock/tattoo/tattoo_scene.h @@ -132,6 +132,12 @@ public: * A negative playRate can also be specified to play the animation in reverse */ virtual int startCAnim(int cAnimNum, int playRate = 1); + + /** + * Attempts to find a background shape within the passed bounds. If found, + * it will return the shape number, or -1 on failure. + */ + virtual int findBgShape(const Common::Point &pt); }; } // End of namespace Tattoo |