diff options
author | Travis Howell | 2006-09-30 05:51:06 +0000 |
---|---|---|
committer | Travis Howell | 2006-09-30 05:51:06 +0000 |
commit | f5c5a64d72dbe2d5017efcb8cca0aeb7326ddef8 (patch) | |
tree | 74171b4658914c3ef717b282812930a728d33169 /engines/agos | |
parent | 54d3405225694231eec986089f59e0b067631ca9 (diff) | |
download | scummvm-rg350-f5c5a64d72dbe2d5017efcb8cca0aeb7326ddef8.tar.gz scummvm-rg350-f5c5a64d72dbe2d5017efcb8cca0aeb7326ddef8.tar.bz2 scummvm-rg350-f5c5a64d72dbe2d5017efcb8cca0aeb7326ddef8.zip |
Add opcode table for Elvira 2 and cleanup
svn-id: r24025
Diffstat (limited to 'engines/agos')
-rw-r--r-- | engines/agos/debug.cpp | 32 | ||||
-rw-r--r-- | engines/agos/intern.h | 2 | ||||
-rw-r--r-- | engines/agos/items.cpp | 2 | ||||
-rw-r--r-- | engines/agos/res.cpp | 93 |
4 files changed, 87 insertions, 42 deletions
diff --git a/engines/agos/debug.cpp b/engines/agos/debug.cpp index d8d8bc5f45..d422832532 100644 --- a/engines/agos/debug.cpp +++ b/engines/agos/debug.cpp @@ -95,24 +95,32 @@ const byte *AGOSEngine::dumpOpcode(const byte *p) { } case 'W':{ - int n = (int16)((p[0] << 8) | p[1]); + int n = (int16)READ_BE_UINT16(p); p += 2; - if (n >= 30000 && n < 30512) - printf("[%d] ", n - 30000); - else - printf("%d ", n); + if (getGameType() == GType_PP) { + if (n >= 60000 && n < 62048) + printf("[%d] ", n - 60000); + else + printf("%d ", n); + + } else { + if (n >= 30000 && n < 30512) + printf("[%d] ", n - 30000); + else + printf("%d ", n); + } break; } case 'w':{ - int n = (int16)((p[0] << 8) | p[1]); + int n = (int16)READ_BE_UINT16(p); p += 2; printf("%d ", n); break; } case 'I':{ - int n = (int16)((p[0] << 8) | p[1]);; + int n = (int16)READ_BE_UINT16(p); p += 2; if (n == -1) printf("ITEM_M1 "); @@ -135,7 +143,7 @@ const byte *AGOSEngine::dumpOpcode(const byte *p) { break; case 'T':{ - uint n = ((p[0] << 8) | p[1]); + uint n = READ_BE_UINT16(p); p += 2; if (n != 0xFFFF) printf("\"%s\"(%d) ", getStringPtrByID(n), n); @@ -188,11 +196,11 @@ void AGOSEngine::dump_video_script(const byte *src, bool one_opcode_only) { const char *str, *strn; do { - if (getGameType() == GType_SIMON1 || getGameType() == GType_WW) { + if (getGameType() == GType_SIMON2 || getGameType() == GType_FF || getGameType() == GType_PP) { + opcode = *src++; + } else { opcode = READ_BE_UINT16(src); src += 2; - } else { - opcode = *src++; } if (opcode >= _numVideoOpcodes) { @@ -338,7 +346,7 @@ void dump_bmp(const char *filename, int w, int h, const byte *bytes, const uint3 void AGOSEngine::dump_bitmap(const char *filename, const byte *offs, int w, int h, int flags, const byte *palette, byte base) { - if (getGameType() == GType_SIMON1 || getGameType() == GType_SIMON2) + if (getGameType() != GType_FF && getGameType() != GType_PP) w *= 16; /* allocate */ diff --git a/engines/agos/intern.h b/engines/agos/intern.h index 3883d36c6b..4c3b7a8ae7 100644 --- a/engines/agos/intern.h +++ b/engines/agos/intern.h @@ -42,6 +42,8 @@ struct SubRoom : Child { struct SubObject : Child { uint16 objectName; + uint16 objectSize; + uint16 objectWeight; uint32 objectFlags; int16 objectFlagValue[1]; }; diff --git a/engines/agos/items.cpp b/engines/agos/items.cpp index cf12a41cde..8762e0511c 100644 --- a/engines/agos/items.cpp +++ b/engines/agos/items.cpp @@ -516,6 +516,8 @@ void AGOSEngine::setupOpcodes() { opcode_table[283] = &AGOSEngine::o_isBox; break; + case GType_ELVIRA2: + break; case GType_WW: // Confirmed opcode_table[70] = &AGOSEngine::o1_printLongText; diff --git a/engines/agos/res.cpp b/engines/agos/res.cpp index 6d87ad494f..9057eb791f 100644 --- a/engines/agos/res.cpp +++ b/engines/agos/res.cpp @@ -40,7 +40,7 @@ using Common::File; namespace AGOS { // Script opcodes to load into memory -static const char *const opcode_arg_table_elvira[300] = { +static const char *const opcode_arg_table_elvira1[300] = { "I ", "I ", "I ", "I ", "I ", "I ", "I ", "I ", "II ", "II ", "II ", "II ", "F ", "F ", "FN ", /* EQ", */ "FN ", "FN ", "FN ", "FF ", "FF ", "FF ", "FF ", "II ", "II ", "a ", "a ", "n ", "n ", "p ", /* PREP", */ "N ", "I ", "I ", "I ", "I ", "IN ", "IB ", "IB ", "II ", "IB ", "N ", " ", " ", " ", "I ", /* GET", */ @@ -64,6 +64,30 @@ static const char *const opcode_arg_table_elvira[300] = { " ", "NI ","N ", }; +static const char *const opcode_arg_table_elvira2[400] = { + "I ", "I ", "I ", "I ", "I ", "I ", "I ", "I ", "II ", "II ", "II ", "II ", "F ", "F ", "F ", + "N ", "FN ", "FN ", "FN ", "FF ", "FF ", "FF ", "FF ", "II ", "II ", "a ", "a ", "n ", "n ", + "p ", "N ", " ", "I ", "I ", "I ", "I ", "IN ", "IB ", "I ", "B ", "II ", "IB ", "N ", " ", " ", + " ", "I ", "I ", " ", "I ", "I ", "I ", "I ", "I ", "II ", "I ", "I ", "II ", "II ", "IBF ", + "FIB ", "FF ", "N ", "NI ", "IF ", "F ", "F ", "IB ", "IB ", "FN ", "FN ", " ", "FN ", "FF ", + "FF ", "FN ", "FN ", "FF ", "FF ", "FN ", "FF ", "FN ", "F ", "I ", "IN ", "IN ", "IB", " ", + "IB ", "IB ", "IB ", "II ", "I ", "I ", "IN ", "T ", "F ", " ", "T ", "T ", "I ", "I ", " ", + " ", "T ", " ", " ", " ", " ", " ", "T ", " ", "N ", "INN ", "II ", "II ", "ITN ", "ITIN ", + "ITI ", "N ", "I3 ", "IN ", "I ", "I ", "Ivnn ", "vnn ", "Ivnn ", "NN ", "IT ", "INN ", " ", + "N ", "N ", "N ", " ", "T ", "v ", " ", " ", " ", " ", "FN ", "I ", "TN ", "IT ", "II ", "I ", + " ", "N ", "I ", " ", "I ", "NI ", "I ", "I ", "T ", "I ", "I ", "N ", "N ", " ", "N ", "IF ", + "IF ", "IF ", "I ", "F ", "IF ", "IF ", "T ", "IB ", "IB ", "IB ", "I ", " ", "vnnN ", "Ivnn ", + "T ", "T ", "T ", "IF ", " ", " ", " ", "Ivnn ", "IF ", "INI ", "INN ", "IN ", " ", "II ", + "IFF ", "IIF ", "I ", "II ", "I ", "I ", "IN ", "IN ", "II ", "II ", "II ", "II ", "IIN " + " ", "IIN ", "IN ", "II ", "IN ", "IN ", "T ", "v", "anpan ", "vIpI ", "T ", "T ", " ", + " ", "IN ", "I ", "N ", "IN ", "IN ", "N ", "INTTT ", "ITTT ", "ITTT ", "I ", "I ", "IN ", + "I ", " ", "F ", "NN ", "I ", "NN ", "INN ", "INNN ", "TF ", "NN ", "N ", "NNNN ", "N ", "N ", + " ", "NNNNNNN ", "N ", " ", "N ", "NN ", "N ", "NNNNNIN ", "N ", "N ", "N ", "N ", "NN ", + "NNNN ", "INNN ", "IN ", "IN ", "TT ", "I ", "I ", "I ", "TTT ", "IN ", "IN ", "FN ", "FN ", + "F ", "N ", "N ", "N ", "N ", "NI ", " ", " ", "N ", "I ", "INN ", "NN ", "N ", "N ", "Nan ", + "NN ", " ", " ", " ", " ", " ", " ", " ", "IF ", "N ", " ", " ", " ", "II ", " ", "NI ", "N " +}; + static const char *const opcode_arg_table_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 ", @@ -443,7 +467,7 @@ void AGOSEngine::readItemFromGamePc(Common::File *in, Item *item) { void AGOSEngine::readItemChildren(Common::File *in, Item *item, uint type) { if (type == 1) { - if (getGameType() == GType_ELVIRA) { + if (getGameType() == GType_ELVIRA || getGameType() == GType_ELVIRA2) { SubRoom *subRoom = (SubRoom *)allocateChildBlock(item, 1, sizeof(SubRoom)); subRoom->roomShort = in->readUint32BE(); subRoom->roomLong = in->readUint32BE(); @@ -469,27 +493,38 @@ void AGOSEngine::readItemChildren(Common::File *in, Item *item, uint type) { subRoom->roomExit[k++] = (uint16)fileReadItemID(in); } } else if (type == 2) { - uint32 fr = in->readUint32BE(); - uint i, k, size; - SubObject *subObject; + if (getGameType() == GType_ELVIRA || getGameType() == GType_ELVIRA2) { + SubObject *subObject = (SubObject *)allocateChildBlock(item, 2, sizeof(SubObject)); + in->readUint32BE(); + in->readUint32BE(); + in->readUint32BE(); + subObject->objectName = in->readUint32BE(); + subObject->objectSize = in->readUint16BE(); + subObject->objectWeight = in->readUint16BE(); + subObject->objectFlags = in->readUint16BE(); + } else { + uint32 fr = in->readUint32BE(); + uint i, k, size; + SubObject *subObject; - size = SubObject_SIZE; - for (i = 0; i != 16; i++) - if (fr & (1 << i)) - size += sizeof(subObject->objectFlagValue[0]); + size = SubObject_SIZE; + for (i = 0; i != 16; i++) + if (fr & (1 << i)) + size += sizeof(subObject->objectFlagValue[0]); - subObject = (SubObject *)allocateChildBlock(item, 2, size); - subObject->objectFlags = fr; + subObject = (SubObject *)allocateChildBlock(item, 2, size); + subObject->objectFlags = fr; - k = 0; - if (fr & 1) { - subObject->objectFlagValue[k++] = (uint16)in->readUint32BE(); - } - for (i = 1; i != 16; i++) - if (fr & (1 << i)) - subObject->objectFlagValue[k++] = in->readUint16BE(); + k = 0; + if (fr & 1) { + subObject->objectFlagValue[k++] = (uint16)in->readUint32BE(); + } + for (i = 1; i != 16; i++) + if (fr & (1 << i)) + subObject->objectFlagValue[k++] = in->readUint16BE(); - subObject->objectName = (uint16)in->readUint32BE(); + subObject->objectName = (uint16)in->readUint32BE(); + } } else if (type == 4) { SubGenExit *genExit = (SubGenExit *)allocateChildBlock(item, 4, sizeof(SubGenExit)); genExit->dest[0] = (uint16)fileReadItemID(in); @@ -516,7 +551,7 @@ void AGOSEngine::readItemChildren(Common::File *in, Item *item, uint type) { setUserFlag(item, 1, in->readUint16BE()); setUserFlag(item, 2, in->readUint16BE()); setUserFlag(item, 3, in->readUint16BE()); - if (getGameType() == GType_ELVIRA) { + if (getGameType() == GType_ELVIRA || getGameType() == GType_ELVIRA2) { setUserFlag(item, 4, in->readUint16BE()); setUserFlag(item, 5, in->readUint16BE()); setUserFlag(item, 6, in->readUint16BE()); @@ -563,8 +598,10 @@ byte *AGOSEngine::readSingleOpcode(Common::File *in, byte *ptr) { table = opcode_arg_table_simon1dos; else if (getGameType() == GType_WW) table = opcode_arg_table_waxworks; + else if (getGameType() == GType_ELVIRA2) + table = opcode_arg_table_elvira2; else - table = opcode_arg_table_elvira; + table = opcode_arg_table_elvira1; i = 0; if (getGameType() == GType_ELVIRA || getGameType() == GType_ELVIRA2) { @@ -594,15 +631,13 @@ byte *AGOSEngine::readSingleOpcode(Common::File *in, byte *ptr) { case 'v': case '3': val = in->readUint16BE(); - *ptr++ = val >> 8; - *ptr++ = val & 255; + WRITE_BE_UINT16(ptr, val); ptr += 2; break; case 'B': if (getGameType() == GType_ELVIRA || getGameType() == GType_ELVIRA2) { val = in->readUint16BE(); - *ptr++ = val >> 8; - *ptr++ = val & 255; + WRITE_BE_UINT16(ptr, val); ptr += 2; } else { *ptr++ = in->readByte(); if (ptr[-1] == 0xFF) { @@ -632,8 +667,7 @@ byte *AGOSEngine::readSingleOpcode(Common::File *in, byte *ptr) { default: val = fileReadItemID(in);; } - *ptr++ = val >> 8; - *ptr++ = val & 255; + WRITE_BE_UINT16(ptr, val); ptr += 2; break; case 'T': @@ -649,11 +683,10 @@ byte *AGOSEngine::readSingleOpcode(Common::File *in, byte *ptr) { val = (uint16)in->readUint32BE(); break; } - *ptr++ = val >> 8; - *ptr++ = val & 255; + WRITE_BE_UINT16(ptr, val); ptr += 2; break; default: - error("readSingleOpcode: Bad cmd table entry %c", l); + error("readSingleOpcode: Bad cmd table entry %d", l); } } } |