diff options
author | Strangerke | 2014-12-14 23:51:01 +0100 |
---|---|---|
committer | Strangerke | 2014-12-14 23:51:01 +0100 |
commit | 66bf0ec7412949eee758c138be1f81571b1fc56d (patch) | |
tree | 2bc9479fdc389e25e947990d0a1ee8dea6c3b51e /engines/access | |
parent | dcc6ceb117549a68a275b5740edea5e5e02030bd (diff) | |
download | scummvm-rg350-66bf0ec7412949eee758c138be1f81571b1fc56d.tar.gz scummvm-rg350-66bf0ec7412949eee758c138be1f81571b1fc56d.tar.bz2 scummvm-rg350-66bf0ec7412949eee758c138be1f81571b1fc56d.zip |
ACCESS: Some refactoring concerning the mouse cursor
Diffstat (limited to 'engines/access')
-rw-r--r-- | engines/access/amazon/amazon_game.cpp | 2 | ||||
-rw-r--r-- | engines/access/amazon/amazon_room.cpp | 5 | ||||
-rw-r--r-- | engines/access/events.cpp | 9 | ||||
-rw-r--r-- | engines/access/events.h | 10 | ||||
-rw-r--r-- | engines/access/inventory.cpp | 9 | ||||
-rw-r--r-- | engines/access/martian/martian_room.cpp | 2 | ||||
-rw-r--r-- | engines/access/room.cpp | 30 |
7 files changed, 37 insertions, 30 deletions
diff --git a/engines/access/amazon/amazon_game.cpp b/engines/access/amazon/amazon_game.cpp index 793a601d34..9a86642579 100644 --- a/engines/access/amazon/amazon_game.cpp +++ b/engines/access/amazon/amazon_game.cpp @@ -193,7 +193,7 @@ void AmazonEngine::initVariables() { _player->_playerX = _player->_rawPlayer.x = TRAVEL_POS[_player->_roomNumber][0]; _player->_playerY = _player->_rawPlayer.y = TRAVEL_POS[_player->_roomNumber][1]; _room->_selectCommand = -1; - _events->_normalMouse = CURSOR_CROSSHAIRS; + _events->setNormalCursor(CURSOR_CROSSHAIRS); _mouseMode = 0; _numAnimTimers = 0; } diff --git a/engines/access/amazon/amazon_room.cpp b/engines/access/amazon/amazon_room.cpp index d6ab2bd758..10b622c738 100644 --- a/engines/access/amazon/amazon_room.cpp +++ b/engines/access/amazon/amazon_room.cpp @@ -87,7 +87,7 @@ void AmazonRoom::reloadRoom1() { } _selectCommand = -1; - _vm->_events->_normalMouse = CURSOR_CROSSHAIRS; + _vm->_events->setNormalCursor(CURSOR_CROSSHAIRS); _vm->_mouseMode = 0; _vm->_boxSelect = true; _vm->_player->_playerOff = false; @@ -210,8 +210,7 @@ void AmazonRoom::walkCursor() { if (_vm->_events->_middleButton || (_vm->_player->_roomNumber == 29 && events._normalMouse != CURSOR_CROSSHAIRS)) { - events._normalMouse = CURSOR_CROSSHAIRS; - events.setCursor(CURSOR_CROSSHAIRS); + events.forceSetCursor(CURSOR_CROSSHAIRS); _selectCommand = -1; _vm->_boxSelect = true; } else { diff --git a/engines/access/events.cpp b/engines/access/events.cpp index 249ba15010..cd1880b338 100644 --- a/engines/access/events.cpp +++ b/engines/access/events.cpp @@ -54,6 +54,15 @@ EventsManager::~EventsManager() { _invCursor.free(); } +void EventsManager::forceSetCursor(CursorType cursorId) { + setNormalCursor(cursorId); + setCursor(cursorId); +} + +void EventsManager::setNormalCursor(CursorType cursorId) { + _normalMouse = cursorId; +} + void EventsManager::setCursor(CursorType cursorId) { if (cursorId == _cursorId) return; diff --git a/engines/access/events.h b/engines/access/events.h index c43bf472f0..fd3adf8797 100644 --- a/engines/access/events.h +++ b/engines/access/events.h @@ -83,6 +83,16 @@ public: uint32 getFrameCounter() { return _frameCounter; } /** + * Sets the cursor and reset the normal cursor + */ + void EventsManager::forceSetCursor(CursorType cursorId); + + /** + * Sets the normal cursor + */ + void EventsManager::setNormalCursor(CursorType cursorId); + + /** * Sets the cursor */ void setCursor(CursorType cursorId); diff --git a/engines/access/inventory.cpp b/engines/access/inventory.cpp index 20c9976a3b..49fa6e7efc 100644 --- a/engines/access/inventory.cpp +++ b/engines/access/inventory.cpp @@ -198,12 +198,9 @@ int InventoryManager::newDisplayInv() { if (!_invRefreshFlag) { if (_vm->_useItem == -1) { result = 2; - events._normalMouse = CURSOR_CROSSHAIRS; - events.setCursor(CURSOR_CROSSHAIRS); - } else { - events.setCursor(CURSOR_INVENTORY); - events._normalMouse = CURSOR_INVENTORY; - } + events.forceSetCursor(CURSOR_CROSSHAIRS); + } else + events.forceSetCursor(CURSOR_INVENTORY); } _invRefreshFlag = false; diff --git a/engines/access/martian/martian_room.cpp b/engines/access/martian/martian_room.cpp index 2bd98186f0..22f456fd4c 100644 --- a/engines/access/martian/martian_room.cpp +++ b/engines/access/martian/martian_room.cpp @@ -82,7 +82,7 @@ void MartianRoom::reloadRoom1() { } _selectCommand = -1; - _vm->_events->_normalMouse = CURSOR_CROSSHAIRS; + _vm->_events->setNormalCursor(CURSOR_CROSSHAIRS); _vm->_mouseMode = 0; _vm->_boxSelect = true; _vm->_player->_playerOff = false; diff --git a/engines/access/room.cpp b/engines/access/room.cpp index a33f773bac..f4826090b1 100644 --- a/engines/access/room.cpp +++ b/engines/access/room.cpp @@ -136,11 +136,11 @@ void Room::doRoom() { } else { _vm->plotList(); - if (_vm->_events->_mousePos.y < 177) { + if (_vm->_events->_mousePos.y < 177) _vm->_events->setCursor(_vm->_events->_normalMouse); - } else { + else _vm->_events->setCursor(CURSOR_ARROW); - } + _vm->copyBlocks(); } } @@ -512,16 +512,13 @@ void Room::executeCommand(int commandId) { switch (commandId) { case 0: - events._normalMouse = CURSOR_LOOK; - events.setCursor(CURSOR_LOOK); + events.forceSetCursor(CURSOR_LOOK); break; case 2: - events._normalMouse = CURSOR_USE; - events.setCursor(CURSOR_USE); + events.forceSetCursor(CURSOR_USE); break; case 3: - events._normalMouse = CURSOR_TAKE; - events.setCursor(CURSOR_TAKE); + events.forceSetCursor(CURSOR_TAKE); break; case 4: events.setCursor(CURSOR_ARROW); @@ -531,19 +528,16 @@ void Room::executeCommand(int commandId) { } break; case 5: - events._normalMouse = CURSOR_CLIMB; - events.setCursor(CURSOR_CLIMB); + events.forceSetCursor(CURSOR_CLIMB); break; case 6: - events._normalMouse = CURSOR_TALK; - events.setCursor(CURSOR_TALK); + events.forceSetCursor(CURSOR_TALK); break; case 7: walkCursor(); return; case 8: - events._normalMouse = CURSOR_HELP; - events.setCursor(CURSOR_HELP); + events.forceSetCursor(CURSOR_HELP); break; default: break; @@ -570,8 +564,7 @@ void Room::executeCommand(int commandId) { void Room::walkCursor() { EventsManager &events = *_vm->_events; - events._normalMouse = CURSOR_CROSSHAIRS; - events.setCursor(CURSOR_CROSSHAIRS); + events.forceSetCursor(CURSOR_CROSSHAIRS); _vm->_scripts->_sequence = 5000; _vm->_scripts->searchForSequence(); roomMenu(); @@ -588,8 +581,7 @@ void Room::walkCursor() { void Room::commandOff() { _selectCommand = -1; - _vm->_events->_normalMouse = CURSOR_CROSSHAIRS; - _vm->_events->setCursor(CURSOR_CROSSHAIRS); + _vm->_events->forceSetCursor(CURSOR_CROSSHAIRS); roomMenu(); } |