aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/sherlock/scalpel/scalpel_user_interface.cpp2
-rw-r--r--engines/sherlock/scene.cpp4
-rw-r--r--engines/sherlock/scene.h6
-rw-r--r--engines/sherlock/sherlock.cpp1
-rw-r--r--engines/sherlock/sherlock.h1
-rw-r--r--engines/sherlock/tattoo/tattoo.cpp2
-rw-r--r--engines/sherlock/tattoo/tattoo.h1
-rw-r--r--engines/sherlock/tattoo/tattoo_scene.cpp2
-rw-r--r--engines/sherlock/tattoo/tattoo_scene.h2
-rw-r--r--engines/sherlock/tattoo/tattoo_user_interface.cpp101
-rw-r--r--engines/sherlock/tattoo/tattoo_user_interface.h46
-rw-r--r--engines/sherlock/user_interface.h4
12 files changed, 164 insertions, 8 deletions
diff --git a/engines/sherlock/scalpel/scalpel_user_interface.cpp b/engines/sherlock/scalpel/scalpel_user_interface.cpp
index ef9221882e..dc5ab01020 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 22a0e3620e..efb2b90b4c 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 98b29903c5..0fd3483756 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 9c397e3794..3c12d84aa4 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 ad840a6dcf..6e87c1c5ef 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 60803c7fbb..60705f6016 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 6cafc3fe52..2342f56da3 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 73b6b652a9..31d497dfe7 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 7c432b4268..ed5f46a6cf 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 084d52acc6..dff759be3d 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 a04239b39b..c827b9ad75 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 a9fb8cb0ea..7b79b53f6b 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 {