diff options
| -rw-r--r-- | engines/mohawk/detection_tables.h | 16 | ||||
| -rw-r--r-- | engines/sherlock/events.cpp | 6 | ||||
| -rw-r--r-- | engines/sherlock/events.h | 11 | ||||
| -rw-r--r-- | engines/sherlock/inventory.cpp | 2 | ||||
| -rw-r--r-- | engines/sherlock/objects.cpp | 9 | ||||
| -rw-r--r-- | engines/sherlock/objects.h | 3 | ||||
| -rw-r--r-- | engines/sherlock/scene.cpp | 12 | ||||
| -rw-r--r-- | engines/sherlock/screen.cpp | 3 | ||||
| -rw-r--r-- | engines/sherlock/sherlock.h | 1 | ||||
| -rw-r--r-- | engines/sherlock/tattoo/tattoo_map.cpp | 3 | ||||
| -rw-r--r-- | engines/sherlock/tattoo/tattoo_scene.cpp | 2 | ||||
| -rw-r--r-- | engines/sherlock/tattoo/tattoo_user_interface.cpp | 10 | ||||
| -rw-r--r-- | engines/sherlock/tattoo/widget_base.cpp | 10 | ||||
| -rw-r--r-- | engines/sherlock/tattoo/widget_inventory.cpp | 7 | ||||
| -rw-r--r-- | engines/sherlock/tattoo/widget_tooltip.cpp | 13 | ||||
| -rw-r--r-- | engines/sherlock/tattoo/widget_verbs.cpp | 6 | 
16 files changed, 76 insertions, 38 deletions
diff --git a/engines/mohawk/detection_tables.h b/engines/mohawk/detection_tables.h index 7632cde294..6bb836b5b8 100644 --- a/engines/mohawk/detection_tables.h +++ b/engines/mohawk/detection_tables.h @@ -1379,6 +1379,22 @@ static const MohawkGameDescription gameDescriptions[] = {  		"GRANDMA.EXE"  	}, +	// Just Grandma and Me 1.0, Macintosh +	{ +		{ +			"grandma", +			"v1.0", +			AD_ENTRY1("BookOutline", "9162483da06179e76f4a082412245efa"), +			Common::EN_ANY, +			Common::kPlatformMacintosh, +			ADGF_NO_FLAGS, +			GUIO1(GUIO_NOASPECT) +		}, +		GType_LIVINGBOOKSV1, +		GF_LB_10, +		0 +	}, +  	// Just Grandma and Me 1.1 Mac  	// From eisnerguy1 in bug#3610725  	{ diff --git a/engines/sherlock/events.cpp b/engines/sherlock/events.cpp index fdfd77ef74..3f49e347ae 100644 --- a/engines/sherlock/events.cpp +++ b/engines/sherlock/events.cpp @@ -196,10 +196,14 @@ bool Events::checkForNextFrameCounter() {  	return false;  } -Common::Point Events::mousePos() const { +Common::Point Events::screenMousePos() const {  	return g_system->getEventManager()->getMousePos();  } +Common::Point Events::mousePos() const { +	return screenMousePos() + _vm->_screen->_currentScroll; +} +  Common::KeyState Events::getKey() {  	return _pendingKeys.pop();  } diff --git a/engines/sherlock/events.h b/engines/sherlock/events.h index b0dda37607..ffe6584ae6 100644 --- a/engines/sherlock/events.h +++ b/engines/sherlock/events.h @@ -127,10 +127,21 @@ public:  	/**  	 * Get the current mouse position  	 */ +	Common::Point screenMousePos() const; + +	/** +	 * Get the current mouse position within the scene, adjusted by the scroll position +	 */  	Common::Point mousePos() const; +	/** +	 * Return the current game frame number +	 */  	uint32 getFrameCounter() const { return _frameCounter; } +	/** +	 * Returns true if there's a pending keyboard key +	 */  	bool kbHit() const { return !_pendingKeys.empty(); }  	/** diff --git a/engines/sherlock/inventory.cpp b/engines/sherlock/inventory.cpp index 01d515c61e..9b08b9d540 100644 --- a/engines/sherlock/inventory.cpp +++ b/engines/sherlock/inventory.cpp @@ -199,7 +199,7 @@ void Inventory::copyToInventory(Object &obj) {  	invItem._description = obj._description;  	invItem._examine = obj._examine;  	invItem._lookFlag = obj._lookFlag; -	invItem._requiredFlag = obj._requiredFlag; +	invItem._requiredFlag = obj._requiredFlag[0];  	insert_at(_holdings, invItem);  	++_holdings; diff --git a/engines/sherlock/objects.cpp b/engines/sherlock/objects.cpp index 6471710ae3..a27807627e 100644 --- a/engines/sherlock/objects.cpp +++ b/engines/sherlock/objects.cpp @@ -64,7 +64,7 @@ BaseObject::BaseObject() {  	_allow = 0;  	_frameNumber = 0;  	_lookFlag = 0; -	_requiredFlag = 0; +	_requiredFlag[0] = _requiredFlag[1] = 0;  	_status = 0;  	_misc = 0;  	_maxFrames = 0; @@ -80,7 +80,6 @@ BaseObject::BaseObject() {  	_seqSize = 0;  	_quickDraw = 0;  	_scaleVal = 0; -	_requiredFlags1 = 0;  	_gotoSeq = 0;  	_talkSeq = 0;  	_restoreSlot = 0; @@ -980,7 +979,7 @@ void Object::load(Common::SeekableReadStream &s, bool isRoseTattoo) {  	_defaultCommand = isRoseTattoo ? 0 : s.readByte();  	_lookFlag = s.readSint16LE();  	_pickupFlag = isRoseTattoo ? 0 : s.readSint16LE(); -	_requiredFlag = s.readSint16LE(); +	_requiredFlag[0] = s.readSint16LE();  	_noShapeSize.x = s.readUint16LE();  	_noShapeSize.y = s.readUint16LE();  	_status = s.readUint16LE(); @@ -1019,7 +1018,7 @@ void Object::load(Common::SeekableReadStream &s, bool isRoseTattoo) {  		_quickDraw = s.readByte();  		_scaleVal = s.readUint16LE(); -		_requiredFlags1 = s.readSint16LE(); +		_requiredFlag[1] = s.readSint16LE();  		_gotoSeq = s.readByte();  		_talkSeq = s.readByte();  		_restoreSlot = s.readByte(); @@ -1074,7 +1073,7 @@ void Object::load3DO(Common::SeekableReadStream &s) {  	// Unverified  	_lookFlag = s.readSint16BE();  	_pickupFlag = s.readSint16BE(); -	_requiredFlag = s.readSint16BE(); +	_requiredFlag[0] = s.readSint16BE();  	_noShapeSize.x = s.readUint16BE();  	_noShapeSize.y = s.readUint16BE();  	_status = s.readUint16BE(); diff --git a/engines/sherlock/objects.h b/engines/sherlock/objects.h index ef62ff9d26..8cfb466255 100644 --- a/engines/sherlock/objects.h +++ b/engines/sherlock/objects.h @@ -218,7 +218,7 @@ public:  	Point32 _goto;					// Walk destination  	int _lookFlag;					// Which flag LOOK   will set (if any) -	int _requiredFlag;				// Object will be hidden if not set +	int _requiredFlag[2];			// Object will be hidden if not set  	Common::Point _noShapeSize;		// Size of a NO_SHAPE  	int _status;					// Status (open/closed, moved/not)  	int8 _misc;						// Misc field -- use varies with type @@ -237,7 +237,6 @@ public:  	UseType _use[6];				// Serrated Scalpel uses 4, Rose Tattoo 6  	int _quickDraw;					// Flag telling whether to use quick draw routine or not  	int _scaleVal;					// Tells how to scale the sprite -	int _requiredFlags1;			// This flag must also be set, or the sprite is hidden  	int _gotoSeq;					// Used by Talk to tell which sequence to goto when able  	int _talkSeq;					// Tells which talk sequence currently in use (Talk or Listen)  	int _restoreSlot;				// Used when talk returns to the previous sequence diff --git a/engines/sherlock/scene.cpp b/engines/sherlock/scene.cpp index 450370de2d..4e5cacb5b2 100644 --- a/engines/sherlock/scene.cpp +++ b/engines/sherlock/scene.cpp @@ -1099,9 +1099,15 @@ void Scene::checkSceneFlags(bool flag) {  	for (uint idx = 0; idx < _bgShapes.size(); ++idx) {  		Object &o = _bgShapes[idx]; +		bool flag = true; -		if (o._requiredFlag) { -			if (!_vm->readFlags(_bgShapes[idx]._requiredFlag)) { +		if (o._requiredFlag[0] || o._requiredFlag[1]) { +			if (o._requiredFlag[0] != 0) +				flag = _vm->readFlags(o._requiredFlag[0]); +			if (o._requiredFlag[1] != 0) +				flag &= _vm->readFlags(o._requiredFlag[1]); + +			if (!flag) {  				// Kill object  				if (o._type != HIDDEN && o._type != INVALID) {  					if (o._images == nullptr || o._images->size() == 0) @@ -1111,7 +1117,7 @@ void Scene::checkSceneFlags(bool flag) {  						// Flag it as needing to be hidden after first erasing it  						o._type = mode;  				} -			} else if (_bgShapes[idx]._requiredFlag > 0) { +			} else if (IS_ROSE_TATTOO || o._requiredFlag > 0) {  				// Restore object  				if (o._images == nullptr || o._images->size() == 0)  					o._type = NO_SHAPE; diff --git a/engines/sherlock/screen.cpp b/engines/sherlock/screen.cpp index 85d8c7ad9d..782869d77e 100644 --- a/engines/sherlock/screen.cpp +++ b/engines/sherlock/screen.cpp @@ -355,7 +355,8 @@ void Screen::slamArea(int16 xp, int16 yp, int16 width, int16 height) {  void Screen::slamRect(const Common::Rect &r) {  	if (r.width() && r.height() > 0) {  		Common::Rect srcRect = r, destRect = r; -		srcRect.translate(_currentScroll.x, _currentScroll.y); + +		destRect.translate(-_currentScroll.x, -_currentScroll.y);  		if (destRect.left < 0) {  			srcRect.left += -destRect.left; diff --git a/engines/sherlock/sherlock.h b/engines/sherlock/sherlock.h index b0d0fa28c8..69000e1fbc 100644 --- a/engines/sherlock/sherlock.h +++ b/engines/sherlock/sherlock.h @@ -65,6 +65,7 @@ enum GameType {  #define SHERLOCK_SCREEN_WIDTH _vm->_screen->w()  #define SHERLOCK_SCREEN_HEIGHT _vm->_screen->h() +#define SHERLOCK_SCENE_WIDTH _vm->_screen->_backBuffer1.w()  #define SHERLOCK_SCENE_HEIGHT (IS_SERRATED_SCALPEL ? 138 : 480)  #define SCENES_COUNT (IS_SERRATED_SCALPEL ? 63 : 101) diff --git a/engines/sherlock/tattoo/tattoo_map.cpp b/engines/sherlock/tattoo/tattoo_map.cpp index 943196815b..613951889c 100644 --- a/engines/sherlock/tattoo/tattoo_map.cpp +++ b/engines/sherlock/tattoo/tattoo_map.cpp @@ -305,8 +305,7 @@ void TattooMap::drawMapIcons() {  void TattooMap::checkMapNames(bool slamIt) {  	Events &events = *_vm->_events; -	Screen &screen = *_vm->_screen; -	Common::Point mapPos = events.mousePos() + screen._currentScroll; +	Common::Point mapPos = events.mousePos();  	// See if the mouse is pointing at any of the map locations  	_bgFound = -1; diff --git a/engines/sherlock/tattoo/tattoo_scene.cpp b/engines/sherlock/tattoo/tattoo_scene.cpp index 2d82b2f641..f8ca2651c6 100644 --- a/engines/sherlock/tattoo/tattoo_scene.cpp +++ b/engines/sherlock/tattoo/tattoo_scene.cpp @@ -354,7 +354,7 @@ void TattooScene::doBgAnim() {  		events.wait(3);  	if (screen._flushScreen) { -		screen.slamRect(Common::Rect(0, 0, SHERLOCK_SCREEN_WIDTH, SHERLOCK_SCREEN_HEIGHT)); +		screen.slamArea(screen._currentScroll.x, screen._currentScroll.y, SHERLOCK_SCREEN_WIDTH, SHERLOCK_SCREEN_HEIGHT);  		screen._flushScreen = false;  	} diff --git a/engines/sherlock/tattoo/tattoo_user_interface.cpp b/engines/sherlock/tattoo/tattoo_user_interface.cpp index 2548185ede..9296ff0e8a 100644 --- a/engines/sherlock/tattoo/tattoo_user_interface.cpp +++ b/engines/sherlock/tattoo/tattoo_user_interface.cpp @@ -230,8 +230,7 @@ void TattooUserInterface::handleInput() {  	TattooEngine &vm = *(TattooEngine *)_vm;  	Events &events = *_vm->_events;  	TattooScene &scene = *(TattooScene *)_vm->_scene; -	Screen &screen = *_vm->_screen; -	Common::Point mousePos = events.mousePos() + screen._currentScroll; +	Common::Point mousePos = events.mousePos();  	events.pollEventsAndWait();  	_keyState.keycode = Common::KEYCODE_INVALID; @@ -455,7 +454,7 @@ void TattooUserInterface::doStandardControl() {  			// Either call the code to Look at it's Examine Field or call the Exit animation  			// if the object is an exit, specified by the first four characters of the name being "EXIT"  			Common::String name = _personFound ? people[_bgFound - 1000]._name : _bgShape->_name; -			if (name.hasPrefix("EXIT")) { +			if (!name.hasPrefix("EXIT")) {  				lookAtObject();  			} else {  				// Run the Exit animation and set which scene to go to next @@ -532,14 +531,13 @@ void TattooUserInterface::doLabControl() {  void TattooUserInterface::displayObjectNames() {  	Events &events = *_vm->_events;  	Scene &scene = *_vm->_scene; -	Screen &screen = *_vm->_screen; -	Common::Point scenePos = events.mousePos() + screen._currentScroll; +	Common::Point mousePos = events.mousePos();  	_arrowZone = -1;  	if (_bgFound == -1 || scene._currentScene == 90) {  		for (uint idx = 0; idx < scene._exits.size() && _arrowZone == -1; ++idx) {  			Exit &exit = scene._exits[idx]; -			if (exit.contains(scenePos)) +			if (exit.contains(mousePos))  				_arrowZone = idx;  		}  	} diff --git a/engines/sherlock/tattoo/widget_base.cpp b/engines/sherlock/tattoo/widget_base.cpp index 10b8ad8dec..905dd31be0 100644 --- a/engines/sherlock/tattoo/widget_base.cpp +++ b/engines/sherlock/tattoo/widget_base.cpp @@ -141,12 +141,14 @@ Common::String WidgetBase::splitLines(const Common::String &str, Common::StringA  }  void WidgetBase::restrictToScreen() { -	if (_bounds.left < 0) -		_bounds.moveTo(0, _bounds.top); +	Screen &screen = *_vm->_screen; + +	if (_bounds.left < screen._currentScroll.x) +		_bounds.moveTo(screen._currentScroll.x, _bounds.top);  	if (_bounds.top < 0)  		_bounds.moveTo(_bounds.left, 0); -	if (_bounds.right > SHERLOCK_SCREEN_WIDTH) -		_bounds.moveTo(SHERLOCK_SCREEN_WIDTH - _bounds.width(), _bounds.top); +	if (_bounds.right > SHERLOCK_SCENE_WIDTH) +		_bounds.moveTo(SHERLOCK_SCENE_WIDTH - _bounds.width(), _bounds.top);  	if (_bounds.bottom > SHERLOCK_SCREEN_HEIGHT)  		_bounds.moveTo(_bounds.left, SHERLOCK_SCREEN_HEIGHT - _bounds.height());  } diff --git a/engines/sherlock/tattoo/widget_inventory.cpp b/engines/sherlock/tattoo/widget_inventory.cpp index 3274552f5e..3ce733b3d6 100644 --- a/engines/sherlock/tattoo/widget_inventory.cpp +++ b/engines/sherlock/tattoo/widget_inventory.cpp @@ -127,7 +127,7 @@ void WidgetInventoryTooltip::handleEvents() {  		_oldInvGraphicBounds = _invGraphicBounds;  		// Set the New position of the graphic -		int xp = CLIP(mousePos.x - _invGraphicBounds.width() / 2, 0, SHERLOCK_SCREEN_WIDTH - _invGraphicBounds.width()); +		int xp = CLIP(mousePos.x - _invGraphicBounds.width() / 2, 0, SHERLOCK_SCENE_WIDTH - _invGraphicBounds.width());  		int yp = CLIP(mousePos.y - _invGraphicBounds.height() / 2, 0, SHERLOCK_SCREEN_HEIGHT - _invGraphicBounds.height());  		_invGraphicBounds.moveTo(xp, yp); @@ -242,7 +242,7 @@ void WidgetInventoryTooltip::handleEvents() {  	}  	// Update the position of the tooltip -	int xs = CLIP(mousePos.x - _bounds.width() / 2, 0, SHERLOCK_SCREEN_WIDTH - _bounds.width()); +	int xs = CLIP(mousePos.x - _bounds.width() / 2, 0, SHERLOCK_SCENE_WIDTH - _bounds.width());  	int ys = CLIP(mousePos.y - _bounds.height(), 0, SHERLOCK_SCREEN_HEIGHT - _bounds.height());  	_bounds.moveTo(xs, ys);  } @@ -263,11 +263,12 @@ WidgetInventory::WidgetInventory(SherlockEngine *vm) : WidgetBase(vm), _tooltipW  void WidgetInventory::load(int mode) {  	Events &events = *_vm->_events;  	Inventory &inv = *_vm->_inventory; +	Screen &screen = *_vm->_screen;  	Common::Point mousePos = events.mousePos();  	if (mode == 3) {  		mode = 2; -		mousePos = Common::Point(SHERLOCK_SCREEN_WIDTH / 2, SHERLOCK_SCREEN_HEIGHT / 2); +		mousePos = Common::Point(screen._currentScroll.x + SHERLOCK_SCREEN_WIDTH / 2, SHERLOCK_SCREEN_HEIGHT / 2);  	}  	if (mode != 0) diff --git a/engines/sherlock/tattoo/widget_tooltip.cpp b/engines/sherlock/tattoo/widget_tooltip.cpp index 80ac048874..b1c13c7a29 100644 --- a/engines/sherlock/tattoo/widget_tooltip.cpp +++ b/engines/sherlock/tattoo/widget_tooltip.cpp @@ -39,12 +39,15 @@ void WidgetTooltipBase::draw() {  		erase();  	if (_bounds.width() > 0 && !_surface.empty()) { +		restrictToScreen(); +  		// Blit the affected area to the screen  		screen.slamRect(_bounds);  		// Draw the widget directly onto the screen. Unlike other widgets, we don't draw to the back buffer,  		// since nothing should be drawing on top of tooltips, so there's no need to store in the back buffer -		screen.transBlitFrom(_surface, Common::Point(_bounds.left, _bounds.top)); +		screen.transBlitFrom(_surface, Common::Point(_bounds.left - screen._currentScroll.x,  +			_bounds.top - screen._currentScroll.y));  		// Store a copy of the drawn area for later erasing  		_oldBounds = _bounds; @@ -139,8 +142,8 @@ void WidgetTooltip::setText(const Common::String &str) {  		}  		// Set the initial display position for the tooltip text -		int tagX = CLIP(mousePos.x - width / 2, 0, SHERLOCK_SCREEN_WIDTH - width); -		int tagY = MAX(mousePos.y - height, 0); +		int tagX = mousePos.x - width / 2; +		int tagY = mousePos.y - height;  		_bounds = Common::Rect(tagX, tagY, tagX + width, tagY + height);  	} else { @@ -157,8 +160,8 @@ void WidgetTooltip::handleEvents() {  	Common::Point mousePos = events.mousePos();  	// Set the new position for the tooltip -	int xp = CLIP(mousePos.x - _bounds.width() / 2, 0, SHERLOCK_SCREEN_WIDTH - _bounds.width()); -	int yp = MAX(mousePos.y - _bounds.height(), 0); +	int xp = mousePos.x - _bounds.width() / 2; +	int yp = mousePos.y - _bounds.height();  	_bounds.moveTo(xp, yp);  } diff --git a/engines/sherlock/tattoo/widget_verbs.cpp b/engines/sherlock/tattoo/widget_verbs.cpp index fff984a3ff..81213b763a 100644 --- a/engines/sherlock/tattoo/widget_verbs.cpp +++ b/engines/sherlock/tattoo/widget_verbs.cpp @@ -38,9 +38,9 @@ WidgetVerbs::WidgetVerbs(SherlockEngine *vm) : WidgetBase(vm) {  void WidgetVerbs::load(bool objectsOn) {  	Events &events = *_vm->_events; +	TattooPeople &people = *(TattooPeople *)_vm->_people;  	Talk &talk = *_vm->_talk;  	TattooUserInterface &ui = *(TattooUserInterface *)_vm->_ui; -	TattooPeople &people = *(TattooPeople *)_vm->_people;  	Common::Point mousePos = events.mousePos();  	bool isWatson = false; @@ -153,11 +153,9 @@ void WidgetVerbs::handleEvents() {  	FixedText &fixedText = *_vm->_fixedText;  	People &people = *_vm->_people;  	TattooScene &scene = *(TattooScene *)_vm->_scene; -	Screen &screen = *_vm->_screen;  	Talk &talk = *_vm->_talk;  	TattooUserInterface &ui = *(TattooUserInterface *)_vm->_ui;  	Common::Point mousePos = events.mousePos(); -	Common::Point scenePos = mousePos + screen._currentScroll;  	bool noDesc = false;  	Common::String strLook = fixedText.getText(kFixedText_Look); @@ -183,7 +181,7 @@ void WidgetVerbs::handleEvents() {  				if (events._rightReleased) {  					// Reset the selected shape to what was clicked on -					ui._bgFound = scene.findBgShape(scenePos); +					ui._bgFound = scene.findBgShape(mousePos);  					ui._personFound = ui._bgFound >= 1000;  					Object *_bgShape = ui._personFound ? nullptr : &scene._bgShapes[ui._bgFound];  | 
