diff options
author | Strangerke | 2016-05-12 07:53:06 +0200 |
---|---|---|
committer | Strangerke | 2016-05-12 07:53:06 +0200 |
commit | af1cf151de9ffc9d040a4e52b57fe3dfd754969b (patch) | |
tree | 728eebf4d7f0ac38078b226d4d3b71a14ec07d72 /engines/gnap | |
parent | f467db5ed23cdaa96fb0601ae1b05853f44e3356 (diff) | |
download | scummvm-rg350-af1cf151de9ffc9d040a4e52b57fe3dfd754969b.tar.gz scummvm-rg350-af1cf151de9ffc9d040a4e52b57fe3dfd754969b.tar.bz2 scummvm-rg350-af1cf151de9ffc9d040a4e52b57fe3dfd754969b.zip |
GNAP: Use Common::Rect for hotspots
Diffstat (limited to 'engines/gnap')
-rw-r--r-- | engines/gnap/gnap.cpp | 28 | ||||
-rw-r--r-- | engines/gnap/gnap.h | 14 | ||||
-rw-r--r-- | engines/gnap/grid.cpp | 9 | ||||
-rw-r--r-- | engines/gnap/menu.cpp | 141 | ||||
-rw-r--r-- | engines/gnap/scenes/group1.cpp | 28 | ||||
-rw-r--r-- | engines/gnap/scenes/group2.cpp | 4 | ||||
-rw-r--r-- | engines/gnap/scenes/group4.cpp | 8 |
7 files changed, 73 insertions, 159 deletions
diff --git a/engines/gnap/gnap.cpp b/engines/gnap/gnap.cpp index 24de6ea40d..d9c0971d8c 100644 --- a/engines/gnap/gnap.cpp +++ b/engines/gnap/gnap.cpp @@ -324,26 +324,24 @@ void GnapEngine::delayTicksCursor(int a1) { void GnapEngine::setHotspot(int index, int16 x1, int16 y1, int16 x2, int16 y2, uint16 flags, int16 walkX, int16 walkY) { - _hotspots[index]._x1 = x1; - _hotspots[index]._y1 = y1; - _hotspots[index]._x2 = x2; - _hotspots[index]._y2 = y2; + _hotspots[index]._rect = Common::Rect(x1, y1, x2, y2); _hotspots[index]._flags = flags; _hotspots[index]._id = index; _hotspotsWalkPos[index].x = walkX; _hotspotsWalkPos[index].y = walkY; } -int GnapEngine::getHotspotIndexAtPos(int16 x, int16 y) { - for (int i = 0; i < _hotspotsCount; ++i) - if (!_hotspots[i].isFlag(SF_DISABLED) && _hotspots[i].isPointInside(x, y)) +int GnapEngine::getHotspotIndexAtPos(Common::Point pos) { + for (int i = 0; i < _hotspotsCount; ++i) { + if (!_hotspots[i].isFlag(SF_DISABLED) && _hotspots[i].isPointInside(pos)) return i; + } return -1; } void GnapEngine::updateCursorByHotspot() { if (!_isWaiting) { - int hotspotIndex = getHotspotIndexAtPos(_mouseX, _mouseY); + int hotspotIndex = getHotspotIndexAtPos(Common::Point(_mouseX, _mouseY)); if (_debugger->_showHotspotNumber) { // NOTE This causes some display glitches so don't worry @@ -377,10 +375,8 @@ void GnapEngine::updateCursorByHotspot() { setCursor(kDisabledCursors[_verbCursor]); } // Update platypus hotspot - _hotspots[0]._x1 = _gridMinX + 75 * _plat->_pos.x - 30; - _hotspots[0]._y1 = _gridMinY + 48 * _plat->_pos.y - 100; - _hotspots[0]._x2 = _gridMinX + 75 * _plat->_pos.x + 30; - _hotspots[0]._y2 = _gridMinY + 48 * _plat->_pos.y; + _hotspots[0]._rect = Common::Rect(_gridMinX + 75 * _plat->_pos.x - 30, _gridMinY + 48 * _plat->_pos.y - 100 + , _gridMinX + 75 * _plat->_pos.x + 30, _gridMinY + 48 * _plat->_pos.y); } int GnapEngine::getClickedHotspotId() { @@ -388,7 +384,7 @@ int GnapEngine::getClickedHotspotId() { if (_isWaiting) _mouseClickState._left = false; else if (_mouseClickState._left) { - int hotspotIndex = getHotspotIndexAtPos(_leftClickMouseX, _leftClickMouseY); + int hotspotIndex = getHotspotIndexAtPos(Common::Point(_leftClickMouseX, _leftClickMouseY)); if (hotspotIndex >= 0) { _mouseClickState._left = false; _timers[3] = 300; @@ -578,10 +574,8 @@ void GnapEngine::setDeviceHotspot(int hotspotIndex, int x1, int y1, int x2, int _deviceY1 = 14; if (y2 == -1) _deviceY2 = 79; - _hotspots[hotspotIndex]._x1 = _deviceX1; - _hotspots[hotspotIndex]._y1 = _deviceY1; - _hotspots[hotspotIndex]._x2 = _deviceX2; - _hotspots[hotspotIndex]._y2 = _deviceY2; + + _hotspots[hotspotIndex]._rect = Common::Rect(_deviceX1, _deviceY1, _deviceX2, _deviceY2); _hotspots[hotspotIndex]._flags = SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR; _hotspots[hotspotIndex]._id = hotspotIndex; } diff --git a/engines/gnap/gnap.h b/engines/gnap/gnap.h index 2119ad6cac..45ac584a26 100644 --- a/engines/gnap/gnap.h +++ b/engines/gnap/gnap.h @@ -66,15 +66,21 @@ struct MouseButtonState { }; struct Hotspot { - int16 _x1, _y1, _x2, _y2; + Common::Rect _rect; uint16 _flags; int _id; - bool isPointInside(int16 x, int16 y) const { - return x >= _x1 && x <= _x2 && y >= _y1 && y <= _y2; + + bool isPointInside(Common::Point pos) const { + return _rect.contains(pos); } + bool isFlag(uint16 flag) const { return (_flags & flag) != 0; } + + void clearRect() { + _rect = Common::Rect(0, 0, 0, 0); + } }; const int kMaxTimers = 10; @@ -319,7 +325,7 @@ public: void setHotspot(int index, int16 x1, int16 y1, int16 x2, int16 y2, uint16 flags = 0, int16 walkX = -1, int16 walkY = -1); - int getHotspotIndexAtPos(int16 x, int16 y); + int getHotspotIndexAtPos(Common::Point pos); void updateCursorByHotspot(); int getClickedHotspotId(); diff --git a/engines/gnap/grid.cpp b/engines/gnap/grid.cpp index 076705cd03..a89c87c61d 100644 --- a/engines/gnap/grid.cpp +++ b/engines/gnap/grid.cpp @@ -47,16 +47,13 @@ bool GnapEngine::isPointBlocked(int gridX, int gridY) { if (gridX < 0 || gridX >= _gridMaxX || gridY < 0 || gridY >= _gridMaxY) return true; - if ((_gnap->_pos == Common::Point(gridX, gridY)) || (gridX == _plat->_pos.x && gridY == _plat->_pos.y)) + if ((_gnap->_pos == Common::Point(gridX, gridY)) || (_plat->_pos == Common::Point(gridX, gridY))) return true; - const int x = _gridMinX + 75 * gridX; - const int y = _gridMinY + 48 * gridY; + Common::Point pos = Common::Point(_gridMinX + 75 * gridX, _gridMinY + 48 * gridY); for (int i = 0; i < _hotspotsCount; ++i) { - if (x >= _hotspots[i]._x1 && x <= _hotspots[i]._x2 && - y >= _hotspots[i]._y1 && y <= _hotspots[i]._y2 && - !(_hotspots[i]._flags & SF_WALKABLE)) + if (_hotspots[i].isPointInside(pos) && !(_hotspots[i]._flags & SF_WALKABLE)) return true; } diff --git a/engines/gnap/menu.cpp b/engines/gnap/menu.cpp index 1ce2751a27..78bffefa1e 100644 --- a/engines/gnap/menu.cpp +++ b/engines/gnap/menu.cpp @@ -48,36 +48,24 @@ void GnapEngine::initMenuHotspots1() { for (int i = 0; i < 3; ++i) { for (int j = 0; j < 3; ++j) { - _hotspots[curId]._x1 = 87 * j + 262; - _hotspots[curId]._y1 = 74 * i + 69; - _hotspots[curId]._x2 = _hotspots[curId]._x1 + 79; - _hotspots[curId]._y2 = _hotspots[curId]._y1 + 66; + _hotspots[curId]._rect = Common::Rect(87 * j + 262, 74 * i + 69, _hotspots[curId]._rect.left + 79, _hotspots[curId]._rect.top + 66); _hotspots[curId]._flags = SF_NONE; _hotspots[curId]._id = curId; ++curId; } } - _hotspots[curId]._x1 = 330; - _hotspots[curId]._y1 = 350; - _hotspots[curId]._x2 = 430; - _hotspots[curId]._y2 = 460; + _hotspots[curId]._rect = Common::Rect(330, 350, 430, 460); _hotspots[curId]._flags = SF_GRAB_CURSOR; _hotspots[curId]._id = curId; ++curId; - _hotspots[curId]._x1 = 180; - _hotspots[curId]._y1 = 15; - _hotspots[curId]._x2 = 620; - _hotspots[curId]._y2 = 580; + _hotspots[curId]._rect = Common::Rect(180, 15, 620, 580); _hotspots[curId]._flags = SF_NONE; _hotspots[curId]._id = curId; ++curId; - _hotspots[curId]._x1 = 0; - _hotspots[curId]._y1 = 0; - _hotspots[curId]._x2 = 799; - _hotspots[curId]._y2 = 599; + _hotspots[curId]._rect = Common::Rect(0, 0, 799, 599); _hotspots[curId]._flags = SF_NONE; _hotspots[curId]._id = curId; @@ -88,43 +76,28 @@ void GnapEngine::initMenuHotspots2() { int curId = 0; for (int i = 0; i < 4; ++i) { - _hotspots[curId]._x1 = 312; - _hotspots[curId]._y1 = 48 * i + 85; - _hotspots[curId]._x2 = _hotspots[curId]._x1 + 153; - _hotspots[curId]._y2 = _hotspots[curId]._y1 + 37; + _hotspots[curId]._rect = Common::Rect(312, 48 * i + 85, _hotspots[curId]._rect.left + 153, _hotspots[curId]._rect.top + 37); _hotspots[curId]._flags = SF_GRAB_CURSOR; _hotspots[curId]._id = curId; ++curId; } - _hotspots[curId]._x1 = 500; - _hotspots[curId]._y1 = 72; - _hotspots[curId]._x2 = 527; - _hotspots[curId]._y2 = 99; + _hotspots[curId]._rect = Common::Rect(500, 72, 527, 99); _hotspots[curId]._flags = SF_DISABLED; _hotspots[curId]._id = curId; ++curId; - _hotspots[curId]._x1 = 330; - _hotspots[curId]._y1 = 350; - _hotspots[curId]._x2 = 430; - _hotspots[curId]._y2 = 460; + _hotspots[curId]._rect = Common::Rect(330, 350, 430, 460); _hotspots[curId]._flags = SF_GRAB_CURSOR; _hotspots[curId]._id = curId; ++curId; - _hotspots[curId]._x1 = 180; - _hotspots[curId]._y1 = 15; - _hotspots[curId]._x2 = 620; - _hotspots[curId]._y2 = 580; + _hotspots[curId]._rect = Common::Rect(180, 15, 620, 580); _hotspots[curId]._flags = SF_NONE; _hotspots[curId]._id = curId; ++curId; - _hotspots[curId]._x1 = 0; - _hotspots[curId]._y1 = 0; - _hotspots[curId]._x2 = 799; - _hotspots[curId]._y2 = 599; + _hotspots[curId]._rect = Common::Rect(0, 0, 799, 599); _hotspots[curId]._flags = SF_NONE; _hotspots[curId]._id = curId; @@ -132,38 +105,23 @@ void GnapEngine::initMenuHotspots2() { } void GnapEngine::initMenuQuitQueryHotspots() { - _hotspots[0]._x1 = 311; - _hotspots[0]._y1 = 197; - _hotspots[0]._x2 = 377; - _hotspots[0]._y2 = 237; + _hotspots[0]._rect = Common::Rect(311, 197, 377, 237); _hotspots[0]._flags = SF_GRAB_CURSOR; _hotspots[0]._id = 0; - _hotspots[1]._x1 = 403; - _hotspots[1]._y1 = 197; - _hotspots[1]._x2 = 469; - _hotspots[1]._y2 = 237; + _hotspots[1]._rect = Common::Rect(403, 197, 469, 237); _hotspots[1]._flags = SF_GRAB_CURSOR; _hotspots[1]._id = 1; - _hotspots[2]._x1 = 330; - _hotspots[2]._y1 = 350; - _hotspots[2]._x2 = 430; - _hotspots[2]._y2 = 460; + _hotspots[2]._rect = Common::Rect(330, 350, 430, 460); _hotspots[2]._flags = SF_GRAB_CURSOR; _hotspots[2]._id = 2; - _hotspots[3]._x1 = 180; - _hotspots[3]._y1 = 15; - _hotspots[3]._x2 = 620; - _hotspots[3]._y2 = 580; + _hotspots[3]._rect = Common::Rect(180, 15, 620, 580); _hotspots[3]._flags = SF_NONE; _hotspots[3]._id = 3; - _hotspots[4]._x1 = 0; - _hotspots[4]._y1 = 0; - _hotspots[4]._x2 = 799; - _hotspots[4]._y2 = 599; + _hotspots[4]._rect = Common::Rect(0, 0, 799, 599); _hotspots[4]._flags = SF_NONE; _hotspots[4]._id = 4; @@ -174,53 +132,35 @@ void GnapEngine::initSaveLoadHotspots() { int curId = 0; for (int i = 0; i < 7; ++i ) { - _hotspots[curId]._x1 = 288; - _hotspots[curId]._y1 = 31 * i + 74; - _hotspots[curId]._x2 = _hotspots[curId]._x1 + 91; - _hotspots[curId]._y2 = _hotspots[curId]._y1 + 22; + _hotspots[curId]._rect = Common::Rect(288, 31 * i + 74, _hotspots[curId]._rect.left + 91, _hotspots[curId]._rect.top + 22); _hotspots[curId]._flags = SF_GRAB_CURSOR; _hotspots[curId]._id = curId; ++curId; } if (_menuStatus == 2) { - _hotspots[curId]._x1 = 416; - _hotspots[curId]._y1 = 160; - _hotspots[curId]._x2 = 499; - _hotspots[curId]._y2 = 188; + _hotspots[curId]._rect = Common::Rect(416, 160, 499, 188); _hotspots[curId]._flags = SF_GRAB_CURSOR; _hotspots[curId]._id = curId; ++curId; } - _hotspots[curId]._x1 = 416; - _hotspots[curId]._y1 = 213; - _hotspots[curId]._x2 = 499; - _hotspots[curId]._y2 = 241; + _hotspots[curId]._rect = Common::Rect(416, 213, 499, 241); _hotspots[curId]._flags = SF_GRAB_CURSOR; _hotspots[curId]._id = curId; ++curId; - _hotspots[curId]._x1 = 330; - _hotspots[curId]._y1 = 350; - _hotspots[curId]._x2 = 430; - _hotspots[curId]._y2 = 460; + _hotspots[curId]._rect = Common::Rect(330, 350, 430, 460); _hotspots[curId]._flags = SF_GRAB_CURSOR; _hotspots[curId]._id = curId; ++curId; - _hotspots[curId]._x1 = 180; - _hotspots[curId]._y1 = 15; - _hotspots[curId]._x2 = 620; - _hotspots[curId]._y2 = 580; + _hotspots[curId]._rect = Common::Rect(180, 15, 620, 580); _hotspots[curId]._flags = SF_NONE; _hotspots[curId]._id = curId; ++curId; - _hotspots[curId]._x1 = 0; - _hotspots[curId]._y1 = 0; - _hotspots[curId]._x2 = 799; - _hotspots[curId]._y2 = 599; + _hotspots[curId]._rect = Common::Rect(0, 0, 799, 599); _hotspots[curId]._flags = SF_NONE; _hotspots[curId]._id = curId; @@ -229,7 +169,7 @@ void GnapEngine::initSaveLoadHotspots() { void GnapEngine::drawInventoryFrames() { for (int i = 0; i < 9; ++i) - _gameSys->drawSpriteToSurface(_menuBackgroundSurface, _hotspots[i]._x1 - 93, _hotspots[i]._y1, 0x10001); + _gameSys->drawSpriteToSurface(_menuBackgroundSurface, _hotspots[i]._rect.left - 93, _hotspots[i]._rect.top, 0x10001); } void GnapEngine::insertInventorySprites() { @@ -244,13 +184,13 @@ void GnapEngine::insertInventorySprites() { for (int index = 0; index < 30 && _menuSpritesIndex < 9; ++index) { if (invHas(index)) { _gameSys->drawSpriteToSurface(_menuBackgroundSurface, - _hotspots[_menuSpritesIndex]._x1 - 93, _hotspots[_menuSpritesIndex]._y1, 0x10000); + _hotspots[_menuSpritesIndex]._rect.left - 93, _hotspots[_menuSpritesIndex]._rect.top, 0x10000); _menuInventorySprites[_menuSpritesIndex] = _gameSys->createSurface(getInventoryItemSpriteNum(index) | 0x10000); if (index != _grabCursorSpriteIndex) { _menuInventoryIndices[_menuSpritesIndex] = index; _gameSys->insertSpriteDrawItem(_menuInventorySprites[_menuSpritesIndex], - _hotspots[_menuSpritesIndex]._x1 + ((79 - _menuInventorySprites[_menuSpritesIndex]->w) / 2), - _hotspots[_menuSpritesIndex]._y1 + ((66 - _menuInventorySprites[_menuSpritesIndex]->h) / 2), + _hotspots[_menuSpritesIndex]._rect.left + ((79 - _menuInventorySprites[_menuSpritesIndex]->w) / 2), + _hotspots[_menuSpritesIndex]._rect.top + ((66 - _menuInventorySprites[_menuSpritesIndex]->h) / 2), 261); } _hotspots[_menuSpritesIndex]._flags = SF_GRAB_CURSOR; @@ -390,10 +330,7 @@ void GnapEngine::updateMenuStatusInventory() { }; updateGrabCursorSprite(0, 0); - _hotspots[0]._x1 = 262; - _hotspots[0]._y1 = 69; - _hotspots[0]._x2 = 341; - _hotspots[0]._y2 = 135; + _hotspots[0]._rect = Common::Rect(262, 69, 341, 135); _sceneClickedHotspot = -1; if (_timers[2] == 0) _sceneClickedHotspot = getClickedHotspotId(); @@ -403,7 +340,7 @@ void GnapEngine::updateMenuStatusInventory() { _timers[2] = 10; playSound(0x108F4, false); _menuStatus = 1; - Common::Rect dirtyRect(_hotspots[0]._x1, _hotspots[0]._y1, _hotspots[2]._x2, _hotspots[_hotspotsCount - 4]._y2); + Common::Rect dirtyRect(_hotspots[0]._rect.left, _hotspots[0]._rect.top, _hotspots[2]._rect.right, _hotspots[_hotspotsCount - 4]._rect.bottom); drawInventoryFrames(); initMenuHotspots2(); removeInventorySprites(); @@ -426,8 +363,8 @@ void GnapEngine::updateMenuStatusInventory() { } else if (_sceneClickedHotspot != -1 && _menuInventoryIndices[_sceneClickedHotspot] == -1 && _grabCursorSpriteIndex != -1) { _menuInventoryIndices[_sceneClickedHotspot] = _grabCursorSpriteIndex; _gameSys->insertSpriteDrawItem(_menuInventorySprites[_sceneClickedHotspot], - _hotspots[_sceneClickedHotspot]._x1 + ((79 - _menuInventorySprites[_sceneClickedHotspot]->w) / 2), - _hotspots[_sceneClickedHotspot]._y1 + (66 - _menuInventorySprites[_sceneClickedHotspot]->h) / 2, + _hotspots[_sceneClickedHotspot]._rect.left + ((79 - _menuInventorySprites[_sceneClickedHotspot]->w) / 2), + _hotspots[_sceneClickedHotspot]._rect.top + (66 - _menuInventorySprites[_sceneClickedHotspot]->h) / 2, 261); setGrabCursorSprite(-1); } else if (_sceneClickedHotspot != -1 && _menuInventoryIndices[_sceneClickedHotspot] != -1 && _grabCursorSpriteIndex != -1) { @@ -446,7 +383,7 @@ void GnapEngine::updateMenuStatusInventory() { playSound(0x108AE, false); deleteSurface(&_spriteHandle); // CHECKME _spriteHandle = _gameSys->createSurface(0x10001); - _gameSys->insertSpriteDrawItem(_spriteHandle, _hotspots[_menuSpritesIndex - 1]._x1, _hotspots[_menuSpritesIndex - 1]._y1, 261); + _gameSys->insertSpriteDrawItem(_spriteHandle, _hotspots[_menuSpritesIndex - 1]._rect.left, _hotspots[_menuSpritesIndex - 1]._rect.top, 261); setGrabCursorSprite(kCombineItems[combineIndex].resultItem); removeInventorySprites(); insertInventorySprites(); @@ -458,10 +395,7 @@ void GnapEngine::updateMenuStatusInventory() { } void GnapEngine::updateMenuStatusMainMenu() { - _hotspots[0]._x1 = 312; - _hotspots[0]._y1 = 85; - _hotspots[0]._x2 = 465; - _hotspots[0]._y2 = 122; + _hotspots[0]._rect = Common::Rect(312, 85, 465, 122); _sceneClickedHotspot = -1; if (!_timers[2]) _sceneClickedHotspot = getClickedHotspotId(); @@ -533,7 +467,7 @@ void GnapEngine::updateMenuStatusMainMenu() { if (_menuSprite1) _gameSys->removeSpriteDrawItem(_menuSprite1, 262); insertInventorySprites(); - Common::Rect dirtyRect(_hotspots[0]._x1, _hotspots[0]._y1, _hotspots[2]._x2, _hotspots[_hotspotsCount - 4]._y2); + Common::Rect dirtyRect(_hotspots[0]._rect.left, _hotspots[0]._rect.top, _hotspots[2]._rect.right, _hotspots[_hotspotsCount - 4]._rect.bottom); _gameSys->insertDirtyRect(dirtyRect); } } else { @@ -601,7 +535,7 @@ void GnapEngine::updateMenuStatusMainMenu() { if (readSavegameDescription(i + 1, savegameDescription) == 0) strncpy(_savegameFilenames[i], savegameDescription.c_str(), 40); _gameSys->drawTextToSurface(_savegameSprites[i], 0, 0, 255, 0, 0, _savegameFilenames[i]); - _gameSys->insertSpriteDrawItem(_savegameSprites[i], 288, _hotspots[i]._y1, 263); + _gameSys->insertSpriteDrawItem(_savegameSprites[i], 288, _hotspots[i].top, 263); } _savegameIndex = -1; } @@ -890,10 +824,7 @@ void GnapEngine::updateMenuStatusSaveGame() { } void GnapEngine::updateMenuStatusLoadGame() { - _hotspots[0]._x1 = 288; - _hotspots[0]._y1 = 74; - _hotspots[0]._x2 = 379; - _hotspots[0]._y2 = 96; + _hotspots[0]._rect = Common::Rect(288, 74, 379, 96); _sceneClickedHotspot = -1; if (!_timers[2]) _sceneClickedHotspot = getClickedHotspotId(); @@ -922,11 +853,7 @@ void GnapEngine::updateMenuStatusLoadGame() { } void GnapEngine::updateMenuStatusQueryQuit() { - _hotspots[0]._x1 = 311; - _hotspots[0]._y1 = 197; - _hotspots[0]._x2 = 377; - _hotspots[0]._y2 = 237; - + _hotspots[0]._rect = Common::Rect(311, 197, 377, 237); _sceneClickedHotspot = -1; if (!_timers[2]) diff --git a/engines/gnap/scenes/group1.cpp b/engines/gnap/scenes/group1.cpp index 0993cf53c4..7aa5d9efdd 100644 --- a/engines/gnap/scenes/group1.cpp +++ b/engines/gnap/scenes/group1.cpp @@ -2068,10 +2068,7 @@ void Scene15::run() { _vm->updateMouseCursor(); _vm->updateCursorByHotspot(); - _vm->_hotspots[kHS15Platypus]._x1 = 0; - _vm->_hotspots[kHS15Platypus]._y1 = 0; - _vm->_hotspots[kHS15Platypus]._x2 = 0; - _vm->_hotspots[kHS15Platypus]._y2 = 0; + _vm->_hotspots[kHS15Platypus].clearRect(); _vm->_sceneClickedHotspot = _vm->getClickedHotspotId(); _vm->updateGrabCursorSprite(0, 0); @@ -3147,23 +3144,20 @@ void Scene18::updateHotspots() { if (_vm->isFlag(kGFTruckFilledWithGas)) { if (_vm->isFlag(kGFTruckKeysUsed)) { _vm->_hotspots[kHS18HydrantTopValve]._flags = SF_DISABLED; - _vm->_hotspots[kHS18HydrantRightValve]._x1 = 148; - _vm->_hotspots[kHS18HydrantRightValve]._y1 = 403; + _vm->_hotspots[kHS18HydrantRightValve]._rect.left = 148; + _vm->_hotspots[kHS18HydrantRightValve]._rect.top = 403; _vm->_hotspots[kHS18GarbageCan]._flags = SF_DISABLED; _vm->_hotspotsWalkPos[kHS18GarbageCan].x = 3; _vm->_hotspotsWalkPos[kHS18GarbageCan].y = 7; } else { - _vm->_hotspots[kHS18HydrantTopValve]._y1 = 246; + _vm->_hotspots[kHS18HydrantTopValve]._rect.top = 246; } } else if (_vm->isFlag(kGFBarnPadlockOpen)) { _vm->_hotspots[kHS18HydrantRightValve]._flags = SF_DISABLED; - _vm->_hotspots[kHS18HydrantTopValve]._x1 = 105; - _vm->_hotspots[kHS18HydrantTopValve]._x2 = 192; + _vm->_hotspots[kHS18HydrantTopValve]._rect.left = 105; + _vm->_hotspots[kHS18HydrantTopValve]._rect.right = 192; } else if (_vm->isFlag(kGFTruckKeysUsed)) { - _vm->_hotspots[kHS18GarbageCan]._x1 = 115; - _vm->_hotspots[kHS18GarbageCan]._y1 = 365; - _vm->_hotspots[kHS18GarbageCan]._x2 = 168; - _vm->_hotspots[kHS18GarbageCan]._y2 = 470; + _vm->_hotspots[kHS18GarbageCan]._rect = Common::Rect(115, 365, 168, 470); _vm->_hotspots[kHS18GarbageCan]._flags = SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR; _vm->_hotspotsWalkPos[kHS18GarbageCan].x = 3; _vm->_hotspotsWalkPos[kHS18GarbageCan].y = 7; @@ -3794,11 +3788,11 @@ void Scene18::run() { _vm->clearFlag(kGFPlatypusTalkingToAssistant); } } else { - _vm->_hotspots[kHS18WalkArea1]._y2 += 48; - _vm->_hotspots[kHS18WalkArea2]._x1 += 75; + _vm->_hotspots[kHS18WalkArea1]._rect.bottom += 48; + _vm->_hotspots[kHS18WalkArea2]._rect.left += 75; plat.updateIdleSequence(); - _vm->_hotspots[kHS18WalkArea2]._x1 -= 75; - _vm->_hotspots[kHS18WalkArea1]._y2 -= 48; + _vm->_hotspots[kHS18WalkArea2]._rect.left -= 75; + _vm->_hotspots[kHS18WalkArea1]._rect.bottom -= 48; } if (!_vm->_timers[5]) { _vm->_timers[5] = _vm->getRandom(100) + 100; diff --git a/engines/gnap/scenes/group2.cpp b/engines/gnap/scenes/group2.cpp index 81bc8c5920..380bb0ba67 100644 --- a/engines/gnap/scenes/group2.cpp +++ b/engines/gnap/scenes/group2.cpp @@ -473,9 +473,9 @@ void Scene20::run() { if (!_vm->_isLeavingScene) { if (plat._actionStatus < 0) { - _vm->_hotspots[kHS20WalkArea1]._y2 += 48; + _vm->_hotspots[kHS20WalkArea1]._rect.bottom += 48; plat.updateIdleSequence(); - _vm->_hotspots[kHS20WalkArea1]._y2 -= 48; + _vm->_hotspots[kHS20WalkArea1]._rect.bottom -= 48; } if (gnap._actionStatus < 0) gnap.updateIdleSequence(); diff --git a/engines/gnap/scenes/group4.cpp b/engines/gnap/scenes/group4.cpp index 3c67dd6f4b..810e4bfdfc 100644 --- a/engines/gnap/scenes/group4.cpp +++ b/engines/gnap/scenes/group4.cpp @@ -303,12 +303,8 @@ void Scene41::run() { if (!_vm->isSoundPlaying(0x1094B)) _vm->playSound(0x1094B, true); - if (!_vm->isFlag(kGFGnapControlsToyUFO)) { - _vm->_hotspots[kHS41ToyUfo]._x1 = _vm->_toyUfoX - 25; - _vm->_hotspots[kHS41ToyUfo]._y1 = _vm->_toyUfoY - 20; - _vm->_hotspots[kHS41ToyUfo]._x2 = _vm->_toyUfoX + 25; - _vm->_hotspots[kHS41ToyUfo]._y2 = _vm->_toyUfoY + 20; - } + if (!_vm->isFlag(kGFGnapControlsToyUFO)) + _vm->_hotspots[kHS41ToyUfo]._rect = Common::Rect(_vm->_toyUfoX - 25, _vm->_toyUfoY - 20, _vm->_toyUfoX + 25, _vm->_toyUfoY + 20); _vm->updateMouseCursor(); _vm->updateCursorByHotspot(); |