diff options
-rw-r--r-- | engines/gob/draw.cpp | 31 | ||||
-rw-r--r-- | engines/gob/draw.h | 1 | ||||
-rw-r--r-- | engines/gob/hotspots.cpp | 28 |
3 files changed, 57 insertions, 3 deletions
diff --git a/engines/gob/draw.cpp b/engines/gob/draw.cpp index 2d0cee5c7f..2168053835 100644 --- a/engines/gob/draw.cpp +++ b/engines/gob/draw.cpp @@ -744,7 +744,7 @@ void Draw::winTrace(int16 left, int16 top, int16 width, int16 height) { right = left + width - 1; bottom = top + height - 1; -// To be fixed : either wrong surface, r anything else, but crappy look. +// To be fixed : either wrong surface, or anything else, but crappy look. // _vm->_video->drawLine(*_frontSurface, left, top, right, top, 0); // _vm->_video->drawLine(*_frontSurface, left, top, left, bottom, 0); // _vm->_video->drawLine(*_frontSurface, left, bottom, right, bottom, 0); @@ -1284,6 +1284,35 @@ void Draw::winDraw(int16 fct) { } } +int16 Draw::isOverWin(int16 &dx, int16 &dy) { + int16 bestMatch = -1; + + warning("isOverWin"); + if ((_vm->_draw->_renderFlags & 128) == 0) + return -1; + + for (int i = 0; i < 10; i++) + if (_fascinWin[i].id != -1) { + if ((_vm->_global->_inter_mouseX >= _fascinWin[i].left) && + (_vm->_global->_inter_mouseX < _fascinWin[i].left + _fascinWin[i].width) && + (_vm->_global->_inter_mouseY >= _fascinWin[i].top) && + (_vm->_global->_inter_mouseY < _fascinWin[i].top + _fascinWin[i].height)) { + + if (_fascinWin[i].id == _winCount - 1) { + dx = _fascinWin[i].left; + dy = _fascinWin[i].top; + return(i); + } else + if (_fascinWin[i].id > bestMatch) + bestMatch = _fascinWin[i].id; + } + } + + if (bestMatch != -1) + return(0); + else + return(-1); +} int32 Draw::getSpriteRectSize(int16 index) { if (!_spritesArray[index]) return 0; diff --git a/engines/gob/draw.h b/engines/gob/draw.h index 52a0f37845..4f5576ac0d 100644 --- a/engines/gob/draw.h +++ b/engines/gob/draw.h @@ -199,6 +199,7 @@ public: void handleWinBorder(int16 id); void winDraw(int16 fct); void winTrace(int16 left, int16 top, int16 width, int16 height); + int16 isOverWin(int16 &dx, int16 &dy); int32 getSpriteRectSize(int16 index); void forceBlit(bool backwards = false); diff --git a/engines/gob/hotspots.cpp b/engines/gob/hotspots.cpp index 92211cbea2..84d78b257a 100644 --- a/engines/gob/hotspots.cpp +++ b/engines/gob/hotspots.cpp @@ -551,6 +551,22 @@ uint16 Hotspots::checkMouse(Type type, uint16 &id, uint16 &index) const { id = 0; index = 0; + int16 dx = 0; + int16 dy = 0; + int16 winId = -1; + + if (_vm->getGameType() == kGameTypeFascination) + winId = _vm->_draw->isOverWin(dx, dy); + + warning("checkmouse %d - %d %d",winId, dx, dy); + + if (winId < 0) { + winId = 0; + dx = 0; + dy = 0; + } else + winId *= 256; + if (type == kTypeMove) { // Check where the mouse was moved to @@ -561,6 +577,10 @@ uint16 Hotspots::checkMouse(Type type, uint16 &id, uint16 &index) const { // Only consider enabled hotspots continue; +//Strangerke, for Fascination + if ((spot.flags & 0xFF00) != winId) + continue; + if (spot.getType() > kTypeMove) // Only consider click and move hotspots continue; @@ -569,7 +589,7 @@ uint16 Hotspots::checkMouse(Type type, uint16 &id, uint16 &index) const { // Only check the main window continue; - if (!spot.isIn(_vm->_global->_inter_mouseX, _vm->_global->_inter_mouseY)) + if (!spot.isIn(_vm->_global->_inter_mouseX - dx, _vm->_global->_inter_mouseY - dy)) // If we're not in it, ignore it continue; @@ -591,6 +611,10 @@ uint16 Hotspots::checkMouse(Type type, uint16 &id, uint16 &index) const { // Only consider enabled hotspots continue; +//Strangerke, for Fascination + if ((spot.flags & 0xFF00) != winId) + continue; + if (spot.getWindow() != 0) // Only check the main window continue; @@ -599,7 +623,7 @@ uint16 Hotspots::checkMouse(Type type, uint16 &id, uint16 &index) const { // Only consider hotspots that can be clicked continue; - if (!spot.isIn(_vm->_global->_inter_mouseX, _vm->_global->_inter_mouseY)) + if (!spot.isIn(_vm->_global->_inter_mouseX - dx, _vm->_global->_inter_mouseY - dy)) // If we're not in it, ignore it continue; |