aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSven Hesse2009-07-05 19:56:40 +0000
committerSven Hesse2009-07-05 19:56:40 +0000
commitaeb020602a6f89a5cbc5af66ded393fe8da61212 (patch)
treec99e11a61da4be1deb0469956c0a4ebb73ac9a30
parenta7ab6c5e92ccf774930846144cc5a272d7ce1542 (diff)
downloadscummvm-rg350-aeb020602a6f89a5cbc5af66ded393fe8da61212.tar.gz
scummvm-rg350-aeb020602a6f89a5cbc5af66ded393fe8da61212.tar.bz2
scummvm-rg350-aeb020602a6f89a5cbc5af66ded393fe8da61212.zip
More state-related encapsulation
svn-id: r42144
-rw-r--r--engines/gob/hotspots.cpp16
-rw-r--r--engines/gob/hotspots.h4
-rw-r--r--engines/gob/inter_v2.cpp4
-rw-r--r--engines/gob/inter_v6.cpp6
4 files changed, 18 insertions, 12 deletions
diff --git a/engines/gob/hotspots.cpp b/engines/gob/hotspots.cpp
index 9847ae2ae1..987b91ca59 100644
--- a/engines/gob/hotspots.cpp
+++ b/engines/gob/hotspots.cpp
@@ -93,10 +93,14 @@ uint8 Hotspots::Hotspot::getCursor() const {
return (flags & 0xF000) >> 12;
}
-uint8 Hotspots::Hotspot::getState() const {
+uint8 Hotspots::Hotspot::getState(uint16 id) {
return (id & 0xF000) >> 12;
}
+uint8 Hotspots::Hotspot::getState() const {
+ return getState(id);
+}
+
bool Hotspots::Hotspot::isEnd() const {
return (left == 0xFFFF);
}
@@ -202,11 +206,11 @@ void Hotspots::remove(uint16 id) {
}
}
-void Hotspots::removeState(uint16 state) {
+void Hotspots::removeState(uint8 state) {
for (int i = 0; i < kHotspotCount; i++) {
Hotspot &spot = _hotspots[i];
- if ((spot.id & 0xF000) == state)
+ if (spot.getState() == state)
spot.clear();
}
}
@@ -1449,7 +1453,7 @@ void Hotspots::evaluate() {
if (VAR(16) != 0)
break;
- if ((id & 0xF000) == 0x8000)
+ if (Hotspot::getState(id) == 0x8)
WRITE_VAR(16, array[id & 0xFFF]);
else
WRITE_VAR(16, id & 0xFFF);
@@ -1532,7 +1536,7 @@ void Hotspots::evaluate() {
_vm->_inter->storeMouse();
- if ((id & 0xF000) == 0x8000)
+ if (Hotspot::getState(id) == 0x8)
WRITE_VAR(16, array[id & 0xFFF]);
else
WRITE_VAR(16, id & 0xFFF);
@@ -1624,7 +1628,7 @@ void Hotspots::evaluate() {
_vm->_inter->storeMouse();
if (VAR(16) == 0) {
- if ((id & 0xF000) == 0x8000)
+ if (Hotspot::getState(id) == 0x8)
WRITE_VAR(16, array[id & 0xFFF]);
else
WRITE_VAR(16, id & 0xFFF);
diff --git a/engines/gob/hotspots.h b/engines/gob/hotspots.h
index 6d37b4e4a5..e05e37b296 100644
--- a/engines/gob/hotspots.h
+++ b/engines/gob/hotspots.h
@@ -64,7 +64,7 @@ public:
uint16 funcEnter, uint16 funcLeave, uint16 funcPos);
void remove(uint16 id);
- void removeState(uint16 state);
+ void removeState(uint8 state);
/** Push the current hotspots onto the stack.
*
@@ -116,6 +116,8 @@ private:
bool isIn(uint16 x, uint16 y) const;
/** Does the specified button trigger the hotspot? */
bool buttonMatch(MouseButtons button) const;
+
+ static uint8 getState(uint16 id);
};
struct StackEntry {
diff --git a/engines/gob/inter_v2.cpp b/engines/gob/inter_v2.cpp
index d71a321db7..e82448c12c 100644
--- a/engines/gob/inter_v2.cpp
+++ b/engines/gob/inter_v2.cpp
@@ -1215,9 +1215,9 @@ bool Inter_v2::o2_freeCollision(OpFuncParams &params) {
int16 id = _vm->_game->_script->readValExpr();
if (id == -2)
- _vm->_game->_hotspots->removeState(0xD000);
+ _vm->_game->_hotspots->removeState(0xD);
else if (id == -1)
- _vm->_game->_hotspots->removeState(0xE000);
+ _vm->_game->_hotspots->removeState(0xE);
else
_vm->_game->_hotspots->remove(0xE000 + id);
diff --git a/engines/gob/inter_v6.cpp b/engines/gob/inter_v6.cpp
index 3c71b3cd91..15e2cc9481 100644
--- a/engines/gob/inter_v6.cpp
+++ b/engines/gob/inter_v6.cpp
@@ -369,11 +369,11 @@ bool Inter_v6::o6_freeCollision(OpFuncParams &params) {
_vm->_game->_hotspots->push(2);
break;
case 3:
- _vm->_game->_hotspots->removeState(0xD000);
- _vm->_game->_hotspots->removeState(0x4000);
+ _vm->_game->_hotspots->removeState(0xD);
+ _vm->_game->_hotspots->removeState(0x4);
break;
case 4:
- _vm->_game->_hotspots->removeState(0xE000);
+ _vm->_game->_hotspots->removeState(0xE);
break;
default:
_vm->_game->_hotspots->remove(0xE000 + id);