diff options
author | Paul Gilbert | 2015-06-13 11:38:12 -0400 |
---|---|---|
committer | Paul Gilbert | 2015-06-13 11:38:12 -0400 |
commit | debe270d6f5595f5dbf50a8c7e7eeb888c247f8d (patch) | |
tree | 1dbb7e4d1d64d4e80fffbaa57f72cfc50fe27ab6 /engines/sherlock/tattoo | |
parent | cacf8fbcb0939f34eecc1b982b767f198a7bed16 (diff) | |
download | scummvm-rg350-debe270d6f5595f5dbf50a8c7e7eeb888c247f8d.tar.gz scummvm-rg350-debe270d6f5595f5dbf50a8c7e7eeb888c247f8d.tar.bz2 scummvm-rg350-debe270d6f5595f5dbf50a8c7e7eeb888c247f8d.zip |
SHERLOCK: RT: Implemented handleInput method
Diffstat (limited to 'engines/sherlock/tattoo')
-rw-r--r-- | engines/sherlock/tattoo/tattoo.cpp | 2 | ||||
-rw-r--r-- | engines/sherlock/tattoo/tattoo.h | 1 | ||||
-rw-r--r-- | engines/sherlock/tattoo/tattoo_scene.cpp | 2 | ||||
-rw-r--r-- | engines/sherlock/tattoo/tattoo_scene.h | 2 | ||||
-rw-r--r-- | engines/sherlock/tattoo/tattoo_user_interface.cpp | 101 | ||||
-rw-r--r-- | engines/sherlock/tattoo/tattoo_user_interface.h | 46 |
6 files changed, 150 insertions, 4 deletions
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; |