Fascination - Add a window specific function, modify checkmouse() function in order to use it (without breaking the other games). Windows are no longer "transparent"

svn-id: r47828
This commit is contained in:
Arnaud Boutonné 2010-02-02 23:39:19 +00:00
parent 4b063230b7
commit f072709f25
3 changed files with 57 additions and 3 deletions

View File

@ -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;

View File

@ -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);

View File

@ -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;