aboutsummaryrefslogtreecommitdiff
path: root/engines/agos
diff options
context:
space:
mode:
authorTravis Howell2006-10-05 08:54:51 +0000
committerTravis Howell2006-10-05 08:54:51 +0000
commit4dd72f0b3b6f92722e403eeb11f8227f6374f42c (patch)
treec10f4384586b56d55af4bb1e209c41759e18d37a /engines/agos
parent5074da16d33c0de24ec99e6773c66600f5c75962 (diff)
downloadscummvm-rg350-4dd72f0b3b6f92722e403eeb11f8227f6374f42c.tar.gz
scummvm-rg350-4dd72f0b3b6f92722e403eeb11f8227f6374f42c.tar.bz2
scummvm-rg350-4dd72f0b3b6f92722e403eeb11f8227f6374f42c.zip
Fix loading position of initial items in Elvira 1/2
svn-id: r24122
Diffstat (limited to 'engines/agos')
-rw-r--r--engines/agos/items.cpp5
-rw-r--r--engines/agos/res.cpp10
-rw-r--r--engines/agos/rooms.cpp10
-rw-r--r--engines/agos/subroutine.cpp8
4 files changed, 11 insertions, 22 deletions
diff --git a/engines/agos/items.cpp b/engines/agos/items.cpp
index d70f98d33c..48662f14de 100644
--- a/engines/agos/items.cpp
+++ b/engines/agos/items.cpp
@@ -231,6 +231,7 @@ void AGOSEngine::setupElvira1Opcodes(OpcodeProc *op) {
op[87] = &AGOSEngine::o_setState;
op[91] = &AGOSEngine::o_message;
+ op[92] = &AGOSEngine::o_message;
op[97] = &AGOSEngine::o_end;
op[98] = &AGOSEngine::o_done;
@@ -1771,11 +1772,11 @@ void AGOSEngine::oww_moveDirn() {
void AGOSEngine::oww_goto() {
// 55: set itemA parent
uint item = getNextItemID();
- if (_itemArrayPtr[item] == NULL) {
+ if (derefItem(item) == NULL) {
setItemParent(me(), NULL);
loadRoomItems(item);
}
- setItemParent(me(), _itemArrayPtr[item]);
+ setItemParent(me(), derefItem(item));
}
void AGOSEngine::oww_whereTo() {
diff --git a/engines/agos/res.cpp b/engines/agos/res.cpp
index 805b53baf7..8a7777e41d 100644
--- a/engines/agos/res.cpp
+++ b/engines/agos/res.cpp
@@ -111,7 +111,7 @@ void AGOSEngine::loadOffsets(const char *filename, int number, uint32 &file, uin
int AGOSEngine::allocGamePcVars(File *in) {
uint item_array_size, item_array_inited, stringtable_num;
uint32 version;
- uint i, firstItem;
+ uint i;
item_array_size = in->readUint32BE();
version = in->readUint32BE();
@@ -119,12 +119,11 @@ int AGOSEngine::allocGamePcVars(File *in) {
stringtable_num = in->readUint32BE();
if (getGameType() == GType_ELVIRA || getGameType() == GType_ELVIRA2) {
+ item_array_size += 2;
item_array_inited = item_array_size;
- firstItem = 0;
} else {
item_array_inited += 2; // first two items are predefined
item_array_size += 2;
- firstItem = 1;
}
if (version != 0x80)
@@ -137,7 +136,7 @@ int AGOSEngine::allocGamePcVars(File *in) {
_itemArraySize = item_array_size;
_itemArrayInited = item_array_inited;
- for (i = firstItem; i < item_array_inited; i++) {
+ for (i = 1; i < item_array_inited; i++) {
_itemArrayPtr[i] = (Item *)allocateItem(sizeof(Item));
}
@@ -164,8 +163,7 @@ void AGOSEngine::loadGamePcFile() {
createPlayer();
readGamePcText(&in);
- int firstItem = (getGameType() == GType_ELVIRA || getGameType() == GType_ELVIRA2) ? 0 : 2;
- for (i = firstItem; i < num_inited_objects; i++) {
+ for (i = 2; i < num_inited_objects; i++) {
readItemFromGamePc(&in, _itemArrayPtr[i]);
}
diff --git a/engines/agos/rooms.cpp b/engines/agos/rooms.cpp
index e321485e53..f980d9eeae 100644
--- a/engines/agos/rooms.cpp
+++ b/engines/agos/rooms.cpp
@@ -102,14 +102,11 @@ bool AGOSEngine::loadRoomItems(uint item) {
p++;
for (;;) {
- min_num = (p[0] * 256) | p[1];
- p += 2;
-
+ min_num = READ_BE_UINT16(p); p += 2;
if (min_num == 0)
break;
- max_num = (p[0] * 256) | p[1];
- p += 2;
+ max_num = READ_BE_UINT16(p); p += 2;
if (item >= min_num && item <= max_num) {
@@ -118,9 +115,8 @@ bool AGOSEngine::loadRoomItems(uint item) {
error("loadRoomItems: Can't load rooms file '%s'", filename);
}
- for (i = min_num; i <= max_num; i++) {
+ while ((i = in.readUint16BE()) != 0) {
_itemArrayPtr[i] = (Item *)allocateItem(sizeof(Item));
- in.readUint16BE();
readItemFromGamePc(&in, _itemArrayPtr[i]);
}
in.close();
diff --git a/engines/agos/subroutine.cpp b/engines/agos/subroutine.cpp
index 3d295071fc..d1e28e58cc 100644
--- a/engines/agos/subroutine.cpp
+++ b/engines/agos/subroutine.cpp
@@ -476,13 +476,7 @@ SubroutineLine *AGOSEngine::createSubroutineLine(Subroutine *sub, int where) {
void AGOSEngine::runSubroutine101() {
Subroutine *sub;
- if (getGameType() == GType_ELVIRA || getGameType() == GType_ELVIRA2) {
- // HACK
- sub = getSubroutineByID(1);
- } else {
- sub = getSubroutineByID(101);
- }
-
+ sub = getSubroutineByID(101);
if (sub != NULL)
startSubroutineEx(sub);