aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorD G Turner2012-07-27 06:46:34 +0100
committerD G Turner2012-07-27 06:46:34 +0100
commitb19c164f1a20d02ccdd88a972e9440faa6d95094 (patch)
tree80a4fff2fdc91948a8b948d4366d9a2102d7d1ee /engines
parent7dce94c70bdc0ad58c1fe1ce6324dad7854daf2b (diff)
downloadscummvm-rg350-b19c164f1a20d02ccdd88a972e9440faa6d95094.tar.gz
scummvm-rg350-b19c164f1a20d02ccdd88a972e9440faa6d95094.tar.bz2
scummvm-rg350-b19c164f1a20d02ccdd88a972e9440faa6d95094.zip
TEENAGENT: Add symbols for object callback tables in Inventory class.
Also, removed one ptr usage, replacing with direct get_byte / get_word accesses.
Diffstat (limited to 'engines')
-rw-r--r--engines/teenagent/inventory.cpp13
-rw-r--r--engines/teenagent/resources.h7
2 files changed, 14 insertions, 6 deletions
diff --git a/engines/teenagent/inventory.cpp b/engines/teenagent/inventory.cpp
index 391bcd4ddd..7bf974217b 100644
--- a/engines/teenagent/inventory.cpp
+++ b/engines/teenagent/inventory.cpp
@@ -140,13 +140,14 @@ void Inventory::add(byte item) {
}
bool Inventory::tryObjectCallback(InventoryObject *obj) {
- byte id = obj->id;
- uint i = 0;
- for (byte *table = _vm->res->dseg.ptr(0xbb6f + 3); table[0] != 0 && i < 7; table += 3, ++i) {
- if (table[0] == id) {
+ byte objId = obj->id;
+ for (uint i = 0; i < 7; ++i) {
+ byte tableId = _vm->res->dseg.get_byte(dsAddr_objCallbackTablePtr + (3 * i));
+ uint16 callbackAddr = _vm->res->dseg.get_word(dsAddr_objCallbackTablePtr + (3 * i) + 1);
+ if (tableId == objId) {
resetSelectedObject();
activate(false);
- if (_vm->processCallback(READ_LE_UINT16(table + 1)))
+ if (_vm->processCallback(callbackAddr))
return true;
}
}
@@ -209,7 +210,7 @@ bool Inventory::processEvent(const Common::Event &event) {
return true;
debugC(0, kDebugInventory, "combine(%u, %u)!", id1, id2);
- byte *table = _vm->res->dseg.ptr(0xc335);
+ byte *table = _vm->res->dseg.ptr(dsAddr_objCombiningTablePtr);
while (table[0] != 0 && table[1] != 0) {
if ((id1 == table[0] && id2 == table[1]) || (id2 == table[0] && id1 == table[1])) {
byte new_obj = table[2];
diff --git a/engines/teenagent/resources.h b/engines/teenagent/resources.h
index c424462a6c..a834dfcbe4 100644
--- a/engines/teenagent/resources.h
+++ b/engines/teenagent/resources.h
@@ -642,6 +642,13 @@ const uint16 dsAddr_egoY = 0x64b1; // 2 bytes
// Current Scene Id : 0xb4f3
const uint16 dsAddr_currentScene = 0xb4f3; // 1 byte
+// Inventory Object Callback Table (3 byte (id, callbackAddr) * 7) : 0xbb72 to 0xbb86
+const uint16 dsAddr_objCallbackTablePtr = 0xbb72;
+
+// Inventory Object Combining Table (5 byte (id, id, new object id, msgAddr) * 34) : 0xc335 to 0xc3de
+const uint16 dsAddr_objCombiningTablePtr = 0xc335;
+// 3 byte null terminator for Combining table 0xc3df to 0xc3e1
+
// Object Combine Error Message : 0xc3e2 to 0xc41e
const uint16 dsAddr_objCombineErrorMsg = 0xc3e2; // "Using these two objects ..."