aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorAlyssa Milburn2011-03-31 01:16:47 +0200
committerAlyssa Milburn2011-03-31 01:16:47 +0200
commite705759b7bac28dd1c00d8a655289366535bb0d1 (patch)
tree98e6e64da7279d9cc0253769b4251042bc0d2c19 /engines
parente5533401dc5c10609072794b596a87a0be2c3786 (diff)
downloadscummvm-rg350-e705759b7bac28dd1c00d8a655289366535bb0d1.tar.gz
scummvm-rg350-e705759b7bac28dd1c00d8a655289366535bb0d1.tar.bz2
scummvm-rg350-e705759b7bac28dd1c00d8a655289366535bb0d1.zip
MOHAWK: Implement kLBSetHitTest.
Diffstat (limited to 'engines')
-rw-r--r--engines/mohawk/livingbooks.cpp18
-rw-r--r--engines/mohawk/livingbooks.h1
2 files changed, 15 insertions, 4 deletions
diff --git a/engines/mohawk/livingbooks.cpp b/engines/mohawk/livingbooks.cpp
index de87c7fea6..553940dfda 100644
--- a/engines/mohawk/livingbooks.cpp
+++ b/engines/mohawk/livingbooks.cpp
@@ -1798,6 +1798,7 @@ LBItem::LBItem(MohawkEngine_LivingBooks *vm, Common::Rect rect) : _vm(vm), _rect
_loops = 0;
_isAmbient = false;
+ _doHitTest = true;
}
LBItem::~LBItem() {
@@ -2145,9 +2146,9 @@ void LBItem::readData(uint16 type, uint16 size, Common::SeekableSubReadStreamEnd
case kLBSetHitTest:
{
assert(size == 2);
- uint id = stream->readUint16();
- warning("kLBSetHitTest: unknown: item %s, value %04x", _desc.c_str(), id);
- // FIXME
+ uint val = stream->readUint16();
+ _doHitTest = (bool)val;
+ debug(2, "kLBSetHitTest (on %s): value %04x", _desc.c_str(), val);
}
break;
@@ -3446,6 +3447,9 @@ bool LBPictureItem::contains(Common::Point point) {
if (!LBItem::contains(point))
return false;
+ if (!_doHitTest)
+ return true;
+
// TODO: only check pixels if necessary
return !_vm->_gfx->imageIsTransparentAt(_resourceId, false, point.x - _rect.left, point.y - _rect.top);
}
@@ -3485,7 +3489,13 @@ void LBAnimationItem::setEnabled(bool enabled) {
}
bool LBAnimationItem::contains(Common::Point point) {
- return LBItem::contains(point) && !_anim->transparentAt(point.x, point.y);
+ if (!LBItem::contains(point))
+ return false;
+
+ if (!_doHitTest)
+ return true;
+
+ return !_anim->transparentAt(point.x, point.y);
}
void LBAnimationItem::update() {
diff --git a/engines/mohawk/livingbooks.h b/engines/mohawk/livingbooks.h
index 8eb6f7ed15..7138078c00 100644
--- a/engines/mohawk/livingbooks.h
+++ b/engines/mohawk/livingbooks.h
@@ -401,6 +401,7 @@ protected:
Common::Point _relocPoint;
bool _isAmbient;
+ bool _doHitTest;
Common::Array<LBScriptEntry *> _scriptEntries;
void runScript(uint event, uint16 data = 0, uint16 from = 0);