From b44d93d068e3309dd5c994c64fd06c4d25aa24f1 Mon Sep 17 00:00:00 2001 From: Max Horn Date: Sun, 18 Mar 2007 18:55:11 +0000 Subject: QUEEN: Make use of EventManager::getMousePos svn-id: r26224 --- engines/queen/command.cpp | 14 ++++++++------ engines/queen/input.cpp | 13 ++----------- engines/queen/input.h | 6 ------ engines/queen/logic.cpp | 23 +++++++++++++---------- engines/queen/talk.cpp | 9 ++++++--- 5 files changed, 29 insertions(+), 36 deletions(-) (limited to 'engines/queen') diff --git a/engines/queen/command.cpp b/engines/queen/command.cpp index 42e8634270..9a4896c68b 100644 --- a/engines/queen/command.cpp +++ b/engines/queen/command.cpp @@ -21,6 +21,8 @@ */ #include "common/stdafx.h" +#include "common/events.h" +#include "common/system.h" #include "queen/command.h" #include "queen/display.h" @@ -269,10 +271,9 @@ void Command::executeCurrentAction() { void Command::updatePlayer() { if (_vm->logic()->joeWalk() != JWM_MOVE) { - int16 cx = _vm->input()->mousePosX(); - int16 cy = _vm->input()->mousePosY(); - lookForCurrentObject(cx, cy); - lookForCurrentIcon(cx, cy); + Common::Point mouse = g_system->getEventManager()->getMousePos(); + lookForCurrentObject(mouse.x, mouse.y); + lookForCurrentIcon(mouse.x, mouse.y); } if (_vm->input()->keyVerb() != VERB_NONE) { @@ -530,8 +531,9 @@ int16 Command::makeJoeWalkTo(int16 x, int16 y, int16 objNum, Verb v, bool mustWa } void Command::grabCurrentSelection() { - _selPosX = _vm->input()->mousePosX(); - _selPosY = _vm->input()->mousePosY(); + Common::Point mouse = g_system->getEventManager()->getMousePos(); + _selPosX = mouse.x; + _selPosY = mouse.y; uint16 zone = _vm->grid()->findObjectUnderCursor(_selPosX, _selPosY); _state.noun = _vm->grid()->findObjectNumber(zone); diff --git a/engines/queen/input.cpp b/engines/queen/input.cpp index 2d67e17385..02573d4d3e 100644 --- a/engines/queen/input.cpp +++ b/engines/queen/input.cpp @@ -52,8 +52,8 @@ Input::Input(Common::Language language, OSystem *system) : _system(system), _fastMode(false), _keyVerb(VERB_NONE), _cutawayRunning(false), _canQuit(false), _cutawayQuit(false), _dialogueRunning(false), _talkQuit(false), _quickSave(false), - _quickLoad(false), _debugger(false), _inKey(0), _mouse_x(0), - _mouse_y(0), _mouseButton(0), _idleTime(0) { + _quickLoad(false), _debugger(false), _inKey(0), + _mouseButton(0), _idleTime(0) { switch (language) { case Common::EN_ANY: @@ -108,21 +108,12 @@ void Input::delay(uint amount) { } break; - case Common::EVENT_MOUSEMOVE: - _mouse_x = event.mouse.x; - _mouse_y = event.mouse.y; - break; - case Common::EVENT_LBUTTONDOWN: _mouseButton |= MOUSE_LBUTTON; - _mouse_x = event.mouse.x; - _mouse_y = event.mouse.y; break; case Common::EVENT_RBUTTONDOWN: _mouseButton |= MOUSE_RBUTTON; - _mouse_x = event.mouse.x; - _mouse_y = event.mouse.y; break; case Common::EVENT_QUIT: diff --git a/engines/queen/input.h b/engines/queen/input.h index c83cc5da34..e1d3086b65 100644 --- a/engines/queen/input.h +++ b/engines/queen/input.h @@ -83,9 +83,6 @@ public: Verb keyVerb() const { return _keyVerb; } - int mousePosX() const { return _mouse_x; } - int mousePosY() const { return _mouse_y; } - int mouseButton() const { return _mouseButton; } void clearMouseButton() { _mouseButton = 0; } @@ -150,9 +147,6 @@ private: //! set by delay(); int _inKey; - //! set by delay(); - int _mouse_x, _mouse_y; - //! set by delay(); int _mouseButton; diff --git a/engines/queen/logic.cpp b/engines/queen/logic.cpp index 071f1778ba..eb63957aba 100644 --- a/engines/queen/logic.cpp +++ b/engines/queen/logic.cpp @@ -21,9 +21,12 @@ */ #include "common/stdafx.h" +#include "common/config-manager.h" +#include "common/events.h" +#include "common/system.h" + #include "queen/logic.h" -#include "common/config-manager.h" #include "queen/bankman.h" #include "queen/command.h" #include "queen/credits.h" @@ -1174,10 +1177,11 @@ void Logic::handlePinnacleRoom() { BobSlot *piton = _vm->graphics()->bob(7); // set scrolling value to mouse position to avoid glitch - _vm->display()->horizontalScroll(_vm->input()->mousePosX()); + Common::Point mouse = g_system->getEventManager()->getMousePos(); + _vm->display()->horizontalScroll(mouse.x); - joe->x = piton->x = 3 * _vm->input()->mousePosX() / 4 + 200; - joe->frameNum = _vm->input()->mousePosX() / 36 + 45; + joe->x = piton->x = 3 * mouse.x / 4 + 200; + joe->frameNum = mouse.x / 36 + 45; // bobs have been unpacked from animating objects, we don't need them // to animate anymore ; so turn animation off @@ -1193,19 +1197,18 @@ void Logic::handlePinnacleRoom() { while (_vm->input()->mouseButton() == 0 || _entryObj == 0) { _vm->update(); - int mx = _vm->input()->mousePosX(); - int my = _vm->input()->mousePosY(); + mouse = g_system->getEventManager()->getMousePos(); // update screen scrolling - _vm->display()->horizontalScroll(mx); + _vm->display()->horizontalScroll(mouse.x); // update bobs position / frame - joe->x = piton->x = 3 * mx / 4 + 200; - joe->frameNum = mx / 36 + 45; + joe->x = piton->x = 3 * mouse.x / 4 + 200; + joe->frameNum = mouse.x / 36 + 45; _vm->display()->clearTexts(5, 5); - uint16 curObj = _vm->grid()->findObjectUnderCursor(mx, my); + uint16 curObj = _vm->grid()->findObjectUnderCursor(mouse.x, mouse.y); if (curObj != 0 && curObj != prevObj) { _entryObj = 0; curObj += currentRoomData(); // global object number diff --git a/engines/queen/talk.cpp b/engines/queen/talk.cpp index f93674e2ff..fd8d6e1ec7 100644 --- a/engines/queen/talk.cpp +++ b/engines/queen/talk.cpp @@ -21,7 +21,10 @@ */ #include "common/stdafx.h" +#include "common/events.h" +#include "common/system.h" #include "common/rect.h" + #include "queen/talk.h" #include "queen/bankman.h" @@ -1268,7 +1271,8 @@ int16 Talk::selectSentence() { _vm->update(); - zone = _vm->grid()->findZoneForPos(GS_PANEL, _vm->input()->mousePosX(), _vm->input()->mousePosY()); + Common::Point mouse = g_system->getEventManager()->getMousePos(); + zone = _vm->grid()->findZoneForPos(GS_PANEL, mouse.x, mouse.y); int mouseButton = _vm->input()->mouseButton(); _vm->input()->clearMouseButton(); @@ -1326,8 +1330,7 @@ int16 Talk::selectSentence() { } _vm->input()->clearKeyVerb(); - } - else if (mouseButton) { + } else if (mouseButton) { selectedSentence = zone; } -- cgit v1.2.3