diff options
-rw-r--r-- | engines/tsage/core.cpp | 19 | ||||
-rw-r--r-- | engines/tsage/events.cpp | 17 | ||||
-rw-r--r-- | engines/tsage/events.h | 6 | ||||
-rw-r--r-- | engines/tsage/scenes.cpp | 2 |
4 files changed, 30 insertions, 14 deletions
diff --git a/engines/tsage/core.cpp b/engines/tsage/core.cpp index 405a5206bc..4b27e77687 100644 --- a/engines/tsage/core.cpp +++ b/engines/tsage/core.cpp @@ -59,6 +59,8 @@ InvObject::InvObject(int sceneNumber, int rlbNum, int cursorNum, CursorType curs } void InvObject::setCursor() { + _globals->_events._currentCursor = _cursorId; + if (_iconResNum != -1) { GfxSurface s = surfaceFromRes(_iconResNum, _rlbNum, _cursorNum); @@ -1310,7 +1312,6 @@ void ScenePalette::changeBackground(const Rect &bounds, FadeMode fadeMode) { _globals->_screenSurface.copyFrom(_globals->_sceneManager._scene->_backSurface, bounds, Rect(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT), NULL); - _globals->_events.showCursor(); tempPalette._listeners.clear2(); } @@ -2511,19 +2512,23 @@ void Player::postInit(SceneObjectList *OwnerList) { void Player::disableControl() { _canWalk = false; _uiEnabled = false; - _globals->_events.hideCursor(); + _globals->_events.setCursor(CURSOR_NONE); } void Player::enableControl() { _canWalk = true; _uiEnabled = true; - _globals->_events.showCursor(); + _globals->_events.setCursor(CURSOR_WALK); switch (_globals->_events.getCursor()) { - case CURSOR_CROSSHAIRS: - _globals->_events.setCursor(CURSOR_WALK); + case CURSOR_WALK: + case CURSOR_LOOK: + case CURSOR_USE: + case CURSOR_TALK: + _globals->_events.setCursor(_globals->_events.getCursor()); break; default: + _globals->_events.setCursor(CURSOR_WALK); break; } } @@ -3314,8 +3319,8 @@ void SceneHandler::process(Event &event) { if (_globals->_sceneManager._scene) _globals->_sceneManager._scene->process(event); - // Separate check for F5 - Save key if (!event.handled) { + // Separate check for F5 - Save key if ((event.eventType == EVENT_KEYPRESS) && (event.kbd.keycode == Common::KEYCODE_F5)) { // F5 - Save _globals->_game.saveGame(); @@ -3344,7 +3349,7 @@ void SceneHandler::process(Event &event) { (*i)->doAction(_globals->_events.getCursor()); event.handled = _globals->_events.getCursor() != CURSOR_WALK; - if (!_globals->_player._uiEnabled && !_globals->_player._canWalk && + if (_globals->_player._uiEnabled && _globals->_player._canWalk && (_globals->_events.getCursor() != CURSOR_LOOK)) { _globals->_events.setCursor(CURSOR_WALK); } else if (_globals->_player._canWalk && (_globals->_events.getCursor() != CURSOR_LOOK)) { diff --git a/engines/tsage/events.cpp b/engines/tsage/events.cpp index 2b27fa74a3..be3b7e3f53 100644 --- a/engines/tsage/events.cpp +++ b/engines/tsage/events.cpp @@ -137,8 +137,16 @@ bool EventsClass::getEvent(Event &evt, int eventMask) { void EventsClass::setCursor(CursorType cursorType) { _globals->clearFlag(122); - if (cursorType != CURSOR_ARROW) - _currentCursor = cursorType; + if ((_currentCursor == cursorType) && CursorMan.isVisible()) + return; + + if (cursorType == CURSOR_NONE) { + if (CursorMan.isVisible()) + CursorMan.showMouse(false); + return; + } + + CursorMan.showMouse(true); const byte *cursor; bool delFlag = true; @@ -154,16 +162,19 @@ void EventsClass::setCursor(CursorType cursorType) { case CURSOR_LOOK: // Look cursor cursor = _vm->_dataManager->getSubResource(4, 1, 5, &size); + _currentCursor = CURSOR_LOOK; break; case CURSOR_USE: // Use cursor cursor = _vm->_dataManager->getSubResource(4, 1, 4, &size); + _currentCursor = CURSOR_USE; break; case CURSOR_TALK: // Talk cursor cursor = _vm->_dataManager->getSubResource(4, 1, 3, &size); + _currentCursor = CURSOR_TALK; break; case CURSOR_ARROW: @@ -172,9 +183,11 @@ void EventsClass::setCursor(CursorType cursorType) { delFlag = false; break; + case CURSOR_WALK: default: // Walk cursor cursor = CURSOR_WALK_DATA; + _currentCursor = CURSOR_WALK; delFlag = false; break; } diff --git a/engines/tsage/events.h b/engines/tsage/events.h index 093d392a48..d8f58a4ce2 100644 --- a/engines/tsage/events.h +++ b/engines/tsage/events.h @@ -65,14 +65,13 @@ enum CursorType { OBJECT_NULLIFIER = 25, OBJECT_PEG = 26, OBJECT_VIAL = 27, OBJECT_JACKET = 28, OBJECT_TUNIC2 = 29, OBJECT_BONE = 30, OBJECT_EMPTY_JAR = 31, OBJECT_JAR = 32, - CURSOR_WALK = 0x100, CURSOR_LOOK = 0x200, - CURSOR_700 = 700, CURSOR_USE = 0x400, CURSOR_TALK = 0x800, CURSOR_CROSSHAIRS = 0xfffe, CURSOR_ARROW = 0xffff + CURSOR_WALK = 0x100, CURSOR_LOOK = 0x200, CURSOR_700 = 700, CURSOR_USE = 0x400, CURSOR_TALK = 0x800, + CURSOR_NONE = -1, CURSOR_CROSSHAIRS = -2, CURSOR_ARROW = -3 }; class EventsClass: public SaveListener { private: Common::Event _event; - CursorType _currentCursor; uint32 _frameNumber; uint32 _prevDelayFrame; uint32 _priorFrameTime; @@ -80,6 +79,7 @@ public: EventsClass(); Common::Point _mousePos; + CursorType _currentCursor; void setCursor(CursorType cursorType); void setCursor(Graphics::Surface &cursor, int transColour, const Common::Point &hotspot, CursorType cursorId); diff --git a/engines/tsage/scenes.cpp b/engines/tsage/scenes.cpp index 7175fc1371..e0ef87f66b 100644 --- a/engines/tsage/scenes.cpp +++ b/engines/tsage/scenes.cpp @@ -298,8 +298,6 @@ void Scene::loadSceneData(int sceneNum) { // Load the background for the scene loadBackground(0, 0); - - _globals->_events.showCursor(); } void Scene::loadBackground(int xAmount, int yAmount) { |