aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorStrangerke2016-05-17 07:09:42 +0200
committerStrangerke2016-05-17 07:09:42 +0200
commit63589812018eafc0c7ed4b7a8b77b7e048db10ad (patch)
tree5f66556781ff44ff6710605aed2df99de7bfd37d /engines
parente024a26ccdd95893839a35325c17276a7a01107e (diff)
downloadscummvm-rg350-63589812018eafc0c7ed4b7a8b77b7e048db10ad.tar.gz
scummvm-rg350-63589812018eafc0c7ed4b7a8b77b7e048db10ad.tar.bz2
scummvm-rg350-63589812018eafc0c7ed4b7a8b77b7e048db10ad.zip
GNAP: USe Common::Point for mouse position, initialize some more variables
Diffstat (limited to 'engines')
-rw-r--r--engines/gnap/gnap.cpp17
-rw-r--r--engines/gnap/gnap.h2
2 files changed, 11 insertions, 8 deletions
diff --git a/engines/gnap/gnap.cpp b/engines/gnap/gnap.cpp
index 2a143ad141..21f44c3e59 100644
--- a/engines/gnap/gnap.cpp
+++ b/engines/gnap/gnap.cpp
@@ -103,6 +103,10 @@ GnapEngine::GnapEngine(OSystem *syst, const ADGameDescription *gd) :
_savedTimers[i] = _timers[i] = 0;
_isWaiting = false;
+ _sceneWaiting = false;
+
+ _mousePos = Common::Point(0, 0);
+ _currGrabCursorX = _currGrabCursorY = 0;
}
GnapEngine::~GnapEngine() {
@@ -205,8 +209,7 @@ void GnapEngine::updateEvents() {
_keyDownState[event.kbd.keycode] = 0;
break;
case Common::EVENT_MOUSEMOVE:
- _mouseX = event.mouse.x;
- _mouseY = event.mouse.y;
+ _mousePos = event.mouse;
break;
case Common::EVENT_LBUTTONUP:
_mouseButtonState._left = false;
@@ -352,7 +355,7 @@ int GnapEngine::getHotspotIndexAtPos(Common::Point pos) {
void GnapEngine::updateCursorByHotspot() {
if (!_isWaiting) {
- int hotspotIndex = getHotspotIndexAtPos(Common::Point(_mouseX, _mouseY));
+ int hotspotIndex = getHotspotIndexAtPos(_mousePos);
if (_debugger->_showHotspotNumber) {
// NOTE This causes some display glitches
@@ -474,8 +477,8 @@ void GnapEngine::setGrabCursorSprite(int index) {
void GnapEngine::createGrabCursorSprite(int spriteId) {
_grabCursorSprite = _gameSys->createSurface(spriteId);
_gameSys->insertSpriteDrawItem(_grabCursorSprite,
- _mouseX - (_grabCursorSprite->w / 2),
- _mouseY - (_grabCursorSprite->h / 2),
+ _mousePos.x - (_grabCursorSprite->w / 2),
+ _mousePos.y - (_grabCursorSprite->h / 2),
300);
delayTicks(5);
}
@@ -491,8 +494,8 @@ void GnapEngine::freeGrabCursorSprite() {
void GnapEngine::updateGrabCursorSprite(int x, int y) {
if (_grabCursorSprite) {
- int newGrabCursorX = _mouseX - (_grabCursorSprite->w / 2) - x;
- int newGrabCursorY = _mouseY - (_grabCursorSprite->h / 2) - y;
+ int newGrabCursorX = _mousePos.x - (_grabCursorSprite->w / 2) - x;
+ int newGrabCursorY = _mousePos.y - (_grabCursorSprite->h / 2) - y;
if (_currGrabCursorX != newGrabCursorX || _currGrabCursorY != newGrabCursorY) {
_currGrabCursorX = newGrabCursorX;
_currGrabCursorY = newGrabCursorY;
diff --git a/engines/gnap/gnap.h b/engines/gnap/gnap.h
index 45f675c848..3cedf1b9fe 100644
--- a/engines/gnap/gnap.h
+++ b/engines/gnap/gnap.h
@@ -286,7 +286,7 @@ public:
int _newCursorValue, _cursorValue;
int _verbCursor, _cursorIndex;
- int _mouseX, _mouseY;
+ Common::Point _mousePos;
int _leftClickMouseX, _leftClickMouseY;
Graphics::Surface *_grabCursorSprite;