aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTravis Howell2006-10-04 07:10:22 +0000
committerTravis Howell2006-10-04 07:10:22 +0000
commitaab8b9b2a26b29f8fe5c582ec236b7329280fc15 (patch)
tree130661fc8de4312206fc48d32f193347b5f3e206
parent863bed3fd034ab9e7a93d5426aab5c00297f4340 (diff)
downloadscummvm-rg350-aab8b9b2a26b29f8fe5c582ec236b7329280fc15.tar.gz
scummvm-rg350-aab8b9b2a26b29f8fe5c582ec236b7329280fc15.tar.bz2
scummvm-rg350-aab8b9b2a26b29f8fe5c582ec236b7329280fc15.zip
Fix initial resource loading in Elvira 2
svn-id: r24106
-rw-r--r--engines/agos/agos.cpp12
-rw-r--r--engines/agos/intern.h9
-rw-r--r--engines/agos/items.cpp4
-rw-r--r--engines/agos/res.cpp73
-rw-r--r--engines/agos/subroutine.cpp64
-rw-r--r--engines/agos/vga.cpp4
6 files changed, 99 insertions, 67 deletions
diff --git a/engines/agos/agos.cpp b/engines/agos/agos.cpp
index 1ff3cfb580..72dc0244da 100644
--- a/engines/agos/agos.cpp
+++ b/engines/agos/agos.cpp
@@ -611,6 +611,18 @@ void AGOSEngine::setupGame() {
_tableMemSize = 150000;
_vgaBaseDelay = 1;
_numVars = 255;
+ } else if (getGameType() == GType_ELVIRA2) {
+ gss = PTR(simon1_settings);
+ _numTextBoxes = 20;
+ _numVideoOpcodes = 56;
+#ifndef PALMOS_68K
+ _vgaMemSize = 1000000;
+#else
+ _vgaMemSize = gVars->memory[kMemSimon1Games];
+#endif
+ _tableMemSize = 50000;
+ _vgaBaseDelay = 1;
+ _numVars = 512;
} else if (getGameType() == GType_ELVIRA) {
gss = PTR(simon1_settings);
_numTextBoxes = 20;
diff --git a/engines/agos/intern.h b/engines/agos/intern.h
index c3a425f7c9..64160918c7 100644
--- a/engines/agos/intern.h
+++ b/engines/agos/intern.h
@@ -40,6 +40,14 @@ struct SubRoom : Child {
uint16 flags;
};
+struct SubSuperRoom : Child {
+ uint16 subroutine_id;
+ uint16 roomX;
+ uint16 roomY;
+ uint16 roomZ;
+ uint16 roomExit[1];
+};
+
struct SubObject : Child {
uint16 objectName;
uint16 objectSize;
@@ -77,6 +85,7 @@ struct SubGenExit : Child {
enum {
SubRoom_SIZE = sizeof(SubRoom) - sizeof(uint16),
+ SubSuperRoom_SIZE = sizeof(SubSuperRoom) - sizeof(uint16),
SubObject_SIZE = sizeof(SubObject) - sizeof(int16)
};
diff --git a/engines/agos/items.cpp b/engines/agos/items.cpp
index 80c0eb3f03..e53ef8095b 100644
--- a/engines/agos/items.cpp
+++ b/engines/agos/items.cpp
@@ -2618,7 +2618,7 @@ int AGOSEngine::runScript() {
if (_continousMainScript)
dumpOpcode(_codePtr);
- if (getGameType() == GType_ELVIRA || getGameType() == GType_ELVIRA2) {
+ if (getGameType() == GType_ELVIRA) {
opcode = getVarOrWord();
if (opcode == 10000)
return 0;
@@ -2634,7 +2634,7 @@ int AGOSEngine::runScript() {
/* Invert condition? */
flag = false;
- if (getGameType() == GType_ELVIRA || getGameType() == GType_ELVIRA2) {
+ if (getGameType() == GType_ELVIRA) {
if (opcode == 203) {
flag = true;
opcode = getVarOrWord();
diff --git a/engines/agos/res.cpp b/engines/agos/res.cpp
index a0dfa8d86b..d2ee19e951 100644
--- a/engines/agos/res.cpp
+++ b/engines/agos/res.cpp
@@ -262,7 +262,7 @@ void AGOSEngine::readGamePcText(Common::File *in) {
void AGOSEngine::readItemFromGamePc(Common::File *in, Item *item) {
uint32 type;
- if (getGameType() == GType_ELVIRA || getGameType() == GType_ELVIRA2) {
+ if (getGameType() == GType_ELVIRA) {
item->itemName = (uint16)in->readUint32BE();
item->adjective = in->readUint16BE();
item->noun = in->readUint16BE();
@@ -276,6 +276,17 @@ void AGOSEngine::readItemFromGamePc(Common::File *in, Item *item) {
in->readUint16BE();
item->classFlags = in->readUint16BE();
item->children = NULL;
+ } else if (getGameType() == GType_ELVIRA2) {
+ item->itemName = (uint16)in->readUint32BE();
+ item->adjective = in->readUint16BE();
+ item->noun = in->readUint16BE();
+ item->state = in->readUint16BE();
+ item->sibling = (uint16)fileReadItemID(in);
+ item->child = (uint16)fileReadItemID(in);
+ item->parent = (uint16)fileReadItemID(in);
+ in->readUint16BE();
+ item->classFlags = in->readUint16BE();
+ item->children = NULL;
} else {
item->adjective = in->readUint16BE();
item->noun = in->readUint16BE();
@@ -299,7 +310,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 || getGameType() == GType_ELVIRA2) {
+ if (getGameType() == GType_ELVIRA) {
SubRoom *subRoom = (SubRoom *)allocateChildBlock(item, 1, sizeof(SubRoom));
subRoom->roomShort = in->readUint32BE();
subRoom->roomLong = in->readUint32BE();
@@ -325,7 +336,7 @@ void AGOSEngine::readItemChildren(Common::File *in, Item *item, uint type) {
subRoom->roomExit[k++] = (uint16)fileReadItemID(in);
}
} else if (type == 2) {
- if (getGameType() == GType_ELVIRA || getGameType() == GType_ELVIRA2) {
+ if (getGameType() == GType_ELVIRA) {
SubObject *subObject = (SubObject *)allocateChildBlock(item, 2, sizeof(SubObject));
in->readUint32BE();
in->readUint32BE();
@@ -355,22 +366,48 @@ void AGOSEngine::readItemChildren(Common::File *in, Item *item, uint type) {
if (fr & (1 << i))
subObject->objectFlagValue[k++] = in->readUint16BE();
- subObject->objectName = (uint16)in->readUint32BE();
+ if (getGameType() != GType_ELVIRA2)
+ subObject->objectName = (uint16)in->readUint32BE();
}
} else if (type == 4) {
- SubGenExit *genExit = (SubGenExit *)allocateChildBlock(item, 4, sizeof(SubGenExit));
- genExit->dest[0] = (uint16)fileReadItemID(in);
- genExit->dest[1] = (uint16)fileReadItemID(in);
- genExit->dest[2] = (uint16)fileReadItemID(in);
- genExit->dest[3] = (uint16)fileReadItemID(in);
- genExit->dest[4] = (uint16)fileReadItemID(in);
- genExit->dest[5] = (uint16)fileReadItemID(in);
- fileReadItemID(in);
- fileReadItemID(in);
- fileReadItemID(in);
- fileReadItemID(in);
- fileReadItemID(in);
- fileReadItemID(in);
+ if (getGameType() == GType_ELVIRA2) {
+ uint i, j, k, size;
+ uint id, x, y, z;
+ SubSuperRoom *subSuperRoom;
+
+ id = in->readUint16BE();
+ x = in->readUint16BE();
+ y = in->readUint16BE();
+ z = in->readUint16BE();
+
+ j = x * y * z;
+ size = SubSuperRoom_SIZE;
+ for (i = 0; i != j; i++)
+ size += sizeof(subSuperRoom->roomExit[0]);
+
+ subSuperRoom = (SubSuperRoom *)allocateChildBlock(item, 4, size);
+ subSuperRoom->subroutine_id = id;
+ subSuperRoom->roomX = x;
+ subSuperRoom->roomY = y;
+ subSuperRoom->roomZ = z;
+
+ for (i = k = 0; i != j; i++)
+ subSuperRoom->roomExit[k++] = in->readUint16BE();
+ } else if (getGameType() == GType_ELVIRA) {
+ SubGenExit *genExit = (SubGenExit *)allocateChildBlock(item, 4, sizeof(SubGenExit));
+ genExit->dest[0] = (uint16)fileReadItemID(in);
+ genExit->dest[1] = (uint16)fileReadItemID(in);
+ genExit->dest[2] = (uint16)fileReadItemID(in);
+ genExit->dest[3] = (uint16)fileReadItemID(in);
+ genExit->dest[4] = (uint16)fileReadItemID(in);
+ genExit->dest[5] = (uint16)fileReadItemID(in);
+ fileReadItemID(in);
+ fileReadItemID(in);
+ fileReadItemID(in);
+ fileReadItemID(in);
+ fileReadItemID(in);
+ fileReadItemID(in);
+ }
} else if (type == 7) {
SubContainer *container = (SubContainer *)allocateChildBlock(item, 7, sizeof(SubContainer));
container->volume = in->readUint16BE();
@@ -383,7 +420,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 || getGameType() == GType_ELVIRA2) {
+ if (getGameType() == GType_ELVIRA) {
setUserFlag(item, 4, in->readUint16BE());
setUserFlag(item, 5, in->readUint16BE());
setUserFlag(item, 6, in->readUint16BE());
diff --git a/engines/agos/subroutine.cpp b/engines/agos/subroutine.cpp
index 11f1c19686..36c1a28aeb 100644
--- a/engines/agos/subroutine.cpp
+++ b/engines/agos/subroutine.cpp
@@ -32,53 +32,29 @@ namespace AGOS {
// Script opcodes to load into memory
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", */
+ "I ", "I ", "I ", "I ", "I ", "I ", "I ", "I ", "II ", "II ", "II ", "II ", "F ", "F ", "FN ",
+ "FN ", "FN ", "FN ", "FF ", "FF ", "FF ", "FF ", "II ", "II ", "a ", "a ", "n ", "n ", "p ",
+ "N ", "I ", "I ", "I ", "I ", "IN ", "IB ", "IB ", "II ", "IB ", "N ", " ", " ", " ", "I ",
"I ","I ","I ", "I ","I ","I ", "II ","II ","II ","II ","IBF ", "FIB ", "FF ", "N ", "NI ",
- "IF ", "F ", "F ", "IB ", "IB ", "FN ", "FN ", "FN ", "FF ", "FF ", "FN ", "FN ", "FF ", "FF ", /* DIVF", */
- "FN ", "FF ", "FN ", "F ", "I ", "IN ", "IN ", "IB ", "IB ", "IB ", "IB ", "II ", "I ", "I ", /* DEC", */
- "IN ", "T ", "F ", " ", "T ", "T ", "I ", "I ", " ", " ", "T ", " ", " ", " ", " ", " ", "T ", /* PARSE", */
+ "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 ", "ITIN ", "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 ", /* BECOME", */
+ "FN ", "I ", "TN ", "IT ", "II ", "I ", " ", "N ", "I ", " ", "I ", "NI ", "I ", "I ", "T ",
"I ", "I ", "N ", "N ", " ", "N ", "IF ", "IF ", "IF ", "IF ", "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 ", /* ROPENEXT", */
+ "IF ", "INI ", "INN ", "IN ", "II ", "IFF ", "IIF ", "I ", "II ", "I ", "I ", "IN ", "IN ",
"II ", "II ", "II ", "II ", "IIN ", "IIN ", "IN ", "II ", "IN ", "IN ", "T ", "vanpan ",
"vIpI ", "T ", "T ", " ", " ", "IN ", "IN ", "IN ", "IN ", "N ", "INTTT ", "ITTT ",
- "ITTT ", "I ", "I ", "IN ", "I ", " ", "F ", "NN ", "INN ", "INN ", "INNN ", "TF ", "NN ", /* PICTURE", */
- "N ", "NNNNN ", "N ", " ", "NNNNNNN ", "N ", " ", "N ", "NN ", "N ", "NNNNNIN ", "N ", "N ", /* ENABLEBOX", */
- "N ", "NNN ", "NNNN ", "INNN ", "IN ", "IN ", "TT ", "I ", "I ", "I ", "TTT ", "IN ", "IN ", /* UNSETCLASS",*/
- "FN ", "FN ", "FN ", "N ", "N ", "N ", "NI ", " ", " ", "N ", "I ", "INN ", "NN ", "N ", /* WAITENDTUNE */
- "N ", "Nan ", "NN ", " ", " ", " ", " ", " ", " ", " ", "IF ", "N ", " ", " ", " ", "II ", /* PLACENOICONS*/
+ "ITTT ", "I ", "I ", "IN ", "I ", " ", "F ", "NN ", "INN ", "INN ", "INNN ", "TF ", "NN ",
+ "N ", "NNNNN ", "N ", " ", "NNNNNNN ", "N ", " ", "N ", "NN ", "N ", "NNNNNIN ", "N ", "N ",
+ "N ", "NNN ", "NNNN ", "INNN ", "IN ", "IN ", "TT ", "I ", "I ", "I ", "TTT ", "IN ", "IN ",
+ "FN ", "FN ", "FN ", "N ", "N ", "N ", "NI ", " ", " ", "N ", "I ", "INN ", "NN ", "N ",
+ "N ", "Nan ", "NN ", " ", " ", " ", " ", " ", " ", " ", "IF ", "N ", " ", " ", " ", "II ",
" ", "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 ",
@@ -500,7 +476,7 @@ SubroutineLine *AGOSEngine::createSubroutineLine(Subroutine *sub, int where) {
void AGOSEngine::runSubroutine101() {
Subroutine *sub;
- if (getGameType() == GType_ELVIRA || getGameType() == GType_ELVIRA2) {
+ if (getGameType() == GType_ELVIRA) {
// HACK
sub = getSubroutineByID(1);
} else {
@@ -611,13 +587,13 @@ void AGOSEngine::readSubroutineLine(File *in, SubroutineLine *sl, Subroutine *su
sl->verb = in->readUint16BE();
sl->noun1 = in->readUint16BE();
sl->noun2 = in->readUint16BE();
- } else if (getGameType() == GType_ELVIRA || getGameType() == GType_ELVIRA2) {
+ } else if (getGameType() == GType_ELVIRA) {
in->readUint16BE();
in->readUint16BE();
in->readUint16BE();
}
- if (getGameType() == GType_ELVIRA || getGameType() == GType_ELVIRA2) {
+ if (getGameType() == GType_ELVIRA) {
int16 tmp = in->readUint16BE();
WRITE_BE_UINT16(q, tmp);
while (tmp != 10000) {
@@ -666,15 +642,13 @@ byte *AGOSEngine::readSingleOpcode(Common::File *in, byte *ptr) {
table = opcode_arg_table_simon1win;
else if (getGameType() == GType_SIMON1)
table = opcode_arg_table_simon1dos;
- else if (getGameType() == GType_WW)
+ else if (getGameType() == GType_WW || getGameType() == GType_ELVIRA2)
table = opcode_arg_table_waxworks;
- else if (getGameType() == GType_ELVIRA2)
- table = opcode_arg_table_elvira2;
else
table = opcode_arg_table_elvira1;
i = 0;
- if (getGameType() == GType_ELVIRA || getGameType() == GType_ELVIRA2) {
+ if (getGameType() == GType_ELVIRA) {
opcode = READ_BE_UINT16(ptr);
ptr += 2;
} else {
@@ -705,7 +679,7 @@ byte *AGOSEngine::readSingleOpcode(Common::File *in, byte *ptr) {
break;
case 'B':
- if (getGameType() == GType_ELVIRA || getGameType() == GType_ELVIRA2) {
+ if (getGameType() == GType_ELVIRA) {
val = in->readUint16BE();
WRITE_BE_UINT16(ptr, val); ptr += 2;
} else {
diff --git a/engines/agos/vga.cpp b/engines/agos/vga.cpp
index 6e56fcc3f1..2fc7112be4 100644
--- a/engines/agos/vga.cpp
+++ b/engines/agos/vga.cpp
@@ -186,9 +186,9 @@ void AGOSEngine::setupVgaOpcodes() {
switch (getGameType()) {
case GType_ELVIRA:
- case GType_ELVIRA2:
setupElvira1VideoOpcodes(vga_opcode_table);
break;
+ case GType_ELVIRA2:
case GType_WW:
case GType_SIMON1:
setupCommonVideoOpcodes(vga_opcode_table);
@@ -2346,7 +2346,7 @@ void AGOSEngine::vc57_blackPalette() {
void AGOSEngine::vc58() {
if (getGameType() == GType_WW)
- return;
+ error("Code whell");;
uint16 sprite = _vgaCurSpriteId;
uint16 file = _vgaCurZoneNum;