Re-introduced Input::getMousePos and removed g_system-

svn-id: r26372
This commit is contained in:
Gregory Montoir 2007-04-02 19:12:17 +00:00
parent 20ec8d2d34
commit 38eab5c5df
5 changed files with 24 additions and 13 deletions

View File

@ -271,7 +271,7 @@ void Command::executeCurrentAction() {
void Command::updatePlayer() {
if (_vm->logic()->joeWalk() != JWM_MOVE) {
Common::Point mouse = g_system->getEventManager()->getMousePos();
Common::Point mouse = _vm->input()->getMousePos();
lookForCurrentObject(mouse.x, mouse.y);
lookForCurrentIcon(mouse.x, mouse.y);
}
@ -531,7 +531,7 @@ int16 Command::makeJoeWalkTo(int16 x, int16 y, int16 objNum, Verb v, bool mustWa
}
void Command::grabCurrentSelection() {
Common::Point mouse = g_system->getEventManager()->getMousePos();
Common::Point mouse = _vm->input()->getMousePos();
_selPosX = mouse.x;
_selPosY = mouse.y;

View File

@ -49,10 +49,10 @@ const Verb Input::_verbKeys[] = {
};
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),
_system(system), _eventMan(system->getEventManager()), _fastMode(false),
_keyVerb(VERB_NONE), _cutawayRunning(false), _canQuit(false),
_cutawayQuit(false), _dialogueRunning(false), _talkQuit(false),
_quickSave(false), _quickLoad(false), _debugger(false), _inKey(0),
_mouseButton(0), _idleTime(0) {
switch (language) {
@ -91,8 +91,7 @@ void Input::delay(uint amount) {
uint32 end = _system->getMillis() + amount;
do {
Common::Event event;
Common::EventManager *eventMan = _system->getEventManager();
while (eventMan->pollEvent(event)) {
while (_eventMan->pollEvent(event)) {
_idleTime = 0;
switch (event.type) {
case Common::EVENT_KEYDOWN:
@ -160,7 +159,7 @@ int Input::checkKeys() {
case KEY_DIGIT_4:
_keyVerb = VERB_DIGIT_4;
break;
case KEY_ESCAPE: // slip cutaway / dialogue
case KEY_ESCAPE: // skip cutaway / dialogue
if (_canQuit) {
if (_cutawayRunning) {
debug(6, "[Input::checkKeys] Setting _cutawayQuit to true");
@ -204,5 +203,8 @@ int Input::checkKeys() {
return inKey;
}
Common::Point Input::getMousePos() const {
return _eventMan->getMousePos();
}
} // End of namespace Queen

View File

@ -24,10 +24,15 @@
#define QUEEN_INPUT_H
#include "common/util.h"
#include "common/rect.h"
#include "queen/defs.h"
class OSystem;
namespace Common {
class EventManager;
}
namespace Queen {
class Input {
@ -36,7 +41,7 @@ public:
//! Adjust here to change delays!
enum {
DELAY_SHORT = 10,
DELAY_NORMAL = 100,
DELAY_NORMAL = 100, // 5 * 20ms
DELAY_SCREEN_BLANKER = 5 * 60 * 1000
};
enum {
@ -79,6 +84,8 @@ public:
Verb keyVerb() const { return _keyVerb; }
Common::Point getMousePos() const;
int mouseButton() const { return _mouseButton; }
void clearMouseButton() { _mouseButton = 0; }
@ -110,6 +117,8 @@ private:
//! used to get keyboard and mouse events
OSystem *_system;
Common::EventManager *_eventMan;
//! some cutaways require update() run faster
bool _fastMode;

View File

@ -1177,7 +1177,7 @@ void Logic::handlePinnacleRoom() {
BobSlot *piton = _vm->graphics()->bob(7);
// set scrolling value to mouse position to avoid glitch
Common::Point mouse = g_system->getEventManager()->getMousePos();
Common::Point mouse = _vm->input()->getMousePos();
_vm->display()->horizontalScroll(mouse.x);
joe->x = piton->x = 3 * mouse.x / 4 + 200;
@ -1197,7 +1197,7 @@ void Logic::handlePinnacleRoom() {
while (_vm->input()->mouseButton() == 0 || _entryObj == 0) {
_vm->update();
mouse = g_system->getEventManager()->getMousePos();
mouse = _vm->input()->getMousePos();
// update screen scrolling
_vm->display()->horizontalScroll(mouse.x);

View File

@ -1271,7 +1271,7 @@ int16 Talk::selectSentence() {
_vm->update();
Common::Point mouse = g_system->getEventManager()->getMousePos();
Common::Point mouse = _vm->input()->getMousePos();
zone = _vm->grid()->findZoneForPos(GS_PANEL, mouse.x, mouse.y);
int mouseButton = _vm->input()->mouseButton();