diff options
author | Paul Gilbert | 2014-08-30 11:52:48 -0400 |
---|---|---|
committer | Paul Gilbert | 2014-08-30 11:52:48 -0400 |
commit | 2cca520465dd8005aa3ee21b25961afbde227afd (patch) | |
tree | 4434a993ffc75ab73808fb85e4c169b54d17c800 | |
parent | 949033ea9242f8ce0ae7c6906c8c5d6831929056 (diff) | |
download | scummvm-rg350-2cca520465dd8005aa3ee21b25961afbde227afd.tar.gz scummvm-rg350-2cca520465dd8005aa3ee21b25961afbde227afd.tar.bz2 scummvm-rg350-2cca520465dd8005aa3ee21b25961afbde227afd.zip |
ACCESS: Add new support for mouse wheel for cycling through cursors
-rw-r--r-- | engines/access/events.cpp | 16 | ||||
-rw-r--r-- | engines/access/events.h | 2 | ||||
-rw-r--r-- | engines/access/room.cpp | 29 | ||||
-rw-r--r-- | engines/access/room.h | 5 |
4 files changed, 49 insertions, 3 deletions
diff --git a/engines/access/events.cpp b/engines/access/events.cpp index 7366905b0c..0a754305b2 100644 --- a/engines/access/events.cpp +++ b/engines/access/events.cpp @@ -40,6 +40,8 @@ EventsManager::EventsManager(AccessEngine *vm): _vm(vm) { _frameCounter = 10; _priorFrameTime = 0; _leftButton = _rightButton = false; + _middleButton = false; + _wheelUp = _wheelDown = false; _mouseCol = _mouseRow = 0; _cursorExitFlag = false; } @@ -122,6 +124,8 @@ void EventsManager::pollEvents() { nextFrame(); } + _wheelUp = _wheelDown = false; + Common::Event event; while (g_system->getEventManager()->pollEvent(event)) { switch (event.type) { @@ -158,6 +162,18 @@ void EventsManager::pollEvents() { case Common::EVENT_RBUTTONUP: _rightButton = false; return; + case Common::EVENT_MBUTTONDOWN: + _middleButton = true; + return; + case Common::EVENT_MBUTTONUP: + _middleButton = false; + return; + case Common::EVENT_WHEELUP: + _wheelUp = true; + return; + case Common::EVENT_WHEELDOWN: + _wheelDown = true; + return; default: break; } diff --git a/engines/access/events.h b/engines/access/events.h index 014ff239b9..6b46086d9a 100644 --- a/engines/access/events.h +++ b/engines/access/events.h @@ -55,6 +55,8 @@ public: CursorType _cursorId; CursorType _normalMouse; bool _leftButton, _rightButton; + bool _middleButton; + bool _wheelUp, _wheelDown; Common::Point _mousePos; int _mouseCol, _mouseRow; bool _cursorExitFlag; diff --git a/engines/access/room.cpp b/engines/access/room.cpp index d4e8886cac..a7b619c238 100644 --- a/engines/access/room.cpp +++ b/engines/access/room.cpp @@ -79,7 +79,7 @@ void Room::doRoom() { _vm->_screen->fadeIn(); } - // Handle any events + // Poll for events _vm->_canSaveLoad = true; _vm->_events->pollEvents(); _vm->_canSaveLoad = false; @@ -408,7 +408,16 @@ void Room::doCommands() { if (_vm->_screen->_screenChangeFlag) { _vm->_screen->_screenChangeFlag = false; _vm->_events->_cursorExitFlag = true; - executeCommand(4); + executeCommand(7); + } + else if (_vm->_events->_wheelUp || _vm->_events->_wheelDown) { + // Handle scrolling mouse wheel + cycleCommand(_vm->_events->_wheelUp ? 1 : -1); + + } else if (_vm->_events->_middleButton) { + // Switch back to walking + handleCommand(7); + } else if (_vm->_events->_leftButton) { if (_vm->_events->_mouseRow >= 22) { // Mouse in user interface area @@ -431,6 +440,20 @@ void Room::doCommands() { } } +void Room::cycleCommand(int incr) { + int command = _selectCommand + incr; + if (command < -1) + command = 6; + else if (command == -1) + command = 7; + else if (command == 1) + command = (incr == 1) ? 2 : 0; + else if (command == 4) + command = (incr == 1) ? 5 : 3; + + handleCommand(command); +} + void Room::handleCommand(int commandId) { if (commandId == 1) --commandId; @@ -494,7 +517,7 @@ void Room::executeCommand(int commandId) { _vm->_scripts->executeScript(); } _vm->_boxSelect = true; - break; + return; case 8: events.setCursor(CURSOR_HELP); break; diff --git a/engines/access/room.h b/engines/access/room.h index 1d540840e3..321ace4fd1 100644 --- a/engines/access/room.h +++ b/engines/access/room.h @@ -72,6 +72,11 @@ private: int calcLR(int yp); int calcUD(int xp); + /** + * Cycles forwards or backwards through the list of commands + */ + void cycleCommand(int incr); + bool checkCode(int v1, int v2); protected: void loadRoomData(const byte *roomData); |