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

dreammaster dreammaster at scummvm.org
Wed Jul 8 03:27:00 CEST 2015


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:
ed2caf7cd6 SHERLOCK: RT: Fix display of verb menu in wide-screen scenes


Commit: ed2caf7cd64ad16110dba763ebda8bbbdb69a244
    https://github.com/scummvm/scummvm/commit/ed2caf7cd64ad16110dba763ebda8bbbdb69a244
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2015-07-07T21:25:55-04:00

Commit Message:
SHERLOCK: RT: Fix display of verb menu in wide-screen scenes

Changed paths:
    engines/sherlock/events.cpp
    engines/sherlock/events.h
    engines/sherlock/screen.cpp
    engines/sherlock/tattoo/tattoo_map.cpp
    engines/sherlock/tattoo/tattoo_user_interface.cpp
    engines/sherlock/tattoo/widget_base.cpp
    engines/sherlock/tattoo/widget_verbs.cpp



diff --git a/engines/sherlock/events.cpp b/engines/sherlock/events.cpp
index fdfd77e..490d30f 100644
--- a/engines/sherlock/events.cpp
+++ b/engines/sherlock/events.cpp
@@ -200,6 +200,10 @@ Common::Point Events::mousePos() const {
 	return g_system->getEventManager()->getMousePos();
 }
 
+Common::Point Events::sceneMousePos() const {
+	return mousePos() + _vm->_screen->_currentScroll;
+}
+
 Common::KeyState Events::getKey() {
 	return _pendingKeys.pop();
 }
diff --git a/engines/sherlock/events.h b/engines/sherlock/events.h
index b0dda37..052698a 100644
--- a/engines/sherlock/events.h
+++ b/engines/sherlock/events.h
@@ -129,8 +129,19 @@ public:
 	 */
 	Common::Point mousePos() const;
 
+	/**
+	 * Get the current mouse position within the scene, adjusted by the scroll position
+	 */
+	Common::Point sceneMousePos() 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/screen.cpp b/engines/sherlock/screen.cpp
index 85d8c7a..782869d 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/tattoo/tattoo_map.cpp b/engines/sherlock/tattoo/tattoo_map.cpp
index 9431968..1a9aed7 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.sceneMousePos();
 
 	// See if the mouse is pointing at any of the map locations
 	_bgFound = -1;
diff --git a/engines/sherlock/tattoo/tattoo_user_interface.cpp b/engines/sherlock/tattoo/tattoo_user_interface.cpp
index 2548185..7b2ef72 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.sceneMousePos();
 
 	events.pollEventsAndWait();
 	_keyState.keycode = Common::KEYCODE_INVALID;
@@ -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.sceneMousePos();
 	_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 10b8ad8..d946c46 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() {
+	Screen &screen = *_vm->_screen;
+
 	if (_bounds.left < 0)
 		_bounds.moveTo(0, _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 > screen._backBuffer1.w())
+		_bounds.moveTo(screen._backBuffer1.w() - _bounds.width(), _bounds.top);
 	if (_bounds.bottom > SHERLOCK_SCREEN_HEIGHT)
 		_bounds.moveTo(_bounds.left, SHERLOCK_SCREEN_HEIGHT - _bounds.height());
 }
@@ -243,7 +245,7 @@ void WidgetBase::drawScrollBar(int index, int pageSize, int count) {
 void WidgetBase::handleScrollbarEvents(int index, int pageSize, int count) {
 	Events &events = *_vm->_events;
 	TattooUserInterface &ui = *(TattooUserInterface *)_vm->_ui;
-	Common::Point mousePos = events.mousePos();
+	Common::Point mousePos = events.sceneMousePos();
 
 	// If they have selected the sollbar, return with the Scroll Bar Still selected
 	if (ui._scrollHighlight == 3)
diff --git a/engines/sherlock/tattoo/widget_verbs.cpp b/engines/sherlock/tattoo/widget_verbs.cpp
index fff984a..ec18e3c 100644
--- a/engines/sherlock/tattoo/widget_verbs.cpp
+++ b/engines/sherlock/tattoo/widget_verbs.cpp
@@ -38,10 +38,10 @@ 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();
+	Common::Point mousePos = events.sceneMousePos();
 	bool isWatson = false;
 
 	if (talk._talkToAbort)
@@ -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;
+	Common::Point mousePos = events.sceneMousePos();
 	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];
 
@@ -285,7 +283,7 @@ void WidgetVerbs::handleEvents() {
 void WidgetVerbs::highlightVerbControls() {
 	Events &events = *_vm->_events;
 	Screen &screen = *_vm->_screen;
-	Common::Point mousePos = events.mousePos();
+	Common::Point mousePos = events.sceneMousePos();
 
 	// Get highlighted verb
 	_selector = -1;






More information about the Scummvm-git-logs mailing list