aboutsummaryrefslogtreecommitdiff
path: root/engines/voyeur
diff options
context:
space:
mode:
authorStrangerke2014-03-03 23:04:51 +0100
committerStrangerke2014-03-03 23:04:51 +0100
commitf0111e92dc039e1555ee2d77053960bf95487ea0 (patch)
tree48270dfbbda410c49b5394902d8d4e488328ee11 /engines/voyeur
parent1c6a6474d2ad1c8cbb179a4fcacc0509cfb05bd2 (diff)
downloadscummvm-rg350-f0111e92dc039e1555ee2d77053960bf95487ea0.tar.gz
scummvm-rg350-f0111e92dc039e1555ee2d77053960bf95487ea0.tar.bz2
scummvm-rg350-f0111e92dc039e1555ee2d77053960bf95487ea0.zip
VOYEUR: Rewrite hotspot code in doLock()
Diffstat (limited to 'engines/voyeur')
-rw-r--r--engines/voyeur/voyeur.cpp29
1 files changed, 11 insertions, 18 deletions
diff --git a/engines/voyeur/voyeur.cpp b/engines/voyeur/voyeur.cpp
index 85dabf2347..f2d08850ab 100644
--- a/engines/voyeur/voyeur.cpp
+++ b/engines/voyeur/voyeur.cpp
@@ -238,18 +238,15 @@ bool VoyeurEngine::doLock() {
byte *wrongVoc = _filesManager->fload("wrong.voc", &wrongVocSize);
if (_bVoy->getBoltGroup(0x700)) {
- _voy->_viewBounds = _bVoy->boltEntry(0x704)._rectResource;
-
Common::String password = "3333";
- PictureResource *cursorPic = _bVoy->getPictureResource(0x702);
- assert(cursorPic);
-
- // Get the mappings of keys on the keypad
- byte *keyData = _bVoy->memberAddr(0x705);
- int keyCount = READ_LE_UINT16(keyData);
- _graphicsManager->_backColors = _bVoy->getCMapResource(0x7010000);
_graphicsManager->_backgroundPage = _bVoy->getPictureResource(0x700);
+ _graphicsManager->_backColors = _bVoy->getCMapResource(0x701);
+ PictureResource *cursorPic = _bVoy->getPictureResource(0x702);
+ _voy->_viewBounds = _bVoy->boltEntry(0x704)._rectResource;
+ Common::Array<RectEntry> &hotspots = _bVoy->boltEntry(0x705)._rectResource->_entries;
+
+ assert(cursorPic);
(*_graphicsManager->_vPort)->setupViewPort();
_graphicsManager->_backColors->startFade();
@@ -306,17 +303,13 @@ bool VoyeurEngine::doLock() {
do {
// Scan through the list of key rects to check if a keypad key is highlighted
key = -1;
- Common::Point mousePos = _eventsManager->getMousePos() +
- Common::Point(30, 20);
-
- for (int keyIndex = 0; keyIndex < keyCount; ++keyIndex) {
- int x1 = READ_LE_UINT16(keyData + (((keyIndex << 2) + 1) << 1));
- int x2 = READ_LE_UINT16(keyData + (((keyIndex << 2) + 3) << 1));
- int y1 = READ_LE_UINT16(keyData + (((keyIndex << 2) + 2) << 1));
- int y2 = READ_LE_UINT16(keyData + (((keyIndex << 2) + 4) << 1));
+ Common::Point mousePos = _eventsManager->getMousePos() + Common::Point(20, 10);
- if (mousePos.x >= x1 && mousePos.x <= x2 && mousePos.y >= y1 && mousePos.y <= y2) {
+ int keyCount = hotspots.size();
+ for (int keyIndex = 0; keyIndex < keyCount; ++keyIndex) {
+ if (hotspots[keyIndex].contains(mousePos)) {
key = keyIndex;
+ break;
}
}