aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorTravis Howell2006-10-10 11:44:58 +0000
committerTravis Howell2006-10-10 11:44:58 +0000
commit99df94503818613b4ae799a2b1742b3b2318dbd4 (patch)
tree134e36c69896e57a4ad9e2746da653362acaac65 /engines
parentc5044d67c90c2886d88b3bb82df737ac93d945b5 (diff)
downloadscummvm-rg350-99df94503818613b4ae799a2b1742b3b2318dbd4.tar.gz
scummvm-rg350-99df94503818613b4ae799a2b1742b3b2318dbd4.tar.bz2
scummvm-rg350-99df94503818613b4ae799a2b1742b3b2318dbd4.zip
Fix guard response in Elvira 1
svn-id: r24261
Diffstat (limited to 'engines')
-rw-r--r--engines/agos/agos.cpp6
-rw-r--r--engines/agos/agos.h4
-rw-r--r--engines/agos/contain.cpp10
-rw-r--r--engines/agos/debug.h4
-rw-r--r--engines/agos/items.cpp16
5 files changed, 35 insertions, 5 deletions
diff --git a/engines/agos/agos.cpp b/engines/agos/agos.cpp
index 2f26acb01b..50f955d456 100644
--- a/engines/agos/agos.cpp
+++ b/engines/agos/agos.cpp
@@ -559,7 +559,7 @@ int AGOSEngine::init() {
return 0;
}
-const static uint16 initialVideoWindows_Simon[24] = {
+const static uint16 initialVideoWindows_Simon[20] = {
0, 0, 20, 200,
0, 0, 3, 136,
17, 0, 3, 136,
@@ -567,7 +567,7 @@ const static uint16 initialVideoWindows_Simon[24] = {
0, 0, 20, 134
};
-const static uint16 initialVideoWindows_Common[24] = {
+const static uint16 initialVideoWindows_Common[20] = {
3, 0, 14, 136,
0, 0, 3, 136,
17, 0, 3, 136,
@@ -713,7 +713,7 @@ void AGOSEngine::setupGame() {
_stringIdLocalMin = 1;
- for (int i = 0; i < 24; i++) {
+ for (int i = 0; i < 20; i++) {
if (getGameType() == GType_SIMON1 || getGameType() == GType_SIMON2)
_videoWindows[i] = initialVideoWindows_Simon[i];
else
diff --git a/engines/agos/agos.h b/engines/agos/agos.h
index 2937b25f90..9070357a55 100644
--- a/engines/agos/agos.h
+++ b/engines/agos/agos.h
@@ -1036,6 +1036,8 @@ public:
void moveDirn_e2(Item *i, uint x);
void moveDirn_ww(Item *i, uint x);
+ int contains(Item *a, Item *b);
+
int sizeContents(Item *x);
int sizeOfRec(Item *o, int d);
int sizeRec(Item *x, int d);
@@ -1056,6 +1058,8 @@ public:
void oe1_isNotAt();
void oe1_sibling();
void oe1_notSibling();
+ void oe1_isIn();
+ void oe1_isNotIn();
void oe1_isPlayer();
void oe1_canPut();
void oe1_copyof();
diff --git a/engines/agos/contain.cpp b/engines/agos/contain.cpp
index 043e48feb4..40d492bb97 100644
--- a/engines/agos/contain.cpp
+++ b/engines/agos/contain.cpp
@@ -60,6 +60,16 @@ void AGOSEngine::xPlace(Item *x, Item *y) {
linkItem(x, y);
}
+int AGOSEngine::contains(Item *a, Item *b) {
+ while (derefItem(b->parent)) {
+ if (derefItem(b->parent) == a)
+ return 1;
+ b = derefItem(b->parent);
+ }
+
+ return 0;
+}
+
int AGOSEngine::sizeContents(Item *x) {
return sizeRec(x, 0);
}
diff --git a/engines/agos/debug.h b/engines/agos/debug.h
index 096b05c2e3..8d5dc9a367 100644
--- a/engines/agos/debug.h
+++ b/engines/agos/debug.h
@@ -55,8 +55,8 @@ static const char *const elvira1_opcodeNameTable[300] = {
/* 20 */
"WWJ|IS_LEF",
"WWJ|IS_GEF",
- NULL,
- NULL,
+ "WWJ|IS_IN",
+ "WWJ|IS_NOT_IN",
/* 24 */
NULL,
NULL,
diff --git a/engines/agos/items.cpp b/engines/agos/items.cpp
index 5718025a13..cc2a69f3f4 100644
--- a/engines/agos/items.cpp
+++ b/engines/agos/items.cpp
@@ -189,6 +189,8 @@ void AGOSEngine::setupElvira1Opcodes(OpcodeProc *op) {
op[19] = &AGOSEngine::o_notEqf;
op[20] = &AGOSEngine::o_ltf;
op[21] = &AGOSEngine::o_gtf;
+ op[22] = &AGOSEngine::oe1_isIn;
+ op[23] = &AGOSEngine::oe1_isNotIn;
op[29] = &AGOSEngine::o_chance;
op[30] = &AGOSEngine::oe1_isPlayer;
@@ -1818,6 +1820,20 @@ void AGOSEngine::oe1_notSibling() {
setScriptCondition(item1->parent != item2->parent);
}
+void AGOSEngine::oe1_isIn() {
+ // 22: is in
+ Item *item1 = getNextItemPtr();
+ Item *item2 = getNextItemPtr();
+ setScriptCondition(contains(item1, item2) != 0);
+}
+
+void AGOSEngine::oe1_isNotIn() {
+ // 23: is not in
+ Item *item1 = getNextItemPtr();
+ Item *item2 = getNextItemPtr();
+ setScriptCondition(contains(item1, item2) == 0);
+}
+
void AGOSEngine::oe1_isPlayer() {
// 30: is player
setScriptCondition(isPlayer(getNextItemPtr()));