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

dreammaster dreammaster at scummvm.org
Sat Jun 13 17:39:19 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:
debe270d6f SHERLOCK: RT: Implemented handleInput method


Commit: debe270d6f5595f5dbf50a8c7e7eeb888c247f8d
    https://github.com/scummvm/scummvm/commit/debe270d6f5595f5dbf50a8c7e7eeb888c247f8d
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2015-06-13T11:38:12-04:00

Commit Message:
SHERLOCK: RT: Implemented handleInput method

Changed paths:
    engines/sherlock/scalpel/scalpel_user_interface.cpp
    engines/sherlock/scene.cpp
    engines/sherlock/scene.h
    engines/sherlock/sherlock.cpp
    engines/sherlock/sherlock.h
    engines/sherlock/tattoo/tattoo.cpp
    engines/sherlock/tattoo/tattoo.h
    engines/sherlock/tattoo/tattoo_scene.cpp
    engines/sherlock/tattoo/tattoo_scene.h
    engines/sherlock/tattoo/tattoo_user_interface.cpp
    engines/sherlock/tattoo/tattoo_user_interface.h
    engines/sherlock/user_interface.h



diff --git a/engines/sherlock/scalpel/scalpel_user_interface.cpp b/engines/sherlock/scalpel/scalpel_user_interface.cpp
index ef92218..dc5ab01 100644
--- a/engines/sherlock/scalpel/scalpel_user_interface.cpp
+++ b/engines/sherlock/scalpel/scalpel_user_interface.cpp
@@ -149,7 +149,7 @@ void ScalpelUserInterface::handleInput() {
 		whileMenuCounter();
 
 	Common::Point pt = events.mousePos();
-	_bgFound = scene.findBgShape(Common::Rect(pt.x, pt.y, pt.x + 1, pt.y + 1));
+	_bgFound = scene.findBgShape(pt);
 	_keyPress = '\0';
 
 	// Check kbd and set the mouse released flag if Enter or space is pressed.
diff --git a/engines/sherlock/scene.cpp b/engines/sherlock/scene.cpp
index 22a0e36..efb2b90 100644
--- a/engines/sherlock/scene.cpp
+++ b/engines/sherlock/scene.cpp
@@ -1205,6 +1205,10 @@ int Scene::findBgShape(const Common::Rect &r) {
 	return -1;
 }
 
+int Scene::findBgShape(const Common::Point &pt) {
+	return findBgShape(Common::Rect(pt.x, pt.y, pt.x + 1, pt.y + 1));
+}
+
 int Scene::checkForZones(const Common::Point &pt, int zoneType) {
 	int matches = 0;
 
diff --git a/engines/sherlock/scene.h b/engines/sherlock/scene.h
index 98b2990..0fd3483 100644
--- a/engines/sherlock/scene.h
+++ b/engines/sherlock/scene.h
@@ -265,6 +265,12 @@ public:
 	int findBgShape(const Common::Rect &r);
 
 	/**
+	 * Attempts to find a background shape within the passed bounds. If found,
+	 * it will return the shape number, or -1 on failure.
+	 */
+	int findBgShape(const Common::Point &pt);
+
+	/**
 	 * Checks to see if the given position in the scene belongs to a given zone type.
 	 * If it is, the zone is activated and used just like a TAKL zone or aFLAG_SET zone.
 	 */
diff --git a/engines/sherlock/sherlock.cpp b/engines/sherlock/sherlock.cpp
index 9c397e3..3c12d84 100644
--- a/engines/sherlock/sherlock.cpp
+++ b/engines/sherlock/sherlock.cpp
@@ -50,7 +50,6 @@ SherlockEngine::SherlockEngine(OSystem *syst, const SherlockGameDescription *gam
 	_canLoadSave = false;
 	_showOriginalSavesDialog = false;
 	_interactiveFl = true;
-	_fastMode = false;
 }
 
 SherlockEngine::~SherlockEngine() {
diff --git a/engines/sherlock/sherlock.h b/engines/sherlock/sherlock.h
index ad840a6..6e87c1c 100644
--- a/engines/sherlock/sherlock.h
+++ b/engines/sherlock/sherlock.h
@@ -126,7 +126,6 @@ public:
 	bool _canLoadSave;
 	bool _showOriginalSavesDialog;
 	bool _interactiveFl;
-	bool _fastMode;
 public:
 	SherlockEngine(OSystem *syst, const SherlockGameDescription *gameDesc);
 	virtual ~SherlockEngine();
diff --git a/engines/sherlock/tattoo/tattoo.cpp b/engines/sherlock/tattoo/tattoo.cpp
index 60803c7..60705f6 100644
--- a/engines/sherlock/tattoo/tattoo.cpp
+++ b/engines/sherlock/tattoo/tattoo.cpp
@@ -34,6 +34,8 @@ TattooEngine::TattooEngine(OSystem *syst, const SherlockGameDescription *gameDes
 		SherlockEngine(syst, gameDesc) {
 	_creditsActive = false;
 	_runningProlog = false;
+	_fastMode = false;
+	_allowFastMode = true;
 }
 
 void TattooEngine::showOpening() {
diff --git a/engines/sherlock/tattoo/tattoo.h b/engines/sherlock/tattoo/tattoo.h
index 6cafc3f..2342f56 100644
--- a/engines/sherlock/tattoo/tattoo.h
+++ b/engines/sherlock/tattoo/tattoo.h
@@ -50,6 +50,7 @@ protected:
 public:
 	bool _creditsActive;
 	bool _runningProlog;
+	bool _fastMode, _allowFastMode;
 public:
 	TattooEngine(OSystem *syst, const SherlockGameDescription *gameDesc);
 	virtual ~TattooEngine() {}
diff --git a/engines/sherlock/tattoo/tattoo_scene.cpp b/engines/sherlock/tattoo/tattoo_scene.cpp
index 73b6b65..31d497d 100644
--- a/engines/sherlock/tattoo/tattoo_scene.cpp
+++ b/engines/sherlock/tattoo/tattoo_scene.cpp
@@ -890,7 +890,7 @@ int TattooScene::startCAnim(int cAnimNum, int playRate) {
 			if (keyState.keycode == Common::KEYCODE_ESCAPE && vm._runningProlog) {
 				_vm->setFlags(-76);
 				_vm->setFlags(396);
-				_goToScene = 1;
+				_goToScene = STARTING_GAME_SCENE;
 				talk._talkToAbort = true;
 				_activeCAnim.close();
 			}
diff --git a/engines/sherlock/tattoo/tattoo_scene.h b/engines/sherlock/tattoo/tattoo_scene.h
index 7c432b4..ed5f46a 100644
--- a/engines/sherlock/tattoo/tattoo_scene.h
+++ b/engines/sherlock/tattoo/tattoo_scene.h
@@ -31,7 +31,7 @@ namespace Sherlock {
 namespace Tattoo {
 
 enum {
-	STARTING_INTRO_SCENE = 91, OVERHEAD_MAP2 = 99, OVERHEAD_MAP = 100
+	STARTING_GAME_SCENE = 1,  STARTING_INTRO_SCENE = 91, OVERHEAD_MAP2 = 99, OVERHEAD_MAP = 100
 };
 
 struct SceneTripEntry {
diff --git a/engines/sherlock/tattoo/tattoo_user_interface.cpp b/engines/sherlock/tattoo/tattoo_user_interface.cpp
index 084d52a..dff759b 100644
--- a/engines/sherlock/tattoo/tattoo_user_interface.cpp
+++ b/engines/sherlock/tattoo/tattoo_user_interface.cpp
@@ -35,6 +35,10 @@ TattooUserInterface::TattooUserInterface(SherlockEngine *vm): UserInterface(vm)
 	_invGraphic = nullptr;
 	_scrollSize = _scrollSpeed = 0;
 	_drawMenu = false;
+	_bgFound = _oldBgFound = -1;
+	_bgShape = nullptr;
+	_personFound = false;
+	_lockoutTimer = 0;
 }
 
 void TattooUserInterface::initScrollVars() {
@@ -44,8 +48,69 @@ void TattooUserInterface::initScrollVars() {
 }
 
 void TattooUserInterface::handleInput() {
-	// TODO
-	_vm->_events->pollEventsAndWait();
+	TattooEngine &vm = *(TattooEngine *)_vm;
+	Events &events = *_vm->_events;
+	TattooScene &scene = *(TattooScene *)_vm->_scene;
+	Common::Point mousePos = events.mousePos();
+
+	events.pollEventsAndWait();
+	_keyState.keycode = Common::KEYCODE_INVALID;
+
+	// Check the mouse positioning
+	if (events.isCursorVisible())
+		_bgFound = scene.findBgShape(mousePos);
+	_personFound = _bgFound >= 1000;
+	_bgShape = (_bgFound != -1 && _bgFound < 1000) ? &scene._bgShapes[_bgFound] : nullptr;
+
+	if (_lockoutTimer)
+		--_lockoutTimer;
+	
+	// Key handling
+	if (events.kbHit()) {
+		_keyState = events.getKey();
+
+		if (_keyState.keycode == Common::KEYCODE_s && vm._allowFastMode)
+			vm._fastMode = !vm._fastMode;
+
+		else if (_keyState.keycode == Common::KEYCODE_ESCAPE && vm._runningProlog && !_lockoutTimer) {
+			vm.setFlags(-76);
+			vm.setFlags(396);
+			scene._goToScene = STARTING_GAME_SCENE;
+		}
+	}
+
+	if (!events.isCursorVisible())
+		_keyState.keycode = Common::KEYCODE_INVALID;
+
+	// Handle input depending on what mode we're in
+	switch (_menuMode) {
+	case STD_MODE:
+		doStandardControl();
+		break;
+	case LOOK_MODE:
+		doLookControl();
+		break;
+	case FILES_MODE:
+		doFileControl();
+		break;
+	case INV_MODE:
+		doInventoryControl();
+		break;
+	case VERB_MODE:
+		doVerbControl();
+		break;
+	case TALK_MODE:
+		doTalkControl();
+		break;
+	case MESSAGE_MODE:
+		doMessageControl();
+		break;
+	case LAB_MODE:
+		doLabControl();
+		break;
+	default:
+		break;
+	}
 }
 
 void TattooUserInterface::drawInterface(int bufferNum) {
@@ -206,6 +271,38 @@ void TattooUserInterface::drawGrayAreas() {
 	// TODO
 }
 
+void TattooUserInterface::doStandardControl() {
+	warning("TODO: ui control");
+}
+
+void TattooUserInterface::doLookControl() {
+	warning("TODO: ui control");
+}
+
+void TattooUserInterface::doFileControl() {
+	warning("TODO: ui control");
+}
+
+void TattooUserInterface::doInventoryControl() {
+	warning("TODO: ui control");
+}
+
+void TattooUserInterface::doVerbControl() {
+	warning("TODO: ui control");
+}
+
+void TattooUserInterface::doTalkControl() {
+	warning("TODO: ui control");
+}
+
+void TattooUserInterface::doMessageControl() {
+	warning("TODO: ui control");
+}
+
+void TattooUserInterface::doLabControl() {
+	warning("TODO: ui control");
+}
+
 } // End of namespace Tattoo
 
 } // End of namespace Sherlock
diff --git a/engines/sherlock/tattoo/tattoo_user_interface.h b/engines/sherlock/tattoo/tattoo_user_interface.h
index a04239b..c827b9a 100644
--- a/engines/sherlock/tattoo/tattoo_user_interface.h
+++ b/engines/sherlock/tattoo/tattoo_user_interface.h
@@ -45,11 +45,57 @@ private:
 	Surface *_tagBuffer;
 	Surface *_invGraphic;
 	Common::Array<Common::Rect> _grayAreas;
+	int _bgFound, _oldBgFound;
+	Object *_bgShape;
+	bool _personFound;
+	int _lockoutTimer;
+	Common::KeyState _keyState;
 private:
 	/**
 	 * Draws designated areas of the screen that are meant to be grayed out using grayscale colors
 	 */
 	void drawGrayAreas();
+
+	/**
+	 * Handle any input when we're in standard mode (with no windows open)
+	 */
+	void doStandardControl();
+
+	/**
+	 * Handle input when in look mode
+	 */
+	void doLookControl();
+
+	/**
+	 * Handle input when the File window is open
+	 */
+	void doFileControl();
+
+	/**
+	 * Handle input if an inventory command (INVENT, LOOK, or USE) has an open window and is active
+	 */
+	void doInventoryControl();
+
+	/**
+	 * Handle input while the verb menu is open
+	 */
+	void doVerbControl();
+
+	/**
+	 * Handles input when in talk mode. It highlights the buttons and response statements,
+	 * and handles any actions for clicking on the buttons or statements.
+	 */
+	void doTalkControl();
+
+	/**
+	 * Handles input when a message window is open at the bottom of the screen
+	 */
+	void doMessageControl();
+	
+	/**
+	 * Handles input when the player is in the Lab Table scene
+	 */
+	void doLabControl();
 public:
 	Common::Point _currentScroll, _targetScroll;
 	int _scrollSize, _scrollSpeed;
diff --git a/engines/sherlock/user_interface.h b/engines/sherlock/user_interface.h
index a9fb8cb..7b79b53 100644
--- a/engines/sherlock/user_interface.h
+++ b/engines/sherlock/user_interface.h
@@ -50,7 +50,9 @@ enum MenuMode {
 	SETUP_MODE		= 12,
 
 	// Rose Tattoo specific
-	LAB_MODE		= 20
+	LAB_MODE		= 20,
+	MESSAGE_MODE	= 21,
+	VERB_MODE		= 22
 };
 
 class UserInterface {






More information about the Scummvm-git-logs mailing list