[Scummvm-cvs-logs] scummvm master -> e705759b7bac28dd1c00d8a655289366535bb0d1

fuzzie fuzzie at fuzzie.org
Thu Mar 31 01:18:39 CEST 2011


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
e705759b7b MOHAWK: Implement kLBSetHitTest.


Commit: e705759b7bac28dd1c00d8a655289366535bb0d1
    https://github.com/scummvm/scummvm/commit/e705759b7bac28dd1c00d8a655289366535bb0d1
Author: Alyssa Milburn (fuzzie at fuzzie.org)
Date: 2011-03-30T16:16:47-07:00

Commit Message:
MOHAWK: Implement kLBSetHitTest.

Changed paths:
    engines/mohawk/livingbooks.cpp
    engines/mohawk/livingbooks.h



diff --git a/engines/mohawk/livingbooks.cpp b/engines/mohawk/livingbooks.cpp
index de87c7f..553940d 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 8eb6f7e..7138078 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);






More information about the Scummvm-git-logs mailing list