aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorMax Horn2010-03-10 20:56:54 +0000
committerMax Horn2010-03-10 20:56:54 +0000
commit8d1431a5ab0efe7c4f84f7c0fcdff10f8fe39ad1 (patch)
tree241947a898cc329c6f397b76e87793be0ba519e9 /engines
parent80fae481b0d97b8de64803275067fa08dbe1c720 (diff)
downloadscummvm-rg350-8d1431a5ab0efe7c4f84f7c0fcdff10f8fe39ad1.tar.gz
scummvm-rg350-8d1431a5ab0efe7c4f84f7c0fcdff10f8fe39ad1.tar.bz2
scummvm-rg350-8d1431a5ab0efe7c4f84f7c0fcdff10f8fe39ad1.zip
AGOS: cleanup
svn-id: r48227
Diffstat (limited to 'engines')
-rw-r--r--engines/agos/rooms.cpp99
-rw-r--r--engines/agos/script_e2.cpp12
2 files changed, 57 insertions, 54 deletions
diff --git a/engines/agos/rooms.cpp b/engines/agos/rooms.cpp
index c390269fec..91c8a53681 100644
--- a/engines/agos/rooms.cpp
+++ b/engines/agos/rooms.cpp
@@ -263,62 +263,65 @@ void AGOSEngine::moveDirn(Item *i, uint x) {
// Elvira 2 specific
int AGOSEngine_Elvira2::changeExitStates(SubSuperRoom *sr, int n, int d, uint16 s) {
int b, bd;
- uint16 mask = 3;
- uint16 bs = s;
+ uint16 mask;
switch (d) {
- case 0:
- b =- (sr->roomX); bd = 2;
- if (((n % (sr->roomX * sr->roomY)) / sr->roomX) == 0)
- return(0);
- else
- break;
- case 1:
- b = 1; bd = 3;
- if (((n % (sr->roomX * sr->roomY)) % sr->roomX) == 0)
- return 0;
- else
- break;
- case 2:
- b = sr->roomX; bd = 0;
- if (((n % (sr->roomX * sr->roomY)) / sr->roomX) == (sr->roomY - 1))
- return 0;
- else
- break;
- case 3:
- b =- 1; bd = 1;
- if (((n % (sr->roomX * sr->roomY)) % sr->roomX) == 1)
- return 0;
- else
- break;
- case 4:
- b =- (sr->roomX * sr->roomY); bd = 5;
- if (n < (sr->roomX * sr->roomY))
- return 0;
- else
- break;
- case 5:
- b = sr->roomX * sr->roomY; bd = 4;
- if (n > (sr->roomX * sr->roomY * (sr->roomZ - 1)))
- return 0;
- else
- break;
- default:
+ case 0:
+ b = -(sr->roomX);
+ bd = 2;
+ if (((n % (sr->roomX * sr->roomY)) / sr->roomX) == 0)
+ return 0;
+ else
+ break;
+ case 1:
+ b = 1;
+ bd = 3;
+ if (((n % (sr->roomX * sr->roomY)) % sr->roomX) == 0)
return 0;
+ else
+ break;
+ case 2:
+ b = sr->roomX;
+ bd = 0;
+ if (((n % (sr->roomX * sr->roomY)) / sr->roomX) == (sr->roomY - 1))
+ return 0;
+ else
+ break;
+ case 3:
+ b = -1;
+ bd = 1;
+ if (((n % (sr->roomX * sr->roomY)) % sr->roomX) == 1)
+ return 0;
+ else
+ break;
+ case 4:
+ b = -(sr->roomX * sr->roomY);
+ bd = 5;
+ if (n < (sr->roomX * sr->roomY))
+ return 0;
+ else
+ break;
+ case 5:
+ b = sr->roomX * sr->roomY;
+ bd = 4;
+ if (n > (sr->roomX * sr->roomY * (sr->roomZ - 1)))
+ return 0;
+ else
+ break;
+ default:
+ return 0;
}
+
n--;
d <<= 1;
- mask <<= d;
- s <<= d;
+ mask = (3 << d);
sr->roomExitStates[n] &= ~mask;
- sr->roomExitStates[n] |= s;
- mask = 3;
- n += b;
+ sr->roomExitStates[n] |= (s << d);
+
bd <<= 1;
- mask <<= bd;
- bs <<= bd;
- sr->roomExitStates[n] &= ~mask;
- sr->roomExitStates[n] |= bs;
+ mask = (3 << bd);
+ sr->roomExitStates[n + b] &= ~mask;
+ sr->roomExitStates[n + b] |= (s << bd);
return 1;
}
diff --git a/engines/agos/script_e2.cpp b/engines/agos/script_e2.cpp
index 827dbf620d..f8af7db214 100644
--- a/engines/agos/script_e2.cpp
+++ b/engines/agos/script_e2.cpp
@@ -644,17 +644,17 @@ void AGOSEngine_Elvira2::oe2_printMonsterDamage() {
void AGOSEngine_Elvira2::oe2_isAdjNoun() {
// 179: item unk1 unk2 is
Item *item = getNextItemPtr();
- int16 a = getNextWord(), n = getNextWord();
+ int16 a = getNextWord();
+ int16 n = getNextWord();
- if (getGameType() == GType_ELVIRA2) {
+ if (getGameType() == GType_ELVIRA2 && item == NULL) {
// WORKAROUND bug #1745996: A NULL item can occur when
// interacting with items in the dinning room
- if (item == NULL) {
- setScriptCondition(false);
- return;
- }
+ setScriptCondition(false);
+ return;
}
+ assert(item);
setScriptCondition(item->adjective == a && item->noun == n);
}