diff options
author | Travis Howell | 2006-10-13 11:38:41 +0000 |
---|---|---|
committer | Travis Howell | 2006-10-13 11:38:41 +0000 |
commit | f46fb07f277cef1828c3807a38230db604df58d6 (patch) | |
tree | 5b72eea95a7b30092850f428b6dda23b98233143 | |
parent | 0385a4d2bbcde1fac41452f5f75f091c3e84e533 (diff) | |
download | scummvm-rg350-f46fb07f277cef1828c3807a38230db604df58d6.tar.gz scummvm-rg350-f46fb07f277cef1828c3807a38230db604df58d6.tar.bz2 scummvm-rg350-f46fb07f277cef1828c3807a38230db604df58d6.zip |
Add differences in opcode table for Elvira 2 and cleanup
svn-id: r24294
-rw-r--r-- | engines/agos/agos.cpp | 2 | ||||
-rw-r--r-- | engines/agos/agos.h | 2 | ||||
-rw-r--r-- | engines/agos/debug.cpp | 4 | ||||
-rw-r--r-- | engines/agos/debug.h | 243 | ||||
-rw-r--r-- | engines/agos/event.cpp | 14 | ||||
-rw-r--r-- | engines/agos/icons.cpp | 5 | ||||
-rw-r--r-- | engines/agos/items.cpp | 30 | ||||
-rw-r--r-- | engines/agos/rooms.cpp | 109 | ||||
-rw-r--r-- | engines/agos/subroutine.cpp | 21 |
9 files changed, 362 insertions, 68 deletions
diff --git a/engines/agos/agos.cpp b/engines/agos/agos.cpp index 7829b45c17..d97d14270f 100644 --- a/engines/agos/agos.cpp +++ b/engines/agos/agos.cpp @@ -711,6 +711,8 @@ void AGOSEngine::setupGame() { _stringIdLocalMin = 1; + _superRoomNumber = 1; + for (int i = 0; i < 20; i++) { if (getGameType() == GType_SIMON1 || getGameType() == GType_SIMON2) { _videoWindows[i] = initialVideoWindows_Simon[i]; diff --git a/engines/agos/agos.h b/engines/agos/agos.h index 1ab30dd250..a6a118e4d2 100644 --- a/engines/agos/agos.h +++ b/engines/agos/agos.h @@ -1227,6 +1227,8 @@ protected: bool vc_maybe_skip_proc_1(uint16 a, int16 b); bool isVgaQueueEmpty(); + void haltAnimation(); + void restartAnimation(); void addVgaEvent(uint16 num, const byte *code_ptr, uint16 cur_sprite, uint16 curZoneNum, int32 param = 0); void deleteVgaEvent(VgaTimerEntry * vte); void processVgaEvents(); diff --git a/engines/agos/debug.cpp b/engines/agos/debug.cpp index 64ffc5c83a..db3723964c 100644 --- a/engines/agos/debug.cpp +++ b/engines/agos/debug.cpp @@ -60,8 +60,10 @@ const byte *AGOSEngine::dumpOpcode(const byte *p) { st = s = simon2dos_opcodeNameTable[opcode]; } else if (getGameType() == GType_SIMON1) { st = s = simon1dos_opcodeNameTable[opcode]; - } else if (getGameType() == GType_ELVIRA2 || getGameType() == GType_WW) { + } else if (getGameType() == GType_WW) { st = s = waxworks_opcodeNameTable[opcode]; + } else if (getGameType() == GType_ELVIRA2) { + st = s = elvira2_opcodeNameTable[opcode]; } else { st = s = elvira1_opcodeNameTable[opcode]; } diff --git a/engines/agos/debug.h b/engines/agos/debug.h index 179e02805a..9c1a074a31 100644 --- a/engines/agos/debug.h +++ b/engines/agos/debug.h @@ -384,6 +384,239 @@ static const char *const elvira1_opcodeNameTable[300] = { "WJ|IS_BOX", }; +static const char *const elvira2_opcodeNameTable[256] = { + /* 0 */ + "|NOT", + "IJ|AT", + "IJ|NOT_AT", + NULL, + /* 4 */ + NULL, + "IJ|CARRIED", + "IJ|NOT_CARRIED", + "IIJ|IS_AT", + /* 8 */ + "IIJ|IS_NOT_AT", + "IIJ|IS_SIBLING", + "IIJ|IS_NOT_SIBLING", + "VJ|IS_ZERO", + /* 12 */ + "VJ|ISNOT_ZERO", + "VWJ|IS_EQ", + "VWJ|IS_NEQ", + "VWJ|IS_LE", + /* 16 */ + "VWJ|IS_GE", + "VVJ|IS_EQF", + "VVJ|IS_NEQF", + "VVJ|IS_LEF", + /* 20 */ + "VVJ|IS_GEF", + NULL, + NULL, + "WJ|CHANCE", + /* 24 */ + "IJ|IS_PLAYER", + "IJ|IS_ROOM", + "IJ|IS_OBJECT", + "IWJ|ITEM_STATE_IS", + /* 28 */ + "IBJ|OBJECT_HAS_FLAG", + "IIJ|CAN_PUT", + NULL, + "I|SET_NO_PARENT", + /* 32 */ + NULL, + "II|SET_PARENT", + "IBV|COPY_OF", + "VIB|COPY_FO", + /* 36 */ + "VV|MOVE", + "W|WHAT_O", + NULL, + NULL, + /* 40 */ + NULL, + "V|ZERO", + "VW|SET", + "VW|ADD", + /* 44 */ + "VW|SUB", + "VV|ADDF", + "VV|SUBF", + "VW|MUL", + /* 48 */ + "VW|DIV", + "VV|MULF", + "VV|DIVF", + "VW|MOD", + /* 52 */ + "VV|MODF", + "VW|RANDOM", + "B|MOVE_DIRN", + "I|SET_A_PARENT", + /* 56 */ + "IB|SET_CHILD2_BIT", + "IB|CLEAR_CHILD2_BIT", + "II|MAKE_SIBLING", + "I|INC_STATE", + /* 60 */ + "I|DEC_STATE", + "IW|SET_STATE", + "V|SHOW_INT", + "T|SHOW_STRING_NL", + /* 64 */ + "T|SHOW_STRING", + "I|UNK_65", + "I|UNK_66", + "|UNK_67", + /* 68 */ + "x|END", + "x|DONE", + NULL, + "W|START_SUB", + /* 72 */ + NULL, + "I|PRINT_OBJ", + "I|PRINT_NAME", + "I|PRINT_CNAME", + /* 76 */ + "WW|ADD_TIMEOUT", + "J|IS_M1_EMPTY", + "J|IS_M3_EMPTY", + "ITJ|CHILD_FR2_IS", + /* 80 */ + "IIJ|IS_ITEM_EQ", + NULL, + "B|DEBUG", + "|RESCAN", + /* 84 */ + NULL, + "IBB|WHERE_TO", + NULL, + "W|COMMENT", + /* 88 */ + "|STOP_ANIMATION", + "T|LOAD_USER_GAME", + "IB|GET_PARENT", + "IB|GET_NEXT", + /* 92 */ + "IB|GET_CHILDREN", + NULL, + NULL, + NULL, + /* 96 */ + "WB|PICTURE", + "W|LOAD_ZONE", + "WBWWW|ANIMATE", + "W|STOP_ANIMATE", + /* 100 */ + "|KILL_ANIMATE", + "BWWWWWW|DEFINE_WINDOW", + "B|CHANGE_WINDOW", + "|CLS", + /* 104 */ + "B|CLOSE_WINDOW", + "B|UNK_105", + "W|UNK_106", + "WWWWWIW|ADD_BOX", + /* 108 */ + "W|DEL_BOX", + "W|ENABLE_BOX", + "W|DISABLE_BOX", + "WWW|MOVE_BOX", + /* 112 */ + NULL, + NULL, + "IB|DO_ICONS", + "IBJ|IS_CLASS", + /* 116 */ + "IB|SET_CLASS", + "IB|UNSET_CLASS", + NULL, + "W|WAIT_SYNC", + /* 120 */ + "W|SYNC", + "BI|DEF_OBJ", + NULL, + "|SET_TIME", + /* 124 */ + NULL, + "IJ|IS_SIBLING_WITH_A", + "IBB|DO_CLASS_ICONS", + "WW|PLAY_TUNE", + /* 128 */ + "W|WAIT_END_TUNE", + "W|IF_END_TUNE", + "Bww|SET_ADJ_NOUN", + NULL, + /* 132 */ + "|SAVE_GAME", + "|LOAD_GAME", + "|STOP_TUNE", + "|PAUSE", + /* 136 */ + "IV|COPY_SF", + "B|RESTORE_ICONS", + "|FREEZE_ZONES", + "II|SET_PARENT_SPECIAL", + /* 140 */ + "|CLEAR_TIMERS", + "BI|SET_M1_OR_M3", + "WJ|IS_BOX", + "I|START_ITEM_SUB", + /* 144 */ + "IB|SET_DOOR_OPEN", + "IB|SET_DOOR_CLOSED", + "IB|SET_DOOR_LOCKED", + "IB|SET_DOOR_OPEN", + /* 148 */ + "IBJ|IF_DOOR_OPEN", + "IBJ|IF_DOOR_CLOSED", + "IBJ|IF_DOOR_LOCKED", + "BI|STORE_ITEM", + /* 152 */ + "BB|GET_ITEM", + "B|SET_BIT", + "B|CLEAR_BIT", + "BJ|IS_BIT_CLEAR", + /* 156 */ + "BJ|IS_BIT_SET", + "IBB|GET_ITEM_PROP", + "IBW|SET_ITEM_PROP", + NULL, + /* 160 */ + "B|SET_INK", + "|UNK_161", + "BT|PRINT_STR", + NULL, + /* 164 */ + NULL, + "W|SET_SUPER_ROOM", + "BV|GET_SUPER_ROOM", + NULL, + /* 168 */ + NULL, + NULL, + NULL, + NULL, + /* 172 */ + NULL, + NULL, + "W|UNK_174", + "|getDollar2", + /* 176 */ + "IWBB|UNK_176", + "B|UNK_177", + "B|UNK_178", + "IWWJ|IS_ADJ_NOUN", + /* 180 */ + "B|SET_BIT2", + "B|CLEAR_BIT2", + "BJ|IS_BIT2_CLEAR", + "BJ|IS_BIT2_SET", +}; + static const char *const waxworks_opcodeNameTable[256] = { /* 0 */ "|NOT", @@ -589,15 +822,15 @@ static const char *const waxworks_opcodeNameTable[256] = { "B|SET_INK", "|UNK_161", "BT|PRINT_STR", - "W|PLAY_EFFECT", + NULL, /* 164 */ - "|getDollar2", + NULL, "W|SET_SUPER_ROOM", "BV|GET_SUPER_ROOM", - "B|CLEAR_BIT2", + NULL, /* 168 */ - "BJ|IS_BIT2_CLEAR", - "BJ|IS_BIT2_SET", + NULL, + NULL, NULL, NULL, /* 172 */ diff --git a/engines/agos/event.cpp b/engines/agos/event.cpp index e4f94e0f47..4cef41ac54 100644 --- a/engines/agos/event.cpp +++ b/engines/agos/event.cpp @@ -160,6 +160,20 @@ bool AGOSEngine::isVgaQueueEmpty() { return result; } +void AGOSEngine::haltAnimation() { + VgaTimerEntry *vte = _vgaTimerList; + + _lockWord |= 0x10; + + while (vte->delay) { + vte->delay += 10; + } +} + +void AGOSEngine::restartAnimation() { + _lockWord &= ~0x10; +} + void AGOSEngine::addVgaEvent(uint16 num, const byte *code_ptr, uint16 cur_sprite, uint16 curZoneNum, int32 param) { VgaTimerEntry *vte; diff --git a/engines/agos/icons.cpp b/engines/agos/icons.cpp index eeee459af3..14d312b8c5 100644 --- a/engines/agos/icons.cpp +++ b/engines/agos/icons.cpp @@ -199,6 +199,9 @@ void AGOSEngine::draw_icon_c(WindowBlock *window, uint icon, uint x, uint y) { src += READ_LE_UINT16(&((uint16 *)src)[icon]); decompressIcon(dst, src, 24, 12, 224, _dxSurfacePitch); } + } else if (getGameType() == GType_ELVIRA2 || getGameType() == GType_WW) { + // TODO + } else if (getGameType() == GType_ELVIRA1) { dst += (x + window->x) * 8; dst += (y * 8 + window->y) * _dxSurfacePitch; @@ -206,8 +209,6 @@ void AGOSEngine::draw_icon_c(WindowBlock *window, uint icon, uint x, uint y) { src = _iconFilePtr; src += icon * 288; decompressIconAmiga(dst, src, 16, _dxSurfacePitch, false); - } else { - // TODO } _lockWord &= ~0x8000; diff --git a/engines/agos/items.cpp b/engines/agos/items.cpp index c5ac944290..b65c705e6e 100644 --- a/engines/agos/items.cpp +++ b/engines/agos/items.cpp @@ -383,6 +383,11 @@ void AGOSEngine::setupElvira2Opcodes(OpcodeProc *op) { op[183] = &AGOSEngine::o_b2NotZero; // Code difference, check if triggered + op[65] = NULL; + op[66] = NULL; + op[67] = NULL; + op[70] = NULL; + op[163] = NULL; op[164] = NULL; op[167] = NULL; @@ -417,10 +422,10 @@ void AGOSEngine::setupWaxworksOpcodes(OpcodeProc *op) { op[74] = &AGOSEngine::oe1_pName; op[75] = &AGOSEngine::oe1_pcName; op[83] = &AGOSEngine::o1_rescan; - op[98] = &AGOSEngine::o1_animate; - op[99] = &AGOSEngine::o1_stopAnimate; op[85] = &AGOSEngine::oww_whereTo; op[89] = &AGOSEngine::oe2_loadUserGame; + op[98] = &AGOSEngine::o1_animate; + op[99] = &AGOSEngine::o1_stopAnimate; op[105] = &AGOSEngine::oww_menu; op[106] = &AGOSEngine::oww_textMenu; op[123] = &AGOSEngine::oe1_setTime; @@ -1466,11 +1471,24 @@ void AGOSEngine::o_isBox() { void AGOSEngine::o_doTable() { // 143: start item sub - SubRoom *subRoom = (SubRoom *)findChildOfType(getNextItemPtr(), 1); - if (subRoom != NULL) { - Subroutine *sub = getSubroutineByID(subRoom->subroutine_id); - if (sub) + SubRoom *r = (SubRoom *)findChildOfType(getNextItemPtr(), 1); + if (r != NULL) { + Subroutine *sub = getSubroutineByID(r->subroutine_id); + if (sub) { startSubroutine(sub); + return; + } + } + + if (getGameType() == GType_ELVIRA2) { + SubSuperRoom *sr = (SubSuperRoom *)findChildOfType(getNextItemPtr(), 4); + if (sr != NULL) { + Subroutine *sub = getSubroutineByID(sr->subroutine_id); + if (sub) { + startSubroutine(sub); + return; + } + } } } diff --git a/engines/agos/rooms.cpp b/engines/agos/rooms.cpp index 2a305d7b4f..2c2ad348cd 100644 --- a/engines/agos/rooms.cpp +++ b/engines/agos/rooms.cpp @@ -43,22 +43,6 @@ uint16 AGOSEngine::getBackExit(int n) { return 0; } -uint16 AGOSEngine::getDoorOf(Item *i, uint16 d) { - SubGenExit *g; - Item *x; - - g = (SubGenExit *)findChildOfType(i, 4); - if (g == NULL) - return 0; - - x = derefItem(g->dest[d]); - if (x == NULL) - return 0; - if (isRoom(x)) - return 0; - return itemPtrToID(x); -} - uint16 AGOSEngine::getDoorState(Item *item, uint16 d) { uint16 mask = 3; uint16 n; @@ -75,24 +59,6 @@ uint16 AGOSEngine::getDoorState(Item *item, uint16 d) { return n; } -uint16 AGOSEngine::getExitOf_e1(Item *item, uint16 d) { - SubGenExit *g; - Item *x; - - g = (SubGenExit *)findChildOfType(item, 4); - if (g == NULL) - return 0; - - x = derefItem(g->dest[d]); - if (x == NULL) - return 0; - if (isRoom(x)) - return itemPtrToID(x); - if (x->state != 0) - return 0; - return x->parent; -} - uint16 AGOSEngine::getExitOf(Item *item, uint16 d) { SubRoom *subRoom; uint16 x; @@ -110,25 +76,6 @@ uint16 AGOSEngine::getExitOf(Item *item, uint16 d) { return subRoom->roomExit[d]; } -uint16 AGOSEngine::getExitState(Item *i, uint16 x, uint16 d) { - SubSuperRoom *sr; - uint16 mask = 3; - uint16 n; - uint16 *c; - - sr = (SubSuperRoom *)findChildOfType(i, 4); - if (sr == NULL) - return 0; - - c = sr->roomExitStates; - c += x - 1; - d <<= 1; - mask <<= d; - n = *c & mask; - n >>= d; - return n; -} - void AGOSEngine::changeDoorState(SubRoom *r, uint16 d, uint16 n) { uint16 mask=3; d <<= 1; @@ -176,6 +123,41 @@ void AGOSEngine::setDoorState(Item *i, uint16 d, uint16 n) { changeDoorState(r1, d, n); } +// Elvira 1 specific +uint16 AGOSEngine::getDoorOf(Item *i, uint16 d) { + SubGenExit *g; + Item *x; + + g = (SubGenExit *)findChildOfType(i, 4); + if (g == NULL) + return 0; + + x = derefItem(g->dest[d]); + if (x == NULL) + return 0; + if (isRoom(x)) + return 0; + return itemPtrToID(x); +} + +uint16 AGOSEngine::getExitOf_e1(Item *item, uint16 d) { + SubGenExit *g; + Item *x; + + g = (SubGenExit *)findChildOfType(item, 4); + if (g == NULL) + return 0; + + x = derefItem(g->dest[d]); + if (x == NULL) + return 0; + if (isRoom(x)) + return itemPtrToID(x); + if (x->state != 0) + return 0; + return x->parent; +} + void AGOSEngine::moveDirn_e1(Item *i, uint x) { Item *d, *p; uint16 n; @@ -208,6 +190,26 @@ void AGOSEngine::moveDirn_e1(Item *i, uint x) { showMessageFormat("You can't go that way.\n"); } +// Elvira 2 specific +uint16 AGOSEngine::getExitState(Item *i, uint16 x, uint16 d) { + SubSuperRoom *sr; + uint16 mask = 3; + uint16 n; + uint16 *c; + + sr = (SubSuperRoom *)findChildOfType(i, 4); + if (sr == NULL) + return 0; + + c = sr->roomExitStates; + c += x - 1; + d <<= 1; + mask <<= d; + n = *c & mask; + n >>= d; + return n; +} + void AGOSEngine::moveDirn_e2(Item *i, uint x) { SubSuperRoom *sr; Item *d, *p; @@ -251,6 +253,7 @@ void AGOSEngine::moveDirn_e2(Item *i, uint x) { } } +// Waxworks specific void AGOSEngine::moveDirn_ww(Item *i, uint x) { Item *d; uint16 n; diff --git a/engines/agos/subroutine.cpp b/engines/agos/subroutine.cpp index 16036032cc..c7535d0197 100644 --- a/engines/agos/subroutine.cpp +++ b/engines/agos/subroutine.cpp @@ -55,6 +55,23 @@ static const char *const opcodeArgTable_elvira1[300] = { " ", "NI ","N ", }; +static const char *const opcodeArgTable_elvira2[256] = { + " ", "I ", "I ", "I ", "I ", "I ", "I ", "II ", "II ", "II ", "II ", "B ", "B ", "BN ", "BN ", + "BN ", "BN ", "BB ", "BB ", "BB ", "BB ", "II ", "II ", "N ", "I ", "I ", "I ", "IN ", "IB ", + "II ", "I ", "I ", "II ", "II ", "IBB ", "BIB ", "BB ", "B ", "BI ", "IB ", "B ", "B ", "BN ", + "BN ", "BN ", "BB ", "BB ", "BN ", "BN ", "BB ", "BB ", "BN ", "BB ", "BN ", "B ", "I ", "IB ", + "IB ", "II ", "I ", "I ", "IN ", "B ", "T ", "T ", "I ", "I ", " ", "T ", " ", " ", + "N ", "IBN ", "I ", "I ", "I ", "NN ", " ", " ", "IT ", "II ", "I ", "B ", " ", "IB ", "IBB ", + "IIB ", "T ", "T ", "T ", "IB ", "IB ", "IB ", "B ", "BB ", "IBB ", "NB ", "N ", "NBNNN ", "N ", + " ", "BNNNNNN ", "B ", " ", "B ", "B ", "N ", "NNNNNIN ", "N ", "N ", "N ", "NNN ", "NBNN ", + "IBNN ", "IB ", "IB ", "IB ", "IB ", "N ", "N ", "N ", "BI ", " ", " ", "N ", "I ", "IBB ", + "NN ", "N ", "N ", "Ban ", "BB ", " ", " ", " ", " ", "IB ", "B ", " ", "II ", " ", "BI ", "N ", + "I ", "IB ", "IB ", "IB ", "IB ", "IB ", "IB ", "IB ", "BI ", "BB ", "B ", "B ", "B ", "B ", + "IBB ", "IBN ", "IB ", "B ", " ", "TB ", "TB ", "I ", "N ", "B ", "INB ", "INB ", "INB ", "INB ", + "INB ", "INB ", "INB ", "N ", " ", "INBB ", "B ", "B ", "Ian ", "B ", "B ", "B ", "B ", "T ", + "T ", "B ", " ", "I ", " ", " " +}; + static const char *const opcodeArgTable_waxworks[256] = { " ", "I ", "I ", "I ", "I ", "I ", "I ", "II ", "II ", "II ", "II ", "B ", "B ", "BN ", "BN ", "BN ", "BN ", "BB ", "BB ", "BB ", "BB ", "II ", "II ", "N ", "I ", "I ", "I ", "IN ", "IB ", @@ -636,8 +653,10 @@ byte *AGOSEngine::readSingleOpcode(Common::File *in, byte *ptr) { table = opcodeArgTable_simon1talkie; else if (getGameType() == GType_SIMON1) table = opcodeArgTable_simon1dos; - else if (getGameType() == GType_WW || getGameType() == GType_ELVIRA2) + else if (getGameType() == GType_WW) table = opcodeArgTable_waxworks; + else if (getGameType() == GType_ELVIRA2) + table = opcodeArgTable_elvira2; else table = opcodeArgTable_elvira1; |