diff options
author | Travis Howell | 2006-10-08 08:35:25 +0000 |
---|---|---|
committer | Travis Howell | 2006-10-08 08:35:25 +0000 |
commit | 245a40963ad8e5fe1779d872f2127573e1eb918a (patch) | |
tree | 95c66fc238722a41d81e9c25e7a163cb652cd13b /engines/agos | |
parent | de280a5a5c68bd12ecbbf22e7cc522963a0bc423 (diff) | |
download | scummvm-rg350-245a40963ad8e5fe1779d872f2127573e1eb918a.tar.gz scummvm-rg350-245a40963ad8e5fe1779d872f2127573e1eb918a.tar.bz2 scummvm-rg350-245a40963ad8e5fe1779d872f2127573e1eb918a.zip |
Add opcode for Elvira 1 and remove errors that don't occur in original games
svn-id: r24193
Diffstat (limited to 'engines/agos')
-rw-r--r-- | engines/agos/agos.h | 1 | ||||
-rw-r--r-- | engines/agos/debug.h | 4 | ||||
-rw-r--r-- | engines/agos/items.cpp | 80 | ||||
-rw-r--r-- | engines/agos/rooms.cpp | 2 |
4 files changed, 49 insertions, 38 deletions
diff --git a/engines/agos/agos.h b/engines/agos/agos.h index d7d9806e0b..bb81a85139 100644 --- a/engines/agos/agos.h +++ b/engines/agos/agos.h @@ -1068,6 +1068,7 @@ public: void oe1_setUserItem(); void oe1_getUserItem(); void oe1_whereTo(); + void oe1_doorExit(); void oe1_clearUserItem(); void oe1_findMaster(); void oe1_nextMaster(); diff --git a/engines/agos/debug.h b/engines/agos/debug.h index ea74d4847a..f585b841a1 100644 --- a/engines/agos/debug.h +++ b/engines/agos/debug.h @@ -64,7 +64,7 @@ static const char *const elvira1_opcodeNameTable[300] = { NULL, /* 28 */ NULL, - NULL, + "WJ|CHANCE", "IJ|IS_PLAYER", NULL, /* 32 */ @@ -254,7 +254,7 @@ static const char *const elvira1_opcodeNameTable[300] = { NULL, /* 180 */ "IWW|WHERE_TO", - NULL, + "IIW|DOOR_EXIT", NULL, NULL, /* 184 */ diff --git a/engines/agos/items.cpp b/engines/agos/items.cpp index a461666f3a..e41d7732dc 100644 --- a/engines/agos/items.cpp +++ b/engines/agos/items.cpp @@ -270,6 +270,7 @@ void AGOSEngine::setupElvira1Opcodes(OpcodeProc *op) { op[178] = &AGOSEngine::oe1_clearUserItem; op[180] = &AGOSEngine::oe1_whereTo; + op[181] = &AGOSEngine::oe1_doorExit; op[198] = &AGOSEngine::o_comment; @@ -1072,47 +1073,30 @@ void AGOSEngine::o_restartAnimation() { void AGOSEngine::o_getParent() { // 90: set minusitem to parent - Item *item = derefItem(getNextItemPtr()->parent); - switch (getVarOrByte()) { - case 0: - _objectItem = item; - break; - case 1: - _subjectItem = item; - break; - default: - error("o_getParent: invalid subcode"); - } + Item *i = getNextItemPtr(); + if (getVarOrByte() == 1) + _subjectItem = derefItem(i->parent); + else + _objectItem = derefItem(i->parent); } void AGOSEngine::o_getNext() { // 91: set minusitem to next - Item *item = derefItem(getNextItemPtr()->next); - switch (getVarOrByte()) { - case 0: - _objectItem = item; - break; - case 1: - _subjectItem = item; - break; - default: - error("o_getNext: invalid subcode"); - } + Item *i = getNextItemPtr(); + if (getVarOrByte() == 1) + _subjectItem = derefItem(i->next); + else + _objectItem = derefItem(i->next); } void AGOSEngine::o_getChildren() { // 92: set minusitem to child - Item *item = derefItem(getNextItemPtr()->child); - switch (getVarOrByte()) { - case 0: - _objectItem = item; - break; - case 1: - _subjectItem = item; - break; - default: - error("o_getChildren: invalid subcode"); - } + Item *i = getNextItemPtr(); + if (getVarOrByte() == 1) + _subjectItem = derefItem(i->child); + + else + _objectItem = derefItem(i->child); } void AGOSEngine::o_picture() { @@ -1972,8 +1956,8 @@ void AGOSEngine::oe1_getUserItem() { void AGOSEngine::oe1_whereTo() { // 180: where to Item *i = getNextItemPtr(); - int16 d = getVarOrByte(); - int16 f = getVarOrByte(); + int16 d = getVarOrWord(); + int16 f = getVarOrWord(); if (f == 1) _subjectItem = derefItem(getExitOf_e1(i, d)); @@ -1981,6 +1965,31 @@ void AGOSEngine::oe1_whereTo() { _objectItem = derefItem(getExitOf_e1(i, d)); } +void AGOSEngine::oe1_doorExit() { + // 181: door exit + Item *x; + Item *a = (Item *)-1; + SubUserChain *c; + Item *i = getNextItemPtr(); + Item *d = getNextItemPtr(); + int16 f = getVarOrWord(); + int16 ct = 0; + + + c = (SubUserChain *)findChildOfType(d, 8); + if (c) + a = derefItem(c->chChained); + while (ct < 6) { + x = derefItem(getDoorOf(i, ct)); + if ((x == d) | (x == a)) { + writeVariable(f, ct); + return; + } + ct++; + } + writeVariable(f, 255); +} + void AGOSEngine::oe1_clearUserItem() { // 178: clear user item Item *i = getNextItemPtr(); @@ -3091,6 +3100,7 @@ int AGOSEngine::runScript() { if (opcode == 203) { flag = true; opcode = getVarOrWord(); + debug(1, "runScript: opcode %d", opcode); if (opcode == 10000) return 0; } diff --git a/engines/agos/rooms.cpp b/engines/agos/rooms.cpp index 2de093b32d..b49d821af1 100644 --- a/engines/agos/rooms.cpp +++ b/engines/agos/rooms.cpp @@ -54,7 +54,7 @@ uint16 AGOSEngine::getDoorOf(Item *i, uint16 d) { x = derefItem(g->dest[d]); if (x == NULL) return 0; - if (findChildOfType(x, 1)) + if (isRoom(x)) return 0; return itemPtrToID(x); } |