[Scummvm-cvs-logs] SF.net SVN: scummvm:[42144] scummvm/trunk/engines/gob
drmccoy at users.sourceforge.net
drmccoy at users.sourceforge.net
Sun Jul 5 21:56:40 CEST 2009
Revision: 42144
http://scummvm.svn.sourceforge.net/scummvm/?rev=42144&view=rev
Author: drmccoy
Date: 2009-07-05 19:56:40 +0000 (Sun, 05 Jul 2009)
Log Message:
-----------
More state-related encapsulation
Modified Paths:
--------------
scummvm/trunk/engines/gob/hotspots.cpp
scummvm/trunk/engines/gob/hotspots.h
scummvm/trunk/engines/gob/inter_v2.cpp
scummvm/trunk/engines/gob/inter_v6.cpp
Modified: scummvm/trunk/engines/gob/hotspots.cpp
===================================================================
--- scummvm/trunk/engines/gob/hotspots.cpp 2009-07-05 19:56:23 UTC (rev 42143)
+++ scummvm/trunk/engines/gob/hotspots.cpp 2009-07-05 19:56:40 UTC (rev 42144)
@@ -93,10 +93,14 @@
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::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 @@
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 @@
_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 @@
_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);
Modified: scummvm/trunk/engines/gob/hotspots.h
===================================================================
--- scummvm/trunk/engines/gob/hotspots.h 2009-07-05 19:56:23 UTC (rev 42143)
+++ scummvm/trunk/engines/gob/hotspots.h 2009-07-05 19:56:40 UTC (rev 42144)
@@ -64,7 +64,7 @@
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 @@
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 {
Modified: scummvm/trunk/engines/gob/inter_v2.cpp
===================================================================
--- scummvm/trunk/engines/gob/inter_v2.cpp 2009-07-05 19:56:23 UTC (rev 42143)
+++ scummvm/trunk/engines/gob/inter_v2.cpp 2009-07-05 19:56:40 UTC (rev 42144)
@@ -1215,9 +1215,9 @@
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);
Modified: scummvm/trunk/engines/gob/inter_v6.cpp
===================================================================
--- scummvm/trunk/engines/gob/inter_v6.cpp 2009-07-05 19:56:23 UTC (rev 42143)
+++ scummvm/trunk/engines/gob/inter_v6.cpp 2009-07-05 19:56:40 UTC (rev 42144)
@@ -369,11 +369,11 @@
_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);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Scummvm-git-logs
mailing list