From 7032dd5a1dd804b1691c98a0982f3eb0691537cb Mon Sep 17 00:00:00 2001 From: D G Turner Date: Sat, 28 Jul 2012 09:05:16 +0100 Subject: TEENAGENT: Symbolise most of remaining addresses in TeenAgent engine. Also, change address 0 usage to 0x0000 for readability. --- engines/teenagent/callbacks.cpp | 20 ++++++++++---------- engines/teenagent/resources.h | 9 +++++++++ engines/teenagent/teenagent.cpp | 22 +++++++++++----------- 3 files changed, 30 insertions(+), 21 deletions(-) (limited to 'engines/teenagent') diff --git a/engines/teenagent/callbacks.cpp b/engines/teenagent/callbacks.cpp index b49f69b5d5..d87b23b837 100644 --- a/engines/teenagent/callbacks.cpp +++ b/engines/teenagent/callbacks.cpp @@ -124,7 +124,7 @@ void TeenAgentEngine::fnPoleClimbFail() { } void TeenAgentEngine::fnGotAnchor() { - SET_FLAG(0, 0); + SET_FLAG(0x0000, 0); setTimerCallback(0, 0); scene->getActorAnimation()->free(); playSound(64, 7); @@ -148,7 +148,7 @@ void TeenAgentEngine::fnGetOutOfLake() { } void TeenAgentEngine::fnGuardDrinking() { - SET_FLAG(0, 0); + SET_FLAG(0x0000, 0); setTimerCallback(0, 0); scene->getAnimation(0)->free(); SET_FLAG(0xdb9c, 1); @@ -225,7 +225,7 @@ void TeenAgentEngine::fnPutRockInHole() { playActorAnimation(638); inventory->remove(48); setTimerCallback(0x8d79, 100); - SET_FLAG(0, 1); + SET_FLAG(0x0000, 1); } else if (CHECK_FLAG(0, 1)) { playSound(5, 2); playSound(52, 13); @@ -233,7 +233,7 @@ void TeenAgentEngine::fnPutRockInHole() { setOns(1, 46); inventory->remove(49); setTimerCallback(0x8d79, 100); - SET_FLAG(0, 2); + SET_FLAG(0x0000, 2); } else if (CHECK_FLAG(0, 2)) { playActorAnimation(649); setOns(1, 47); @@ -245,7 +245,7 @@ void TeenAgentEngine::fnPutRockInHole() { enableObject(6); disableObject(5); SET_FLAG(0xdbab, 1); - SET_FLAG(0, 0); + SET_FLAG(0x0000, 0); setTimerCallback(0, 0); } } @@ -1144,14 +1144,14 @@ bool TeenAgentEngine::processCallback(uint16 addr) { loadScene(11, 319, 198, 4); if (!CHECK_FLAG(0xdb9c, 1)) { // guard is drinking - SET_FLAG(0, 3); + SET_FLAG(0x0000, 3); setTimerCallback(0x516d, 40); playAnimation(544, 0, true, true); // ignore busy flag for this animation } break; case 0x516d: // too late to scare guard, resetting - SET_FLAG(0, 0); + SET_FLAG(0x0000, 0); break; case csAddr_guardDrinking: @@ -3140,7 +3140,7 @@ bool TeenAgentEngine::processCallback(uint16 addr) { enableObject(4, 27); SET_FLAG(0xdba9, 0); } - SET_FLAG(0, 0); + SET_FLAG(0x0000, 0); break; case csAddr_putRockInHole: @@ -4133,7 +4133,7 @@ bool TeenAgentEngine::processCallback(uint16 addr) { playSound(20, 26); playActorAnimation(615); loadScene(17, 156, 180, 3); - SET_FLAG(0, 4); + SET_FLAG(0x0000, 4); playSound(64, 7); playSound(64, 21); playSound(64, 42); @@ -4145,7 +4145,7 @@ bool TeenAgentEngine::processCallback(uint16 addr) { break; case 0x9a1d: // no anchor, timeout - SET_FLAG(0, 0); + SET_FLAG(0x0000, 0); fnGetOutOfLake(); INC_FLAG(0xdba6); switch (GET_FLAG(0xdba6)) { diff --git a/engines/teenagent/resources.h b/engines/teenagent/resources.h index c3561fcd79..46b709bc5e 100644 --- a/engines/teenagent/resources.h +++ b/engines/teenagent/resources.h @@ -663,9 +663,18 @@ const uint16 dsAddr_currentScene = 0xb4f3; // 1 byte // Ons Animation Table (2 byte address * ??) : 0xb4f5 to 0x???? const uint16 dsAddr_onsAnimationTablePtr = 0xb4f5; +// Examine Object Callback Table (2 byte LE address * ??) : 0xb5ce to 0x???? +const uint16 dsAddr_objExamineCallbackTablePtr = 0xb5ce; + +// Use Object Callback Table (2 byte LE address * ??) : 0xb89c to 0x???? +const uint16 dsAddr_objUseCallbackTablePtr = 0xb89c; + // Inventory Object Callback Table (3 byte (id, callbackAddr) * 7) : 0xbb72 to 0xbb86 const uint16 dsAddr_objCallbackTablePtr = 0xbb72; +// Scene Hotspots Table (2 byte LE address * ??) : 0xbb87 to 0x???? +const uint16 dsAddr_sceneHotspotsPtr = 0xbb87; + // 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 diff --git a/engines/teenagent/teenagent.cpp b/engines/teenagent/teenagent.cpp index ad50645ffc..000d38cba0 100644 --- a/engines/teenagent/teenagent.cpp +++ b/engines/teenagent/teenagent.cpp @@ -100,8 +100,8 @@ bool TeenAgentEngine::trySelectedObject() { debugC(0, kDebugObject, "checking active object %u on %u", inv->id, _dstObject->id); //mouse time challenge hack: - if ((res->dseg.get_byte(0) == 1 && inv->id == 49 && _dstObject->id == 5) || - (res->dseg.get_byte(0) == 2 && inv->id == 29 && _dstObject->id == 5)) { + if ((res->dseg.get_byte(0x0000) == 1 && inv->id == 49 && _dstObject->id == 5) || + (res->dseg.get_byte(0x0000) == 2 && inv->id == 29 && _dstObject->id == 5)) { //putting rock into hole or superglue on rock fnPutRockInHole(); return true; @@ -137,7 +137,7 @@ void TeenAgentEngine::processObject() { if (trySelectedObject()) break; - byte *dcall = res->dseg.ptr(0xb5ce); + byte *dcall = res->dseg.ptr(dsAddr_objExamineCallbackTablePtr); dcall = res->dseg.ptr(READ_LE_UINT16(dcall + scene->getId() * 2 - 2)); dcall += 2 * _dstObject->id - 2; uint16 callback = READ_LE_UINT16(dcall); @@ -149,7 +149,7 @@ void TeenAgentEngine::processObject() { if (trySelectedObject()) break; - byte *dcall = res->dseg.ptr(0xb89c); + byte *dcall = res->dseg.ptr(dsAddr_objUseCallbackTablePtr); dcall = res->dseg.ptr(READ_LE_UINT16(dcall + scene->getId() * 2 - 2)); dcall += 2 * _dstObject->id - 2; uint16 callback = READ_LE_UINT16(dcall); @@ -203,14 +203,14 @@ void TeenAgentEngine::init() { _gameDelay = 110; _useHotspots.resize(42); - byte *scene_hotspots = res->dseg.ptr(0xbb87); + byte *sceneHotspots = res->dseg.ptr(dsAddr_sceneHotspotsPtr); for (byte i = 0; i < 42; ++i) { Common::Array & hotspots = _useHotspots[i]; - byte *hotspots_ptr = res->dseg.ptr(READ_LE_UINT16(scene_hotspots + i * 2)); - while (*hotspots_ptr) { + byte *hotspotsPtr = res->dseg.ptr(READ_LE_UINT16(sceneHotspots + i * 2)); + while (*hotspotsPtr) { UseHotspot h; - h.load(hotspots_ptr); - hotspots_ptr += 9; + h.load(hotspotsPtr); + hotspotsPtr += 9; hotspots.push_back(h); } } @@ -609,11 +609,11 @@ Common::Error TeenAgentEngine::run() { if (current_object == NULL) break; - if (res->dseg.get_byte(0) == 3 && current_object->id == 1) { + if (res->dseg.get_byte(0x0000) == 3 && current_object->id == 1) { fnGuardDrinking(); break; } - if (res->dseg.get_byte(0) == 4 && current_object->id == 5) { + if (res->dseg.get_byte(0x0000) == 4 && current_object->id == 5) { fnGotAnchor(); break; } -- cgit v1.2.3