diff options
author | Nicola Mettifogo | 2007-03-17 21:17:00 +0000 |
---|---|---|
committer | Nicola Mettifogo | 2007-03-17 21:17:00 +0000 |
commit | 794fa64de19be6874f86345dba612feb64569090 (patch) | |
tree | 15f871eb49fc9bfc8c4847e2c086051e4b8010d9 | |
parent | e6f64e83dd43384c511ea40c748114f47a301d4d (diff) | |
download | scummvm-rg350-794fa64de19be6874f86345dba612feb64569090.tar.gz scummvm-rg350-794fa64de19be6874f86345dba612feb64569090.tar.bz2 scummvm-rg350-794fa64de19be6874f86345dba612feb64569090.zip |
added getRect() to Zone to slightly simplify hitZone condition check
svn-id: r26186
-rw-r--r-- | engines/parallaction/zone.cpp | 12 | ||||
-rw-r--r-- | engines/parallaction/zone.h | 7 |
2 files changed, 15 insertions, 4 deletions
diff --git a/engines/parallaction/zone.cpp b/engines/parallaction/zone.cpp index 738e30c968..dbc4d1dab1 100644 --- a/engines/parallaction/zone.cpp +++ b/engines/parallaction/zone.cpp @@ -581,10 +581,14 @@ Zone *hitZone(uint32 type, uint16 x, uint16 y) { if (z->_flags & kFlagsRemove) continue; - if ((_si >= z->_right) || - (_si <= z->_left) || - (_di >= z->_bottom) || - (_di <= z->_top)) { + Common::Rect r; + z->getRect(r); + r.right++; // adjust border because Common::Rect doesn't include bottom-right edge + r.bottom++; + + r.grow(-1); // allows some tolerance for mouse click + + if (!r.contains(_si, _di)) { // out of Zone, so look for special values if ((z->_left == -2) || (z->_left == -3)) { diff --git a/engines/parallaction/zone.h b/engines/parallaction/zone.h index 12af43e231..3c6b9162aa 100644 --- a/engines/parallaction/zone.h +++ b/engines/parallaction/zone.h @@ -141,6 +141,13 @@ struct Zone : public Node { Command *_commands; Point _moveTo; + void getRect(Common::Rect& r) const { + r.left = _left; + r.right = _right; + r.top = _top; + r.bottom = _bottom; + } + void translate(int16 x, int16 y) { _left += x; _right += x; |