aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
Diffstat (limited to 'engines')
-rw-r--r--engines/teenagent/actor.cpp12
-rw-r--r--engines/teenagent/actor.h9
-rw-r--r--engines/teenagent/animation.cpp42
-rw-r--r--engines/teenagent/callbacks.cpp2533
-rw-r--r--engines/teenagent/dialog.cpp115
-rw-r--r--engines/teenagent/dialog.h27
-rw-r--r--engines/teenagent/font.cpp12
-rw-r--r--engines/teenagent/inventory.cpp90
-rw-r--r--engines/teenagent/inventory.h4
-rw-r--r--engines/teenagent/music.cpp47
-rw-r--r--engines/teenagent/music.h7
-rw-r--r--engines/teenagent/notes.txt109
-rw-r--r--engines/teenagent/objects.cpp10
-rw-r--r--engines/teenagent/objects.h4
-rw-r--r--engines/teenagent/pack.cpp19
-rw-r--r--engines/teenagent/resources.cpp59
-rw-r--r--engines/teenagent/resources.h35
-rw-r--r--engines/teenagent/scene.cpp332
-rw-r--r--engines/teenagent/scene.h16
-rw-r--r--engines/teenagent/segment.h12
-rw-r--r--engines/teenagent/surface.cpp10
-rw-r--r--engines/teenagent/surface_list.cpp7
-rw-r--r--engines/teenagent/surface_list.h1
-rw-r--r--engines/teenagent/teenagent.cpp139
-rw-r--r--engines/teenagent/teenagent.h30
25 files changed, 1934 insertions, 1747 deletions
diff --git a/engines/teenagent/actor.cpp b/engines/teenagent/actor.cpp
index cb8c798fb6..ef0ca32cf6 100644
--- a/engines/teenagent/actor.cpp
+++ b/engines/teenagent/actor.cpp
@@ -22,29 +22,29 @@
#include "teenagent/actor.h"
#include "teenagent/objects.h"
#include "teenagent/resources.h"
+#include "teenagent/teenagent.h"
#include "common/random.h"
#include "common/textconsole.h"
namespace TeenAgent {
-Actor::Actor() : head_index(0), idle_type(0) {}
+Actor::Actor(TeenAgentEngine *vm) : _vm(vm), head_index(0), idle_type(0) {}
//idle animation lists at dseg: 0x6540
Common::Rect Actor::renderIdle(Graphics::Surface *surface, const Common::Point &position, uint8 orientation, int delta_frame, uint zoom, Common::RandomSource &rnd) {
if (index == 0) {
idle_type = rnd.getRandomNumber(2);
- debug(0, "switched to idle animation %u", idle_type);
+ debugC(kDebugActor, "switched to idle animation %u", idle_type);
}
- Resources *res = Resources::instance();
byte *frames_idle;
do {
- frames_idle = res->dseg.ptr(res->dseg.get_word(0x6540 + idle_type * 2)) + index;
+ frames_idle = _vm->res->dseg.ptr(_vm->res->dseg.get_word(0x6540 + idle_type * 2)) + index;
index += delta_frame;
if (*frames_idle == 0) {
idle_type = rnd.getRandomNumber(2);
- debug(0, "switched to idle animation %u[loop]", idle_type);
+ debugC(kDebugActor, "switched to idle animation %u[loop]", idle_type);
index = 3; //put 4th frame (base 1) if idle animation loops
}
} while (*frames_idle == 0);
@@ -52,7 +52,7 @@ Common::Rect Actor::renderIdle(Graphics::Surface *surface, const Common::Point &
bool mirror = orientation == kActorLeft;
Surface *s = frames + *frames_idle - 1;
- ///\todo remove copy-paste here and below
+ //TODO: remove copy-paste here and below
int xp = position.x - s->w * zoom / 512 - s->x, yp = position.y - 62 * zoom / 256 - s->y; //hardcoded in original game
return s->render(surface, xp, yp, mirror, Common::Rect(), zoom);
}
diff --git a/engines/teenagent/actor.h b/engines/teenagent/actor.h
index 9a7d395547..a2b8ef3d6a 100644
--- a/engines/teenagent/actor.h
+++ b/engines/teenagent/actor.h
@@ -28,11 +28,18 @@ class RandomSource;
namespace TeenAgent {
+class TeenAgentEngine;
+
class Actor : public Animation {
+private:
+ TeenAgentEngine *_vm;
+
uint head_index;
uint idle_type;
+
public:
- Actor();
+ Actor(TeenAgentEngine *vm);
+
Common::Rect render(Graphics::Surface *surface, const Common::Point &position, uint8 orientation, int delta_frame, bool head, uint zoom);
Common::Rect renderIdle(Graphics::Surface *surface, const Common::Point &position, uint8 orientation, int delta_frame, uint zoom, Common::RandomSource &rnd);
};
diff --git a/engines/teenagent/animation.cpp b/engines/teenagent/animation.cpp
index 56107b67ca..7958df35c9 100644
--- a/engines/teenagent/animation.cpp
+++ b/engines/teenagent/animation.cpp
@@ -19,7 +19,9 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
+#include "teenagent/teenagent.h"
#include "teenagent/animation.h"
+
#include "common/endian.h"
#include "common/textconsole.h"
@@ -52,7 +54,7 @@ Surface *Animation::currentFrame(int dt) {
if (data != NULL) {
uint32 frame = 3 * index;
- //debug(0, "%u/%u", index, data_size / 3);
+ debugC(2, kDebugAnimation, "%u/%u", index, data_size / 3);
index += dt;
if (!loop && index >= data_size / 3) {
@@ -73,7 +75,7 @@ Surface *Animation::currentFrame(int dt) {
y = r->y = pos / 320;
}
} else {
- //debug(0, "index %u", index);
+ debugC(2, kDebugAnimation, "index %u", index);
r = frames + index;
index += dt;
index %= frames_count;
@@ -107,42 +109,40 @@ void Animation::free() {
}
void Animation::load(Common::SeekableReadStream &s, Type type) {
- //fixme: do not reload the same animation each time
+ //FIXME: do not reload the same animation each time
free();
if (s.size() <= 1) {
- debug(1, "empty animation");
+ debugC(1, kDebugAnimation, "empty animation");
return;
}
- //uint16 pos = 0;
+ uint16 pos = 0;
int off = 0;
switch (type) {
case kTypeLan:
data_size = s.readUint16LE();
if (s.eos()) {
- debug(1, "empty animation");
+ debugC(1, kDebugAnimation, "empty animation");
return;
}
data_size -= 2;
data = new byte[data_size];
data_size = s.read(data, data_size);
- /* for (int i = 0; i < data_size; ++i) {
- debug(0, "%02x ", data[i]);
- }
- debug(0, ", %u frames", data_size / 3);
- */
+ for (int i = 0; i < data_size; ++i)
+ debugC(2, kDebugAnimation, "%02x ", data[i]);
+ debugC(2, kDebugAnimation, ", %u frames", data_size / 3);
frames_count = s.readByte();
- debug(1, "%u physical frames", frames_count);
+ debugC(1, kDebugAnimation, "%u physical frames", frames_count);
if (frames_count == 0)
return;
frames = new Surface[frames_count];
s.skip(frames_count * 2 - 2); //sizes
- /*pos = */s.readUint16LE();
- //debug(0, "pos?: %04x", pos);
+ pos = s.readUint16LE();
+ debugC(3, kDebugAnimation, "pos?: 0x%04x", pos);
for (uint16 i = 0; i < frames_count; ++i) {
frames[i].load(s, Surface::kTypeLan);
@@ -158,8 +158,8 @@ void Animation::load(Common::SeekableReadStream &s, Type type) {
frames_count = 0;
for (byte i = 0; i < data_size / 3; ++i) {
int idx = i * 3;
- /* byte unk = */
- s.readByte();
+ byte unk = s.readByte();
+ debugC(3, kDebugAnimation, "unk?: 0x%02x", unk);
data[idx] = s.readByte();
if (data[idx] == 0)
data[idx] = 1; //fixme: investigate
@@ -167,7 +167,7 @@ void Animation::load(Common::SeekableReadStream &s, Type type) {
frames_count = data[idx];
data[idx + 1] = 0;
data[idx + 2] = 0;
- //debug(0, "frame #%u", data[idx]);
+ debugC(2, kDebugAnimation, "frame #%u", data[idx]);
}
frames = new Surface[frames_count];
@@ -180,15 +180,15 @@ void Animation::load(Common::SeekableReadStream &s, Type type) {
case kTypeVaria:
frames_count = s.readByte();
- debug(1, "loading varia resource, %u physical frames", frames_count);
+ debugC(1, kDebugAnimation, "loading varia resource, %u physical frames", frames_count);
uint16 offset[255];
for (byte i = 0; i < frames_count; ++i) {
offset[i] = s.readUint16LE();
- //debug(0, "%u: %04x", i, offset[i]);
+ debugC(0, kDebugAnimation, "%u: %04x", i, offset[i]);
}
frames = new Surface[frames_count];
for (uint16 i = 0; i < frames_count; ++i) {
- //debug(0, "%04x", offset[i]);
+ debugC(0, kDebugAnimation, "%04x", offset[i]);
s.seek(offset[i] + off);
frames[i].load(s, Surface::kTypeOns);
}
@@ -196,7 +196,7 @@ void Animation::load(Common::SeekableReadStream &s, Type type) {
break;
}
- debug(0, "%u frames", data_size / 3);
+ debugC(2, kDebugAnimation, "%u frames", data_size / 3);
}
Animation::~Animation() {
diff --git a/engines/teenagent/callbacks.cpp b/engines/teenagent/callbacks.cpp
index 8882531d27..79a4c9f7f3 100644
--- a/engines/teenagent/callbacks.cpp
+++ b/engines/teenagent/callbacks.cpp
@@ -19,8 +19,9 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
-#include "teenagent/scene.h"
#include "teenagent/teenagent.h"
+#include "teenagent/scene.h"
+#include "teenagent/inventory.h"
#include "teenagent/resources.h"
#include "teenagent/dialog.h"
@@ -34,31 +35,27 @@ namespace TeenAgent {
#define INC_FLAG(addr) (++*res->dseg.ptr(addr))
void TeenAgentEngine::rejectMessage() {
- Resources *res = Resources::instance();
//random reject message:
uint i = _rnd.getRandomNumber(3);
- //debug(0, "reject message: %s", (const char *)res->dseg.ptr(res->dseg.get_word(0x339e + 2 * i)));
- displayMessage(res->dseg.get_word(0x339e + 2 * i));
+ debugC(0, kDebugCallbacks, "reject message: %s", (const char *)res->dseg.ptr(res->dseg.get_word(dsAddr_rejectMsg + 2 * i)));
+ displayMessage(res->dseg.get_word(dsAddr_rejectMsg + 2 * i));
}
-
bool TeenAgentEngine::processCallback(uint16 addr) {
if (addr == 0)
return false;
- Resources *res = Resources::instance();
- debug(0, "processCallback(%04x)", addr);
+ debugC(0, kDebugCallbacks, "processCallback(%04x)", addr);
byte *code = res->cseg.ptr(addr);
- //try trivial callbacks first
+ // try trivial callbacks first
if (code[0] == 0xbb && code[3] == 0xe8 && code[6] == 0xc3) {
- //call display_message, r
+ // call display_message, r
uint16 msg = READ_LE_UINT16(code + 1);
uint16 func = 6 + addr + READ_LE_UINT16(code + 4);
- debug(0, "call %04x", func);
- //debug(0, "trivial callback, showing message %s", (const char *)res->dseg.ptr(addr));
- switch (func) {
- case 0xa055:
+ debugC(0, kDebugCallbacks, "call %04x", func);
+ debugC(0, kDebugCallbacks, "trivial callback, showing message %s", (const char *)res->dseg.ptr(addr));
+ if (func == csAddr_displayMsg) {
displayMessage(msg);
return true;
}
@@ -66,8 +63,8 @@ bool TeenAgentEngine::processCallback(uint16 addr) {
if (code[0] == 0xe8 && code[3] == 0xc3) {
uint func = 3 + addr + READ_LE_UINT16(code + 1);
- debug(0, "call %04x and return", func);
- if (func == 0xa4d6) {
+ debugC(0, kDebugCallbacks, "call %04x and return", func);
+ if (func == csAddr_rejectMsg) {
rejectMessage();
return true;
}
@@ -83,9 +80,9 @@ bool TeenAgentEngine::processCallback(uint16 addr) {
return true;
}
+ bool retVal = true;
switch (addr) {
-
- case 0x024c: //intro
+ case csAddr_intro: // intro
hideActor();
loadScene(41, 139, 156, 3);
@@ -97,7 +94,7 @@ bool TeenAgentEngine::processCallback(uint16 addr) {
playAnimation(913, 1);
setOns(1, 109);
setLan(2, 1);
- Dialog::show(scene, 0x748e, 914, 915, 0xe7, 0xd7, 2, 1);
+ dialog->show(192, scene, 914, 915, 0xe7, 0xd7, 2, 1);
displayCredits(0xe3c2);
loadScene(42, 139, 156, 3);
@@ -115,12 +112,12 @@ bool TeenAgentEngine::processCallback(uint16 addr) {
loadScene(40, 139, 156, 3);
playMusic(3);
- Dialog::show(scene, 0x750d, 920, 924, 0xe7, 0xeb, 1, 2); //as i told you, our organization...
+ dialog->show(193, scene, 920, 924, 0xe7, 0xeb, 1, 2);
playSound(26, 50);
playAnimation(925, 0, true);
playAnimation(926, 1, true);
waitAnimation();
- Dialog::show(scene, 0x78a6, 927, 920, 0xeb, 0xe7, 2, 1);
+ dialog->show(194, scene, 927, 920, 0xeb, 0xe7, 2, 1);
displayCredits(0xe3ff);
loadScene(39, 139, 156, 3);
@@ -135,11 +132,11 @@ bool TeenAgentEngine::processCallback(uint16 addr) {
playSound(81, 21);
playAnimation(928, 1);
setOns(0, 112);
- Dialog::showMono(scene, 0x78e1, 929, 0xd1, 1); //he's coming
+ dialog->showMono(195, scene, 929, 0xd1, 1);
showActor();
moveTo(319, 150, 1, true);
moveTo(63, 150, 1);
- displayAsyncMessage(0x5da8, 19844, 18, 36); //hey, what's the matter?
+ displayAsyncMessage(0x5da8, 19844, 18, 36); // hey, what's the matter?
playAnimation(851, 0, true);
playActorAnimation(930, true);
waitAnimation();
@@ -151,27 +148,26 @@ bool TeenAgentEngine::processCallback(uint16 addr) {
playMusic(3);
loadScene(40, 50, 186, 1);
setOns(0, 113);
- Dialog::show(scene, 0x78f1, 919, 0, 0xe7, 0xd1, 1, 0);
+ dialog->show(196, scene, 919, 0, 0xe7, 0xd1, 1, 0);
moveTo(196, 186, 1);
- Dialog::show(scene, 0x7958, 0, 920, 0xd1, 0xe7, 0, 1);
+ dialog->show(197, scene, 0, 920, 0xd1, 0xe7, 0, 1);
playActorAnimation(932);
- Dialog::show(scene, 0x7e07, 0, 920, 0xd1, 0xe7, 0, 1);
+ dialog->show(198, scene, 0, 920, 0xd1, 0xe7, 0, 1);
playActorAnimation(932);
- Dialog::show(scene, 0x7e1a, 0, 920, 0xd1, 0xe7, 0, 1);
+ dialog->show(199, scene, 0, 920, 0xd1, 0xe7, 0, 1);
playActorAnimation(932);
- Dialog::show(scene, 0x7e2c, 0, 922, 0xd1, 0xe7, 0, 1);
+ dialog->show(200, scene, 0, 922, 0xd1, 0xe7, 0, 1);
playActorAnimation(933);
- Dialog::show(scene, 0x7e70, 0, 920, 0xd1, 0xe7, 0, 1);
+ dialog->show(201, scene, 0, 920, 0xd1, 0xe7, 0, 1);
moveTo(174, 186, 1);
playAnimation(851, 0, true);
playActorAnimation(934, true);
waitAnimation();
loadScene(10, 136, 153, 3);
-
- return true;
+ break;
case 0x4021:
- //pulling out mysterious object
+ // pulling out mysterious object
if (CHECK_FLAG(0xdbe1, 1)) {
playActorAnimation(844);
playActorAnimation(846);
@@ -180,12 +176,11 @@ bool TeenAgentEngine::processCallback(uint16 addr) {
} else {
displayMessage(0x570f);
}
- return true;
+ break;
- case 0x4094: //climbing to the pole near mudpool
- if (CHECK_FLAG(0xDBE4, 1)) {
+ case 0x4094: // climbing to the pole near mudpool
+ if (CHECK_FLAG(0xdbe4, 1)) {
displayMessage(0x57b2);
- return true;
} else {
for (byte i = 11; i <= 27; i += 4)
playSound(76, i);
@@ -198,7 +193,7 @@ bool TeenAgentEngine::processCallback(uint16 addr) {
//InventoryObject *obj = inventory->selectedObject();
//if (obj != NULL && obj->id == 0x55) {
- //implement pause and using real object:
+ // implement pause and using real object:
if (inventory->has(0x55)) {
playSound(5, 4);
playSound(5, 19);
@@ -208,27 +203,27 @@ bool TeenAgentEngine::processCallback(uint16 addr) {
inventory->add(0x56);
moveTo(86, 195, 1, true);
playActorAnimation(868);
- SET_FLAG(0xDBE4, 1);
+ SET_FLAG(0xdbe4, 1);
} else {
processCallback(0x4173);
- Dialog::pop(scene, 0xDB72, 0, 0, 0xd1, 0xd1, 0, 0);
+ dialog->pop(scene, 0xdb72, 0, 0, 0xd1, 0xd1, 0, 0);
}
- return true;
}
+ break;
+
case 0x4173:
- //fail!
+ // fail!
moveTo(86, 195, 1, true);
playActorAnimation(868);
- return true;
+ break;
- case 0x419c: //getting the bird
+ case 0x419c: // getting the bird
setOns(0, 0);
playSound(56, 10);
playActorAnimation(875);
disableObject(6);
inventory->add(0x5c);
- return true;
-
+ break;
case 0x41ce:
moveTo(197, 159, 4);
@@ -238,7 +233,7 @@ bool TeenAgentEngine::processCallback(uint16 addr) {
moveTo(225, 159, 4);
inventory->add(0x4e);
disableObject(3);
- return true;
+ break;
case 0x4267:
hideActor();
@@ -252,7 +247,7 @@ bool TeenAgentEngine::processCallback(uint16 addr) {
playSound(5, 26);
playActorAnimation(842);
wait(100);
- //shown in different positions
+ // shown in different positions
displayMessage(0x5656, 0xd1, 0x5510);
wait(50);
displayMessage(0x567a, 0xd1, 0x555c);
@@ -266,19 +261,19 @@ bool TeenAgentEngine::processCallback(uint16 addr) {
disableObject(1);
inventory->add(0x51);
displayMessage(0x5646);
- return true;
+ break;
case 0x4388:
playSound(80, 4);
playActorAnimation(961);
loadScene(8, 155, 199, 1);
- return true;
+ break;
- case 0x43b5: //HQ, first trial - prison
+ case 0x43b5: // HQ, first trial - prison
playSound(70, 6);
playActorAnimation(962);
loadScene(7, 30, 184, 2);
- if (res->dseg.get_byte(0xDBDF) < 2) {
+ if (res->dseg.get_byte(0xdbdf) < 2) {
wait(150);
moveTo(134, 167, 2);
displayMessage(0x54f7);
@@ -286,22 +281,22 @@ bool TeenAgentEngine::processCallback(uint16 addr) {
playAnimation(812, 0, true);
playActorAnimation(811);
- Dialog::show(scene, 0x6117, 0, 813, 0xd1, 0xec, 0, 1);
+ dialog->show(148, scene, 0, 813, 0xd1, 0xec, 0, 1);
loadScene(6, 230, 184);
playMusic(5);
- Dialog::show(scene, 0x626a, 0, 814, 0xd1, 0xec, 0, 1);
+ dialog->show(149, scene, 0, 814, 0xd1, 0xec, 0, 1);
playSound(4, 14);
playAnimation(815, 0);
setOns(1, 0);
- Dialog::showMono(scene, 0x62dc, 0, 0xd1, 0);
+ dialog->showMono(150, scene, 0, 0xd1, 0);
- SET_FLAG(0xDBDF, 1);
+ SET_FLAG(0xdbdf, 1);
}
- return true;
+ break;
case 0x4482:
- if (CHECK_FLAG(0xDBDF, 0)) {
+ if (CHECK_FLAG(0xdbdf, 0)) {
playActorAnimation(968);
displayMessage(0x5511);
} else {
@@ -310,9 +305,9 @@ bool TeenAgentEngine::processCallback(uint16 addr) {
playActorAnimation(968);
loadScene(6, 280, 186, 4);
}
- return true;
+ break;
- case 0x44fc: //pull out spring from bed
+ case 0x44fc: // pull out spring from bed
playSound(53, 25);
playSound(24, 27);
playSound(5, 36);
@@ -320,23 +315,23 @@ bool TeenAgentEngine::processCallback(uint16 addr) {
moveTo(278, scene->getPosition().y, 0, true);
inventory->add(0x50);
disableObject(1);
- return true;
+ break;
case 0x44cb:
- if (CHECK_FLAG(0xDBE5, 1)) {
+ if (CHECK_FLAG(0xdbe5, 1)) {
displayMessage(0x57c0);
} else {
playSound(49, 14);
playSound(5, 21);
playActorAnimation(869);
inventory->add(0x58);
- SET_FLAG(0xDBE5, 1);
+ SET_FLAG(0xdbe5, 1);
}
- return true;
+ break;
- case 0x4539: //prison cell: use crates
+ case 0x4539: // prison cell: use crates
if (CHECK_FLAG(0xdbdd, 2)) {
- //finished the meal - trap
+ // finished the meal - trap
displayMessage(0x55c0);
moveTo(306, 196, 2);
wait(50);
@@ -358,28 +353,27 @@ bool TeenAgentEngine::processCallback(uint16 addr) {
SET_FLAG(0xdbdd, 3);
scene->getObject(4)->setName("body");
} else {
- if (Dialog::pop(scene, 0xdb5c, 0, 0, 0xd1, 0xd1, 0, 0) != 0x636b) //not 'im getting hungry'
- return true;
-
- wait(100);
- playSound(52, 8);
- playSound(52, 13);
- playAnimation(820, 1);
- setOns(3, 0x59);
- wait(50);
- moveTo(scene->getPosition().x, scene->getPosition().y + 1, 3);
- wait(150);
- moveTo(scene->getPosition().x, scene->getPosition().y - 1, 2);
- wait(100);
- displayMessage(0x551f);
- enableObject(4);
- SET_FLAG(0xdbdc, 1);
+ if (dialog->pop(scene, 0xdb5c, 0, 0, 0xd1, 0xd1, 0, 0) == 0x636b) { // 'im getting hungry'
+ wait(100);
+ playSound(52, 8);
+ playSound(52, 13);
+ playAnimation(820, 1);
+ setOns(3, 0x59);
+ wait(50);
+ moveTo(scene->getPosition().x, scene->getPosition().y + 1, 3);
+ wait(150);
+ moveTo(scene->getPosition().x, scene->getPosition().y - 1, 2);
+ wait(100);
+ displayMessage(0x551f);
+ enableObject(4);
+ SET_FLAG(0xdbdc, 1);
+ }
}
- return true;
+ break;
case 0x4662:
- if (CHECK_FLAG(0xDBDD, 3)) {
- if (CHECK_FLAG(0xDBDE, 1)) {
+ if (CHECK_FLAG(0xdbdd, 3)) {
+ if (CHECK_FLAG(0xdbde, 1)) {
displayMessage(0x5608);
} else {
moveTo(280, 179, 2);
@@ -387,13 +381,13 @@ bool TeenAgentEngine::processCallback(uint16 addr) {
playSound(5, 17);
playActorAnimation(827);
inventory->add(0x4d);
- SET_FLAG(0xDBDE, 1);
+ SET_FLAG(0xdbde, 1);
}
} else
displayMessage(0x5905);
- return true;
+ break;
- case 0x46af: //prison cell: use live cable
+ case 0x46af: // prison cell: use live cable
if (CHECK_FLAG(0xdbdc, 1)) {
displayMessage(0x555d);
setOns(2, 0);
@@ -407,13 +401,13 @@ bool TeenAgentEngine::processCallback(uint16 addr) {
SET_FLAG(0xdbdd, 1);
} else
displayMessage(0x5528);
- return true;
+ break;
- case 0x4705: //prison: getting lamp bulb
+ case 0x4705: // prison: getting lamp bulb
wait(50);
moveTo(144, 185, 4);
playSound(56, 15);
- setOns(0, 86); //hiding lamp
+ setOns(0, 86); // hiding lamp
playActorAnimation(816, true);
playAnimation(817, 0, true);
waitAnimation();
@@ -431,51 +425,51 @@ bool TeenAgentEngine::processCallback(uint16 addr) {
disableObject(6);
enableObject(5);
inventory->add(0x4c);
- return true;
+ break;
- case 0x4794: //prison cell door
- if (res->dseg.get_byte(0xDBDF) >= 2) {
+ case 0x4794: // prison cell door
+ if (res->dseg.get_byte(0xdbdf) >= 2) {
loadScene(5, 287, 143);
} else {
displayMessage(0x592f);
}
- return true;
+ break;
- case 0x47bc: //prison: examining trash can
+ case 0x47bc: // prison: examining trash can
playSound(79, 5);
playSound(1, 14);
playActorAnimation(966);
displayMessage(0x5955);
- return true;
+ break;
- case 0x47db: //prison: use switch
- if (CHECK_FLAG(0xDBDF, 1)) {
+ case 0x47db: // prison: use switch
+ if (CHECK_FLAG(0xdbdf, 1)) {
playSound(71, 4);
playActorAnimation(823);
- if (CHECK_FLAG(0xDBDD, 0)) {
+ if (CHECK_FLAG(0xdbdd, 0)) {
displayMessage(0x4d80);
} else {
playSound(74, 1);
playAnimation(824, 1);
- if (CHECK_FLAG(0xDBDD, 1)) {
+ if (CHECK_FLAG(0xdbdd, 1)) {
wait(100);
displayMessage(0x559a);
- SET_FLAG(0xDBDD, 2);
+ SET_FLAG(0xdbdd, 2);
}
}
} else {
displayMessage(0x52f6);
}
- return true;
+ break;
case 0x4871:
playActorAnimation(965);
displayMessage(0x5511);
- return true;
+ break;
- case 0x4893: //taking pills
- if (CHECK_FLAG(0xDBE6, 1)) {
- SET_FLAG(0xDBE6, 2);
+ case 0x4893: // taking pills
+ if (CHECK_FLAG(0xdbe6, 1)) {
+ SET_FLAG(0xdbe6, 2);
setOns(1, 0x67);
playSound(5, 9);
playActorAnimation(872);
@@ -485,13 +479,13 @@ bool TeenAgentEngine::processCallback(uint16 addr) {
playActorAnimation(964);
displayMessage(0x5511);
}
- return true;
+ break;
- case 0x4918: //talking with barmen
- if (CHECK_FLAG(0xDBE7, 1)) {
+ case 0x4918: // talking with barmen
+ if (CHECK_FLAG(0xdbe7, 1)) {
moveTo(140, 152, 1);
- if (CHECK_FLAG(0xDBE8, 1)) {
- Dialog::showMono(scene, 0x6f20, 0, 0xd1, 0); //aren't you thirsty?
+ if (CHECK_FLAG(0xdbe8, 1)) {
+ dialog->showMono(177, scene, 0, 0xd1, 0);
displayMessage(0x5883, 0xef, 21472);
//reloadLan();
setLan(1, 0);
@@ -504,57 +498,57 @@ bool TeenAgentEngine::processCallback(uint16 addr) {
shakeScreen();
disableObject(1);
disableObject(2);
- SET_FLAG(0xDBE9, 1);
+ SET_FLAG(0xdbe9, 1);
} else
displayMessage(0x5855);
} else {
- if (CHECK_FLAG(0xDBDF, 3)) {
- if (CHECK_FLAG(0xDBE3, 1)) {
- Dialog::show(scene, 0x6BD6, 0, 857, 0xd1, 0xef, 0, 1);
+ if (CHECK_FLAG(0xdbdf, 3)) {
+ if (CHECK_FLAG(0xdbe3, 1)) {
+ dialog->show(168, scene, 0, 857, 0xd1, 0xef, 0, 1);
} else {
- Dialog::show(scene, 0x69B5, 0, 857, 0xd1, 0xef, 0, 1); //taking mug
+ dialog->show(166, scene, 0, 857, 0xd1, 0xef, 0, 1); // taking mug
playActorAnimation(859, true);
playAnimation(858, 0, true);
waitAnimation();
playSound(75, 6);
playActorAnimation(860);
- Dialog::show(scene, 0x69C2, 0, 857, 0xd1, 0xef, 0, 1);
+ dialog->show(167, scene, 0, 857, 0xd1, 0xef, 0, 1);
inventory->add(0x55);
- SET_FLAG(0xDBE3, 1);
- SET_FLAG(0xDBF0, 0);
+ SET_FLAG(0xdbe3, 1);
+ SET_FLAG(0xdbf0, 0);
}
} else {
- Dialog::pop(scene, 0xDB68, 0, 857, 0xd1, 0xef, 0, 1);
+ dialog->pop(scene, 0xdb68, 0, 857, 0xd1, 0xef, 0, 1);
}
}
- return true;
+ break;
- case 0x4f14: //use the hollow
- displayMessage(CHECK_FLAG(0xDBA1, 1) ? 0x370f : 0x36c2);
- return true;
+ case 0x4f14: // use the hollow
+ displayMessage(CHECK_FLAG(0xdba1, 1) ? 0x370f : 0x36c2);
+ break;
case 0x4a64:
- if (CHECK_FLAG(0xDBF0, 1)) {
+ if (CHECK_FLAG(0xdbf0, 1)) {
displayMessage(0x5e25);
} else {
loadScene(5, 35, 162);
}
- return true;
+ break;
case 0x4bf5:
playActorAnimation(959);
loadScene(8, 40, 152, 3);
- return true;
+ break;
case 0x483a:
- Dialog::pop(scene, 0xdb82, 0, 0, 0xd1, 0xd1, 0, 0);
- return true;
+ dialog->pop(scene, 0xdb82, 0, 0, 0xd1, 0xd1, 0, 0);
+ break;
case 0x4844:
playSound(80, 4);
playActorAnimation(963);
loadScene(5, 166, 158);
- return true;
+ break;
case 0x48ea:
setOns(0, 0);
@@ -562,28 +556,28 @@ bool TeenAgentEngine::processCallback(uint16 addr) {
playActorAnimation(836);
inventory->add(0x4f);
disableObject(12);
- return true;
+ break;
case 0x4a8c:
- if (CHECK_FLAG(0xDBE9, 1)) {
+ if (CHECK_FLAG(0xdbe9, 1)) {
playSound(89, 5);
playActorAnimation(958);
loadScene(9, 240, 182, 4);
- } else if (CHECK_FLAG(0xDBE7, 1)) {
+ } else if (CHECK_FLAG(0xdbe7, 1)) {
displayMessage(0x5894);
} else {
- Dialog::pop(scene, 0xDB8A, 0, 857, 0xd1, 0xef, 0, 1);
+ dialog->pop(scene, 0xdb8a, 0, 857, 0xd1, 0xef, 0, 1);
}
- return true;
+ break;
- case 0x4af4: //taking the crumbs
+ case 0x4af4: // taking the crumbs
setOns(0, 0);
playSound(49, 6);
playSound(5, 13);
playActorAnimation(861);
inventory->add(0x57);
disableObject(6);
- return true;
+ break;
case 0x4b35:
playSound(15, 7);
@@ -591,103 +585,101 @@ bool TeenAgentEngine::processCallback(uint16 addr) {
playSound(55, 1);
playSound(24, 12);
playAnimation(885, 0);
- Dialog::show(scene, 0x67e5, 886, 0, 0xd0, 0xd1, 1, 0);
+ dialog->show(164, scene, 886, 0, 0xd0, 0xd1, 1, 0);
playMusic(3);
loadScene(40, 198, 186, 1);
- Dialog::show(scene, 0x7f20, 0, 920, 0xd1, 0xe7, 0, 1);
+ dialog->show(202, scene, 0, 920, 0xd1, 0xe7, 0, 1);
inventory->clear();
inventory->add(0x1d);
displayCredits(0xe45c);
loadScene(1, 198, 186);
hideActor();
playActorAnimation(956);
- Dialog::showMono(scene, 0x8bc4, 957, 0xd1, 1);
+ dialog->showMono(212, scene, 957, 0xd1, 1);
waitAnimation();
loadScene(15, 157, 199, 1);
playMusic(6);
- return true;
+ break;
- case 0x4c3e: //get the grenade
+ case 0x4c3e: // get the grenade
playSound(32, 24);
playActorAnimation(862);
reloadLan();
playAnimation(863, 1);
inventory->add(0x54);
disableObject(1);
- SET_FLAG(0xDBE2, 2);
- return true;
+ SET_FLAG(0xdbe2, 2);
+ break;
case 0x4c70:
- if (CHECK_FLAG(0xDBE2, 0)) {
- if (CHECK_FLAG(0xDBDA, 1)) { //papers are shown
- Dialog::pop(scene, 0xDB4C, 0, 809, 0xd1, 0xd0, 0, 1);
+ if (CHECK_FLAG(0xdbe2, 0)) {
+ if (CHECK_FLAG(0xdbda, 1)) { // papers are shown
+ dialog->pop(scene, 0xdb4c, 0, 809, 0xd1, 0xd0, 0, 1);
} else {
- Dialog::pop(scene, 0xDB40, 0, 809, 0xd1, 0xd0, 0, 1);
+ dialog->pop(scene, 0xdb40, 0, 809, 0xd1, 0xd0, 0, 1);
}
} else {
displayMessage(0x5722);
wait(100);
displayMessage(0x572a);
}
- return true;
+ break;
case 0x4c1c:
playActorAnimation(960);
displayMessage(0x5511);
- return true;
+ break;
case 0x4cac:
- if (CHECK_FLAG(0xdbda, 1)) { //papers are shown
+ if (CHECK_FLAG(0xdbda, 1)) { // papers are shown
loadScene(5, 124, 199);
} else {
- Dialog::show(scene, 0x5FE9, 0, 809, 0xd1, 0xd0, 0, 1);
+ dialog->show(144, scene, 0, 809, 0xd1, 0xd0, 0, 1);
moveTo(269, 175, 4);
- Dialog::pop(scene, 0xDB56, 0, 809, 0xd1, 0xd0, 0, 1);
+ dialog->pop(scene, 0xdb56, 0, 809, 0xd1, 0xd0, 0, 1);
}
- return true;
+ break;
- case 0x4cf1: { //talking with mansion guard
+ case 0x4cf1: // talking with mansion guard
SET_FLAG(0xda96, 1);
- if (Dialog::pop(scene, 0xdaa6, 0, 529, 0xd1, 0xd9, 0, 1) != 0x1b4)
- return true;
-
- Common::Point p = scene->getPosition();
- moveTo(189, 159, 0);
- //waitLanAnimationFrame(1, 1);
+ if (dialog->pop(scene, 0xdaa6, 0, 529, 0xd1, 0xd9, 0, 1) == 0x1b4) {
+ Common::Point p = scene->getPosition();
+ moveTo(189, 159, 0);
+ //waitLanAnimationFrame(1, 1);
- playSound(5, 2);
- playSound(5, 19);
- playActorAnimation(550, true);
- playAnimation(551, 0, true);
- waitAnimation();
+ playSound(5, 2);
+ playSound(5, 19);
+ playActorAnimation(550, true);
+ playAnimation(551, 0, true);
+ waitAnimation();
- moveTo(p, 2);
- inventory->add(0x13);
- Dialog::pop(scene, 0xdaa6, 0, 529, 0xd1, 0xd9, 0, 1);
- }
- return true;
+ moveTo(p, 2);
+ inventory->add(0x13);
+ dialog->pop(scene, 0xdaa6, 0, 529, 0xd1, 0xd9, 0, 1);
+ }
+ break;
- case 0x4d94: //talking with fatso
- Dialog::show(scene, 0x33bd, 0, 666, 0xd1, 0xd0, 0, 2);
+ case 0x4d94: // talking with fatso
+ dialog->show(87, scene, 0, 666, 0xd1, 0xd0, 0, 2);
displayAsyncMessage(0x49ae, /*25060*/ 35000, 1, 10, 0xd0);
playSound(5, 3);
playAnimation(667, 1);
playAnimation(668, 1);
setOns(2, 50);
- Dialog::show(scene, 0x36c7, 0, 666, 0xd1, 0xd0, 0, 2);
+ dialog->show(88, scene, 0, 666, 0xd1, 0xd0, 0, 2);
setOns(3, 0);
- setFlag(0xDBEC, 0);
+ setFlag(0xdbec, 0);
reloadLan();
playSound(82, 19);
playAnimation(669, 1);
- Dialog::showMark(scene, 0x3779);
+ dialog->showMark(89, scene);
enableObject(15);
disableObject(8);
- return true;
+ break;
case 0x4e61:
loadScene(14, 280, 198);
- return true;
+ break;
case 0x4ee5:
setOns(2, 0);
@@ -696,7 +688,7 @@ bool TeenAgentEngine::processCallback(uint16 addr) {
displayMessage(0x4ab0);
disableObject(15);
inventory->add(51);
- return true;
+ break;
case 0x4d56:
inventory->add(16);
@@ -704,26 +696,25 @@ bool TeenAgentEngine::processCallback(uint16 addr) {
setOns(0, 0);
playSound(5, 12);
playActorAnimation(547);
- return true;
-
+ break;
- case 0x4eb9://Pick up wrapper
+ case 0x4eb9: // Pick up wrapper
playSound(5, 12);
playSound(5, 18);
inventory->add(0x12);
setOns(1, 0);
playActorAnimation(549);
disableObject(13);
- return true;
+ break;
case 0x4f25:
playActorAnimation(967);
displayMessage(0x3542);
- return true;
+ break;
- case 0x4f32: //use tree near the mansion
- if (CHECK_FLAG(0xDBA1, 1)) {
- if (CHECK_FLAG(0xDBA2, 1)) {
+ case 0x4f32: // use tree near the mansion
+ if (CHECK_FLAG(0xdba1, 1)) {
+ if (CHECK_FLAG(0xdba2, 1)) {
displayMessage(0x3766);
} else {
playSound(26, 13);
@@ -740,7 +731,7 @@ bool TeenAgentEngine::processCallback(uint16 addr) {
playActorAnimation(591);
wait(50);
displayMessage(0x372e);
- SET_FLAG(0xDBA2, 1);
+ SET_FLAG(0xdba2, 1);
processCallback(0x9d45);
}
} else {
@@ -754,13 +745,13 @@ bool TeenAgentEngine::processCallback(uint16 addr) {
wait(100);
displayMessage(0x3668);
}
- return true;
+ break;
- case 0x500d: //picking up wild plant
- if (CHECK_FLAG(0xDB9E, 1)) {
- displayMessage(0x35E8); //there are no more
+ case 0x500d: // picking up wild plant
+ if (CHECK_FLAG(0xdb9e, 1)) {
+ displayMessage(0x35e8); // there are no more
} else {
- SET_FLAG(0xDB9E, 1);
+ SET_FLAG(0xdb9e, 1);
setOns(2, 0);
playSound(21, 9);
playSound(34, 21);
@@ -769,28 +760,27 @@ bool TeenAgentEngine::processCallback(uint16 addr) {
setOns(2, 0x12);
inventory->add(0x14);
}
- return true;
+ break;
case 0x5104:
loadScene(11, 319, 198, 4);
- if (CHECK_FLAG(0xDB9C, 1))
- return true;
-
- //guard's drinking
- SET_FLAG(0, 3);
- setTimerCallback(0x516d, 40);
- playAnimation(544, 0, true, true); //ignore busy flag for this animation
- return true;
+ if (!CHECK_FLAG(0xdb9c, 1)) {
+ // guard is drinking
+ SET_FLAG(0, 3);
+ setTimerCallback(0x516d, 40);
+ playAnimation(544, 0, true, true); // ignore busy flag for this animation
+ }
+ break;
- case 0x516d: //too late to scare guard, resetting
+ case 0x516d: // too late to scare guard, resetting
SET_FLAG(0, 0);
- return true;
+ break;
- case 0x5189: //guard's drinking, boo!
+ case 0x5189: // guard is drinking, boo!
SET_FLAG(0, 0);
setTimerCallback(0, 0);
scene->getAnimation(0)->free();
- SET_FLAG(0xDB9C, 1);
+ SET_FLAG(0xdb9c, 1);
displayAsyncMessage(0x3563, 320 * 130 + 300, 1, 5);
setOns(0, 16);
@@ -799,10 +789,10 @@ bool TeenAgentEngine::processCallback(uint16 addr) {
playSound(17, 5);
playAnimation(545, 0);
- Dialog::show(scene, 0x0917, 0, 546, 0xd1, 0xd9, 0, 1);
- SET_FLAG(0xDA96, 1);
- SET_FLAG(0xDA97, 0);
- return true;
+ dialog->show(5, scene, 0, 546, 0xd1, 0xd9, 0, 1);
+ SET_FLAG(0xda96, 1);
+ SET_FLAG(0xda97, 0);
+ break;
case 0x51f0:
setOns(0, 0);
@@ -810,24 +800,24 @@ bool TeenAgentEngine::processCallback(uint16 addr) {
playActorAnimation(637);
disableObject(7);
inventory->add(49);
- return true;
+ break;
case 0x5217:
- displayMessage(CHECK_FLAG(0xDB9F, 1) ? 0x402e : 0x34e1);
- return true;
+ displayMessage(CHECK_FLAG(0xdb9f, 1) ? 0x402e : 0x34e1);
+ break;
case 0x5237:
- if (!CHECK_FLAG(0xDB9F, 1)) {
+ if (!CHECK_FLAG(0xdb9f, 1)) {
displayMessage(0x34e1);
- } else if (CHECK_FLAG(0xDBA0, 1))
- displayMessage(0x3E31);
+ } else if (CHECK_FLAG(0xdba0, 1))
+ displayMessage(0x3e31);
else {
moveTo(173, 138, 2);
playSound(28, 5);
playActorAnimation(583);
playActorAnimation(584);
- loadScene(0, 0, 0, 0); //clear background
+ loadScene(0, 0, 0, 0); // clear background
playSound(72, 18);
playSound(73, 39);
@@ -838,51 +828,52 @@ bool TeenAgentEngine::processCallback(uint16 addr) {
playActorAnimation(586);
moveTo(138, 163, 3);
displayMessage(0x3650);
- SET_FLAG(0xDBA0, 1);
- processCallback(0x9d45); //another mansion try
+ SET_FLAG(0xdba0, 1);
+ processCallback(0x9d45); // another mansion try
}
- return true;
+ break;
- case 0x55a8: {
- uint16 d = Dialog::pop(scene, 0xdb08, 0, 0, 0xd1, 0xd1, 0, 0);
- if (d == 0x2c5d) {
- waitLanAnimationFrame(1, 0x23);
- setOns(0, 0);
- playSound(52, 9);
- playSound(52, 11);
- playSound(52, 13);
- playSound(53, 32);
- playAnimation(570, 0);
- wait(50);
- displayMessage(0x551f);
- disableObject(5);
- SET_FLAG(0xDBB0, 1);
- } else if (d != 0x2c9b) {
- waitLanAnimationFrame(1, 0x23);
- playSound(52, 9);
- playSound(52, 11);
- playSound(52, 13);
- playAnimation(569, 0);
+ case 0x55a8:
+ {
+ uint16 d = dialog->pop(scene, 0xdb08, 0, 0, 0xd1, 0xd1, 0, 0);
+ if (d == 0x2c5d) {
+ waitLanAnimationFrame(1, 0x23);
+ setOns(0, 0);
+ playSound(52, 9);
+ playSound(52, 11);
+ playSound(52, 13);
+ playSound(53, 32);
+ playAnimation(570, 0);
+ wait(50);
+ displayMessage(0x551f);
+ disableObject(5);
+ SET_FLAG(0xdbb0, 1);
+ } else if (d != 0x2c9b) {
+ waitLanAnimationFrame(1, 0x23);
+ playSound(52, 9);
+ playSound(52, 11);
+ playSound(52, 13);
+ playAnimation(569, 0);
+ }
}
- }
- return true;
+ break;
case 0x5663:
- displayMessage(CHECK_FLAG(0xDBB0, 1) ? 0x41b1 : 0x417e);
- return true;
+ displayMessage(CHECK_FLAG(0xdbb0, 1) ? 0x41b1 : 0x417e);
+ break;
case 0x569c:
playSound(67, 5);
playActorAnimation(983);
displayMessage(0x5955);
- return true;
+ break;
case 0x56b7:
playSound(66, 5);
playSound(67, 11);
playActorAnimation(984);
displayMessage(0x5955);
- return true;
+ break;
case 0x5728:
inventory->add(0x0d);
@@ -890,15 +881,15 @@ bool TeenAgentEngine::processCallback(uint16 addr) {
setOns(0, 0);
playSound(5, 10);
playActorAnimation(566);
- return true;
+ break;
case 0x5793:
- if (!CHECK_FLAG(0xDB94, 1)) {
+ if (!CHECK_FLAG(0xdb94, 1)) {
displayMessage(0x3e63);
- } else if (CHECK_FLAG(0xDB95, 1)) {
+ } else if (CHECK_FLAG(0xdb95, 1)) {
displayMessage(0x3e75);
} else {
- SET_FLAG(0xDB95, 1);
+ SET_FLAG(0xdb95, 1);
moveTo(188, 179, 0);
playSound(7, 16);
playActorAnimation(519);
@@ -906,13 +897,13 @@ bool TeenAgentEngine::processCallback(uint16 addr) {
moveTo(168, 179, 2);
inventory->add(3);
}
- return true;
+ break;
case 0x5d88:
- if (CHECK_FLAG(0xDBA5, 1)) { //dry laundry
- SET_FLAG(0xDBA5, 2);
- Dialog::show(scene, 0x1F4F, 0, 523, 0xd1, 0xe5, 0, 1);
- //waitLanAnimationFrame(1, 1); //another long waiting
+ if (CHECK_FLAG(0xdba5, 1)) { // dry laundry
+ SET_FLAG(0xdba5, 2);
+ dialog->show(46, scene, 0, 523, 0xd1, 0xe5, 0, 1);
+ //waitLanAnimationFrame(1, 1); // another long waiting
playAnimation(604, 0);
loadScene(21, scene->getPosition());
@@ -924,24 +915,24 @@ bool TeenAgentEngine::processCallback(uint16 addr) {
setOns(0, 33);
loadScene(23, scene->getPosition());
playAnimation(605, 0);
- Dialog::show(scene, 0x2002, 0, 523, 0xd1, 0xe5, 0, 1);
+ dialog->show(47, scene, 0, 523, 0xd1, 0xe5, 0, 1);
} else {
- uint16 d = Dialog::pop(scene, 0xdada, 0, 523, 0xd1, 0xe5, 0, 1);
+ uint16 d = dialog->pop(scene, 0xdada, 0, 523, 0xd1, 0xe5, 0, 1);
if (d == 0x1913) {
wait(100);
moveRel(0, 0, 3);
wait(50);
- displayMessage(0x34d5); //I give up
+ displayMessage(0x34d5); // I give up
wait(50);
}
}
- return true;
+ break;
- case 0x5ff3: //get duster
- if (CHECK_FLAG(0xDB9A, 0)) {
- Dialog::pop(scene, 0xdaf6, 0, 523, 0xd1, 0xe5, 0, 1);
+ case 0x5ff3: // get duster
+ if (CHECK_FLAG(0xdb9a, 0)) {
+ dialog->pop(scene, 0xdaf6, 0, 523, 0xd1, 0xe5, 0, 1);
} else {
- Dialog::show(scene, 0x1e1e, 0, 523, 0xd1, 0xe5, 0, 1);
+ dialog->show(43, scene, 0, 523, 0xd1, 0xe5, 0, 1);
wait(50);
inventory->add(12);
disableObject(12);
@@ -949,10 +940,10 @@ bool TeenAgentEngine::processCallback(uint16 addr) {
playSound(5, 6);
playActorAnimation(541);
}
- return true;
+ break;
case 0x603e:
- if (CHECK_FLAG(0xDBB3, 1)) {
+ if (CHECK_FLAG(0xdbb3, 1)) {
displayMessage(0x44a7);
} else {
displayMessage(0x4412);
@@ -963,58 +954,58 @@ bool TeenAgentEngine::processCallback(uint16 addr) {
wait(150);
displayMessage(0x4492);
wait(150);
- SET_FLAG(0xDBB3, 1);
+ SET_FLAG(0xdbb3, 1);
}
- return true;
+ break;
case 0x6205:
- if (CHECK_FLAG(0xDBA4, 1))
+ if (CHECK_FLAG(0xdba4, 1))
displayMessage(0x450e);
else
processCallback(0x61fe);
- return true;
+ break;
case 0x6217:
- if (CHECK_FLAG(0xDBA4, 1))
+ if (CHECK_FLAG(0xdba4, 1))
displayMessage(0x44d6);
else
processCallback(0x61fe);
- return true;
+ break;
case 0x62c1:
- if (CHECK_FLAG(0xDBA4, 1))
- return false;
-
- processCallback(0x61fe);
- return true;
+ if (CHECK_FLAG(0xdba4, 1))
+ retVal = false;
+ else
+ processCallback(0x61fe);
+ break;
case 0x63bc:
playMusic(6);
loadScene(25, 151, 156, 2);
- return true;
+ break;
case 0x63dc:
- Dialog::showMono(scene, 0x3375, 0, 0xd1, 0);
- return true;
+ dialog->showMono(86, scene, 0, 0xd1, 0);
+ break;
case 0x646e:
case 0x6475:
- Dialog::showMono(scene, 0x32C1, 0, 0xd1, 0);
- return true;
+ dialog->showMono(85, scene, 0, 0xd1, 0);
+ break;
case 0x6479:
- Dialog::showMono(scene, 0x325e, 0, 0xd1, 0);
- return true;
+ dialog->showMono(84, scene, 0, 0xd1, 0);
+ break;
case 0x6507:
- if (CHECK_FLAG(0xDB96, 1)) {
+ if (CHECK_FLAG(0xdb96, 1))
rejectMessage();
- } else
+ else
displayMessage(0x47e7);
- return true;
+ break;
case 0x65c3:
- if (CHECK_FLAG(0xDBA9, 1)) {
+ if (CHECK_FLAG(0xdba9, 1)) {
playActorAnimation(635);
setOns(5, 0);
playSound(63, 11);
@@ -1025,83 +1016,86 @@ bool TeenAgentEngine::processCallback(uint16 addr) {
inventory->add(48);
moveTo(scene->getPosition().x - 1, 139, 1, true);
displayMessage(0x3b83);
- SET_FLAG(0xDBA9, 2);
- SET_FLAG(0xDBA8, 0);
+ SET_FLAG(0xdba9, 2);
+ SET_FLAG(0xdba8, 0);
} else
displayMessage(0x4808);
- return true;
+ break;
case 0x7866:
- if (CHECK_FLAG(0xdbdd, 3)) {
+ if (CHECK_FLAG(0xdbdd, 3))
displayMessage(0x55ff);
- return true;
- } else
- return false;
+ else
+ retVal = false;
+ break;
- case 0x7878: {
- byte v = res->dseg.get_byte(0xDBDB) + 1;
- if (v <= 6)
- SET_FLAG(0xDBDB, v);
+ case 0x7878:
+ {
+ byte v = res->dseg.get_byte(0xdbdb) + 1;
+ if (v <= 6)
+ SET_FLAG(0xdbdb, v);
- switch (v) {
- case 1:
- displayMessage(0x5411);
- return true;
- case 2:
- displayMessage(0x5463);
- return true;
- case 3:
- displayMessage(0x5475);
- return true;
- case 4:
- displayMessage(0x5484);
- return true;
- case 5:
- displayMessage(0x54c4);
- return true;
- default:
- displayMessage(0x54d5);
- return true;
+ switch (v) {
+ case 1:
+ displayMessage(0x5411);
+ break;
+ case 2:
+ displayMessage(0x5463);
+ break;
+ case 3:
+ displayMessage(0x5475);
+ break;
+ case 4:
+ displayMessage(0x5484);
+ break;
+ case 5:
+ displayMessage(0x54c4);
+ break;
+ default:
+ displayMessage(0x54d5);
+ break;
+ }
}
- }
+ break;
case 0x78a9:
- if (CHECK_FLAG(0xDBE6, 1)) {
+ if (CHECK_FLAG(0xdbe6, 1))
displayMessage(0x5827);
- return true;
- } else
- return false;
+ else
+ retVal = false;
+ break;
case 0x78bb:
- if (CHECK_FLAG(0xDBE8, 1)) {
+ if (CHECK_FLAG(0xdbe8, 1))
displayMessage(0x58b0);
- return true;
- } else
- return false;
+ else
+ retVal = false;
+ break;
case 0x78ce:
- if (!CHECK_FLAG(0xDBA1, 1)) {
+ if (!CHECK_FLAG(0xdba1, 1))
displayMessage(0x3694);
- return true;
- } else
- return false;
+ else
+ retVal = false;
+ break;
- case 0x792b: //left click on ann
+ case 0x792b: // left click on ann
moveTo(245, 198, 1);
- if (CHECK_FLAG(0xDBAF, 1))
- return false;
-
- Dialog::showMono(scene, 0x2193, 0, 0xd1, 0);
- SET_FLAG(0xDBAF, 1);
- return true;
+ if (!CHECK_FLAG(0xdbaf, 1)) {
+ dialog->showMono(50, scene, 0, 0xd1, 0);
+ SET_FLAG(0xdbaf, 1);
+ } else
+ retVal = false;
+ break;
case 0x79c3:
- if (CHECK_FLAG(0xDBA4, 1))
- return false;
- processCallback(0x61fe);
- return true;
+ if (CHECK_FLAG(0xdba4, 1))
+ retVal = false;
+ else
+ processCallback(0x61fe);
+ break;
- case 0x7b26: //cutting the fence
+ case 0x7b26: // cutting the fence
setOns(0, 0);
playSound(5, 2);
playSound(51, 11);
@@ -1114,11 +1108,11 @@ bool TeenAgentEngine::processCallback(uint16 addr) {
setOns(0, 0x60);
moveTo(281, scene->getPosition().y, 0, true);
disableObject(4);
- SET_FLAG(0xDBE1, 1);
- return true;
+ SET_FLAG(0xdbe1, 1);
+ break;
- case 0x7b89: //digging mysterious object
- if (CHECK_FLAG(0xDBE1, 1)) {
+ case 0x7b89: // digging mysterious object
+ if (CHECK_FLAG(0xdbe1, 1)) {
playActorAnimation(844);
setOns(1, 0);
playSound(5, 5);
@@ -1134,7 +1128,7 @@ bool TeenAgentEngine::processCallback(uint16 addr) {
inventory->remove(0x51);
} else
displayMessage(0x56da);
- return true;
+ break;
case 0x7bfd:
playSound(76, 18);
@@ -1167,9 +1161,9 @@ bool TeenAgentEngine::processCallback(uint16 addr) {
inventory->remove(0x5b);
enableObject(6);
disableObject(1);
- return true;
+ break;
- case 0x7ce5: //put spring on the solid ground
+ case 0x7ce5: // put spring on the solid ground
playSound(5, 2);
playSound(19, 11);
playActorAnimation(840);
@@ -1177,10 +1171,10 @@ bool TeenAgentEngine::processCallback(uint16 addr) {
inventory->remove(0x50);
disableObject(2);
enableObject(7);
- return true;
+ break;
- case 0x7d1a: //captain's key + door
- if (res->dseg.get_byte(0xDBDF) <= 1) {
+ case 0x7d1a: // captain's key + door
+ if (res->dseg.get_byte(0xdbdf) <= 1) {
playSound(5, 2);
playSound(57, 12);
playSound(70, 19);
@@ -1198,22 +1192,22 @@ bool TeenAgentEngine::processCallback(uint16 addr) {
wait(200);
playAnimation(0, 1);
setOns(0, 0);
- Dialog::showMono(scene, 0x63a5, 830, 0xd0, 1);
+ dialog->showMono(156, scene, 830, 0xd0, 1);
loadScene(7, 130, 195, 2);
playMusic(4);
setLan(1, 1);
wait(100);
- Dialog::show(scene, 0x6406, 0, 832, 0xd1, 0xec, 0, 1);
+ dialog->show(157, scene, 0, 832, 0xd1, 0xec, 0, 1);
//playAnimation(831, 1);
- SET_FLAG(0xDBDF, 2);
+ SET_FLAG(0xdbdf, 2);
} else
displayMessage(0x52f6);
- return true;
+ break;
- case 0x7e02: //tickling the captain
+ case 0x7e02: // tickling the captain
if (CHECK_FLAG(0xdbe0, 1)) {
displayMessage(0x5632);
} else {
@@ -1224,14 +1218,14 @@ bool TeenAgentEngine::processCallback(uint16 addr) {
waitAnimation();
setOns(0, 94);
- Dialog::show(scene, 0x65e9, 0, 832, 0xd1, 0xec, 0, 1);
+ dialog->show(161, scene, 0, 832, 0xd1, 0xec, 0, 1);
enableObject(12);
SET_FLAG(0xdbe0, 1);
}
- return true;
+ break;
- case 0x7e4f: //giving magazine to captain
- Dialog::show(scene, 0x66c0, 0, 856, 0xd1, 0xec, 0, 1);
+ case 0x7e4f: // giving magazine to captain
+ dialog->show(162, scene, 0, 856, 0xd1, 0xec, 0, 1);
playSound(5, 3);
playActorAnimation(852, true);
playActorAnimation(853, true);
@@ -1243,18 +1237,18 @@ bool TeenAgentEngine::processCallback(uint16 addr) {
playAnimation(856, 1);
playSound(5, 3);
//playActorAnimation(854);
- Dialog::show(scene, 0x66fe, 0, 856, 0xd1, 0xec, 0, 1);
+ dialog->show(163, scene, 0, 856, 0xd1, 0xec, 0, 1);
playAnimation(855, 1);
wait(200);
moveTo(30, 181, 0);
disableObject(1);
setLan(1, 0);
- SET_FLAG(0xDBDF, 3);
- SET_FLAG(0xDBF0, 1);
+ SET_FLAG(0xdbdf, 3);
+ SET_FLAG(0xdbf0, 1);
loadScene(8, 155, 199);
- return true;
+ break;
- case 0x7fbd: //using bird & bartender
+ case 0x7fbd: // using bird & bartender
playSound(5, 3);
playActorAnimation(876);
setOns(1, 0);
@@ -1263,15 +1257,15 @@ bool TeenAgentEngine::processCallback(uint16 addr) {
playAnimation(877, 1);
playAnimation(880, 1, true);
- Dialog::show(scene, 0x6f0e, 0, 857, 0xd1, 0xef, 0, 1);
+ dialog->show(176, scene, 0, 857, 0xd1, 0xef, 0, 1);
setOns(2, 0x6a);
reloadLan();
playAnimation(878, 0);
- //playAnimation(879, 0); //background bartender animation
+ //playAnimation(879, 0); // background bartender animation
inventory->remove(0x5c);
enableObject(1);
- SET_FLAG(0xDBE7, 1);
- return true;
+ SET_FLAG(0xdbe7, 1);
+ break;
case 0x8047:
playSound(32, 5);
@@ -1281,25 +1275,25 @@ bool TeenAgentEngine::processCallback(uint16 addr) {
setOns(2, 0x6b);
inventory->remove(0x56);
inventory->add(0x55);
- SET_FLAG(0xDBE8, 1);
- return true;
+ SET_FLAG(0xdbe8, 1);
+ break;
case 0x808b:
- if (CHECK_FLAG(0xDBDA, 1)) {
- //alredy shown
- displayMessage(0x53F2);
+ if (CHECK_FLAG(0xdbda, 1)) {
+ // already shown
+ displayMessage(0x53f2);
} else {
- displayMessage(0x53DD);
+ displayMessage(0x53dd);
playSound(5, 2);
playSound(5, 18);
playActorAnimation(810);
- Dialog::show(scene, 0x60BF, 0, 809, 0xd1, 0xd0, 0, 1);
- SET_FLAG(0xDBDA, 1);
+ dialog->show(147, scene, 0, 809, 0xd1, 0xd0, 0, 1);
+ SET_FLAG(0xdbda, 1);
}
- return true;
+ break;
- case 0x80c3: //show kaleydoscope to the guard
- Dialog::show(scene, 0x6811, 0, 809, 0xd1, 0xd0, 0, 1);
+ case 0x80c3: // show kaleidoscope to the guard
+ dialog->show(165, scene, 0, 809, 0xd1, 0xd0, 0, 1);
playSound(5, 3);
playSound(5, 30);
playSound(26, 14);
@@ -1312,25 +1306,25 @@ bool TeenAgentEngine::processCallback(uint16 addr) {
inventory->add(0x53);
inventory->remove(0x52);
enableObject(1);
- SET_FLAG(0xDBE2, 1);
- return true;
+ SET_FLAG(0xdbe2, 1);
+ break;
- //Shore
+ // Shore
case 0x5348:
- if (CHECK_FLAG(0xdb99, 1)) { //got broken paddle from boat
+ if (CHECK_FLAG(0xdb99, 1)) { // got broken paddle from boat
displayMessage(0x351f);
} else {
- SET_FLAG(0xDB99, 1);
+ SET_FLAG(0xdb99, 1);
playSound(57, 6);
playActorAnimation(536);
- Dialog::showMono(scene, 0x30c3, 0, 0xd1, 0);
+ dialog->showMono(77, scene, 0, 0xd1, 0);
inventory->add(0x8);
}
- return true;
+ break;
case 0x53a1:
- if (CHECK_FLAG(0xdbb2, 1)) { //spoken to man in well
+ if (CHECK_FLAG(0xdbb2, 1)) { // spoken to man in well
displayMessage(0x411d);
} else {
displayMessage(0x408a);
@@ -1343,71 +1337,72 @@ bool TeenAgentEngine::processCallback(uint16 addr) {
displayMessage(0x410f, 0xe5, 52712);
wait(100);
displayMessage(0x4091, 0xe5, 52728);
- SET_FLAG(0xDBB2, 1);
+ SET_FLAG(0xdbb2, 1);
}
- return true;
-
+ break;
- case 0x5458: {
- setOns(2, 0);
- playSound(34, 7);
- playActorAnimation(535);
- inventory->add(11);
- disableObject(1);
+ case 0x5458:
+ {
+ setOns(2, 0);
+ playSound(34, 7);
+ playActorAnimation(535);
+ inventory->add(11);
+ disableObject(1);
- byte *scene_15_ons = scene->getOns(15); //patch ons for the scene 15
- scene_15_ons[0] = 0;
+ byte *scene_15_ons = scene->getOns(15); // patch ons for the scene 15
+ scene_15_ons[0] = 0;
- byte f = GET_FLAG(0xDB98) + 1;
- SET_FLAG(0xDB98, f);
- if (f >= 2) {
- //disable object boat for scene 15!!
- disableObject(1, 15);
+ byte f = GET_FLAG(0xdb98) + 1;
+ SET_FLAG(0xdb98, f);
+ if (f >= 2) {
+ // disable object boat for scene 15!!
+ disableObject(1, 15);
+ }
}
- }
- return true;
+ break;
- case 0x54b3: {
- setOns(1, 0);
- setOns(3, 0);
- playSound(33, 6);
- playActorAnimation(534);
- inventory->add(10);
- disableObject(2);
- setOns(1, 10);
- setOns(1, 0, 15);
- byte f = GET_FLAG(0xDB98) + 1;
- SET_FLAG(0xDB98, f);
- if (f >= 2) {
- //disable object boat for scene 15!!
- disableObject(1, 15);
+ case 0x54b3:
+ {
+ setOns(1, 0);
+ setOns(3, 0);
+ playSound(33, 6);
+ playActorAnimation(534);
+ inventory->add(10);
+ disableObject(2);
+ setOns(1, 10);
+ setOns(1, 0, 15);
+ byte f = GET_FLAG(0xdb98) + 1;
+ SET_FLAG(0xdb98, f);
+ if (f >= 2) {
+ // disable object boat for scene 15!!
+ disableObject(1, 15);
+ }
}
- }
- return true;
+ break;
case 0x5502:
setOns(0, 0);
loadScene(15, 115, 180, 1);
playMusic(6);
playActorAnimation(568);
- return true;
+ break;
- case 0x5561://Enter lakeside house
- moveTo(94, 115, 4); //call 557e, but it's not needed I guess
+ case 0x5561: // Enter lakeside house
+ moveTo(94, 115, 4); // call 557e, but it's not needed I guess
loadScene(19, 223, 199, 1);
- return true;
+ break;
case 0x55a1:
processCallback(0x557e);
rejectMessage();
- return true;
+ break;
case 0x557e:
if (scene->getPosition().y <= 149)
moveTo(94, 115, 4);
else
moveTo(51, 149, 4);
- return true;
+ break;
case 0x563b:
playSound(5, 10);
@@ -1415,7 +1410,7 @@ bool TeenAgentEngine::processCallback(uint16 addr) {
playActorAnimation(561);
inventory->add(26);
disableObject(6);
- return true;
+ break;
case 0x56f6:
playSound(32, 7);
@@ -1424,9 +1419,9 @@ bool TeenAgentEngine::processCallback(uint16 addr) {
disableObject(12);
inventory->add(45);
displayMessage(0x3b04);
- return true;
+ break;
- case 0x5756://Open car door
+ case 0x5756: // Open car door
playSound(11, 4);
playActorAnimation(514);
setOns(4, 8);
@@ -1435,55 +1430,55 @@ bool TeenAgentEngine::processCallback(uint16 addr) {
enableObject(15);
enableObject(16);
disableObject(1);
- return true;
+ break;
- case 0x5805://Enter basketball house
+ case 0x5805: // Enter basketball house
playSound(70, 6);
playActorAnimation(513);
loadScene(22, 51, 180, 2);
- return true;
+ break;
- case 0x5832://Ring doorbell
+ case 0x5832: // Ring doorbell
playActorAnimation(509);
displayMessage(0x5dce);
- return true;
+ break;
case 0x58a2:
- Dialog::pop(scene, 0xdaba, 0, 502, 0xd1, 0xe5, 0, 1);
+ dialog->pop(scene, 0xdaba, 0, 502, 0xd1, 0xe5, 0, 1);
scene->getObject(13)->setName((const char *)res->dseg.ptr(0x92e5));
- return true;
+ break;
- case 0x58b7://Get comb from car
+ case 0x58b7: // Get comb from car
disableObject(14);
setOns(4, 0);
playSound(5, 7);
playActorAnimation(521);
setOns(4, 0);
inventory->add(0x6);
- return true;
+ break;
- case 0x58df://Pull trunk lever in car
- SET_FLAG(0xDB94, 1);
+ case 0x58df: // Pull trunk lever in car
+ SET_FLAG(0xdb94, 1);
playSound(6, 1);
setOns(3, 6);
playActorAnimation(515);
- return true;
+ break;
- case 0x593e://Enter annes house
+ case 0x593e: // Enter annes house
playSound(89, 4);
playActorAnimation(980);
loadScene(23, 76, 199, 1);
- if (CHECK_FLAG(0xDBEE, 1))
+ if (CHECK_FLAG(0xdbee, 1))
playMusic(7);
- return true;
+ break;
case 0x5994:
processCallback(0x599b);
processCallback(0x5a21);
- return true;
+ break;
case 0x599b:
- return true;
+ break;
case 0x5a21:
loadScene(24, 230, 170, 1);
@@ -1496,45 +1491,45 @@ bool TeenAgentEngine::processCallback(uint16 addr) {
playSound(52, 25);
playActorAnimation(601);
moveTo(230, 179, 3);
- if (!CHECK_FLAG(0xDBA4, 1))
- displayMessage(0x37ea); //it's kinda dark here
- return true;
+ if (!CHECK_FLAG(0xdba4, 1))
+ displayMessage(0x37ea); // it's kinda dark here
+ break;
case 0x5a8b:
- if (!CHECK_FLAG(0xDBAD, 1)) {
- playSound(43, 4); //grrrrrr
+ if (!CHECK_FLAG(0xdbad, 1)) {
+ playSound(43, 4); // grrrrrr
playSound(42, 15);
playSound(42, 17);
playSound(42, 19);
playAnimation(656, 0);
wait(50);
displayMessage(0x3c16);
- } else if (!CHECK_FLAG(0xDBA3, 1)) {//Dog has bone
+ } else if (!CHECK_FLAG(0xdba3, 1)) { // Dog has bone
playSound(28, 3);
playActorAnimation(596);
setOns(1, 30);
- SET_FLAG(0xDBA3, 1);
+ SET_FLAG(0xdba3, 1);
enableObject(8);
} else {
setOns(1, 0);
playSound(4, 4);
playActorAnimation(597);
- SET_FLAG(0xDBA3, 0);
+ SET_FLAG(0xdba3, 0);
disableObject(8);
displayMessage(0x37b8);
setOns(1, 32, 24);
enableObject(4, 24);
}
- return true;
+ break;
- case 0x5b3a://Click on dog
- Dialog::popMark(scene, 0xDB14);
- return true;
+ case 0x5b3a: // Click on dog
+ dialog->popMark(scene, 0xdb14);
+ break;
- case 0x5b59: //picking up the rope
- Dialog::showMark(scene, 0x2cbd);
+ case 0x5b59: // picking up the rope
+ dialog->showMark(70, scene);
wait(150);
- Dialog::showMark(scene, 0x2dc2);
+ dialog->showMark(71, scene);
moveRel(0, -12, 0);
playSound(34, 5);
playActorAnimation(607);
@@ -1547,79 +1542,79 @@ bool TeenAgentEngine::processCallback(uint16 addr) {
moveTo(16, scene->getPosition().y, 4, true);
inventory->add(38);
disableObject(12);
- return true;
+ break;
- case 0x5be1://Talk to grandpa
- Dialog::pop(scene, 0xDAC4, 0, 522, 0xd1, 0xd8, 0, 1);
- return true;
+ case 0x5be1: // Talk to grandpa
+ dialog->pop(scene, 0xdac4, 0, 522, 0xd1, 0xd8, 0, 1);
+ break;
case 0x5bee:
playSound(89, 5);
playSound(67, 11);
playActorAnimation(982);
displayMessage(0x5955);
- return true;
+ break;
- case 0x5c0d: //grandpa - drawers
- if (CHECK_FLAG(0xDBA7, 1)) {
+ case 0x5c0d: // grandpa - drawers
+ if (CHECK_FLAG(0xdba7, 1)) {
displayMessage(0x3bac);
} else {
- if (!CHECK_FLAG(0xDB92, 1))
- Dialog::show(scene, 0x15a0, 0, 522, 0xd1, 0xd8, 0, 1); //can I search your drawers?
+ if (!CHECK_FLAG(0xdb92, 1))
+ dialog->show(24, scene, 0, 522, 0xd1, 0xd8, 0, 1);
playSound(66, 5);
playSound(67, 20);
playSound(5, 23);
playActorAnimation(631);
inventory->add(47);
- SET_FLAG(0xDBA7, 1);
+ SET_FLAG(0xdba7, 1);
}
- return true;
+ break;
case 0x5c84:
- if (CHECK_FLAG(0xDB92, 1)) {
+ if (CHECK_FLAG(0xdb92, 1)) {
inventory->add(2);
disableObject(7);
playSound(32, 7);
setOns(0, 0);
playActorAnimation(520);
} else {
- Dialog::pop(scene, 0xDACE, 0, 522, 0xd1, 0xd8, 0, 1);
+ dialog->pop(scene, 0xdace, 0, 522, 0xd1, 0xd8, 0, 1);
}
- return true;
+ break;
- case 0x5cf0://Exit basketball house
+ case 0x5cf0:// Exit basketball house
playSound(88, 5);
playActorAnimation(981);
loadScene(20, 161, 165);
- return true;
+ break;
- case 0x5d24: //getting the fan
- if (CHECK_FLAG(0xDB92, 1)) {
+ case 0x5d24: // getting the fan
+ if (CHECK_FLAG(0xdb92, 1)) {
setLan(2, 0);
playSound(32, 7);
playActorAnimation(508);
disableObject(13);
inventory->add(7);
} else {
- Dialog::pop(scene, 0xDAD4, 0, 522, 0xd1, 0xd8, 0, 1);
+ dialog->pop(scene, 0xdad4, 0, 522, 0xd1, 0xd8, 0, 1);
}
- return true;
+ break;
- case 0x5e4d: //right click on ann
- if (!CHECK_FLAG(0xDB97, 0)) {
+ case 0x5e4d: // right click on ann
+ if (!CHECK_FLAG(0xdb97, 0)) {
displayMessage(0x3d59);
} else {
moveTo(245, 198, 1);
- Dialog::show(scene, 0x21d7, 0, 524, 0xd1, 0xe5, 0, 2);
- //waitLanAnimationFrame(2, 1); //too long, about 200 frames! seems to be present in original game (sic)
- SET_FLAG(0xDB97, 1);
+ dialog->show(51, scene, 0, 524, 0xd1, 0xe5, 0, 2);
+ //waitLanAnimationFrame(2, 1); // too long, about 200 frames! seems to be present in original game (sic)
+ SET_FLAG(0xdb97, 1);
for (byte i = 10; i <= 20; i += 2)
playSound(13, i);
playAnimation(528, 1);
wait(50);
playMusic(7);
- SET_FLAG(0xDBEE, 1);
+ SET_FLAG(0xdbee, 1);
for (byte i = 3; i <= 17; i += 2)
playSound(56, i);
playActorAnimation(525);
@@ -1633,30 +1628,31 @@ bool TeenAgentEngine::processCallback(uint16 addr) {
playSound(55, 5);
playActorAnimation(527);
wait(50);
- Dialog::show(scene, 0x2219, 0, 524, 0xd1, 0xe5, 0, 2);
+ dialog->show(52, scene, 0, 524, 0xd1, 0xe5, 0, 2);
scene->getObject(2)->setName((const char *)res->dseg.ptr(0x9820));
}
- return true;
+ break;
- case 0x5f73: //exiting ann's house
- if (CHECK_FLAG(0xDBEE, 1))
+ case 0x5f73: // exiting ann's house
+ if (CHECK_FLAG(0xdbee, 1))
playMusic(6);
loadScene(21, 99, 180, 3);
- return true;
+ break;
case 0x5fba:
- if (CHECK_FLAG(0xDBB1, 1)) {
+ if (CHECK_FLAG(0xdbb1, 1)) {
displayMessage(0x4380);
} else {
- Dialog::pop(scene, 0xDAFC, 0, 523, 0xd1, 0xe5, 0, 1);
+ dialog->pop(scene, 0xdafc, 0, 523, 0xd1, 0xe5, 0, 1);
}
- return true;
+ break;
case 0x607f:
- return processCallback(0x60b5);
+ retVal = processCallback(0x60b5);
+ break;
case 0x6083:
- if (CHECK_FLAG(0xDBA4, 1)) {
+ if (CHECK_FLAG(0xdba4, 1)) {
setOns(0, 0);
playSound(56, 10);
playActorAnimation(599);
@@ -1664,27 +1660,28 @@ bool TeenAgentEngine::processCallback(uint16 addr) {
disableObject(2);
} else
processCallback(0x60b5);
- return true;
+ break;
case 0x60b5:
- if (CHECK_FLAG(0xDBAE, 1)) {
+ if (CHECK_FLAG(0xdbae, 1)) {
processCallback(0x60d9);
- Dialog::showMark(scene, 0x2fdd);
+ dialog->showMark(75, scene);
} else {
- Dialog::showMark(scene, 0x2e41);
+ dialog->showMark(73, scene);
processCallback(0x60d9);
wait(100);
- Dialog::showMark(scene, 0x2e6d);
+ dialog->showMark(74, scene);
}
- return true;
+ break;
- case 0x60d9: {
- Object *obj = scene->getObject(3);
- moveTo(obj);
- processCallback(0x612b);
- moveTo(48, 190, 3);
- }
- return true;
+ case 0x60d9:
+ {
+ Object *objTemp = scene->getObject(3);
+ moveTo(objTemp);
+ processCallback(0x612b);
+ moveTo(48, 190, 3);
+ }
+ break;
case 0x612b:
playSound(52, 10);
@@ -1696,37 +1693,35 @@ bool TeenAgentEngine::processCallback(uint16 addr) {
playSound(52, 32);
playActorAnimation(600);
loadScene(21, 297, 178, 3);
- return true;
+ break;
case 0x6176:
- if (CHECK_FLAG(0xDBA4, 1)) {
+ if (CHECK_FLAG(0xdba4, 1)) {
displayMessage(0x3801);
- return true;
+ } else {
+ playSound(71, 6);
+ playActorAnimation(598);
+ loadScene(24, scene->getPosition());
+ setOns(2, 0);
+ setLan(1, 0);
+ playAnimation(660, 0);
+ disableObject(1);
+ SET_FLAG(0xdba4, 1);
+ loadScene(24, scene->getPosition());
}
- playSound(71, 6);
- playActorAnimation(598);
- loadScene(24, scene->getPosition());
- setOns(2, 0);
- setLan(1, 0);
- playAnimation(660, 0);
- disableObject(1);
- SET_FLAG(0xDBA4, 1);
- loadScene(24, scene->getPosition());
-
- return true;
+ break;
case 0x61e9:
- if (CHECK_FLAG(0xDBA4, 1)) {
- Dialog::popMark(scene, 0xdb1e);
- } else
+ if (CHECK_FLAG(0xdba4, 1))
+ dialog->popMark(scene, 0xdb1e);
+ else
processCallback(0x61fe);
+ break;
- return true;
-
- case 0x6229: //shelves in cellar
- if (CHECK_FLAG(0xDBA4, 1)) {
+ case 0x6229: // shelves in cellar
+ if (CHECK_FLAG(0xdba4, 1)) {
Common::Point p = scene->getPosition();
- byte v = GET_FLAG(0xDBB4);
+ byte v = GET_FLAG(0xdbb4);
switch (v) {
case 0:
displayMessage(0x4532);
@@ -1740,24 +1735,24 @@ bool TeenAgentEngine::processCallback(uint16 addr) {
displayMessage(0x458e);
moveTo(p, 3);
displayMessage(0x459f);
- SET_FLAG(0xDBB4, 1);
+ SET_FLAG(0xdbb4, 1);
break;
case 1:
displayMessage(0x45b8);
wait(100);
displayMessage(0x45da);
- SET_FLAG(0xDBB4, 2);
+ SET_FLAG(0xdbb4, 2);
break;
default:
displayMessage(0x4603);
+ break;
}
} else
processCallback(0x61fe);
+ break;
- return true;
-
- case 0x6480: //dive mask
- if (CHECK_FLAG(0xDB96, 1)) {
+ case 0x6480: // dive mask
+ if (CHECK_FLAG(0xdb96, 1)) {
playSound(56, 7);
playSound(5, 15);
playActorAnimation(613);
@@ -1767,10 +1762,10 @@ bool TeenAgentEngine::processCallback(uint16 addr) {
displayMessage(0x387c);
} else
displayMessage(0x3eb2);
- return true;
+ break;
- case 0x64c4: //flippers
- if (CHECK_FLAG(0xDB96, 1)) {
+ case 0x64c4: // flippers
+ if (CHECK_FLAG(0xdb96, 1)) {
setOns(2, 35);
playSound(63, 8);
playSound(24, 10);
@@ -1779,16 +1774,16 @@ bool TeenAgentEngine::processCallback(uint16 addr) {
disableObject(6);
} else
displayMessage(0x3eb2);
- return true;
+ break;
- case 0x7907://Describe car lever
- if (CHECK_FLAG(0xdb94, 1)) {//Already pulled lever?
+ case 0x7907: // Describe car lever
+ if (CHECK_FLAG(0xdb94, 1)) { // Already pulled lever?
displayMessage(0x3e4f);
- return true;
} else
- return false;
+ retVal = false;
+ break;
- case 0x62d0://Get bone from under rock
+ case 0x62d0: // Get bone from under rock
displayAsyncMessage(0x463c, 30938, 16, 24);
playSound(26, 6);
playSound(26, 10);
@@ -1802,15 +1797,15 @@ bool TeenAgentEngine::processCallback(uint16 addr) {
playSound(5, 2);
playActorAnimation(595);
displayMessage(0x3790);
- return true;
+ break;
case 0x6351:
- if (CHECK_FLAG(0xdaca, 1)) { //cave bush is cut down
+ if (CHECK_FLAG(0xdaca, 1)) { // cave bush is cut down
playMusic(8);
loadScene(26, 319, 169, 4);
} else
displayMessage(0x3bd2);
- return true;
+ break;
case 0x63ea:
playSound(5, 10);
@@ -1818,12 +1813,11 @@ bool TeenAgentEngine::processCallback(uint16 addr) {
playActorAnimation(640);
inventory->add(50);
disableObject(6);
- return true;
+ break;
- case 0x6411://Kick hen
- if (CHECK_FLAG(0xdb93, 1)) { //already kicked hen
+ case 0x6411: // Kick hen
+ if (CHECK_FLAG(0xdb93, 1)) { // already kicked hen
displayMessage(0x3e08);
- return true;
} else {
SET_FLAG(0xdb93, 1);
displayMessage(0x3dc6);
@@ -1836,10 +1830,10 @@ bool TeenAgentEngine::processCallback(uint16 addr) {
setOns(0, 1);
enableObject(14);
displayMessage(0x3df4);
- return true;
}
+ break;
- case 0x6592: //Rake
+ case 0x6592: // Rake
setOns(1, 0);
playSound(18, 10);
playActorAnimation(553);
@@ -1847,98 +1841,96 @@ bool TeenAgentEngine::processCallback(uint16 addr) {
wait(50);
displayMessage(0x3605);
disableObject(11);
- return true;
+ break;
case 0x66b5:
playSound(89, 5);
playActorAnimation(969);
loadScene(33, 319, 181, 4);
- return true;
+ break;
- case 0x6519://Sickle
+ case 0x6519: // Sickle
setOns(4, 0);
playSound(5, 11);
playActorAnimation(625);
inventory->add(0x2c);
disableObject(8);
- return true;
+ break;
- case 0x655b://Get needle from haystack
- if (CHECK_FLAG(0xdb9d, 1)) { //already have needle
+ case 0x655b: // Get needle from haystack
+ if (CHECK_FLAG(0xdb9d, 1)) { // already have needle
displayMessage(0x356a);
- return true;
} else {
SET_FLAG(0xdb9d, 1);
playSound(49, 3);
playActorAnimation(548);
inventory->add(0x11);
displayMessage(0x35b2);
- return true;
}
+ break;
- case 0x663c://Feather
+ case 0x663c: // Feather
setOns(0, 0);
playSound(5, 9);
playActorAnimation(511);
inventory->add(1);
disableObject(15);
- return true;
+ break;
case 0x667c:
playSound(70, 4);
playActorAnimation(972);
loadScene(29, 160, 199, 1);
- return true;
+ break;
case 0x66a9:
displayMessage(0x4a7e);
disableObject(4);
- return true;
+ break;
case 0x66e2:
playSound(88, 4);
playActorAnimation(970);
loadScene(35, 160, 199, 1);
- return true;
+ break;
case 0x70bb:
- Dialog::pop(scene, 0xdb24, 0, 709, 0xd1, 0xef, 0, 1);
- return true;
+ dialog->pop(scene, 0xdb24, 0, 709, 0xd1, 0xef, 0, 1);
+ break;
case 0x71ae:
- if (CHECK_FLAG(0xDBCD, 1)) {
- if (CHECK_FLAG(0xDBCE, 1)) {
+ if (CHECK_FLAG(0xdbcd, 1)) {
+ if (CHECK_FLAG(0xdbce, 1)) {
displayMessage(0x4f9b);
} else {
displayMessage(0x4fb1);
playSound(32, 6);
playActorAnimation(717);
inventory->add(66);
- SET_FLAG(0xDBCE, 1);
+ SET_FLAG(0xdbce, 1);
}
} else
- Dialog::showMark(scene, 0x3c9d);
- return true;
+ dialog->showMark(97, scene);
+ break;
case 0x70c8:
- if (!processCallback(0x70e0))
- return true;
- moveTo(81, 160, 4);
- displayMessage(0x5cac);
- return true;
+ if (processCallback(0x70e0)) {
+ moveTo(81, 160, 4);
+ displayMessage(0x5cac);
+ }
+ break;
case 0x70e0:
- if (!CHECK_FLAG(0xDBCC, 1)) {
+ if (!CHECK_FLAG(0xdbcc, 1)) {
displayMessage(0x4ece);
- return false;
+ retVal = false;
}
- return true;
+ break;
case 0x70ef:
- if (!processCallback(0x70e0))
- return true;
- displayMessage(0x5046);
- return true;
+ if (processCallback(0x70e0))
+ displayMessage(0x5046);
+ break;
case 0x70f9:
if (inventory->has(68)) {
@@ -1947,30 +1939,29 @@ bool TeenAgentEngine::processCallback(uint16 addr) {
displayMessage(0x500a);
} else
loadScene(29, 40, 176, 2);
- return true;
+ break;
case 0x712c:
- if (!processCallback(0x70e0))
- return true;
-
- if (CHECK_FLAG(0xDBCF, 1)) {
- playSound(89, 4);
- playActorAnimation(719);
- setOns(4, 67);
- ++ *res->dseg.ptr(READ_LE_UINT16(res->dseg.ptr(0x6746 + (scene->getId() - 1) * 2)));
- disableObject(5);
- enableObject(12);
- } else {
- playSound(89, 4);
- playSound(89, 4);
- playSound(87, 45);
- displayAsyncMessage(0x4fcb, 34672, 11, 35, 0xe5);
- playActorAnimation(718);
- wait(100);
- displayMessage(0x4fe2);
- SET_FLAG(0xDBCF, 1);
+ if (processCallback(0x70e0)) {
+ if (CHECK_FLAG(0xdbcf, 1)) {
+ playSound(89, 4);
+ playActorAnimation(719);
+ setOns(4, 67);
+ ++ *res->dseg.ptr(READ_LE_UINT16(res->dseg.ptr(0x6746 + (scene->getId() - 1) * 2)));
+ disableObject(5);
+ enableObject(12);
+ } else {
+ playSound(89, 4);
+ playSound(89, 4);
+ playSound(87, 45);
+ displayAsyncMessage(0x4fcb, 34672, 11, 35, 0xe5);
+ playActorAnimation(718);
+ wait(100);
+ displayMessage(0x4fe2);
+ SET_FLAG(0xdbcf, 1);
+ }
}
- return true;
+ break;
case 0x71eb:
setOns(2, 0);
@@ -1979,16 +1970,15 @@ bool TeenAgentEngine::processCallback(uint16 addr) {
inventory->add(62);
disableObject(7);
enableObject(8);
- return true;
+ break;
case 0x7244:
- if (!processCallback(0x70e0))
- return true;
- displayMessage(0x5c60);
- return true;
+ if (processCallback(0x70e0))
+ displayMessage(0x5c60);
+ break;
case 0x7255:
- if (CHECK_FLAG(0xDBD0, 1)) {
+ if (CHECK_FLAG(0xdbd0, 1)) {
setOns(4, 69);
playSound(32, 5);
playActorAnimation(725);
@@ -1998,7 +1988,7 @@ bool TeenAgentEngine::processCallback(uint16 addr) {
playActorAnimation(721);
displayMessage(0x505e);
}
- return true;
+ break;
case 0x721c:
setOns(3, 0);
@@ -2006,7 +1996,7 @@ bool TeenAgentEngine::processCallback(uint16 addr) {
playActorAnimation(715);
inventory->add(63);
disableObject(9);
- return true;
+ break;
case 0x7336:
setOns(1, 0);
@@ -2015,17 +2005,17 @@ bool TeenAgentEngine::processCallback(uint16 addr) {
playActorAnimation(697);
inventory->add(56);
disableObject(1);
- return true;
+ break;
case 0x7381:
playSound(5, 12);
playActorAnimation(704);
disableObject(2);
inventory->add(58);
- return true;
+ break;
case 0x7408:
- if (CHECK_FLAG(0xDBC4, 1)) {
+ if (CHECK_FLAG(0xdbc4, 1)) {
displayMessage(0x4d2a);
} else {
setOns(0, 0);
@@ -2038,25 +2028,25 @@ bool TeenAgentEngine::processCallback(uint16 addr) {
playActorAnimation(698);
setOns(0, 52);
setOns(2, 61);
- Dialog::showMark(scene, 0x38b6);
+ dialog->showMark(92, scene);
enableObject(11);
- SET_FLAG(0xDBC4, 1);
+ SET_FLAG(0xdbc4, 1);
}
- return true;
+ break;
case 0x7476:
- if (CHECK_FLAG(0xDBC9, 1)) {
+ if (CHECK_FLAG(0xdbc9, 1)) {
displayMessage(0x4dbb);
} else {
- SET_FLAG(0xDBC9, 1);
- Dialog::showMark(scene, 0x3aca);
+ SET_FLAG(0xdbc9, 1);
+ dialog->showMark(94, scene);
playSound(61, 5);
playSound(5, 14);
playActorAnimation(705);
displayMessage(0x4dd3);
inventory->add(59);
}
- return true;
+ break;
case 0x74d1:
setOns(2, 0);
@@ -2064,19 +2054,19 @@ bool TeenAgentEngine::processCallback(uint16 addr) {
playActorAnimation(699);
inventory->add(57);
disableObject(11);
- return true;
+ break;
- case 0x7513: //fatso + doctor: pre-final
- if (CHECK_FLAG(0xDBD7, 1)) {
- if (CHECK_FLAG(0xDBD8, 1)) {
+ case 0x7513: // fatso + doctor: pre-final
+ if (CHECK_FLAG(0xdbd7, 1)) {
+ if (CHECK_FLAG(0xdbd8, 1)) {
playSound(88, 4);
playActorAnimation(979);
loadScene(37, 51, 183);
- Dialog::show(scene, 0x54ea, 768, 769, 0xd9, 0xe5, 1, 2);
+ dialog->show(125, scene, 768, 769, 0xd9, 0xe5, 1, 2);
playAnimation(770, 0, true, true, true);
playAnimation(771, 1, true, true, true);
- Dialog::showMono(scene, 0x5523, 0, 0xd1, 0);
+ dialog->showMono(126, scene, 0, 0xd1, 0);
playAnimation(770, 0, true, true, true);
playAnimation(771, 1, true, true, true);
playSound(5, 3);
@@ -2090,11 +2080,11 @@ bool TeenAgentEngine::processCallback(uint16 addr) {
waitAnimation();
setOns(0, 74);
hideActor();
- Dialog::showMono(scene, 0x5556, 775, 0xd0, 1);
+ dialog->showMono(127, scene, 775, 0xd0, 1);
playAnimation(771, 1, true, true, true);
playAnimation(776, 0);
- Dialog::show(scene, 0x55f7, 777, 778, 0xd0, 0xe5, 1, 2); //i have to kill you anyway
+ dialog->show(128, scene, 777, 778, 0xd0, 0xe5, 1, 2);
playAnimation(779, 0, true, true, true);
playAnimation(780, 1, true, true, true);
@@ -2151,7 +2141,7 @@ bool TeenAgentEngine::processCallback(uint16 addr) {
setOns(0, 80);
playAnimation(792, 3, true, true, true);
- Dialog::show(scene, 0x5665, 0, 791, 0xd1, 0xd0, 0, 4);
+ dialog->show(129, scene, 0, 791, 0xd1, 0xd0, 0, 4);
playAnimation(792, 3, true, true, true);
moveTo(40, 171, 4);
@@ -2161,43 +2151,47 @@ bool TeenAgentEngine::processCallback(uint16 addr) {
playAnimation(0, 3);
loadScene(31, 298, 177, 4);
- SET_FLAG(0xDBD9, 1);
- } else {
+ SET_FLAG(0xdbd9, 1);
+ } else
displayMessage(0x52fe);
- }
} else
displayMessage(0x52cb);
- return true;
+ break;
case 0x783d:
- Dialog::pop(scene, 0xdb36, 0, 797, 0xd1, 0xd0, 0, 1);
- return true;
+ dialog->pop(scene, 0xdb36, 0, 797, 0xd1, 0xd0, 0, 1);
+ break;
case 0x7966:
- if (CHECK_FLAG(0xDBA4, 1))
- return false;
- return processCallback(0x60b5);
+ if (CHECK_FLAG(0xdba4, 1))
+ retVal = false;
+ else
+ retVal = processCallback(0x60b5);
+ break;
case 0x7ad0:
case 0x7ad7:
- return !processCallback(0x70e0);
+ retVal = !processCallback(0x70e0);
+ break;
case 0x7ab9:
- if (CHECK_FLAG(0xDBB6, 1))
- return false;
- Dialog::showMono(scene, 0x37d0, 0, 0xd1, 0);
- SET_FLAG(0xDBB6, 1);
- return true;
+ if (CHECK_FLAG(0xdbb6, 1))
+ retVal = false;
+ else {
+ dialog->showMono(90, scene, 0, 0xd1, 0);
+ SET_FLAG(0xdbb6, 1);
+ }
+ break;
case 0x7ade:
- if (CHECK_FLAG(0xdbcd, 1)) {
+ if (CHECK_FLAG(0xdbcd, 1))
displayMessage(0x4f69);
- return true;
- } else
- return false;
+ else
+ retVal = false;
+ break;
- case 0x7f23://Use grenade on captains drawer
- if (CHECK_FLAG(0xDBDF, 3)) {
+ case 0x7f23: // Use grenade on captains drawer
+ if (CHECK_FLAG(0xdbdf, 3)) {
enableOn(false);
playSound(5, 3);
playSound(58, 11);
@@ -2207,26 +2201,26 @@ bool TeenAgentEngine::processCallback(uint16 addr) {
playActorAnimation(870);
playSound(54, 15);
playActorAnimation(871);
- SET_FLAG(0xDBE6, 1);
+ SET_FLAG(0xdbe6, 1);
setOns(1, 0x66);
moveTo(224, 194, 0, true);
displayCutsceneMessage(0x57df, 30423);
inventory->remove(0x59);
enableOn(true);
- } else {
+ } else
displayMessage(0x5de2);
- }
- return true;
+ break;
- case 0x505c: {
+ case 0x505c:
//suspicious stuff
- Common::Point p = scene->getPosition();
- if (p.x != 203 && p.y != 171)
- moveTo(203, 169, 2);
- else
- moveTo(203, 169, 1);
- }
- return true;
+ {
+ Common::Point p = scene->getPosition();
+ if (p.x != 203 && p.y != 171)
+ moveTo(203, 169, 2);
+ else
+ moveTo(203, 169, 1);
+ }
+ break;
case 0x509a:
processCallback(0x505c);
@@ -2235,95 +2229,103 @@ bool TeenAgentEngine::processCallback(uint16 addr) {
playActorAnimation(543);
inventory->add(15);
disableObject(9);
- return true;
+ break;
case 0x7802:
- if (CHECK_FLAG(0xDBD7, 1)) {
- if (CHECK_FLAG(0xDBD8, 1))
+ if (CHECK_FLAG(0xdbd7, 1)) {
+ if (CHECK_FLAG(0xdbd8, 1))
displayMessage(0x52f6);
else {
playSound(71, 4);
playActorAnimation(796);
setLan(1, 0);
- SET_FLAG(0xDBD8, 1);
+ SET_FLAG(0xdbd8, 1);
}
} else
displayMessage(0x52cb);
- return true;
+ break;
case 0x78e0:
processCallback(0x50c5);
- return false;
+ retVal = false;
+ break;
case 0x78e7:
processCallback(0x557e);
- return false;
+ retVal = false;
+ break;
case 0x78ee:
processCallback(0x557e);
- return false;
+ retVal = false;
+ break;
case 0x78f5:
- if (CHECK_FLAG(0xDB95, 1)) {
+ if (CHECK_FLAG(0xdb95, 1)) {
displayMessage(0x3575);
- return true;
} else
- return false;
+ retVal = false;
+ break;
case 0x7919:
- if (!CHECK_FLAG(0xDBA5, 1))
- return false;
- displayMessage(0x3E98);
- return true;
+ if (!CHECK_FLAG(0xdba5, 1))
+ retVal = false;
+ else
+ displayMessage(0x3e98);
+ break;
case 0x7950:
- if (!CHECK_FLAG(0xDBB1, 1))
- return false;
-
- displayMessage(0x3DAF);
- return true;
+ if (!CHECK_FLAG(0xdbb1, 1))
+ retVal = false;
+ else
+ displayMessage(0x3daf);
+ break;
case 0x7975:
- if (CHECK_FLAG(0xDBA4, 1))
- return false;
- displayMessage(0x3832);
- return true;
+ if (CHECK_FLAG(0xdba4, 1))
+ retVal = false;
+ else
+ displayMessage(0x3832);
+ break;
case 0x7987:
case 0x7996:
case 0x79a5:
case 0x79b4:
- if (CHECK_FLAG(0xDBA4, 1))
- return false;
- return processCallback(0x61fe);
+ if (CHECK_FLAG(0xdba4, 1))
+ retVal = false;
+ else
+ retVal = processCallback(0x61fe);
+ break;
case 0x79d2:
- if (!CHECK_FLAG(0xDB9D, 1))
- return false;
- displayMessage(0x3590);
- return true;
+ if (!CHECK_FLAG(0xdb9d, 1))
+ retVal = false;
+ else
+ displayMessage(0x3590);
+ break;
case 0x7af0:
- if (!processCallback(0x70e0))
- return true;
- return false;
+ if (processCallback(0x70e0))
+ retVal = false;
+ break;
case 0x8117:
- Dialog::show(scene, 0x0a41, 0, 529, 0xd1, 0xd9, 0, 1);
+ dialog->show(9, scene, 0, 529, 0xd1, 0xd9, 0, 1);
playSound(5, 2);
playSound(5, 44);
playAnimation(642, 0, true);
playActorAnimation(641, true);
waitAnimation();
- Dialog::show(scene, 0x0aff, 0, 529, 0xd1, 0xd9, 0, 1);
+ dialog->show(10, scene, 0, 529, 0xd1, 0xd9, 0, 1);
wait(170);
- Dialog::show(scene, 0x0ba0, 0, 529, 0xd1, 0xd9, 0, 1);
+ dialog->show(11, scene, 0, 529, 0xd1, 0xd9, 0, 1);
moveRel(0, 1, 0);
wait(100);
- Dialog::show(scene, 0x0c10, 0, 529, 0xd1, 0xd9, 0, 1);
+ dialog->show(12, scene, 0, 529, 0xd1, 0xd9, 0, 1);
inventory->remove(50);
processCallback(0x9d45);
- return true;
+ break;
case 0x8174:
setOns(0, 0);
@@ -2336,7 +2338,7 @@ bool TeenAgentEngine::processCallback(uint16 addr) {
setOns(1, 15);
disableObject(3);
enableObject(9);
- return true;
+ break;
case 0x81c2:
playSound(56, 11);
@@ -2355,10 +2357,10 @@ bool TeenAgentEngine::processCallback(uint16 addr) {
wait(50);
displayMessage(0x367f);
inventory->remove(34);
- SET_FLAG(0xDBA1, 1);
- return true;
+ SET_FLAG(0xdba1, 1);
+ break;
- case 0x823d: //grappling hook on the wall
+ case 0x823d: // grappling hook on the wall
playSound(5, 3);
for (byte i = 16; i <= 28; i += 2)
playSound(65, i);
@@ -2383,11 +2385,10 @@ bool TeenAgentEngine::processCallback(uint16 addr) {
inventory->remove(43);
processCallback(0x9d45);
- return true;
-
+ break;
- case 0x8312: //hedgehog + plastic apple
- Dialog::showMark(scene, 0x3000);
+ case 0x8312: // hedgehog + plastic apple
+ dialog->showMark(76, scene);
setLan(1, 0);
playSound(5, 24);
playSound(26, 32);
@@ -2408,7 +2409,7 @@ bool TeenAgentEngine::processCallback(uint16 addr) {
displayMessage(0x363f);
inventory->remove(27);
inventory->add(28);
- return true;
+ break;
case 0x839f:
inventory->remove(32);
@@ -2437,10 +2438,10 @@ bool TeenAgentEngine::processCallback(uint16 addr) {
playSound(55, 18);
playAnimation(581, 1);
disableObject(2);
- SET_FLAG(0xDB9F, 1);
- return true;
+ SET_FLAG(0xdb9f, 1);
+ break;
- case 0x84c7: //using paddle on boat
+ case 0x84c7: // using paddle on boat
playSound(20, 9);
playActorAnimation(530);
loadScene(16, 236, 95, 1);
@@ -2451,12 +2452,12 @@ bool TeenAgentEngine::processCallback(uint16 addr) {
playActorAnimation(533);
setOns(0, 9);
moveTo(236, 95, 1, true);
- return true;
+ break;
- case 0x8538://Sharpen sickle on well
+ case 0x8538: // Sharpen sickle on well
moveTo(236, 190, 0);
setOns(2, 0);
- //TODO: Remove handle sprite
+ // TODO: Remove handle sprite
playSound(5, 4);
playSound(14, 14);
playSound(14, 33);
@@ -2466,21 +2467,20 @@ bool TeenAgentEngine::processCallback(uint16 addr) {
moveTo(236, 179, 3);
inventory->remove(0x2c);
inventory->add(0x2e);
- return true;
+ break;
case 0x85eb:
- if (CHECK_FLAG(0xDBB0, 1)) {
+ if (CHECK_FLAG(0xdbb0, 1)) {
enableObject(6);
playSound(25, 10);
playSound(25, 14);
playSound(25, 18);
playActorAnimation(559);
setOns(1, 23);
- SET_FLAG(0xDBB0, 2);
+ SET_FLAG(0xdbb0, 2);
} else
displayMessage(0x3d86);
-
- return true;
+ break;
case 0x863d:
playSound(12, 4);
@@ -2489,7 +2489,7 @@ bool TeenAgentEngine::processCallback(uint16 addr) {
playActorAnimation(554);
inventory->remove(19);
inventory->add(22);
- return true;
+ break;
case 0x8665:
playSound(5, 3);
@@ -2498,18 +2498,18 @@ bool TeenAgentEngine::processCallback(uint16 addr) {
playActorAnimation(567);
inventory->remove(12);
inventory->add(33);
- return true;
+ break;
case 0x862c:
- displayMessage(CHECK_FLAG(0xDBB0, 1) ? 0x4882 : 0x3457);
- return true;
+ displayMessage(CHECK_FLAG(0xdbb0, 1) ? 0x4882 : 0x3457);
+ break;
- case 0x86a9: //correcting height of the pole with spanner
- if (CHECK_FLAG(0xDB92, 1)) {
+ case 0x86a9: // correcting height of the pole with spanner
+ if (CHECK_FLAG(0xdb92, 1)) {
displayMessage(0x3d40);
} else {
- SET_FLAG(0xDB92, 1);
- Dialog::show(scene, 0x0fcd, 0, 502, 0xd0, 0xe5, 0, 1);
+ SET_FLAG(0xdb92, 1);
+ dialog->show(17, scene, 0, 502, 0xd0, 0xe5, 0, 1);
waitLanAnimationFrame(1, 7);
playSound(5, 16);
playSound(1, 25);
@@ -2586,93 +2586,97 @@ bool TeenAgentEngine::processCallback(uint16 addr) {
obj->actor_rect.save();
}
}
- return true;
+ break;
- case 0x88c9: //give flower to old lady
- if (CHECK_FLAG(0xDB9A, 1))
- return processCallback(0x890b);
-
- inventory->remove(10);
- SET_FLAG(0xDB9A, 1);
- processCallback(0x88DE);
- return true;
+ case 0x88c9: // give flower to old lady
+ if (CHECK_FLAG(0xdb9a, 1))
+ retVal = processCallback(0x890b);
+ else {
+ inventory->remove(10);
+ SET_FLAG(0xdb9a, 1);
+ processCallback(0x88de);
+ }
+ break;
case 0x88de:
playSound(5, 2);
- Dialog::show(scene, 0x1B5F, 0, 523, 0xd1, 0xe5, 0, 1);
+ dialog->show(37, scene, 0, 523, 0xd1, 0xe5, 0, 1);
playActorAnimation(537, true);
playAnimation(538, 0, true);
waitAnimation();
wait(100);
- Dialog::show(scene, 0x1BE0, 0, 523, 0xd1, 0xe5, 0, 1);
- return true;
+ dialog->show(38, scene, 0, 523, 0xd1, 0xe5, 0, 1);
+ break;
case 0x890b:
- Dialog::pop(scene, 0xDAF0, 0, 523, 0xd1, 0xe5, 0, 1);
- return true;
-
- case 0x8918://give flower to old lady
- if (CHECK_FLAG(0xDB9A, 1))
- return processCallback(0x890B);
+ dialog->pop(scene, 0xdaf0, 0, 523, 0xd1, 0xe5, 0, 1);
+ break;
- inventory->remove(11);
- SET_FLAG(0xDB9A, 1);
- processCallback(0x88DE);
- return true;
+ case 0x8918: // give flower to old lady
+ if (CHECK_FLAG(0xdb9a, 1))
+ retVal = processCallback(0x890b);
+ else {
+ inventory->remove(11);
+ SET_FLAG(0xdb9a, 1);
+ processCallback(0x88de);
+ }
+ break;
case 0x892d:
- if (CHECK_FLAG(0xDB9B, 1))
- return processCallback(0x89aa);
-
- processCallback(0x8942);
- inventory->remove(10);
- SET_FLAG(0xDB9B, 1);
- return true;
+ if (CHECK_FLAG(0xdb9b, 1))
+ retVal = processCallback(0x89aa);
+ else {
+ processCallback(0x8942);
+ inventory->remove(10);
+ SET_FLAG(0xdb9b, 1);
+ }
+ break;
case 0x8942:
- Dialog::show(scene, 0x2293, 0, 524, 0xd1, 0xe5, 0, 2);
+ dialog->show(53, scene, 0, 524, 0xd1, 0xe5, 0, 2);
playSound(5, 10);
playActorAnimation(540, true);
playAnimation(539, 1, true);
waitAnimation();
wait(100);
- Dialog::show(scene, 0x24b1, 0, 524, 0xd1, 0xe5, 0, 2);
+ dialog->show(54, scene, 0, 524, 0xd1, 0xe5, 0, 2);
wait(50);
- Dialog::show(scene, 0x24d7, 0, 524, 0xd1, 0xe5, 0, 2);
- Dialog::show(scene, 0x2514, 0, 524, 0xd1, 0xe5, 0, 2);
+ dialog->show(55, scene, 0, 524, 0xd1, 0xe5, 0, 2);
+ dialog->show(56, scene, 0, 524, 0xd1, 0xe5, 0, 2);
wait(50);
moveRel(0, 1, 0);
- Dialog::show(scene, 0x2570, 0, 524, 0xd1, 0xe5, 0, 2);
+ dialog->show(57, scene, 0, 524, 0xd1, 0xe5, 0, 2);
moveRel(0, -1, 0);
wait(50);
- return true;
+ break;
case 0x89aa:
- Dialog::pop(scene, 0xdb02, 0, 524, 0xd1, 0xe5, 0, 2);
- return true;
+ dialog->pop(scene, 0xdb02, 0, 524, 0xd1, 0xe5, 0, 2);
+ break;
case 0x89b7:
- if (CHECK_FLAG(0xDB9B, 1))
- return processCallback(0x89aa);
-
- processCallback(0x8942);
- inventory->remove(11);
- SET_FLAG(0xDB9B, 1);
- return true;
+ if (CHECK_FLAG(0xdb9b, 1))
+ retVal = processCallback(0x89aa);
+ else {
+ processCallback(0x8942);
+ inventory->remove(11);
+ SET_FLAG(0xdb9b, 1);
+ }
+ break;
case 0x89cc:
inventory->remove(23);
playSound(5, 6);
- Dialog::show(scene, 0x2634, 0, 524, 0xd1, 0xe5, 0, 2);
+ dialog->show(60, scene, 0, 524, 0xd1, 0xe5, 0, 2);
playActorAnimation(555, true);
playAnimation(556, 1, true);
waitAnimation();
playActorAnimation(557, true);
playAnimation(558, 1, true);
waitAnimation();
- Dialog::show(scene, 0x2971, 0, 524, 0xd1, 0xe5, 0, 2);
+ dialog->show(62, scene, 0, 524, 0xd1, 0xe5, 0, 2);
inventory->add(24);
- return true;
+ break;
case 0x8a22:
playSound(45, 16);
@@ -2680,21 +2684,21 @@ bool TeenAgentEngine::processCallback(uint16 addr) {
inventory->remove(26);
inventory->add(27);
wait(50);
- Dialog::show(scene, 0x1ecd, 0, 523, 0xd1, 0xe5, 0, 1);
- Dialog::show(scene, 0x1f09, 0, 523, 0xd1, 0xe5, 0, 1);
- SET_FLAG(0xDBB1, 1);
- return true;
-
- case 0x8a6f: //banknote + ann
- if (CHECK_FLAG(0xDBB5, 1)) {
- Dialog::show(scene, 0x2992, 0, 524, 0xd1, 0xe5, 0, 2);
+ dialog->show(44, scene, 0, 523, 0xd1, 0xe5, 0, 1);
+ dialog->show(45, scene, 0, 523, 0xd1, 0xe5, 0, 1);
+ SET_FLAG(0xdbb1, 1);
+ break;
+
+ case 0x8a6f: // banknote + ann
+ if (CHECK_FLAG(0xdbb5, 1)) {
+ dialog->show(63, scene, 0, 524, 0xd1, 0xe5, 0, 2);
playSound(5, 3);
playSound(5, 20);
playAnimation(671, 1, true);
playActorAnimation(670, true);
waitAnimation();
//playAnimation(672, 1);
- Dialog::show(scene, 0x2a00, 524, 672, 0xd1, 0xe5, 0, 2);
+ dialog->show(64, scene, 524, 672, 0xd1, 0xe5, 0, 2);
//playAnimation(672, 1);
playSound(83, 12);
@@ -2715,9 +2719,9 @@ bool TeenAgentEngine::processCallback(uint16 addr) {
inventory->add(29);
} else
displayMessage(0x4a29);
- return true;
+ break;
- case 0x8b82: //use fan on laundry
+ case 0x8b82: // use fan on laundry
setOns(0, 0);
playSound(5, 3);
playSound(5, 6);
@@ -2730,10 +2734,10 @@ bool TeenAgentEngine::processCallback(uint16 addr) {
playSound(5, 3);
playActorAnimation(603);
setOns(0, 27);
- SET_FLAG(0xDBA5, 1);
- return true;
+ SET_FLAG(0xdba5, 1);
+ break;
- case 0x8bfc://Give bone to dog
+ case 0x8bfc: // Give bone to dog
displayMessage(0x3c31);
playSound(5, 3);
playSound(26, 13);
@@ -2745,7 +2749,7 @@ bool TeenAgentEngine::processCallback(uint16 addr) {
playAnimation(659, 0);
inventory->remove(36);
- SET_FLAG(0xDBAD, 1);
+ SET_FLAG(0xdbad, 1);
{
Object *o = scene->getObject(7);
o->actor_rect.left = o->actor_rect.right = 297;
@@ -2768,9 +2772,9 @@ bool TeenAgentEngine::processCallback(uint16 addr) {
}
wait(100);
displayMessage(0x3c3d);
- return true;
+ break;
- case 0x8c6e://Use car jack on rock
+ case 0x8c6e: // Use car jack on rock
playSound(5, 3);
playSound(26, 13);
playSound(24, 22);
@@ -2783,9 +2787,9 @@ bool TeenAgentEngine::processCallback(uint16 addr) {
setOns(0, 28);
enableObject(1);
inventory->remove(35);
- return true;
+ break;
- case 0x8cc8://Cut bush with sickle
+ case 0x8cc8: // Cut bush with sickle
playSound(5, 3);
playActorAnimation(644);
setOns(1, 45);
@@ -2804,9 +2808,9 @@ bool TeenAgentEngine::processCallback(uint16 addr) {
disableObject(2);
scene->getObject(3)->actor_rect.right = 156;
scene->getObject(3)->save();
- return true;
+ break;
- case 0x8d79: //mouse falls back from the hole (cave)
+ case 0x8d79: // mouse falls back from the hole (cave)
if (CHECK_FLAG(0, 1)) {
inventory->add(48);
playSound(24, 26);
@@ -2831,7 +2835,7 @@ bool TeenAgentEngine::processCallback(uint16 addr) {
SET_FLAG(0xdba9, 0);
}
SET_FLAG(0, 0);
- return true;
+ break;
case 0x8d57:
if (CHECK_FLAG(0, 0)) {
@@ -2859,14 +2863,14 @@ bool TeenAgentEngine::processCallback(uint16 addr) {
setOns(0, 42);
enableObject(6);
disableObject(5);
- SET_FLAG(0xDBAB, 1);
+ SET_FLAG(0xdbab, 1);
SET_FLAG(0, 0);
setTimerCallback(0, 0);
}
- return true;
+ break;
case 0x8f1d:
- Dialog::showMark(scene, 0x2dd6);
+ dialog->showMark(72, scene);
for (uint i = 16; i <= 30; i += 2)
playSound(56, i);
playSound(2, 64);
@@ -2881,8 +2885,8 @@ bool TeenAgentEngine::processCallback(uint16 addr) {
disableObject(2);
disableObject(3);
inventory->remove(2);
- SET_FLAG(0xDB96, 1);
- return true;
+ SET_FLAG(0xdb96, 1);
+ break;
case 0x8fc8:
displayMessage(0x3b2f);
@@ -2894,24 +2898,24 @@ bool TeenAgentEngine::processCallback(uint16 addr) {
playSound(41, 10);
playSound(41, 47);
playSound(55, 52);
- if (CHECK_FLAG(0xDBA8, 1)) {
+ if (CHECK_FLAG(0xdba8, 1)) {
setLan(2, 0);
playActorAnimation(628, true);
playAnimation(634, 1, true);
waitAnimation();
disableObject(4);
displayMessage(0x3b6c);
- SET_FLAG(0xDBA9, 1);
+ SET_FLAG(0xdba9, 1);
} else {
playActorAnimation(628, true);
playAnimation(630, 1, true);
waitAnimation();
displayMessage(0x3b59);
}
- return true;
+ break;
- case 0x9054: //mouse hole
- if (CHECK_FLAG(0xDBAB, 1)) {
+ case 0x9054: // mouse hole
+ if (CHECK_FLAG(0xdbab, 1)) {
displayMessage(0x3c0b);
} else {
playSound(5, 11);
@@ -2920,50 +2924,48 @@ bool TeenAgentEngine::processCallback(uint16 addr) {
setOns(5, 40);
moveTo(239, 139, 0, true);
playActorAnimation(633);
- SET_FLAG(0xDBA8, 1);
+ SET_FLAG(0xdba8, 1);
inventory->remove(47);
- if (!CHECK_FLAG(0xDBAA, 1)) {
- SET_FLAG(0xDBAA, 1);
+ if (!CHECK_FLAG(0xdbaa, 1)) {
+ SET_FLAG(0xdbaa, 1);
displayMessage(0x3b8b);
}
}
- return true;
+ break;
case 0x933d:
- if (!processCallback(0x70e0))
- return true;
-
- if (CHECK_FLAG(0xdbcd, 1)) {
- displayMessage(0x4f3d);
- return true;
+ if (processCallback(0x70e0)) {
+ if (CHECK_FLAG(0xdbcd, 1))
+ displayMessage(0x4f3d);
+ else {
+ setOns(1, 0);
+ playSound(5, 3);
+ playSound(5, 33);
+ playSound(24, 13);
+ playSound(24, 19);
+ playSound(24, 23);
+ playSound(24, 26);
+ playSound(24, 29);
+ playSound(23, 21);
+ playSound(74, 25);
+ playActorAnimation(716);
+ setOns(1, 66);
+ SET_FLAG(0xdbcd, 1);
+ }
}
+ break;
- setOns(1, 0);
- playSound(5, 3);
- playSound(5, 33);
- playSound(24, 13);
- playSound(24, 19);
- playSound(24, 23);
- playSound(24, 26);
- playSound(24, 29);
- playSound(23, 21);
- playSound(74, 25);
- playActorAnimation(716);
- setOns(1, 66);
- SET_FLAG(0xDBCD, 1);
- return true;
-
- case 0x93af: //sheet + hot plate
- if (!processCallback(0x70e0))
- return true;
- playSound(5, 3);
- playSound(86, 11);
- playActorAnimation(720);
- inventory->add(68);
- inventory->remove(55);
- return true;
+ case 0x93af: // sheet + hot plate
+ if (processCallback(0x70e0)) {
+ playSound(5, 3);
+ playSound(86, 11);
+ playActorAnimation(720);
+ inventory->add(68);
+ inventory->remove(55);
+ }
+ break;
- case 0x93d5: //burning sheet + plate
+ case 0x93d5: // burning sheet + plate
setOns(4, 0);
playSound(87, 7);
playActorAnimation(722);
@@ -2978,17 +2980,17 @@ bool TeenAgentEngine::processCallback(uint16 addr) {
setOns(4, 68);
displayMessage(0x503e);
inventory->remove(68);
- SET_FLAG(0xDBD0, 1);
- return true;
+ SET_FLAG(0xdbd0, 1);
+ break;
- case 0x98fa://Right click to open toolbox
+ case 0x98fa: // Right click to open toolbox
inventory->remove(3);
inventory->add(4);
inventory->add(35);
inventory->activate(false);
inventory->resetSelectedObject();
displayMessage(0x3468);
- return true;
+ break;
case 0x9910:
inventory->remove(4);
@@ -2996,24 +2998,22 @@ bool TeenAgentEngine::processCallback(uint16 addr) {
inventory->activate(false);
inventory->resetSelectedObject();
displayMessage(0x3490);
- return true;
-
+ break;
- //very last part of the game:
- case 0x671d:
+ case 0x671d: // very last part of the game
moveTo(153, 163, 4);
playActorAnimation(973);
- if (CHECK_FLAG(0xDBC1, 0)) {
- SET_FLAG(0xDBC1, _rnd.getRandomNumber(5) + 1);
+ if (CHECK_FLAG(0xdbc1, 0)) {
+ SET_FLAG(0xdbc1, _rnd.getRandomNumber(5) + 1);
}
loadScene(30, 18, 159, 2);
- return true;
+ break;
case 0x67a6:
loadScene(29, 149, 163, 1);
playActorAnimation(974);
moveTo(160, 188, 0);
- return true;
+ break;
case 0x6805:
processCallback(0x6849);
@@ -3025,151 +3025,154 @@ bool TeenAgentEngine::processCallback(uint16 addr) {
displayMessage(0x4cc7);
inventory->add(54);
disableObject(4);
- return true;
+ break;
- case 0x6849: {
- Common::Point p = scene->getPosition();
- if (p.x == 208 && p.y == 151) {
- moveRel(0, 0, 2);
- } else
- moveTo(208, 151, 1);
- }
- return true;
+ case 0x6849:
+ {
+ Common::Point p = scene->getPosition();
+ if (p.x == 208 && p.y == 151)
+ moveRel(0, 0, 2);
+ else
+ moveTo(208, 151, 1);
+ }
+ break;
- case 0x687a: //using the book
- if (CHECK_FLAG(0xDBC2, 1)) {
+ case 0x687a: // using the book
+ if (CHECK_FLAG(0xdbc2, 1)) {
displayMessage(0x4ca0);
} else {
playSound(49, 5);
playSound(49, 17);
playActorAnimation(691);
if (!processCallback(0x68e6)) {
- if (!CHECK_FLAG(0xDBC0, 1)) {
+ if (!CHECK_FLAG(0xdbc0, 1)) {
displayMessage(0x4c61);
- SET_FLAG(0xDBC0, 1);
+ SET_FLAG(0xdbc0, 1);
}
} else {
- playSound(15, 8); //secret compartment
+ playSound(15, 8); // secret compartment
playAnimation(692, 0);
setOns(6, 59);
enableObject(4);
displayMessage(0x4c84);
- SET_FLAG(0xDBC2, 1);
+ SET_FLAG(0xdbc2, 1);
}
}
- return true;
+ break;
- case 0x68e6: { //checking drawers
- uint16 v = GET_FLAG(0xDBC1) - 1;
- uint bx = 0xDBB7;
- if (GET_FLAG(bx + v) != 1)
- return false;
-
- uint16 sum = 0;
- for (uint i = 0; i < 6; ++i) {
- sum += GET_FLAG(bx + i);
+ case 0x68e6: // checking drawers
+ {
+ uint16 v = GET_FLAG(0xdbc1) - 1;
+ if (GET_FLAG(0xdbb7 + v) != 1)
+ retVal = false;
+ else {
+ uint16 sum = 0;
+ for (uint i = 0; i < 6; ++i)
+ sum += GET_FLAG(0xdbb7 + i);
+ if (sum != 1)
+ retVal = false;
+ }
}
- return sum == 1;
- }
+ break;
case 0x6918:
- if (inventory->has(55)) {
+ if (inventory->has(55))
displayMessage(0x4cd9);
- return true;
- }
- if (!CHECK_FLAG(0xDBC3, 1)) {
- playActorAnimation(695);
- Dialog::showMark(scene, 0x386a);
- SET_FLAG(0xDBC3, 1);
- }
+ else {
+ if (!CHECK_FLAG(0xdbc3, 1)) {
+ playActorAnimation(695);
+ dialog->showMark(91, scene);
+ SET_FLAG(0xdbc3, 1);
+ }
- playSound(5, 11);
- playActorAnimation(696);
- inventory->add(55);
- return true;
+ playSound(5, 11);
+ playActorAnimation(696);
+ inventory->add(55);
+ }
+ break;
case 0x6962:
- if (CHECK_FLAG(0xDBB7, 1)) {
+ if (CHECK_FLAG(0xdbb7, 1)) {
setOns(0, 0);
playSound(67, 4);
playActorAnimation(678);
- SET_FLAG(0xDBB7, 0);
- } else if (CHECK_FLAG(0xDBB8, 1)) {
+ SET_FLAG(0xdbb7, 0);
+ } else if (CHECK_FLAG(0xdbb8, 1)) {
processCallback(0x6b86);
} else {
playSound(66, 4);
playActorAnimation(677);
setOns(0, 53);
- SET_FLAG(0xDBB7, 1);
+ SET_FLAG(0xdbb7, 1);
}
- return true;
+ break;
case 0x69b8:
- if (CHECK_FLAG(0xDBB8, 1)) {
+ if (CHECK_FLAG(0xdbb8, 1)) {
setOns(1, 0);
playSound(67, 4);
playActorAnimation(680);
- SET_FLAG(0xDBB8, 0);
- } else if (CHECK_FLAG(0xDBB7, 1)) {
+ SET_FLAG(0xdbb8, 0);
+ } else if (CHECK_FLAG(0xdbb7, 1)) {
processCallback(0x6b86);
- } else if (CHECK_FLAG(0xDBB9, 1)) {
+ } else if (CHECK_FLAG(0xdbb9, 1)) {
processCallback(0x6b86);
} else {
playSound(66, 5);
playActorAnimation(679);
setOns(1, 54);
- SET_FLAG(0xDBB8, 1);
+ SET_FLAG(0xdbb8, 1);
}
- return true;
+ break;
case 0x6a1b:
- if (CHECK_FLAG(0xDBB9, 1)) {
+ if (CHECK_FLAG(0xdbb9, 1)) {
setOns(2, 0);
playSound(67, 5);
playActorAnimation(682);
- SET_FLAG(0xDBB9, 0);
- } else if (CHECK_FLAG(0xDBB8, 1)) {
+ SET_FLAG(0xdbb9, 0);
+ } else if (CHECK_FLAG(0xdbb8, 1)) {
processCallback(0x6b86);
} else {
playSound(67, 5);
playActorAnimation(681);
setOns(2, 55);
- SET_FLAG(0xDBB9, 1);
+ SET_FLAG(0xdbb9, 1);
}
- return true;
+ break;
case 0x6a73:
- if (CHECK_FLAG(0xDBBA, 1)) {
+ if (CHECK_FLAG(0xdbba, 1)) {
setOns(3, 0);
playSound(67, 4);
playActorAnimation(684);
- SET_FLAG(0xDBBA, 0);
- } else if (!CHECK_FLAG(0xDBBB, 1)) {
+ SET_FLAG(0xdbba, 0);
+ } else if (!CHECK_FLAG(0xdbbb, 1)) {
playSound(66, 4);
playActorAnimation(683);
setOns(3, 56);
- SET_FLAG(0xDBBA, 1);
+ SET_FLAG(0xdbba, 1);
} else
processCallback(0x6b86);
- return true;
+ break;
case 0x6acb:
- if (CHECK_FLAG(0xDBBB, 1)) {
+ if (CHECK_FLAG(0xdbbb, 1)) {
setOns(4, 0);
playSound(67, 4);
playActorAnimation(686);
- SET_FLAG(0xDBBB, 0);
- } else if (CHECK_FLAG(0xDBBA, 1)) {
+ SET_FLAG(0xdbbb, 0);
+ } else if (CHECK_FLAG(0xdbba, 1)) {
processCallback(0x6b86);
- } else if (CHECK_FLAG(0xDBBC, 1)) {
+ } else if (CHECK_FLAG(0xdbbc, 1)) {
processCallback(0x6b86);
} else {
playSound(66, 5);
playActorAnimation(685);
setOns(4, 57);
- SET_FLAG(0xDBBB, 1);
+ SET_FLAG(0xdbbb, 1);
}
- return true;
+ break;
case 0x6b2e:
if (CHECK_FLAG(0xdbbc, 1)) {
@@ -3183,59 +3186,58 @@ bool TeenAgentEngine::processCallback(uint16 addr) {
playSound(66, 6);
playActorAnimation(687);
setOns(5, 58);
- SET_FLAG(0xDBBC, 1);
+ SET_FLAG(0xdbbc, 1);
}
- return true;
-
+ break;
case 0x6b86:
- if (CHECK_FLAG(0xDBBD, 1)) {
+ if (CHECK_FLAG(0xdbbd, 1))
displayMessage(0x4b39);
- } else {
+ else {
displayMessage(0x4acd);
displayMessage(0x4b0d);
- SET_FLAG(0xDBBD, 1);
+ SET_FLAG(0xdbbd, 1);
}
- return true;
+ break;
- case 0x6be1: //handle to the bathroom
- if (CHECK_FLAG(0xDBD9, 1)) {
- displayMessage(0x5326); //i'd better catch johnny
- } else {
+ case 0x6be1: // handle to the bathroom
+ if (CHECK_FLAG(0xdbd9, 1))
+ displayMessage(0x5326); // i'd better catch johnny
+ else {
playSound(88, 4);
playActorAnimation(808);
loadScene(36, 41, 195, 2);
}
- return true;
+ break;
case 0x6bad:
playSound(80, 4);
playActorAnimation(971);
loadScene(32, 139, 199, 1);
- return true;
+ break;
case 0x6c45:
playSound(89, 6);
- playActorAnimation(CHECK_FLAG(0xDBEF, 1) ? 985 : 806);
+ playActorAnimation(CHECK_FLAG(0xdbef, 1) ? 985 : 806);
loadScene(34, 40, 133, 2);
- return true;
+ break;
case 0x6c83:
waitLanAnimationFrame(1, 1);
- Dialog::pop(scene, 0xdb2e, 0, 727, 0xd1, 0xef, 0, 1);
+ dialog->pop(scene, 0xdb2e, 0, 727, 0xd1, 0xef, 0, 1);
scene->getObject(1)->setName((const char *)res->dseg.ptr(0xaa94));
- SET_FLAG(0xDBD1, 1);
- return true;
+ SET_FLAG(0xdbd1, 1);
+ break;
- case 0x6c9d: //getting jar
+ case 0x6c9d: // getting jar
setOns(0, 71);
playSound(32, 5);
playActorAnimation(732);
disableObject(2);
inventory->add(72);
- return true;
+ break;
- case 0x6cc4: //secret diary
+ case 0x6cc4: // secret diary
playActorAnimation(754);
hideActor();
@@ -3245,49 +3247,47 @@ bool TeenAgentEngine::processCallback(uint16 addr) {
loadScene(11, scene->getPosition());
playAnimation(750, 2);
- Dialog::show(scene, 0x4f50, 751, 529, 0xe5, 0xd9, 2, 1);
+ dialog->show(117, scene, 751, 529, 0xe5, 0xd9, 2, 1);
playAnimation(752, 0, true);
playAnimation(753, 1, true);
waitAnimation();
- Dialog::show(scene, 0x5168, 529, 751, 0xd9, 0xe5, 1, 2);
+ dialog->show(118, scene, 529, 751, 0xd9, 0xe5, 1, 2);
loadScene(30, scene->getPosition());
- Dialog::show(scene, 0x449e, 733, 734, 0xe5, 0xd0, 2, 3);
+ dialog->show(108, scene, 733, 734, 0xe5, 0xd0, 2, 3);
playSound(75, 13);
playSound(32, 22);
playAnimation(735, 1, true);
playAnimation(736, 2, true);
waitAnimation();
- Dialog::show(scene, 0x46cf, 737, 738, 0xd0, 0xe5, 3, 2);
-
+ dialog->show(109, scene, 737, 738, 0xd0, 0xe5, 3, 2);
playSound(32, 1);
playAnimation(739, 1, true);
playAnimation(740, 2, true);
waitAnimation();
- Dialog::show(scene, 0x4772, 733, 734, 0xe5, 0xd0, 2, 3);
+ dialog->show(110, scene, 733, 734, 0xe5, 0xd0, 2, 3);
playAnimation(742, 1, true);
playAnimation(741, 2, true);
waitAnimation();
- Dialog::show(scene, 0x481c, 743, 733, 0xd0, 0xe5, 3, 2); //where's my wallet??
+ dialog->show(111, scene, 743, 733, 0xd0, 0xe5, 3, 2);
playAnimation(744, 1, true);
playAnimation(745, 2, true);
waitAnimation();
- Dialog::show(scene, 0x4873, 734, 733, 0xd0, 0xe5, 3, 2);
+ dialog->show(112, scene, 734, 733, 0xd0, 0xe5, 3, 2);
playAnimation(746, 1, true);
playAnimation(747, 2, true);
waitAnimation();
-
- Dialog::show(scene, 0x4da5, 734, 734, 0xd0, 0xd0, 3, 3);
- Dialog::show(scene, 0x4eb9, 748, 748, 0xd0, 0xd0, 3, 3);
- Dialog::show(scene, 0x4f15, 749, 749, 0xd0, 0xd0, 3, 3);
- Dialog::show(scene, 0x4f2f, 748, 748, 0xd0, 0xd0, 3, 3);
+ dialog->show(113, scene, 734, 734, 0xd0, 0xd0, 3, 3);
+ dialog->show(114, scene, 748, 748, 0xd0, 0xd0, 3, 3);
+ dialog->show(115, scene, 749, 749, 0xd0, 0xd0, 3, 3);
+ dialog->show(116, scene, 748, 748, 0xd0, 0xd0, 3, 3);
playMusic(10);
loadScene(32, scene->getPosition());
@@ -3296,35 +3296,34 @@ bool TeenAgentEngine::processCallback(uint16 addr) {
playActorAnimation(755);
moveRel(0, 0, 3);
- Dialog::show(scene, 0x51bf, 0, 0, 0xd1, 0xd1, 0, 0);
+ dialog->show(119, scene, 0, 0, 0xd1, 0xd1, 0, 0);
hideActor();
loadScene(31, scene->getPosition());
- Dialog::show(scene, 0x539f, 763, 764, 0xd9, 0xd0, 1, 2);
+ dialog->show(123, scene, 763, 764, 0xd9, 0xd0, 1, 2);
loadScene(32, scene->getPosition());
showActor();
- Dialog::show(scene, 0x52c3, 0, 0, 0xd1, 0xd1, 0, 0); //i have to hide somewhere
+ dialog->show(120, scene, 0, 0, 0xd1, 0xd1, 0, 0);
disableObject(3);
enableObject(7);
- SET_FLAG(0xDBD5, 1);
- return true;
+ SET_FLAG(0xdbd5, 1);
+ break;
case 0x6f20:
- if (CHECK_FLAG(0xDBD5, 1)) {
+ if (CHECK_FLAG(0xdbd5, 1))
displayMessage(0x51a7);
- } else {
+ else
rejectMessage();
- }
- return true;
+ break;
- case 0x6f75: //hiding in left corner
+ case 0x6f75: // hiding in left corner
moveRel(0, 0, 3);
playActorAnimation(756);
hideActor();
playAnimation(758, 1);
- Dialog::show(scene, 0x52e6, 759, 759, 0xd0, 0xd0, 2, 2); //I have to buy...
+ dialog->show(121, scene, 759, 759, 0xd0, 0xd0, 2, 2);
playSound(40, 5);
playSound(52, 13);
@@ -3340,9 +3339,9 @@ bool TeenAgentEngine::processCallback(uint16 addr) {
playSound(58, 12);
playSound(58, 14);
playAnimation(765, 1);
- Dialog::show(scene, 0x5443, 766, 766, 0xd9, 0xd9, 1, 1);
+ dialog->show(124, scene, 766, 766, 0xd9, 0xd9, 1, 1);
loadScene(32, scene->getPosition());
- Dialog::show(scene, 0x5358, 761, 761, 0xd0, 0xd0, 2, 2);
+ dialog->show(122, scene, 761, 761, 0xd0, 0xd0, 2, 2);
playAnimation(762, 1);
setOns(2, 0);
showActor();
@@ -3352,25 +3351,24 @@ bool TeenAgentEngine::processCallback(uint16 addr) {
enableObject(8);
disableObject(7);
- SET_FLAG(0xDBD5, 0);
- return true;
+ SET_FLAG(0xdbd5, 0);
+ break;
case 0x6f4d:
- if (CHECK_FLAG(0xDBD5, 1)) {
+ if (CHECK_FLAG(0xdbd5, 1))
displayMessage(0x51bb);
- } else {
+ else
loadScene(31, 139, 172, 3);
- }
- return true;
+ break;
case 0x6f32:
- if (CHECK_FLAG(0xDBD5, 1)) {
+ if (CHECK_FLAG(0xdbd5, 1)) {
displayMessage(0x51a7);
} else {
playActorAnimation(977);
displayMessage(0x5511);
}
- return true;
+ break;
case 0x7096:
playSound(32, 5);
@@ -3378,155 +3376,157 @@ bool TeenAgentEngine::processCallback(uint16 addr) {
setOns(1, 0);
inventory->add(73);
disableObject(8);
- return true;
+ break;
case 0x7291:
playSound(89, 3);
playActorAnimation(975);
loadScene(31, 298, 177, 4);
- return true;
+ break;
case 0x72c2:
- if (CHECK_FLAG(0xDBD6, 2)) {
+ if (CHECK_FLAG(0xdbd6, 2)) {
displayMessage(0x522c);
} else {
playSound(79, 6);
playSound(84, 9);
playActorAnimation(801);
wait(50);
- if (CHECK_FLAG(0xDBD6, 1)) {
+ if (CHECK_FLAG(0xdbd6, 1)) {
displayMessage(0x538d);
- SET_FLAG(0xDBD6, 2);
+ SET_FLAG(0xdbd6, 2);
} else
displayMessage(0x5372);
}
- return true;
+ break;
case 0x7309:
playSound(66, 5);
playSound(67, 11);
playActorAnimation(976);
displayMessage(0x5955);
- return true;
+ break;
case 0x77d5:
- if (CHECK_FLAG(0xdbd7, 1) && !CHECK_FLAG(0xdbd8, 1)) { //disallow exiting through the first door until switch turned on, not present in original game
+ if (CHECK_FLAG(0xdbd7, 1) && !CHECK_FLAG(0xdbd8, 1)) { // disallow exiting through the first door until switch turned on, not present in original game
displayMessage(0x52cb);
- return true;
+ } else {
+ playSound(89, 6);
+ playActorAnimation(978);
+ loadScene(31, 298, 177, 4);
}
- playSound(89, 6);
- playActorAnimation(978);
- loadScene(31, 298, 177, 4);
- return true;
+ break;
case 0x79e4:
processCallback(0x6849);
- return false;
+ retVal = false;
+ break;
- case 0x79eb: //color of the book
- displayMessage(res->dseg.get_word(0x5f3c + GET_FLAG(0xDBC1) * 2 - 2));
- return true;
+ case 0x79eb: // color of the book
+ displayMessage(res->dseg.get_word(0x5f3c + GET_FLAG(0xdbc1) * 2 - 2));
+ break;
case 0x79fd:
- if (CHECK_FLAG(0xDBB7, 1)) {
+ if (CHECK_FLAG(0xdbb7, 1))
displayMessage(0x4b6c);
- return true;
- } else
- return false;
+ else
+ retVal = false;
+ break;
case 0x7a0f:
- if (CHECK_FLAG(0xDBB8, 1)) {
- if (!CHECK_FLAG(0xDBBF, 1)) {
+ if (CHECK_FLAG(0xdbb8, 1)) {
+ if (!CHECK_FLAG(0xdbbf, 1)) {
displayMessage(0x4c32);
playSound(5, 11);
playActorAnimation(690);
inventory->add(53);
- SET_FLAG(0xDBBF, 1);
+ SET_FLAG(0xdbbf, 1);
}
displayMessage(0x4b87);
- return true;
} else
- return false;
+ retVal = false;
+ break;
case 0x7a49:
- if (CHECK_FLAG(0xDBB9, 1)) {
+ if (CHECK_FLAG(0xdbb9, 1))
displayMessage(0x4ba1);
- return true;
- } else
- return false;
+ else
+ retVal = false;
+ break;
case 0x7a5b:
- if (CHECK_FLAG(0xDBBA, 1)) {
+ if (CHECK_FLAG(0xdbba, 1))
displayMessage(0x4bbc);
- return true;
- } else
- return false;
+ else
+ retVal = false;
+ break;
case 0x7a6d:
- if (CHECK_FLAG(0xDBBB, 1)) {
+ if (CHECK_FLAG(0xdbbb, 1))
displayMessage(0x4bd8);
- return true;
- } else
- return false;
+ else
+ retVal = false;
+ break;
case 0x7a7f:
- if (CHECK_FLAG(0xDBBC, 1)) {
- if (!CHECK_FLAG(0xDBBE, 1)) {
- displayMessage(0x4c0f); //there's dictaphone inside!
+ if (CHECK_FLAG(0xdbbc, 1)) {
+ if (!CHECK_FLAG(0xdbbe, 1)) {
+ displayMessage(0x4c0f); // there's a dictaphone inside!
playSound(5, 12);
playActorAnimation(689);
inventory->add(52);
- SET_FLAG(0xDBBE, 1);
+ SET_FLAG(0xdbbe, 1);
}
displayMessage(0x4bf4);
- return true;
} else
- return false;
+ retVal = false;
+ break;
case 0x7af7:
- if (CHECK_FLAG(0xDBD0, 1)) {
+ if (CHECK_FLAG(0xdbd0, 1))
displayMessage(0x5082);
- return true;
- } else
- return false;
+ else
+ retVal = false;
+ break;
- case 0x7b09: {
- byte v = GET_FLAG(0xDBD6);
- switch (v) {
- case 1:
- displayMessage(0x51f8);
- return true;
- case 2:
- displayMessage(0x538d);
- return true;
- default:
- return false;
+ case 0x7b09:
+ {
+ byte v = GET_FLAG(0xdbd6);
+ switch (v) {
+ case 1:
+ displayMessage(0x51f8);
+ break;
+ case 2:
+ displayMessage(0x538d);
+ break;
+ default:
+ retVal = false;
+ break;
+ }
}
- }
+ break;
case 0x9166:
- if (CHECK_FLAG(0xDBD1, 1)) {
- return true;
- } else {
+ if (!CHECK_FLAG(0xdbd1, 1)) {
displayMessage(0x50a6);
- return false;
+ retVal = false;
}
+ break;
case 0x9175:
- if (CHECK_FLAG(0xDBD2, 0) || CHECK_FLAG(0xDBD3, 0) || CHECK_FLAG(0xDBD4, 0))
- return true;
-
- waitLanAnimationFrame(1, 1);
- playSound(89, 2);
- playActorAnimation(731);
- setOns(0, 70);
- setLan(1, 0);
- disableObject(1);
- enableObject(2);
- enableObject(3);
- return true;
+ if (!(CHECK_FLAG(0xdbd2, 0) || CHECK_FLAG(0xdbd3, 0) || CHECK_FLAG(0xdbd4, 0))) {
+ waitLanAnimationFrame(1, 1);
+ playSound(89, 2);
+ playActorAnimation(731);
+ setOns(0, 70);
+ setLan(1, 0);
+ disableObject(1);
+ enableObject(2);
+ enableObject(3);
+ }
+ break;
- case 0x90bc: //handle on the hole
+ case 0x90bc: // handle on the hole
playSound(5, 3);
playSound(6, 9);
playActorAnimation(807);
@@ -3534,78 +3534,73 @@ bool TeenAgentEngine::processCallback(uint16 addr) {
inventory->remove(73);
disableObject(2);
enableObject(3);
- SET_FLAG(0xDBEF, 1);
- return true;
+ SET_FLAG(0xdbef, 1);
+ break;
- case 0x90fc: //dictaphone on robot
- if (!processCallback(0x9166))
- return true;
-
- if (CHECK_FLAG(0xDBD2, 1)) {
- displayMessage(0x50c3);
- return true;
- }
-
- if (!CHECK_FLAG(0xDBCB, 1)) {
- displayMessage(0x5101);
- return true;
+ case 0x90fc: // dictaphone on robot
+ if (processCallback(0x9166)) {
+ if (CHECK_FLAG(0xdbd2, 1)) {
+ displayMessage(0x50c3);
+ } else {
+ if (!CHECK_FLAG(0xdbcb, 1)) {
+ displayMessage(0x5101);
+ } else {
+ displayMessage(0x50e1);
+ waitLanAnimationFrame(1, 1);
+
+ playSound(5, 3);
+ playSound(5, 39);
+ displayAsyncMessage(0x5124, 40388, 9, 35, 0xd0);
+ playActorAnimation(728);
+
+ waitLanAnimationFrame(1, 1);
+ dialog->show(98, scene, 0, 727, 0xd1, 0xef, 0, 1);
+ SET_FLAG(0xdbd2, 1);
+ processCallback(0x9175);
+ }
+ }
}
+ break;
- displayMessage(0x50e1);
- waitLanAnimationFrame(1, 1);
-
- playSound(5, 3);
- playSound(5, 39);
- displayAsyncMessage(0x5124, 40388, 9, 35, 0xd0);
- playActorAnimation(728);
-
- waitLanAnimationFrame(1, 1);
- Dialog::show(scene, 0x3d17, 0, 727, 0xd1, 0xef, 0, 1);
- SET_FLAG(0xDBD2, 1);
- processCallback(0x9175);
- return true;
+ case 0x91cb: // use socks on robot
+ if (processCallback(0x9166)) {
+ if (CHECK_FLAG(0xdbd3, 1)) {
+ displayMessage(0x50c3);
+ } else {
+ displayMessage(0x5138);
- case 0x91cb: //use socks on robot
- if (!processCallback(0x9166))
- return true;
+ waitLanAnimationFrame(1, 1);
+ playSound(5, 3);
+ playSound(5, 23);
+ playActorAnimation(729);
- if (CHECK_FLAG(0xDBD3, 1)) {
- displayMessage(0x50c3);
- return true;
+ waitLanAnimationFrame(1, 1);
+ dialog->show(99, scene, 0, 727, 0xd1, 0xef, 0, 1);
+ SET_FLAG(0xdbd3, 1);
+ processCallback(0x9175);
+ }
}
- displayMessage(0x5138);
-
- waitLanAnimationFrame(1, 1);
- playSound(5, 3);
- playSound(5, 23);
- playActorAnimation(729);
+ break;
- waitLanAnimationFrame(1, 1);
- Dialog::show(scene, 0x3d70, 0, 727, 0xd1, 0xef, 0, 1);
- SET_FLAG(0xDBD3, 1);
- processCallback(0x9175);
- return true;
+ case 0x9209: // photo on robot
+ if (processCallback(0x9166)) {
+ if (CHECK_FLAG(0xdbd4, 1)) {
+ displayMessage(0x50c3);
+ } else {
+ displayMessage(0x5161);
+ waitLanAnimationFrame(1, 1);
- case 0x9209: //photo on robot
- if (!processCallback(0x9166))
- return true;
+ playSound(5, 3);
+ playSound(5, 25);
+ playActorAnimation(730);
- if (CHECK_FLAG(0xDBD4, 1)) {
- displayMessage(0x50c3);
- return true;
+ waitLanAnimationFrame(1, 1);
+ dialog->show(100, scene, 0, 727, 0xd1, 0xef, 0, 1);
+ SET_FLAG(0xdbd4, 1);
+ processCallback(0x9175);
+ }
}
- displayMessage(0x5161);
- waitLanAnimationFrame(1, 1);
-
- playSound(5, 3);
- playSound(5, 25);
- playActorAnimation(730);
-
- waitLanAnimationFrame(1, 1);
- Dialog::show(scene, 0x3dd6, 0, 727, 0xd1, 0xef, 0, 1);
- SET_FLAG(0xDBD4, 1);
- processCallback(0x9175);
- return true;
+ break;
case 0x924e:
setOns(2, 64);
@@ -3613,7 +3608,7 @@ bool TeenAgentEngine::processCallback(uint16 addr) {
playSound(52, 10);
playActorAnimation(711);
moveRel(0, 0, 4);
- Dialog::show(scene, 0x3b21, 0, 709, 0xd1, 0xef, 0, 1);
+ dialog->show(95, scene, 0, 709, 0xd1, 0xef, 0, 1);
moveTo(300, 190, 4);
inventory->remove(64);
disableObject(8);
@@ -3623,7 +3618,7 @@ bool TeenAgentEngine::processCallback(uint16 addr) {
playSound(15, 28);
playSound(16, 37);
playAnimation(713, 0);
- Dialog::show(scene, 0x3c0d, 0, 709, 0xd1, 0xef, 0, 1);
+ dialog->show(96, scene, 0, 709, 0xd1, 0xef, 0, 1);
playSound(85, 2);
playAnimation(714, 0);
setLan(1, 0);
@@ -3649,8 +3644,8 @@ bool TeenAgentEngine::processCallback(uint16 addr) {
obj->actor_orientation = 1;
obj->save();
}
- SET_FLAG(0xDBCC, 1);
- return true;
+ SET_FLAG(0xdbcc, 1);
+ break;
case 0x9472:
playSound(5, 4);
@@ -3658,20 +3653,20 @@ bool TeenAgentEngine::processCallback(uint16 addr) {
playActorAnimation(793);
displayMessage(0x5218);
inventory->remove(60);
- SET_FLAG(0xDBD6, 1);
- return true;
+ SET_FLAG(0xdbd6, 1);
+ break;
- case 0x9449: //meat + stew
+ case 0x9449: // meat + stew
playSound(5, 4);
playSound(63, 12);
playActorAnimation(726);
displayMessage(0x508a);
inventory->remove(69);
inventory->add(70);
- return true;
+ break;
case 0x949b:
- if (CHECK_FLAG(0xDBD6, 2)) {
+ if (CHECK_FLAG(0xdbd6, 2)) {
playSound(5, 4);
playSound(5, 25);
playActorAnimation(802);
@@ -3681,7 +3676,7 @@ bool TeenAgentEngine::processCallback(uint16 addr) {
inventory->add(65);
} else
displayMessage(0x524f);
- return true;
+ break;
case 0x94d4:
if (inventory->has(70)) {
@@ -3695,14 +3690,14 @@ bool TeenAgentEngine::processCallback(uint16 addr) {
inventory->add(71);
} else
displayMessage(0x53ad);
- return true;
+ break;
case 0x951b:
playSound(5, 4);
playSound(5, 22);
playActorAnimation(804);
displayMessage(0x528b);
- return true;
+ break;
case 0x73a3:
if (CHECK_FLAG(0xdbc5, 1)) {
@@ -3714,7 +3709,7 @@ bool TeenAgentEngine::processCallback(uint16 addr) {
playAnimation(0, 0, true);
reloadLan();
- if (CHECK_FLAG(0xDBC6, 1)) {
+ if (CHECK_FLAG(0xdbc6, 1)) {
displayMessage(0x4da6);
}
} else {
@@ -3725,43 +3720,42 @@ bool TeenAgentEngine::processCallback(uint16 addr) {
playActorAnimation(700);
reloadLan();
}
- return true;
+ break;
- case 0x9537: //using remote on VCR
+ case 0x9537: // using remote on VCR
playSound(5, 3);
playSound(5, 16);
playActorAnimation(703);
- if (!CHECK_FLAG(0xDBC8, 1)) {
- displayMessage(0x4D80); //nothing happened
- return true;
- }
-
- //0x955a
- if (CHECK_FLAG(0xDBC6, 0)) {
- if (CHECK_FLAG(0xDBC5, 1)) { //tv on
- if (!CHECK_FLAG(0xDBC7, 1))
- displayMessage(0x4d93); //the tape started
-
- SET_FLAG(0xDBC6, 1);
- reloadLan();
- if (!CHECK_FLAG(0xDBC7, 1)) {
- Dialog::show(scene, 0x392c, 0, 702, 0xd1, 0xd0, 0, 1);
- SET_FLAG(0xDBC7, 1);
+ if (!CHECK_FLAG(0xdbc8, 1))
+ displayMessage(0x4d80); // nothing happened
+ else {
+ //0x955a
+ if (CHECK_FLAG(0xdbc6, 0)) {
+ if (CHECK_FLAG(0xdbc5, 1)) { // tv on
+ if (!CHECK_FLAG(0xdbc7, 1))
+ displayMessage(0x4d93); // the tape started
+
+ SET_FLAG(0xdbc6, 1);
+ reloadLan();
+ if (!CHECK_FLAG(0xdbc7, 1)) {
+ dialog->show(93, scene, 0, 702, 0xd1, 0xd0, 0, 1);
+ SET_FLAG(0xdbc7, 1);
+ }
+ } else
+ displayMessage(0x4d5b); // i just realized that tv is off
+ } else {
+ SET_FLAG(0xdbc6, 0);
+ if (CHECK_FLAG(0xdbc5, 1)) { // tv on
+ reloadLan();
+ displayMessage(0x4da6); // much better!
}
- } else
- displayMessage(0x4d5b); //i just realized that tv is off
- } else {
- SET_FLAG(0xDBC6, 0);
- if (CHECK_FLAG(0xDBC5, 1)) { //tv on
- reloadLan();
- displayMessage(0x4da6); //much better!
}
}
- return true;
+ break;
- case 0x95eb: //polaroid + tv
- if (CHECK_FLAG(0xDBC6, 1)) {
- if (CHECK_FLAG(0xDBCA, 1)) {
+ case 0x95eb: // polaroid + tv
+ if (CHECK_FLAG(0xdbc6, 1)) {
+ if (CHECK_FLAG(0xdbca, 1)) {
displayMessage(0x4de6);
} else {
playSound(5, 3);
@@ -3769,37 +3763,36 @@ bool TeenAgentEngine::processCallback(uint16 addr) {
playSound(90, 18);
playActorAnimation(707);
inventory->add(61);
- SET_FLAG(0xDBCA, 1);
+ SET_FLAG(0xdbca, 1);
}
} else
displayMessage(0x4ea5);
- return true;
+ break;
- case 0x962f: //polaroid + tv
- if (CHECK_FLAG(0xDBC6, 1)) {
- if (CHECK_FLAG(0xDBCB, 1)) {
+ case 0x962f: // polaroid + tv
+ if (CHECK_FLAG(0xdbc6, 1)) {
+ if (CHECK_FLAG(0xdbcb, 1)) {
displayMessage(0x4e32);
} else {
displayMessage(0x4e05);
playSound(5, 3);
playSound(5, 27);
playActorAnimation(708);
- SET_FLAG(0xDBCB, 1);
+ SET_FLAG(0xdbcb, 1);
}
} else
displayMessage(0x4ea5);
- return true;
-
+ break;
case 0x95c8:
playSound(5, 3);
playSound(91, 12);
playActorAnimation(706);
inventory->remove(54);
- SET_FLAG(0xDBC8, 1);
- return true;
+ SET_FLAG(0xdbc8, 1);
+ break;
- case 0x9673: //hit fatso - final scene
+ case 0x9673: // hit fatso - final scene
playSound(5, 3);
playSound(24, 10);
playActorAnimation(798);
@@ -3816,7 +3809,7 @@ bool TeenAgentEngine::processCallback(uint16 addr) {
playMusic(3);
loadScene(11, 105, 157, 4);
- Dialog::show(scene, 0x8409, 0, 938, 0xd1, 0xec, 0, 1);
+ dialog->show(203, scene, 0, 938, 0xd1, 0xec, 0, 1);
playAnimation(939, 0, true, true);
playActorAnimation(942, true);
@@ -3837,9 +3830,9 @@ bool TeenAgentEngine::processCallback(uint16 addr) {
playActorAnimation(945, true);
waitAnimation();
- Dialog::show(scene, 0x844f, 0, 938, 0xd1, 0xec, 0, 1);
+ dialog->show(204, scene, 0, 938, 0xd1, 0xec, 0, 1);
playAnimation(946, 0);
- Dialog::show(scene, 0x87c7, 0, 938, 0xd1, 0xec, 0, 1);
+ dialog->show(205, scene, 0, 938, 0xd1, 0xec, 0, 1);
playSound(24, 7);
playAnimation(948, 0, true);
@@ -3847,16 +3840,16 @@ bool TeenAgentEngine::processCallback(uint16 addr) {
waitAnimation();
loadScene(40, 198, 186, 1);
- Dialog::show(scene, 0x8890, 0, 920, 0xd1, 0xe7, 0, 1);
- Dialog::show(scene, 0x8a2f, 0, 921, 0xd1, 0xe7, 0, 1);
+ dialog->show(206, scene, 0, 920, 0xd1, 0xe7, 0, 1);
+ dialog->show(207, scene, 0, 921, 0xd1, 0xe7, 0, 1);
playAnimation(923, 0);
- Dialog::show(scene, 0x8aa7, 0, 920, 0xd1, 0xe7, 0, 1);
+ dialog->show(208, scene, 0, 920, 0xd1, 0xe7, 0, 1);
moveTo(237, 186, 0);
moveTo(237, 177, 0);
moveTo(192, 177, 4);
playAnimation(949, 0);
- Dialog::showMono(scene, 0x8af6, 950, 0xe7, 1);
+ dialog->showMono(209, scene, 950, 0xe7, 1);
playSound(32, 5);
playSound(40, 14);
@@ -3869,46 +3862,46 @@ bool TeenAgentEngine::processCallback(uint16 addr) {
displayCredits();
loadScene(39, 192, 177, 0);
hideActor();
- Dialog::showMono(scene, 0x8b4d, 953, 0xe3, 1); //well...
+ dialog->showMono(210, scene, 953, 0xe3, 1);
playSound(5, 15);
playAnimation(954, 0);
- Dialog::showMono(scene, 0x8b7a, 955, 0xe3, 1); //that's all folks
+ dialog->showMono(211, scene, 955, 0xe3, 1);
playMusic(2);
- displayCredits(0xe47c, 4500); //3 minutes (infinite until key pressed in original)
+ displayCredits(0xe47c, 4500); // 3 minutes (infinite until key pressed in original)
scene->push(SceneEvent(SceneEvent::kQuit));
+ break;
- return true;
-
- case 0x9921: { //using diving eq
- int id = scene->getId();
- if (id != 15) {
- displayMessage(id == 16 ? 0x38ce : 0x38a7);
- } else {
- playSound(5, 3);
- playSound(38, 16);
- playSound(38, 22);
- playActorAnimation(614);
- playSound(5, 3);
- playSound(44, 10);
- playSound(20, 26);
- playActorAnimation(615);
- loadScene(17, 156, 180, 3);
- SET_FLAG(0, 4);
- playSound(64, 7);
- playSound(64, 21);
- playSound(64, 42);
- playSound(64, 63);
- setTimerCallback(0x9a1d, 30);
- playActorAnimation(617, false, true);
+ case 0x9921: // using diving eq
+ {
+ int id = scene->getId();
+ if (id != 15) {
+ displayMessage(id == 16 ? 0x38ce : 0x38a7);
+ } else {
+ playSound(5, 3);
+ playSound(38, 16);
+ playSound(38, 22);
+ playActorAnimation(614);
+ playSound(5, 3);
+ playSound(44, 10);
+ playSound(20, 26);
+ playActorAnimation(615);
+ loadScene(17, 156, 180, 3);
+ SET_FLAG(0, 4);
+ playSound(64, 7);
+ playSound(64, 21);
+ playSound(64, 42);
+ playSound(64, 63);
+ setTimerCallback(0x9a1d, 30);
+ playActorAnimation(617, false, true);
+ }
}
- }
- return true;
+ break;
- case 0x9a1d: //no anchor, timeout
+ case 0x9a1d: // no anchor, timeout
SET_FLAG(0, 0);
processCallback(0x9a7a);
- INC_FLAG(0xDBA6);
- switch (GET_FLAG(0xDBA6)) {
+ INC_FLAG(0xdba6);
+ switch (GET_FLAG(0xdba6)) {
case 1:
displayMessage(0x39ae);
break;
@@ -3926,10 +3919,11 @@ bool TeenAgentEngine::processCallback(uint16 addr) {
break;
default:
displayMessage(0x39b7);
+ break;
}
- return true;
+ break;
- case 0x99e0: //success getting an anchor
+ case 0x99e0: // success getting an anchor
SET_FLAG(0, 0);
setTimerCallback(0, 0);
scene->getActorAnimation()->free();
@@ -3942,7 +3936,7 @@ bool TeenAgentEngine::processCallback(uint16 addr) {
processCallback(0x9a7a);
inventory->add(42);
displayMessage(0x3989);
- return true;
+ break;
case 0x9a7a:
loadScene(15, 156, 180, 3);
@@ -3951,7 +3945,7 @@ bool TeenAgentEngine::processCallback(uint16 addr) {
playSound(38, 20);
playSound(5, 25);
playActorAnimation(616);
- return true;
+ break;
case 0x9aca:
if (scene->getId() == 13) {
@@ -3990,23 +3984,24 @@ bool TeenAgentEngine::processCallback(uint16 addr) {
wait(100);
displayMessage(0x3cea);
inventory->remove(37);
- processCallback(0x9d45); //another mansion try
+ processCallback(0x9d45); // another mansion try
} else
displayMessage(0x3c58);
- return true;
+ break;
case 0x9c6d:
displayMessage(0x49d1);
- SET_FLAG(0xDBB5, 1);
- return false;
+ SET_FLAG(0xdbb5, 1);
+ retVal = false;
+ break;
- case 0x9c79: //use pills
+ case 0x9c79: // use pills
if (scene->getId() != 36) {
displayMessage(0x52a9);
- } else if (CHECK_FLAG(0xDBF1, 1)) {
- displayMessage(0x52F6);
+ } else if (CHECK_FLAG(0xdbf1, 1)) {
+ displayMessage(0x52f6);
} else {
- SET_FLAG(0xDBF1, 1);
+ SET_FLAG(0xdbf1, 1);
moveTo(102, 195, 2);
playSound(5, 3);
playSound(75, 12);
@@ -4025,7 +4020,7 @@ bool TeenAgentEngine::processCallback(uint16 addr) {
}
setLan(1, 0xff);
- Dialog::showMark(scene, 0x58a9);
+ dialog->showMark(130, scene);
Object *obj = scene->getObject(1);
obj->actor_rect.left = obj->actor_rect.right = 270;
@@ -4039,29 +4034,31 @@ bool TeenAgentEngine::processCallback(uint16 addr) {
obj->actor_orientation = 1;
obj->save();
- SET_FLAG(0xDBD7, 1);
+ SET_FLAG(0xdbd7, 1);
}
- return true;
+ break;
- case 0x9d45: {
- wait(50);
- byte attempts = ++ *(res->dseg.ptr(0xDBEA));
- debug(0, "mansion intrusion attempt #%u", attempts);
- if (attempts >= 7)
- return false;
-
- uint16 ptr = res->dseg.get_word((attempts - 2) * 2 + 0x6035);
- debug(0, "mansion callback = %04x", ptr);
- byte id = scene->getId();
-
- playMusic(11);
- displayCutsceneMessage(0x580a, 30484);
- processCallback(ptr);
- playMusic(6);
- if (getFlag(0xdbec) != 1 || ptr != 0x9f3e) //ptr check eq. scene_id == 11
- loadScene(id, scene->getPosition());
- return true;
- }
+ case 0x9d45:
+ {
+ wait(50);
+ byte attempts = ++ *(res->dseg.ptr(0xdbea));
+ debugC(0, kDebugCallbacks, "mansion intrusion attempt #%u", attempts);
+ if (attempts >= 7)
+ retVal = false;
+ else {
+ uint16 ptr = res->dseg.get_word((attempts - 2) * 2 + 0x6035);
+ debugC(0, kDebugCallbacks, "mansion callback = %04x", ptr);
+ byte id = scene->getId();
+
+ playMusic(11);
+ displayCutsceneMessage(0x580a, 30484);
+ processCallback(ptr);
+ playMusic(6);
+ if (getFlag(0xdbec) != 1 || ptr != 0x9f3e) // ptr check eq. scene_id == 11
+ loadScene(id, scene->getPosition());
+ }
+ }
+ break;
case 0x9d90:
hideActor();
@@ -4069,12 +4066,12 @@ bool TeenAgentEngine::processCallback(uint16 addr) {
playAnimation(986, 0, true);
playAnimation(987, 1, true);
waitAnimation();
- Dialog::show(scene, 0x6f60, 988, 989, 0xd9, 0xd0, 1, 2);
+ dialog->show(178, scene, 988, 989, 0xd9, 0xd0, 1, 2);
playAnimation(990, 0, true);
playAnimation(991, 1, true);
waitAnimation();
showActor();
- return true;
+ break;
case 0x9de5:
hideActor();
@@ -4082,14 +4079,14 @@ bool TeenAgentEngine::processCallback(uint16 addr) {
playAnimation(887, 1);
playAnimation(888, 2, true, true, true);
//waitAnimation();
- Dialog::showMono(scene, 0x6fb8, 889, 0xd9, 2);
+ dialog->showMono(179, scene, 889, 0xd9, 2);
playSound(26, 3);
playAnimation(891, 1, true, true, true);
playAnimation(892, 2);
waitAnimation();
- Dialog::show(scene, 0x6ff0, 890, 889, 0xd0, 0xd9, 3, 2);
+ dialog->show(180, scene, 890, 889, 0xd0, 0xd9, 3, 2);
showActor();
- return true;
+ break;
case 0x9e54:
hideActor();
@@ -4097,13 +4094,13 @@ bool TeenAgentEngine::processCallback(uint16 addr) {
playAnimation(894, 1, true, true, true);
playAnimation(893, 2, true);
waitAnimation();
- Dialog::showMono(scene, 0x706e, 895, 0xd9, 3);
+ dialog->showMono(181, scene, 895, 0xd9, 3);
playSound(75, 9);
playAnimation(898, 1, true);
playAnimation(897, 2, true);
- Dialog::show(scene, 0x7096, 896, 895, 0xd0, 0xd9, 2, 3);
+ dialog->show(182, scene, 896, 895, 0xd0, 0xd9, 2, 3);
showActor();
- return true;
+ break;
case 0x9ec3:
hideActor();
@@ -4111,15 +4108,15 @@ bool TeenAgentEngine::processCallback(uint16 addr) {
playActorAnimation(901, true);
playAnimation(900, 1, true);
waitAnimation();
- Dialog::show(scene, 0x7161, 903, 902, 0xd0, 0xd9, 2, 3);
+ dialog->show(183, scene, 903, 902, 0xd0, 0xd9, 2, 3);
for (byte i = 3; i <= 9; i += 2)
playSound(56, i);
playActorAnimation(905, true);
playAnimation(904, 1, true);
- Dialog::show(scene, 0x71c6, 903, 902, 0xd0, 0xd9, 2, 3);
+ dialog->show(184, scene, 903, 902, 0xd0, 0xd9, 2, 3);
showActor();
- return true;
+ break;
case 0x9f3e:
hideActor();
@@ -4127,24 +4124,26 @@ bool TeenAgentEngine::processCallback(uint16 addr) {
playAnimation(907, 2, true);
playAnimation(906, 3, true);
waitAnimation();
- Dialog::show(scene, 0x7243, 908, 909, 0xd9, 0xd0, 2, 3);
- Dialog::show(scene, 0x7318, 910, 908, 0xd0, 0xd9, 3, 2);
+ dialog->show(185, scene, 908, 909, 0xd9, 0xd0, 2, 3);
+ dialog->show(186, scene, 910, 908, 0xd0, 0xd9, 3, 2);
loadScene(11, scene->getPosition());
showActor();
setOns(3, 51);
playAnimation(911, 1);
playAnimation(899, 1);
- setFlag(0xDBEC, 1);
+ setFlag(0xdbec, 1);
reloadLan();
wait(200);
enableObject(8);
setLan(2, 8);
- return true;
+ break;
+
+ default:
+ warning("invalid callback %04x called", addr);
+ break;
}
- //error("invalid callback %04x called", addr);
- warning("invalid callback %04x called", addr);
- return true;
+ return retVal;
}
} // End of namespace TeenAgent
diff --git a/engines/teenagent/dialog.cpp b/engines/teenagent/dialog.cpp
index 400bd7cec2..bb55b6f405 100644
--- a/engines/teenagent/dialog.cpp
+++ b/engines/teenagent/dialog.cpp
@@ -22,99 +22,101 @@
#include "teenagent/dialog.h"
#include "teenagent/resources.h"
#include "teenagent/scene.h"
+#include "teenagent/teenagent.h"
namespace TeenAgent {
+void Dialog::show(uint16 dialogNum, Scene *scene, uint16 animation1, uint16 animation2, byte color1, byte color2, byte slot1, byte slot2) {
+ uint16 addr = _vm->res->getDialogAddr(dialogNum);
+ // WORKAROUND: For Dialog 163, The usage of this in the engine overlaps the previous dialog i.e. the
+ // starting offset used is two bytes early, thus implicitly changing the first command of this dialog
+ // from NEW_LINE to CHANGE_CHARACTER.
+ // FIXME: Unsure if this is correct behaviour or if this is a regression from the original. Check this.
+ if (dialogNum == 163)
+ addr -= 2;
+ show(scene, addr, animation1, animation2, color1, color2, slot1, slot2);
+}
+
void Dialog::show(Scene *scene, uint16 addr, uint16 animation1, uint16 animation2, byte color1, byte color2, byte slot1, byte slot2) {
- debug(0, "Dialog::show(%04x, %u:%u, %u:%u)", addr, slot1, animation1, slot2, animation2);
- Resources *res = Resources::instance();
+ debugC(0, kDebugDialog, "Dialog::show(%04x, %u:%u, %u:%u)", addr, slot1, animation1, slot2, animation2);
int n = 0;
Common::String message;
byte color = color1;
if (animation1 != 0) {
- SceneEvent e(SceneEvent::kPlayAnimation);
- e.animation = animation1;
- e.slot = 0xc0 | slot1; //looped, paused
- scene->push(e);
+ SceneEvent e1(SceneEvent::kPlayAnimation);
+ e1.animation = animation1;
+ e1.slot = 0xc0 | slot1; //looped, paused
+ scene->push(e1);
}
if (animation2 != 0) {
- SceneEvent e(SceneEvent::kPlayAnimation);
- e.animation = animation2;
- e.slot = 0xc0 | slot2; //looped, paused
- scene->push(e);
+ SceneEvent e2(SceneEvent::kPlayAnimation);
+ e2.animation = animation2;
+ e2.slot = 0xc0 | slot2; //looped, paused
+ scene->push(e2);
}
while (n < 4) {
- byte c = res->eseg.get_byte(addr++);
- //debug(0, "%02x: %c", c, c > 0x20? c: '.');
+ byte c = _vm->res->eseg.get_byte(addr++);
+ debugC(1, kDebugDialog, "%02x: %c", c, c > 0x20? c: '.');
switch (c) {
case 0:
++n;
switch (n) {
case 1:
- //debug(0, "new line\n");
+ debugC(1, kDebugDialog, "new line\n");
if (!message.empty())
message += '\n';
break;
case 2:
- //debug(0, "displaymessage %s", message.c_str());
+ debugC(1, kDebugDialog, "displaymessage %s", message.c_str());
if (color == color2) {
//pause animation in other slot
- {
- SceneEvent e(SceneEvent::kPauseAnimation);
- e.slot = 0x80 | slot1;
- scene->push(e);
- }
- {
- SceneEvent e(SceneEvent::kPlayAnimation);
- e.animation = animation2;
- e.slot = 0x80 | slot2;
- scene->push(e);
- }
+ SceneEvent e1(SceneEvent::kPauseAnimation);
+ e1.slot = 0x80 | slot1;
+ scene->push(e1);
+
+ SceneEvent e2(SceneEvent::kPlayAnimation);
+ e2.animation = animation2;
+ e2.slot = 0x80 | slot2;
+ scene->push(e2);
} else if (color == color1) {
//pause animation in other slot
- {
- SceneEvent e(SceneEvent::kPauseAnimation);
- e.slot = 0x80 | slot2;
- scene->push(e);
- }
- {
- SceneEvent e(SceneEvent::kPlayAnimation);
- e.animation = animation1;
- e.slot = 0x80 | slot1;
- scene->push(e);
- }
- }
+ SceneEvent e2(SceneEvent::kPauseAnimation);
+ e2.slot = 0x80 | slot2;
+ scene->push(e2);
- {
- message.trim();
- if (message.empty())
- break;
+ SceneEvent e1(SceneEvent::kPlayAnimation);
+ e1.animation = animation1;
+ e1.slot = 0x80 | slot1;
+ scene->push(e1);
+ }
- SceneEvent e(SceneEvent::kMessage);
- e.message = message;
- e.color = color;
+ message.trim();
+ if (!message.empty()) {
+ SceneEvent em(SceneEvent::kMessage);
+ em.message = message;
+ em.color = color;
if (color == color1)
- e.slot = slot1;
+ em.slot = slot1;
if (color == color2)
- e.slot = slot2;
- scene->push(e);
+ em.slot = slot2;
+ scene->push(em);
message.clear();
}
break;
case 3:
- color = color == color1 ? color2 : color1;
- //debug(0, "changing color to %02x", color);
+ color = (color == color1) ? color2 : color1;
+ debugC(1, kDebugDialog, "changing color to %02x", color);
break;
}
break;
case 0xff: {
- //fixme : wait for the next cycle of the animation
+ //FIXME : wait for the next cycle of the animation
}
break;
@@ -124,21 +126,20 @@ void Dialog::show(Scene *scene, uint16 addr, uint16 animation1, uint16 animation
}
}
- SceneEvent e(SceneEvent::kClearAnimations);
- scene->push(e);
+ SceneEvent ec(SceneEvent::kClearAnimations);
+ scene->push(ec);
}
uint16 Dialog::pop(Scene *scene, uint16 addr, uint16 animation1, uint16 animation2, byte color1, byte color2, byte slot1, byte slot2) {
- debug(0, "Dialog::pop(%04x, %u:%u, %u:%u)", addr, slot1, animation1, slot2, animation2);
- Resources *res = Resources::instance();
+ debugC(0, kDebugDialog, "Dialog::pop(%04x, %u:%u, %u:%u)", addr, slot1, animation1, slot2, animation2);
uint16 next;
do {
- next = res->dseg.get_word(addr);
+ next = _vm->res->dseg.get_word(addr);
addr += 2;
} while (next == 0);
- uint16 next2 = res->dseg.get_word(addr);
+ uint16 next2 = _vm->res->dseg.get_word(addr);
if (next2 != 0xffff)
- res->dseg.set_word(addr - 2, 0);
+ _vm->res->dseg.set_word(addr - 2, 0);
show(scene, next, animation1, animation2, color1, color2, slot1, slot2);
return next;
}
diff --git a/engines/teenagent/dialog.h b/engines/teenagent/dialog.h
index 3bb7d818c1..e756c18f73 100644
--- a/engines/teenagent/dialog.h
+++ b/engines/teenagent/dialog.h
@@ -28,19 +28,32 @@
namespace TeenAgent {
class Scene;
+class TeenAgentEngine;
+
class Dialog {
public:
- static uint16 pop(Scene *scene, uint16 addr, uint16 animation1, uint16 animation2, byte color1, byte color2, byte slot1, byte slot2);
- static uint16 popMark(Scene *scene, uint16 addr) {
+ Dialog(TeenAgentEngine *vm) : _vm(vm) { }
+
+ uint16 pop(Scene *scene, uint16 addr, uint16 animation1, uint16 animation2, byte color1, byte color2, byte slot1, byte slot2);
+
+ uint16 popMark(Scene *scene, uint16 addr) {
return pop(scene, addr, 0, 0, 0xd1, 0xd1, 0, 0);
}
- static void show(Scene *scene, uint16 addr, uint16 animation1, uint16 animation2, byte color1, byte color2, byte slot1, byte slot2);
- static void showMono(Scene *scene, uint16 addr, uint16 animation, byte color, byte slot) {
- show(scene, addr, animation, animation, color, color, slot, slot);
+
+ void show(uint16 dialogNum, Scene *scene, uint16 animation1, uint16 animation2, byte color1, byte color2, byte slot1, byte slot2);
+
+ void showMono(uint16 dialogNum, Scene *scene, uint16 animation, byte color, byte slot) {
+ show(dialogNum, scene, animation, animation, color, color, slot, slot);
}
- static void showMark(Scene *scene, uint16 addr) {
- show(scene, addr, 0, 0, 0xd1, 0xd1, 0, 0);
+
+ void showMark(uint16 dialogNum, Scene *scene) {
+ show(dialogNum, scene, 0, 0, 0xd1, 0xd1, 0, 0);
}
+
+private:
+ TeenAgentEngine *_vm;
+
+ void show(Scene *scene, uint16 addr, uint16 animation1, uint16 animation2, byte color1, byte color2, byte slot1, byte slot2);
};
} // End of namespace TeenAgent
diff --git a/engines/teenagent/font.cpp b/engines/teenagent/font.cpp
index f7558b60f2..cf3deadacb 100644
--- a/engines/teenagent/font.cpp
+++ b/engines/teenagent/font.cpp
@@ -20,8 +20,10 @@
*/
#include "teenagent/font.h"
+
#include "teenagent/pack.h"
-#include "common/debug.h"
+#include "teenagent/teenagent.h"
+
#include "common/endian.h"
#include "common/stream.h"
#include "common/textconsole.h"
@@ -43,13 +45,13 @@ void Font::load(const Pack &pack, int id) {
data = new byte[s->size()];
s->read(data, s->size());
- debug(0, "font size: %d", s->size());
+ debugC(0, kDebugFont, "font size: %d", s->size());
}
uint Font::render(Graphics::Surface *surface, int x, int y, char c, byte color) {
unsigned idx = (unsigned char)c;
if (idx < 0x20 || idx >= 0x81) {
- debug(0, "unhandled char 0x%02x", idx);
+ debugC(0, kDebugFont, "unhandled char 0x%02x", idx);
return 0;
}
idx -= 0x20;
@@ -68,7 +70,7 @@ uint Font::render(Graphics::Surface *surface, int x, int y, char c, byte color)
i0 = -y;
y = 0;
}
- //debug(0, "char %c, width: %dx%d", c, w, h);
+ debugC(0, kDebugFont, "char %c, width: %dx%d", c, w, h);
glyph += 2;
glyph += i0 * w + j0;
byte *dst = (byte *)surface->getBasePtr(x, y);
@@ -109,7 +111,7 @@ uint Font::render(Graphics::Surface *surface, int x, int y, const Common::String
do {
j = find_in_str(str, '\n', i);
Common::String line(str.c_str() + i, j - i);
- //debug(0, "line: %s", line.c_str());
+ debugC(0, kDebugFont, "line: %s", line.c_str());
if (y + (int)height >= 0) {
uint w = render(NULL, 0, 0, line, false);
diff --git a/engines/teenagent/inventory.cpp b/engines/teenagent/inventory.cpp
index 59dd44baa3..ec46936b7e 100644
--- a/engines/teenagent/inventory.cpp
+++ b/engines/teenagent/inventory.cpp
@@ -24,6 +24,7 @@
#include "common/textconsole.h"
#include "teenagent/inventory.h"
+
#include "teenagent/resources.h"
#include "teenagent/objects.h"
#include "teenagent/teenagent.h"
@@ -31,25 +32,22 @@
namespace TeenAgent {
-Inventory::Inventory(TeenAgentEngine *engine) {
- _engine = engine;
+Inventory::Inventory(TeenAgentEngine *vm) : _vm(vm) {
_active = false;
FilePack varia;
varia.open("varia.res");
- {
- Common::ScopedPtr<Common::SeekableReadStream> s(varia.getStream(3));
- if (!s)
- error("no inventory background");
- debug(0, "loading inventory background...");
- _background.load(*s, Surface::kTypeOns);
- }
+ Common::ScopedPtr<Common::SeekableReadStream> s(varia.getStream(3));
+ if (!s)
+ error("no inventory background");
+ debugC(0, kDebugInventory, "loading inventory background...");
+ _background.load(*s, Surface::kTypeOns);
uint32 items_size = varia.getSize(4);
if (items_size == 0)
error("invalid inventory items size");
- debug(0, "loading items, size: %u", items_size);
+ debugC(0, kDebugInventory, "loading items, size: %u", items_size);
_items = new byte[items_size];
varia.read(4, _items, items_size);
@@ -60,16 +58,15 @@ Inventory::Inventory(TeenAgentEngine *engine) {
}
_offset[92] = items_size;
- Resources *res = Resources::instance();
for (byte i = 0; i <= 92; ++i) {
InventoryObject io;
- uint16 obj_addr = res->dseg.get_word(0xc4a4 + i * 2);
+ uint16 obj_addr = vm->res->dseg.get_word(0xc4a4 + i * 2);
if (obj_addr != 0)
- io.load(res->dseg.ptr(obj_addr));
+ io.load(vm->res->dseg.ptr(obj_addr));
_objects.push_back(io);
}
- _inventory = res->dseg.ptr(0xc48d);
+ _inventory = vm->res->dseg.ptr(0xc48d);
for (int y = 0; y < 4; ++y)
for (int x = 0; x < 6; ++x) {
@@ -97,7 +94,7 @@ bool Inventory::has(byte item) const {
}
void Inventory::remove(byte item) {
- debug(0, "removing %u from inventory", item);
+ debugC(0, kDebugInventory, "removing %u from inventory", item);
int i;
for (i = 0; i < 24; ++i) {
if (_inventory[i] == item) {
@@ -113,7 +110,7 @@ void Inventory::remove(byte item) {
}
void Inventory::clear() {
- debug(0, "clearing inventory");
+ debugC(0, kDebugInventory, "clearing inventory");
for (int i = 0; i < 24; ++i) {
_inventory[i] = 0;
_graphics[i].free();
@@ -132,7 +129,7 @@ void Inventory::reload() {
void Inventory::add(byte item) {
if (has(item))
return;
- debug(0, "adding %u to inventory", item);
+ debugC(0, kDebugInventory, "adding %u to inventory", item);
for (int i = 0; i < 24; ++i) {
if (_inventory[i] == 0) {
_inventory[i] = item;
@@ -145,11 +142,11 @@ void Inventory::add(byte item) {
bool Inventory::tryObjectCallback(InventoryObject *obj) {
byte id = obj->id;
uint i = 0;
- for (byte *table = Resources::instance()->dseg.ptr(0xBB6F + 3); table[0] != 0 && i < 7; table += 3, ++i) {
+ for (byte *table = _vm->res->dseg.ptr(0xbb6f + 3); table[0] != 0 && i < 7; table += 3, ++i) {
if (table[0] == id) {
resetSelectedObject();
activate(false);
- if (_engine->processCallback(READ_LE_UINT16(table + 1)))
+ if (_vm->processCallback(READ_LE_UINT16(table + 1)))
return true;
}
}
@@ -157,8 +154,6 @@ bool Inventory::tryObjectCallback(InventoryObject *obj) {
}
bool Inventory::processEvent(const Common::Event &event) {
- Resources *res = Resources::instance();
-
switch (event.type) {
case Common::EVENT_MOUSEMOVE:
@@ -197,14 +192,14 @@ bool Inventory::processEvent(const Common::Event &event) {
if (_hoveredObj == NULL)
return true;
- debug(0, "lclick on %u:%s", _hoveredObj->id, _hoveredObj->name.c_str());
+ debugC(0, kDebugInventory, "lclick on %u:%s", _hoveredObj->id, _hoveredObj->name.c_str());
if (_selectedObj == NULL) {
if (tryObjectCallback(_hoveredObj))
return true;
//activate(false);
- int w = res->font7.render(NULL, 0, 0, _hoveredObj->description, 0xd1);
- _engine->scene->displayMessage(_hoveredObj->description, 0xd1, Common::Point((320 - w) / 2, 162));
+ int w = _vm->res->font7.render(NULL, 0, 0, _hoveredObj->description, 0xd1);
+ _vm->scene->displayMessage(_hoveredObj->description, 0xd1, Common::Point((320 - w) / 2, 162));
return true;
}
@@ -213,30 +208,27 @@ bool Inventory::processEvent(const Common::Event &event) {
if (id1 == id2)
return true;
- debug(0, "combine(%u, %u)!", id1, id2);
- byte *table = res->dseg.ptr(0xC335);
+ debugC(0, kDebugInventory, "combine(%u, %u)!", id1, id2);
+ byte *table = _vm->res->dseg.ptr(0xc335);
while (table[0] != 0 && table[1] != 0) {
- if (
- (id1 == table[0] && id2 == table[1]) ||
- (id2 == table[0] && id1 == table[1])
- ) {
+ if ((id1 == table[0] && id2 == table[1]) || (id2 == table[0] && id1 == table[1])) {
byte new_obj = table[2];
if (new_obj != 0) {
remove(id1);
remove(id2);
- debug(0, "adding object %u", new_obj);
+ debugC(0, kDebugInventory, "adding object %u", new_obj);
add(new_obj);
- _engine->playSoundNow(69);
+ _vm->playSoundNow(69);
}
uint16 msg = READ_LE_UINT16(table + 3);
- _engine->displayMessage(msg);
+ _vm->displayMessage(msg);
activate(false);
resetSelectedObject();
return true;
}
table += 5;
}
- _engine->displayMessage(0xc3e2);
+ _vm->displayMessage(0xc3e2);
activate(false);
resetSelectedObject();
return true;
@@ -247,14 +239,14 @@ bool Inventory::processEvent(const Common::Event &event) {
return false;
if (_hoveredObj != NULL) {
- debug(0, "rclick object %u:%s", _hoveredObj->id, _hoveredObj->name.c_str());
- if (_hoveredObj->id != 51 && tryObjectCallback(_hoveredObj)) //do not process callback for banknote on r-click
+ debugC(0, kDebugInventory, "rclick object %u:%s", _hoveredObj->id, _hoveredObj->name.c_str());
+ if (_hoveredObj->id != 51 && tryObjectCallback(_hoveredObj)) // do not process callback for banknote on r-click
return true;
}
_selectedObj = _hoveredObj;
if (_selectedObj)
- debug(0, "selected object %s", _selectedObj->name.c_str());
+ debugC(0, kDebugInventory, "selected object %s", _selectedObj->name.c_str());
return true;
case Common::EVENT_KEYDOWN:
@@ -262,7 +254,7 @@ bool Inventory::processEvent(const Common::Event &event) {
activate(false);
return true;
}
- if (event.kbd.keycode == Common::KEYCODE_RETURN) { //triangle button on psp
+ if (event.kbd.keycode == Common::KEYCODE_RETURN) { // triangle button on psp
activate(!_active);
return true;
}
@@ -277,7 +269,6 @@ bool Inventory::processEvent(const Common::Event &event) {
}
}
-
void Inventory::Item::free() {
_animation.free();
_surface.free();
@@ -298,13 +289,13 @@ void Inventory::Item::load(Inventory *inventory, uint item_id) {
InventoryObject *obj = &inventory->_objects[item_id];
if (obj->animated) {
if (_animation.empty()) {
- debug(0, "loading item %d from offset %x", obj->id, inventory->_offset[obj->id - 1]);
+ debugC(0, kDebugInventory, "loading item %d from offset %x", obj->id, inventory->_offset[obj->id - 1]);
Common::MemoryReadStream s(inventory->_items + inventory->_offset[obj->id - 1], inventory->_offset[obj->id] - inventory->_offset[obj->id - 1]);
_animation.load(s, Animation::kTypeInventory);
}
} else {
if (_surface.empty()) {
- debug(0, "loading item %d from offset %x", obj->id, inventory->_offset[obj->id - 1]);
+ debugC(0, kDebugInventory, "loading item %d from offset %x", obj->id, inventory->_offset[obj->id - 1]);
Common::MemoryReadStream s(inventory->_items + inventory->_offset[obj->id - 1], inventory->_offset[obj->id] - inventory->_offset[obj->id - 1]);
_surface.load(s, Surface::kTypeOns);
}
@@ -313,7 +304,6 @@ void Inventory::Item::load(Inventory *inventory, uint item_id) {
void Inventory::Item::render(Inventory *inventory, uint item_id, Graphics::Surface *dst, int delta) {
InventoryObject *obj = &inventory->_objects[item_id];
- Resources *res = Resources::instance();
backgroundEffect(dst);
_rect.render(dst, _hovered ? 233 : 234);
@@ -342,15 +332,16 @@ void Inventory::Item::render(Inventory *inventory, uint item_id, Graphics::Surfa
if (inventory->_selectedObj != inventory->_hoveredObj)
name += obj->name;
- if (_hovered && inventory->_engine->scene->getMessage().empty()) {
- int w = res->font7.render(NULL, 0, 0, name, 0xd1, true);
- res->font7.render(dst, (320 - w) / 2, 180, name, 0xd1, true);
+ if (_hovered && inventory->_vm->scene->getMessage().empty()) {
+ int w = inventory->_vm->res->font7.render(NULL, 0, 0, name, 0xd1, true);
+ inventory->_vm->res->font7.render(dst, (320 - w) / 2, 180, name, 0xd1, true);
}
}
void Inventory::render(Graphics::Surface *surface, int delta) {
if (!_active)
return;
+ debugC(0, kDebugInventory, "Inventory::render()");
_background.render(surface);
@@ -358,11 +349,10 @@ void Inventory::render(Graphics::Surface *surface, int delta) {
for (int x = 0; x < 6; x++) {
int idx = x + 6 * y;
byte item = _inventory[idx];
- if (item == 0)
- continue;
-
- //debug(0, "%d,%d -> %u", x0, y0, item);
- _graphics[idx].render(this, item, surface, delta);
+ if (item != 0) {
+ debugC(0, kDebugInventory, "\t(x, y): %d,%d -> item: %u", x, y, item);
+ _graphics[idx].render(this, item, surface, delta);
+ }
}
}
}
diff --git a/engines/teenagent/inventory.h b/engines/teenagent/inventory.h
index 61e5364542..c5ec52dbd9 100644
--- a/engines/teenagent/inventory.h
+++ b/engines/teenagent/inventory.h
@@ -35,7 +35,7 @@ class TeenAgentEngine;
class Inventory {
public:
- Inventory(TeenAgentEngine *engine);
+ Inventory(TeenAgentEngine *vm);
~Inventory();
void render(Graphics::Surface *surface, int delta);
@@ -55,7 +55,7 @@ public:
void resetSelectedObject() { _selectedObj = NULL; }
private:
- TeenAgentEngine *_engine;
+ TeenAgentEngine *_vm;
Surface _background;
byte *_items;
uint _offset[93];
diff --git a/engines/teenagent/music.cpp b/engines/teenagent/music.cpp
index 1f44e9cfcb..446ae9656a 100644
--- a/engines/teenagent/music.cpp
+++ b/engines/teenagent/music.cpp
@@ -22,6 +22,8 @@
#include "teenagent/music.h"
#include "teenagent/resources.h"
+#include "teenagent/teenagent.h"
+
#include "common/debug.h"
#include "common/ptr.h"
#include "common/textconsole.h"
@@ -34,36 +36,35 @@ static const uint32 noteToPeriod[3][12] = {
{214, 201, 189, 179, 170, 160, 151, 143, 135, 127, 120, 113}
};
-MusicPlayer::MusicPlayer() : Paula(false, 44100, 5000), _id(0) {
+MusicPlayer::MusicPlayer(TeenAgentEngine *vm) : Paula(false, 44100, 5000), _vm(vm), _id(0) {
}
MusicPlayer::~MusicPlayer() {
}
bool MusicPlayer::load(int id) {
- Resources *res = Resources::instance();
-
- Common::ScopedPtr<Common::SeekableReadStream> stream(res->mmm.getStream(id));
+ debugC(0, kDebugMusic, "MusicPlayer::load(%d)", id);
+ Common::ScopedPtr<Common::SeekableReadStream> stream(_vm->res->mmm.getStream(id));
if (!stream)
return false;
char header[4];
stream->read(header, 4);
- //check header?
+ // check header?
Common::StackLock lock(_mutex);
// Load the samples
sampleCount = stream->readByte();
- debug(0, "sampleCount = %d", sampleCount);
+ debugC(0, kDebugMusic, "sampleCount = %d", sampleCount);
for (byte currSample = 0; currSample < sampleCount; currSample++) {
byte sample = stream->readByte();
// Load the sample data
- byte sampleResource = ((sample >> 4) & 0x0F) * 10 + (sample & 0x0F);
- debug(0, "currSample = %d, sample = 0x%02x, resource: %d", currSample, sample, sampleResource);
- uint32 sampleSize = res->sam_mmm.getSize(sampleResource);
+ byte sampleResource = ((sample >> 4) & 0x0f) * 10 + (sample & 0x0f);
+ debugC(0, kDebugMusic, "currSample = %d, sample = 0x%02x, resource: %d", currSample, sample, sampleResource);
+ uint32 sampleSize = _vm->res->sam_mmm.getSize(sampleResource);
if (sampleSize == 0) {
warning("load: invalid sample %d (0x%02x)", sample, sample);
_samples[sample].clear();
@@ -71,7 +72,7 @@ bool MusicPlayer::load(int id) {
}
_samples[sample].resize(sampleSize);
- res->sam_mmm.read(sampleResource, _samples[sample].data, sampleSize);
+ _vm->res->sam_mmm.read(sampleResource, _samples[sample].data, sampleSize);
}
// Load the music data
@@ -87,17 +88,17 @@ bool MusicPlayer::load(int id) {
row.channels[1].note = stream->readByte();
row.channels[2].note = stream->readByte();
_rows.push_back(row);
- } else if ((cmd & 0xF0) == 0x50) {
+ } else if ((cmd & 0xf0) == 0x50) {
byte sample = stream->readByte();
- //debug(1, "%02x: set sample %02x", cmd, sample);
- row.channels[(cmd & 0x0F) - 1].sample = sample;
- } else if ((cmd & 0xF0) == 0x40) {
+ debugC(1, kDebugMusic, "%02x: set sample %02x", cmd, sample);
+ row.channels[(cmd & 0x0f) - 1].sample = sample;
+ } else if ((cmd & 0xf0) == 0x40) {
byte vol = stream->readByte();
- //debug(1, "%02x: set volume %02x -> %02x", cmd, row.channels[(cmd & 0x0F) - 1].volume, vol);
- //channel volume 0x40 * music volume 0x40 mixed with high bytes
- row.channels[(cmd & 0x0F) - 1].volume = vol * 16;
+ debugC(1, kDebugMusic, "%02x: set volume %02x -> %02x", cmd, row.channels[(cmd & 0x0f) - 1].volume, vol);
+ // channel volume 0x40 * music volume 0x40 mixed with high bytes
+ row.channels[(cmd & 0x0f) - 1].volume = vol * 16;
} else {
- debug(0, "unhandled music command %02x", cmd);
+ debugC(0, kDebugMusic, "unhandled music command %02x", cmd);
}
}
_currRow = 0;
@@ -124,13 +125,13 @@ void MusicPlayer::interrupt() {
for (int chn = 0; chn < 3; ++chn) {
setChannelVolume(chn, row->channels[chn].volume);
- //debug(0, "row->channels[%d].volume = %d", chn, row->channels[chn].volume);
+ debugC(2, kDebugMusic, "row->channels[%d].volume = %d", chn, row->channels[chn].volume);
byte sample = (row->channels[chn].sample);
if (row->channels[chn].note != 0 && sample != 0) {
- //debug(0, "row->channels[%d].note = %d", chn, row->channels[chn].note);
- //debug(0, "row->channels[%d].sample = %d", chn, row->channels[chn].sample);
+ debugC(2, kDebugMusic, "row->channels[%d].note = %d", chn, row->channels[chn].note);
+ debugC(2, kDebugMusic, "row->channels[%d].sample = %d", chn, row->channels[chn].sample);
byte note = row->channels[chn].note;
if (_samples[sample].size == 0) {
@@ -139,11 +140,11 @@ void MusicPlayer::interrupt() {
}
setChannelData(chn, (const int8 *)_samples[sample].data, NULL, _samples[sample].size, 0);
- setChannelPeriod(chn, noteToPeriod[((note >> 4) & 0x0F) - 1][(note & 0x0F)]);
+ setChannelPeriod(chn, noteToPeriod[((note >> 4) & 0x0f) - 1][(note & 0x0f)]);
}
}
- //debug(0, "------------------------------------------------");
+ debugC(2, kDebugMusic, "------------------------------------------------");
++_currRow;
}
diff --git a/engines/teenagent/music.h b/engines/teenagent/music.h
index 22b4fa5e8e..408436cf3a 100644
--- a/engines/teenagent/music.h
+++ b/engines/teenagent/music.h
@@ -28,10 +28,11 @@
namespace TeenAgent {
+class TeenAgentEngine;
+
class MusicPlayer : public Audio::Paula {
public:
-
- MusicPlayer();
+ MusicPlayer(TeenAgentEngine *vm);
~MusicPlayer();
bool load(int id);
@@ -41,6 +42,8 @@ public:
void stop();
private:
+ TeenAgentEngine *_vm;
+
int _id;
struct Row {
diff --git a/engines/teenagent/notes.txt b/engines/teenagent/notes.txt
new file mode 100644
index 0000000000..e8c9104808
--- /dev/null
+++ b/engines/teenagent/notes.txt
@@ -0,0 +1,109 @@
+// Dialog #0: Offset 0x0000
+// Dialog #1: Offset 0x01b4
+// Dialog #2: Offset 0x046f
+// Dialog #3: Offset 0x07cb
+// Dialog #4: Offset 0x0901
+
+// Dialog #6: Offset 0x0936
+// Dialog #7: Offset 0x0a02
+// Dialog #8: Offset 0x0a2d
+
+// Dialog #13: Offset 0x0c43
+// Dialog #14: Offset 0x0d75
+// Dialog #15: Offset 0x0f0e
+// Dialog #16: Offset 0x0fb8
+
+// Dialog #18: Offset 0x10db
+// Dialog #19: Offset 0x11ac
+// Dialog #20: Offset 0x12d9
+// Dialog #21: Offset 0x1468
+// Dialog #22: Offset 0x1485
+// Dialog #23: Offset 0x1528
+
+// Dialog #25: Offset 0x16de
+// Dialog #26: Offset 0x1726
+// Dialog #27: Offset 0x1752
+// Dialog #28: Offset 0x178c
+// Dialog #29: Offset 0x1913
+// Dialog #30: Offset 0x1a3e
+// Dialog #31: Offset 0x1a63
+// Dialog #32: Offset 0x1a84
+// Dialog #33: Offset 0x1ac9
+// Dialog #34: Offset 0x1af7
+// Dialog #35: Offset 0x1b27
+// Dialog #36: Offset 0x1b4a
+
+// Dialog #39: Offset 0x1c97
+// Dialog #40: Offset 0x1cec
+// Dialog #41: Offset 0x1d2c
+// Dialog #42: Offset 0x1dd8
+
+// Dialog #48: Offset 0x2041
+// Dialog #49: Offset 0x215f
+
+// Dialog #58: Offset 0x2582
+// Dialog #59: Offset 0x25fe
+
+// Dialog #61: Offset 0x280a
+
+// Dialog #65: Offset 0x2b6f
+// Dialog #66: Offset 0x2bb2
+// Dialog #67: Offset 0x2bdd
+// Dialog #68: Offset 0x2c5d
+// Dialog #69: Offset 0x2c9b
+
+// Dialog #78: Offset 0x3102
+// Dialog #79: Offset 0x311b
+// Dialog #80: Offset 0x3137
+// Dialog #81: Offset 0x316f
+// Dialog #82: Offset 0x317d
+// Dialog #83: Offset 0x3215
+
+// Dialog #101: Offset 0x3e41
+// Dialog #102: Offset 0x3ea3
+// Dialog #103: Offset 0x3f08
+// Dialog #104: Offset 0x3fea
+// Dialog #105: Offset 0x400d
+// Dialog #106: Offset 0x4439
+// Dialog #107: Offset 0x446a
+
+// Dialog #131: Offset 0x58e2
+// Dialog #132: Offset 0x59c5
+// Dialog #133: Offset 0x5a9d
+// Dialog #134: Offset 0x5ad7
+// Dialog #135: Offset 0x5af3
+// Dialog #136: Offset 0x5ba9
+// Dialog #137: Offset 0x5c53
+// Dialog #138: Offset 0x5c99
+// Dialog #139: Offset 0x5d3e
+// Dialog #140: Offset 0x5d5b
+// Dialog #141: Offset 0x5f0a
+// Dialog #142: Offset 0x5fae
+// Dialog #143: Offset 0x5fcf
+
+// Dialog #145: Offset 0x5ffe
+// Dialog #146: Offset 0x6088
+
+// Dialog #151: Offset 0x62f0
+// Dialog #152: Offset 0x6318
+// Dialog #153: Offset 0x6347
+// Dialog #154: Offset 0x636b
+// Dialog #155: Offset 0x6382
+
+// Dialog #158: Offset 0x64fc
+// Dialog #159: Offset 0x654c
+// Dialog #160: Offset 0x65ab
+
+// Dialog #169: Offset 0x6bf7
+// Dialog #170: Offset 0x6d7f
+// Dialog #171: Offset 0x6e7b
+// Dialog #172: Offset 0x6ea4
+// Dialog #173: Offset 0x6ec0
+// Dialog #174: Offset 0x6ee9
+// Dialog #175: Offset 0x6f03
+
+// Dialog #187: Offset 0x735e
+// Dialog #188: Offset 0x73b3
+// Dialog #189: Offset 0x73e8
+// Dialog #190: Offset 0x7405
+// Dialog #191: Offset 0x7459 \ No newline at end of file
diff --git a/engines/teenagent/objects.cpp b/engines/teenagent/objects.cpp
index 748f342d54..72a4ce92a9 100644
--- a/engines/teenagent/objects.cpp
+++ b/engines/teenagent/objects.cpp
@@ -21,8 +21,10 @@
#include "common/debug.h"
#include "common/memstream.h"
+
#include "teenagent/objects.h"
#include "teenagent/resources.h"
+#include "teenagent/teenagent.h"
namespace TeenAgent {
@@ -84,7 +86,7 @@ void Object::setName(const Common::String &new_name) {
}
void Object::dump(int level) const {
- debug(level, "object: %u %u [%u,%u,%u,%u], actor: [%u,%u,%u,%u], orientation: %u, name: %s", id, enabled,
+ debugC(level, kDebugObject, "object: %u %u [%u,%u,%u,%u], actor: [%u,%u,%u,%u], orientation: %u, name: %s", id, enabled,
rect.left, rect.top, rect.right, rect.bottom,
actor_rect.left, actor_rect.top, actor_rect.right, actor_rect.bottom,
actor_orientation, name.c_str()
@@ -101,7 +103,7 @@ Common::String Object::parse_description(const char *name) {
while (*desc != 1 && *desc != 0) {
Common::String line;
while (*desc != 1 && *desc != 0) {
- //debug(0, "%02x ", *desc);
+ debugC(2, kDebugObject, "%02x ", *desc);
line += *desc++;
}
@@ -138,14 +140,14 @@ void UseHotspot::load(byte *src) {
}
void UseHotspot::dump(int level) const {
- debug(level,
+ debugC(level, kDebugObject,
"hotspot: inv_id: %02x, obj_id: %02x, orientation?: %02x, actor position: (%d,%d), callback: %04x",
inventory_id, object_id, orientation, actor_x, actor_y, callback
);
}
void Walkbox::dump(int level) const {
- debug(level, "walkbox %02x %02x [%d, %d, %d, %d] top: %u, right: %u, bottom: %u, left: %u",
+ debugC(level, kDebugObject, "walkbox %02x %02x [%d, %d, %d, %d] top: %u, right: %u, bottom: %u, left: %u",
type, orientation,
rect.left, rect.top, rect.right, rect.bottom,
side_hint[0], side_hint[1], side_hint[2], side_hint[3]);
diff --git a/engines/teenagent/objects.h b/engines/teenagent/objects.h
index 555287fc56..fe423a9d75 100644
--- a/engines/teenagent/objects.h
+++ b/engines/teenagent/objects.h
@@ -26,6 +26,8 @@
#include "common/rect.h"
#include "graphics/surface.h"
+#include "teenagent/teenagent.h"
+
namespace TeenAgent {
enum {kActorUp = 1, kActorRight = 2, kActorDown = 3, kActorLeft = 4 };
@@ -52,7 +54,7 @@ struct Rect {
void render(Graphics::Surface *surface, uint8 color) const;
void dump(int level = 0) const {
- debug(level, "rect[%u, %u, %u, %u]", left, top, right, bottom);
+ debugC(level, kDebugObject, "rect[%u, %u, %u, %u]", left, top, right, bottom);
}
inline void clear() {
diff --git a/engines/teenagent/pack.cpp b/engines/teenagent/pack.cpp
index 5302e2eceb..2e6c913a72 100644
--- a/engines/teenagent/pack.cpp
+++ b/engines/teenagent/pack.cpp
@@ -20,6 +20,8 @@
*/
#include "teenagent/pack.h"
+#include "teenagent/teenagent.h"
+
#include "common/util.h"
#include "common/debug.h"
#include "common/memstream.h"
@@ -44,7 +46,7 @@ bool FilePack::open(const Common::String &filename) {
return false;
_fileCount = file.readUint32LE();
- debug(0, "opened %s, found %u entries", filename.c_str(), _fileCount);
+ debugC(0, kDebugPack, "opened %s, found %u entries", filename.c_str(), _fileCount);
offsets = new uint32[_fileCount + 1];
for (uint32 i = 0; i <= _fileCount; ++i) {
offsets[i] = file.readUint32LE();
@@ -65,18 +67,17 @@ uint32 FilePack::read(uint32 id, byte *dst, uint32 size) const {
file.seek(offsets[id - 1]);
uint32 rsize = offsets[id] - offsets[id - 1];
uint32 r = file.read(dst, MIN(rsize, size));
- //debug(0, "read(%u, %u) = %u", id, size, r);
+ debugC(0, kDebugPack, "read(%u, %u) = %u", id, size, r);
return r;
}
Common::SeekableReadStream *FilePack::getStream(uint32 id) const {
if (id < 1 || id > _fileCount)
return NULL;
- //debug(0, "stream: %04x-%04x", offsets[id - 1], offsets[id]);
+ debugC(0, kDebugPack, "stream: %04x-%04x", offsets[id - 1], offsets[id]);
return new Common::SeekableSubReadStream(&file, offsets[id - 1], offsets[id]);
}
-
TransientFilePack::TransientFilePack() : offsets(0) {}
TransientFilePack::~TransientFilePack() {
@@ -97,7 +98,7 @@ bool TransientFilePack::open(const Common::String &filename) {
return false;
_fileCount = file.readUint32LE();
- debug(0, "opened %s, found %u entries", filename.c_str(), _fileCount);
+ debugC(0, kDebugPack, "opened %s, found %u entries", filename.c_str(), _fileCount);
offsets = new uint32[_fileCount + 1];
for (uint32 i = 0; i <= _fileCount; ++i) {
offsets[i] = file.readUint32LE();
@@ -124,14 +125,14 @@ uint32 TransientFilePack::read(uint32 id, byte *dst, uint32 size) const {
uint32 rsize = offsets[id] - offsets[id - 1];
uint32 r = file.read(dst, MIN(rsize, size));
file.close();
- //debug(0, "read(%u, %u) = %u", id, size, r);
+ debugC(0, kDebugPack, "read(%u, %u) = %u", id, size, r);
return r;
}
Common::SeekableReadStream *TransientFilePack::getStream(uint32 id) const {
if (id < 1 || id > _fileCount)
return NULL;
- //debug(0, "stream: %04x-%04x", offsets[id - 1], offsets[id]);
+ debugC(0, kDebugPack, "stream: %04x-%04x", offsets[id - 1], offsets[id]);
Common::File file;
if (!file.open(_filename))
return NULL;
@@ -146,7 +147,6 @@ Common::SeekableReadStream *TransientFilePack::getStream(uint32 id) const {
return new Common::MemoryReadStream(ptr, r, DisposeAfterUse::YES);
}
-
void MemoryPack::close() {
chunks.clear();
}
@@ -157,7 +157,7 @@ bool MemoryPack::open(const Common::String &filename) {
return false;
uint32 count = file.readUint32LE();
- debug(0, "opened %s, found %u entries [memory]", filename.c_str(), count);
+ debugC(0, kDebugPack, "opened %s, found %u entries [memory]", filename.c_str(), count);
for (uint32 i = 0; i < count; ++i) {
uint32 offset = file.readUint32LE();
int32 pos = file.pos();
@@ -199,5 +199,4 @@ Common::SeekableReadStream *MemoryPack::getStream(uint32 id) const {
return new Common::MemoryReadStream(c.data, c.size, DisposeAfterUse::NO);
}
-
} // End of namespace TeenAgent
diff --git a/engines/teenagent/resources.cpp b/engines/teenagent/resources.cpp
index dff58f98e2..bd09b08522 100644
--- a/engines/teenagent/resources.cpp
+++ b/engines/teenagent/resources.cpp
@@ -27,13 +27,6 @@
namespace TeenAgent {
-Resources::Resources() {}
-
-Resources *Resources::instance() {
- static Resources i;
- return &i;
-}
-
void Resources::deinit() {
off.close();
on.close();
@@ -61,6 +54,36 @@ quick note on varia resources:
11: quit shareware
*/
+#define CSEG_SIZE 46000 // 0xb3b0
+#define DSEG_SIZE 59280 // 0xe790
+#define ESEG_SIZE 35810 // 0x8be2
+
+void Resources::precomputeDialogOffsets() {
+ dialogOffsets.push_back(0);
+ int n = 0;
+ uint8 current, last = 0xff;
+ for (uint i = 0; i < eseg.size(); i++) {
+ current = eseg.get_byte(i);
+
+ if (n == 4) {
+ dialogOffsets.push_back(i);
+ n = 0;
+ }
+
+ if (current != 0x00 && last == 0x00)
+ n = 0;
+
+ if (current == 0x00)
+ n++;
+
+ last = current;
+ }
+
+ debug(1, "Resources::precomputeDialogOffsets() - Found %d dialogs", dialogOffsets.size());
+ for (uint i = 0; i < dialogOffsets.size(); i++)
+ debug(1, "\tDialog #%d: Offset 0x%04x", i, dialogOffsets[i]);
+}
+
bool Resources::loadArchives(const ADGameDescription *gd) {
Common::File *dat_file = new Common::File();
if (!dat_file->open("teenagent.dat")) {
@@ -93,11 +116,13 @@ bool Resources::loadArchives(const ADGameDescription *gd) {
}
#endif
- cseg.read(dat, 0xb3b0);
- dseg.read(dat, 0xe790);
- eseg.read(dat, 0x8be2);
+ cseg.read(dat, CSEG_SIZE);
+ dseg.read(dat, DSEG_SIZE);
+ eseg.read(dat, ESEG_SIZE);
delete dat;
+ precomputeDialogOffsets();
+
FilePack varia;
varia.open("varia.res");
font7.load(varia, 7);
@@ -150,13 +175,13 @@ Common::SeekableReadStream *Resources::loadLan000(uint32 id) const {
switch (id) {
case 81:
- if (dseg.get_byte(0xDBAD))
+ if (dseg.get_byte(0xdbad))
return lan500.getStream(160);
break;
case 137:
- if (dseg.get_byte(0xDBC5) == 1) {
- if (dseg.get_byte(0xDBC6) == 1)
+ if (dseg.get_byte(0xdbc5) == 1) {
+ if (dseg.get_byte(0xdbc6) == 1)
return lan500.getStream(203);
else
return lan500.getStream(202);
@@ -164,7 +189,7 @@ Common::SeekableReadStream *Resources::loadLan000(uint32 id) const {
break;
case 25:
- if (dseg.get_byte(0xDBDF) == 2) {
+ if (dseg.get_byte(0xdbdf) == 2) {
return lan500.getStream(332);
}
break;
@@ -178,17 +203,17 @@ Common::SeekableReadStream *Resources::loadLan000(uint32 id) const {
break;
case 29:
- if (dseg.get_byte(0xDBE7) == 1) {
+ if (dseg.get_byte(0xdbe7) == 1) {
return lan500.getStream(380);
}
case 30:
- if (dseg.get_byte(0xDBE7) == 1) {
+ if (dseg.get_byte(0xdbe7) == 1) {
return lan500.getStream(381);
}
case 42:
- if (dseg.get_byte(0xDBEC) == 1) {
+ if (dseg.get_byte(0xdbec) == 1) {
return lan500.getStream(400);
}
}
diff --git a/engines/teenagent/resources.h b/engines/teenagent/resources.h
index 5c08a46489..e1540f8500 100644
--- a/engines/teenagent/resources.h
+++ b/engines/teenagent/resources.h
@@ -31,18 +31,30 @@ struct ADGameDescription;
namespace TeenAgent {
+// Code Segment Addresses
+// Intro function : 0x024c
+const uint16 csAddr_intro = 0x024c;
+// Display Message function : 0xa055
+const uint16 csAddr_displayMsg = 0xa055;
+// Reject Message function : 0xa4d6
+const uint16 csAddr_rejectMsg = 0xa4d6;
+
+// Data Segment Addresses
+// Reject Messages Address Pointers : (4 * 2-byte) = 0x339e to 0x33a5
+const uint16 dsAddr_rejectMsg = 0x339e;
+
+// Save State Region : 0x6478 to 0xdbf1
+const uint16 dsAddr_saveState = 0x6478;
+const uint16 saveStateSize = 0x777a;
+
class Resources {
-protected:
- Resources();
public:
- static Resources *instance();
- bool loadArchives(const ADGameDescription *gd);
void deinit();
+ bool loadArchives(const ADGameDescription *gd);
+
void loadOff(Graphics::Surface &surface, byte *palette, int id);
Common::SeekableReadStream *loadLan(uint32 id) const;
Common::SeekableReadStream *loadLan000(uint32 id) const;
- //void loadOn(Graphics::Surface &surface, int id, uint16 &dst, uint16 *flags);
- //void loadOns(Graphics::Surface &surface, int id, uint16 &dst);
/*
* PSP (as the other sony playstation consoles - to be confirmed and 'ifdef'ed here too)
@@ -56,8 +68,17 @@ public:
FilePack off, on, ons, lan000, lan500, sam_mmm, sam_sam, mmm, voices;
#endif
- Segment cseg, dseg, eseg;
+ Segment cseg, dseg;
Font font7, font8;
+
+ //const byte *getDialog(uint16 dialogNum) { return eseg.ptr(dialogOffsets[dialogNum]); }
+ uint16 getDialogAddr(uint16 dialogNum) { return dialogOffsets[dialogNum]; }
+
+ Segment eseg;
+private:
+ void precomputeDialogOffsets();
+
+ Common::Array<uint16> dialogOffsets;
};
} // End of namespace TeenAgent
diff --git a/engines/teenagent/scene.cpp b/engines/teenagent/scene.cpp
index 038c8ea05e..fdb0acb59d 100644
--- a/engines/teenagent/scene.cpp
+++ b/engines/teenagent/scene.cpp
@@ -21,6 +21,7 @@
#include "common/config-manager.h"
#include "common/debug.h"
+#include "common/events.h"
#include "common/algorithm.h"
#include "common/ptr.h"
#include "common/textconsole.h"
@@ -28,23 +29,22 @@
#include "graphics/palette.h"
#include "teenagent/scene.h"
+#include "teenagent/inventory.h"
#include "teenagent/resources.h"
#include "teenagent/surface.h"
#include "teenagent/objects.h"
#include "teenagent/teenagent.h"
-#include "teenagent/dialog.h"
#include "teenagent/music.h"
namespace TeenAgent {
-Scene::Scene(TeenAgentEngine *engine, OSystem *system) : intro(false), _id(0), ons(0),
- orientation(kActorRight), actor_talking(false),
+Scene::Scene(TeenAgentEngine *vm) : _vm(vm), intro(false), _id(0), ons(0),
+ orientation(kActorRight), actor_talking(false), teenagent(vm), teenagent_idle(vm),
message_timer(0), message_first_frame(0), message_last_frame(0), message_animation(NULL),
current_event(SceneEvent::kNone), hide_actor(false), callback(0), callback_timer(0), _idle_timer(0) {
- _engine = engine;
- _system = system;
_fade_timer = 0;
+ _fadeOld = 0;
on_enabled = true;
memset(palette, 0, sizeof(palette));
@@ -94,7 +94,7 @@ bool Scene::findPath(Scene::Path &p, const Common::Point &src, const Common::Poi
if (dst.x < 0 || dst.x > 319 || dst.y < 0 || dst.y > 199)
return false;
- debug(1, "findPath %d,%d -> %d,%d", src.x, src.y, dst.x, dst.y);
+ debugC(1, kDebugScene, "findPath %d,%d -> %d,%d", src.x, src.y, dst.x, dst.y);
p.clear();
p.push_back(src);
p.push_back(dst);
@@ -113,7 +113,7 @@ bool Scene::findPath(Scene::Path &p, const Common::Point &src, const Common::Poi
break;
const Common::Point &p1 = *i, &p2 = *next;
- debug(1, "%d,%d -> %d,%d", p1.x, p1.y, p2.x, p2.y);
+ debugC(1, kDebugScene, "%d,%d -> %d,%d", p1.x, p1.y, p2.x, p2.y);
Common::List<uint>::iterator wi;
for (wi = boxes.begin(); wi != boxes.end(); ++wi) {
@@ -124,14 +124,14 @@ bool Scene::findPath(Scene::Path &p, const Common::Point &src, const Common::Poi
}
w.dump(1);
- debug(1, "%u: intersection mask 0x%04x, searching hints", *wi, mask);
+ debugC(1, kDebugScene, "%u: intersection mask 0x%04x, searching hints", *wi, mask);
int dx = p2.x - p1.x, dy = p2.y - p1.y;
if (dx >= 0) {
if ((mask & 8) != 0 && w.side_hint[3] != 0) {
- debug(1, "hint left: %u", w.side_hint[3]);
+ debugC(1, kDebugScene, "hint left: %u", w.side_hint[3]);
Common::Point w1, w2;
w.rect.side(w1, w2, w.side_hint[3], p1);
- debug(1, "hint: %d,%d-%d,%d", w1.x, w1.y, w2.x, w2.y);
+ debugC(1, kDebugScene, "hint: %d,%d-%d,%d", w1.x, w1.y, w2.x, w2.y);
p.insert(next, w1);
if (mask & 2)
p.insert(next, w2);
@@ -140,10 +140,10 @@ bool Scene::findPath(Scene::Path &p, const Common::Point &src, const Common::Poi
}
} else {
if ((mask & 2) != 0 && w.side_hint[1] != 0) {
- debug(1, "hint right: %u", w.side_hint[1]);
+ debugC(1, kDebugScene, "hint right: %u", w.side_hint[1]);
Common::Point w1, w2;
w.rect.side(w1, w2, w.side_hint[1], p1);
- debug(1, "hint: %d,%d-%d,%d", w1.x, w1.y, w2.x, w2.y);
+ debugC(1, kDebugScene, "hint: %d,%d-%d,%d", w1.x, w1.y, w2.x, w2.y);
p.insert(next, w1);
if (mask & 8)
p.insert(next, w2);
@@ -154,10 +154,10 @@ bool Scene::findPath(Scene::Path &p, const Common::Point &src, const Common::Poi
if (dy >= 0) {
if ((mask & 1) != 0 && w.side_hint[0] != 0) {
- debug(1, "hint top: %u", w.side_hint[0]);
+ debugC(1, kDebugScene, "hint top: %u", w.side_hint[0]);
Common::Point w1, w2;
w.rect.side(w1, w2, w.side_hint[0], p1);
- debug(1, "hint: %d,%d-%d,%d", w1.x, w1.y, w2.x, w2.y);
+ debugC(1, kDebugScene, "hint: %d,%d-%d,%d", w1.x, w1.y, w2.x, w2.y);
p.insert(next, w1);
if (mask & 4)
p.insert(next, w2);
@@ -166,10 +166,10 @@ bool Scene::findPath(Scene::Path &p, const Common::Point &src, const Common::Poi
}
} else {
if ((mask & 4) != 0 && w.side_hint[2] != 0) {
- debug(1, "hint bottom: %u", w.side_hint[2]);
+ debugC(1, kDebugScene, "hint bottom: %u", w.side_hint[2]);
Common::Point w1, w2;
w.rect.side(w1, w2, w.side_hint[2], p1);
- debug(1, "hint: %d,%d-%d,%d", w1.x, w1.y, w2.x, w2.y);
+ debugC(1, kDebugScene, "hint: %d,%d-%d,%d", w1.x, w1.y, w2.x, w2.y);
p.insert(next, w1);
if (mask & 1)
p.insert(next, w2);
@@ -187,13 +187,13 @@ bool Scene::findPath(Scene::Path &p, const Common::Point &src, const Common::Poi
void Scene::moveTo(const Common::Point &_point, byte orient, bool validate) {
Common::Point point(_point);
- debug(0, "moveTo(%d, %d, %u)", point.x, point.y, orient);
+ debugC(0, kDebugScene, "moveTo(%d, %d, %u)", point.x, point.y, orient);
const Common::Array<Walkbox> &scene_walkboxes = walkboxes[_id - 1];
for (byte i = 0; i < scene_walkboxes.size(); ++i) {
const Walkbox &w = scene_walkboxes[i];
if (w.rect.in(point)) {
- debug(0, "bumped into walkbox %u", i);
+ debugC(0, kDebugScene, "bumped into walkbox %u", i);
w.dump();
byte o = w.orientation;
switch (o) {
@@ -229,7 +229,7 @@ void Scene::moveTo(const Common::Point &_point, byte orient, bool validate) {
}
if (!findPath(path, position, point)) {
- _engine->cancel();
+ _vm->cancel();
return;
}
@@ -237,8 +237,6 @@ void Scene::moveTo(const Common::Point &_point, byte orient, bool validate) {
}
void Scene::loadObjectData() {
- Resources *res = Resources::instance();
-
//loading objects & walkboxes
objects.resize(42);
walkboxes.resize(42);
@@ -248,20 +246,20 @@ void Scene::loadObjectData() {
Common::Array<Object> &scene_objects = objects[i];
scene_objects.clear();
- uint16 scene_table = res->dseg.get_word(0x7254 + i * 2);
+ uint16 scene_table = _vm->res->dseg.get_word(0x7254 + i * 2);
uint16 object_addr;
- while ((object_addr = res->dseg.get_word(scene_table)) != 0) {
+ while ((object_addr = _vm->res->dseg.get_word(scene_table)) != 0) {
Object obj;
- obj.load(res->dseg.ptr(object_addr));
+ obj.load(_vm->res->dseg.ptr(object_addr));
//obj.dump();
scene_objects.push_back(obj);
scene_table += 2;
}
- debug(0, "scene[%u] has %u object(s)", i + 1, scene_objects.size());
+ debugC(0, kDebugScene, "scene[%u] has %u object(s)", i + 1, scene_objects.size());
- byte *walkboxes_base = res->dseg.ptr(READ_LE_UINT16(res->dseg.ptr(0x6746 + i * 2)));
+ byte *walkboxes_base = _vm->res->dseg.ptr(READ_LE_UINT16(_vm->res->dseg.ptr(0x6746 + i * 2)));
byte walkboxes_n = *walkboxes_base++;
- debug(0, "scene[%u] has %u walkboxes", i + 1, walkboxes_n);
+ debugC(0, kDebugScene, "scene[%u] has %u walkboxes", i + 1, walkboxes_n);
Common::Array<Walkbox> &scene_walkboxes = walkboxes[i];
for (byte j = 0; j < walkboxes_n; ++j) {
@@ -277,7 +275,7 @@ void Scene::loadObjectData() {
scene_walkboxes.push_back(w);
}
- byte *fade_table = res->dseg.ptr(res->dseg.get_word(0x663e + i * 2));
+ byte *fade_table = _vm->res->dseg.ptr(_vm->res->dseg.get_word(0x663e + i * 2));
Common::Array<FadeType> &scene_fades = fades[i];
while (READ_LE_UINT16(fade_table) != 0xffff) {
FadeType fade;
@@ -285,7 +283,7 @@ void Scene::loadObjectData() {
fade_table += 9;
scene_fades.push_back(fade);
}
- debug(0, "scene[%u] has %u fadeboxes", i + 1, scene_fades.size());
+ debugC(0, kDebugScene, "scene[%u] has %u fadeboxes", i + 1, scene_fades.size());
}
}
@@ -304,27 +302,24 @@ Object *Scene::findObject(const Common::Point &point) {
}
byte *Scene::getOns(int id) {
- Resources *res = Resources::instance();
- return res->dseg.ptr(res->dseg.get_word(0xb4f5 + (id - 1) * 2));
+ return _vm->res->dseg.ptr(_vm->res->dseg.get_word(0xb4f5 + (id - 1) * 2));
}
byte *Scene::getLans(int id) {
- Resources *res = Resources::instance();
- return res->dseg.ptr(0xd89e + (id - 1) * 4);
+ return _vm->res->dseg.ptr(0xd89e + (id - 1) * 4);
}
void Scene::loadOns() {
- debug(0, "loading ons animation");
- Resources *res = Resources::instance();
+ debugC(0, kDebugScene, "loading ons animation");
- uint16 addr = res->dseg.get_word(0xb4f5 + (_id - 1) * 2);
- //debug(0, "ons index: %04x", addr);
+ uint16 addr = _vm->res->dseg.get_word(0xb4f5 + (_id - 1) * 2);
+ debugC(0, kDebugScene, "ons index: %04x", addr);
ons_count = 0;
byte b;
byte on_id[16];
- while ((b = res->dseg.get_byte(addr)) != 0xff) {
- debug(0, "on: %04x = %02x", addr, b);
+ while ((b = _vm->res->dseg.get_byte(addr)) != 0xff) {
+ debugC(0, kDebugScene, "on: %04x = %02x", addr, b);
++addr;
if (b == 0)
continue;
@@ -338,7 +333,7 @@ void Scene::loadOns() {
if (ons_count > 0) {
ons = new Surface[ons_count];
for (uint32 i = 0; i < ons_count; ++i) {
- Common::ScopedPtr<Common::SeekableReadStream> s(res->ons.getStream(on_id[i]));
+ Common::ScopedPtr<Common::SeekableReadStream> s(_vm->res->ons.getStream(on_id[i]));
if (s) {
ons[i].load(*s, Surface::kTypeOns);
}
@@ -347,21 +342,20 @@ void Scene::loadOns() {
}
void Scene::loadLans() {
- debug(0, "loading lans animation");
- Resources *res = Resources::instance();
- //load lan000
+ debugC(0, kDebugScene, "loading lans animation");
+ // load lan000
for (byte i = 0; i < 4; ++i) {
animation[i].free();
uint16 bx = 0xd89e + (_id - 1) * 4 + i;
- byte bxv = res->dseg.get_byte(bx);
+ byte bxv = _vm->res->dseg.get_byte(bx);
uint16 res_id = 4 * (_id - 1) + i + 1;
- debug(0, "lan[%u]@%04x = %02x, resource id: %u", i, bx, bxv, res_id);
+ debugC(0, kDebugScene, "lan[%u]@%04x = %02x, resource id: %u", i, bx, bxv, res_id);
if (bxv == 0)
continue;
- Common::ScopedPtr<Common::SeekableReadStream> s(res->loadLan000(res_id));
+ Common::ScopedPtr<Common::SeekableReadStream> s(_vm->res->loadLan000(res_id));
if (s) {
animation[i].load(*s, Animation::kTypeLan);
if (bxv != 0 && bxv != 0xff)
@@ -371,7 +365,7 @@ void Scene::loadLans() {
}
void Scene::init(int id, const Common::Point &pos) {
- debug(0, "init(%d)", id);
+ debugC(0, kDebugScene, "init(%d)", id);
_id = id;
on_enabled = true; //reset on-rendering flag on loading.
sounds.clear();
@@ -383,12 +377,11 @@ void Scene::init(int id, const Common::Point &pos) {
warp(pos);
- Resources *res = Resources::instance();
- res->loadOff(background, palette, id);
+ _vm->res->loadOff(background, palette, id);
if (id == 24) {
- //dark scene
- if (res->dseg.get_byte(0xDBA4) != 1) {
- //dim down palette
+ // ark scene
+ if (_vm->res->dseg.get_byte(0xdba4) != 1) {
+ // dim down palette
uint i;
for (i = 0; i < 624; ++i) {
palette[i] = palette[i] > 0x20 ? palette[i] - 0x20 : 0;
@@ -399,10 +392,10 @@ void Scene::init(int id, const Common::Point &pos) {
}
}
- Common::ScopedPtr<Common::SeekableReadStream> stream(res->on.getStream(id));
+ Common::ScopedPtr<Common::SeekableReadStream> stream(_vm->res->on.getStream(id));
int sub_hack = 0;
- if (id == 7) { //something patched in the captains room
- switch (res->dseg.get_byte(0xdbe6)) {
+ if (id == 7) { // something patched in the captains room
+ switch (_vm->res->dseg.get_byte(0xdbe6)) {
case 2:
break;
case 1:
@@ -417,20 +410,20 @@ void Scene::init(int id, const Common::Point &pos) {
loadOns();
loadLans();
- //check music
- int now_playing = _engine->music->getId();
+ // check music
+ int now_playing = _vm->music->getId();
- if (now_playing != res->dseg.get_byte(0xDB90))
- _engine->music->load(res->dseg.get_byte(0xDB90));
+ if (now_playing != _vm->res->dseg.get_byte(0xdb90))
+ _vm->music->load(_vm->res->dseg.get_byte(0xdb90));
- _system->copyRectToScreen(background.pixels, background.pitch, 0, 0, background.w, background.h);
+ _vm->_system->copyRectToScreen(background.pixels, background.pitch, 0, 0, background.w, background.h);
setPalette(0);
}
void Scene::playAnimation(byte idx, uint id, bool loop, bool paused, bool ignore) {
- debug(0, "playAnimation(%u, %u, loop:%s, paused:%s, ignore:%s)", idx, id, loop ? "true" : "false", paused ? "true" : "false", ignore ? "true" : "false");
+ debugC(0, kDebugScene, "playAnimation(%u, %u, loop:%s, paused:%s, ignore:%s)", idx, id, loop ? "true" : "false", paused ? "true" : "false", ignore ? "true" : "false");
assert(idx < 4);
- Common::ScopedPtr<Common::SeekableReadStream> s(Resources::instance()->loadLan(id + 1));
+ Common::ScopedPtr<Common::SeekableReadStream> s(_vm->res->loadLan(id + 1));
if (!s)
error("playing animation %u failed", id);
@@ -441,8 +434,8 @@ void Scene::playAnimation(byte idx, uint id, bool loop, bool paused, bool ignore
}
void Scene::playActorAnimation(uint id, bool loop, bool ignore) {
- debug(0, "playActorAnimation(%u, loop:%s, ignore:%s)", id, loop ? "true" : "false", ignore ? "true" : "false");
- Common::ScopedPtr<Common::SeekableReadStream> s(Resources::instance()->loadLan(id + 1));
+ debugC(0, kDebugScene, "playActorAnimation(%u, loop:%s, ignore:%s)", id, loop ? "true" : "false", ignore ? "true" : "false");
+ Common::ScopedPtr<Common::SeekableReadStream> s(_vm->res->loadLan(id + 1));
if (!s)
error("playing animation %u failed", id);
@@ -463,17 +456,17 @@ byte Scene::peekFlagEvent(uint16 addr) const {
if (e.type == SceneEvent::kSetFlag && e.callback == addr)
return e.color;
}
- return Resources::instance()->dseg.get_byte(addr);
+ return _vm->res->dseg.get_byte(addr);
}
void Scene::push(const SceneEvent &event) {
- //debug(0, "push");
+ debugC(0, kDebugScene, "push");
//event.dump();
if (event.type == SceneEvent::kWalk && !events.empty()) {
SceneEvent &prev = events.back();
if (prev.type == SceneEvent::kWalk && prev.color == event.color) {
- debug(0, "fixing double-move [skipping event!]");
- if ((event.color & 2) != 0) { //relative move
+ debugC(0, kDebugScene, "fixing double-move [skipping event!]");
+ if ((event.color & 2) != 0) { // relative move
prev.dst.x += event.dst.x;
prev.dst.y += event.dst.y;
} else {
@@ -509,8 +502,8 @@ bool Scene::processEvent(const Common::Event &event) {
message_color = 0xd1;
for (int i = 0; i < 4; ++i)
custom_animation[i].free();
- _engine->playMusic(4);
- _engine->loadScene(10, Common::Point(136, 153));
+ _vm->playMusic(4);
+ _vm->loadScene(10, Common::Point(136, 153));
return true;
}
@@ -535,7 +528,7 @@ bool Scene::processEvent(const Common::Event &event) {
uint feature = event.kbd.keycode - '1';
if (feature < DebugFeatures::kMax) {
debug_features.feature[feature] = !debug_features.feature[feature];
- debug(0, "switched feature %u %s", feature, debug_features.feature[feature] ? "on" : "off");
+ debugC(0, kDebugScene, "switched feature %u %s", feature, debug_features.feature[feature] ? "on" : "off");
}
}
break;
@@ -556,23 +549,20 @@ struct ZOrderCmp {
};
int Scene::lookupZoom(uint y) const {
- Resources *res = Resources::instance();
- for (byte *zoom_table = res->dseg.ptr(res->dseg.get_word(0x70f4 + (_id - 1) * 2));
+ debugC(2, kDebugScene, "lookupZoom(%d)", y);
+ for (byte *zoom_table = _vm->res->dseg.ptr(_vm->res->dseg.get_word(0x70f4 + (_id - 1) * 2));
zoom_table[0] != 0xff && zoom_table[1] != 0xff;
zoom_table += 2) {
- //debug(0, "%d %d->%d", y, zoom_table[0], zoom_table[1]);
+ debugC(2, kDebugScene, "\t%d %d->%d", y, zoom_table[0], zoom_table[1]);
if (y <= zoom_table[0]) {
- //debug(0, "%d %d->%d", y, zoom_table[0], zoom_table[1]);
return 256u * (100 - zoom_table[1]) / 100;
}
}
return 256;
}
-
void Scene::paletteEffect(byte step) {
- Resources *res = Resources::instance();
- byte *src = res->dseg.ptr(0x6609);
+ byte *src = _vm->res->dseg.ptr(0x6609);
byte *dst = palette + 3 * 0xf2;
for (byte i = 0; i < 0xd; ++i) {
for (byte c = 0; c < 3; ++c, ++src)
@@ -595,7 +585,6 @@ byte Scene::findFade() const {
}
bool Scene::render(bool tick_game, bool tick_mark, uint32 delta) {
- Resources *res = Resources::instance();
bool busy;
bool restart;
uint32 game_delta = tick_game ? 1 : 0;
@@ -617,11 +606,11 @@ bool Scene::render(bool tick_game, bool tick_mark, uint32 delta) {
switch (current_event.type) {
case SceneEvent::kCredits: {
- _system->fillScreen(0);
- ///\todo: optimize me
- Graphics::Surface *surface = _system->lockScreen();
- res->font7.render(surface, current_event.dst.x, current_event.dst.y -= game_delta, current_event.message, current_event.color);
- _system->unlockScreen();
+ _vm->_system->fillScreen(0);
+ // TODO: optimize me
+ Graphics::Surface *surface = _vm->_system->lockScreen();
+ _vm->res->font7.render(surface, current_event.dst.x, current_event.dst.y -= game_delta, current_event.message, current_event.color);
+ _vm->_system->unlockScreen();
if (current_event.dst.y < -(int)current_event.timer)
current_event.clear();
@@ -641,24 +630,24 @@ bool Scene::render(bool tick_game, bool tick_mark, uint32 delta) {
}
if (current_event.type == SceneEvent::kCreditsMessage) {
- _system->fillScreen(0);
- Graphics::Surface *surface = _system->lockScreen();
+ _vm->_system->fillScreen(0);
+ Graphics::Surface *surface = _vm->_system->lockScreen();
if (current_event.lan == 8) {
- res->font8.shadow_color = current_event.orientation;
- res->font8.render(surface, current_event.dst.x, current_event.dst.y, message, current_event.color);
+ _vm->res->font8.shadow_color = current_event.orientation;
+ _vm->res->font8.render(surface, current_event.dst.x, current_event.dst.y, message, current_event.color);
} else {
- res->font7.render(surface, current_event.dst.x, current_event.dst.y, message, 0xd1);
+ _vm->res->font7.render(surface, current_event.dst.x, current_event.dst.y, message, 0xd1);
}
- _system->unlockScreen();
+ _vm->_system->unlockScreen();
return true;
}
if (background.pixels && debug_features.feature[DebugFeatures::kShowBack]) {
- _system->copyRectToScreen(background.pixels, background.pitch, 0, 0, background.w, background.h);
+ _vm->_system->copyRectToScreen(background.pixels, background.pitch, 0, 0, background.w, background.h);
} else
- _system->fillScreen(0);
+ _vm->_system->fillScreen(0);
- Graphics::Surface *surface = _system->lockScreen();
+ Graphics::Surface *surface = _vm->_system->lockScreen();
bool got_any_animation = false;
@@ -683,7 +672,7 @@ bool Scene::render(bool tick_game, bool tick_mark, uint32 delta) {
} else {
a = animation + i;
if (!custom_animation[i].empty()) {
- debug(0, "custom animation ended, restart animation in the same slot.");
+ debugC(0, kDebugScene, "custom animation ended, restart animation in the same slot.");
custom_animation[i].free();
a->restart();
}
@@ -697,7 +686,7 @@ bool Scene::render(bool tick_game, bool tick_mark, uint32 delta) {
}
int index = a->currentIndex();
if (index == current_event.animation) {
- debug(0, "kWaitLanAnimationFrame(%d, %d) complete", current_event.slot, current_event.animation);
+ debugC(0, kDebugScene, "kWaitLanAnimationFrame(%d, %d) complete", current_event.slot, current_event.animation);
restart |= nextEvent();
}
}
@@ -745,15 +734,13 @@ bool Scene::render(bool tick_game, bool tick_mark, uint32 delta) {
} else if (!hide_actor) {
actor_animation.free();
uint zoom = lookupZoom(position.y);
- {
- byte fade = findFade();
- static byte old_fade = 0;
- if (fade != old_fade) {
- old_fade = fade;
- paletteEffect(fade);
- if (_fade_timer == 0)
- setPalette(4);
- }
+
+ byte fade = findFade();
+ if (fade != _fadeOld) {
+ _fadeOld = fade;
+ paletteEffect(fade);
+ if (_fade_timer == 0)
+ setPalette(4);
}
if (!path.empty()) {
@@ -768,7 +755,7 @@ bool Scene::render(bool tick_game, bool tick_mark, uint32 delta) {
}
if (tick_mark) {
- int speed_x = zoom / 32; //8 * zoom / 256
+ int speed_x = zoom / 32; // 8 * zoom / 256
int speed_y = (o == kActorDown || o == kActorUp ? 2 : 1) * zoom / 256;
if (speed_x == 0)
speed_x = 1;
@@ -789,7 +776,7 @@ bool Scene::render(bool tick_game, bool tick_mark, uint32 delta) {
path.pop_front();
if (path.empty()) {
if (orientation == 0)
- orientation = o; //save last orientation
+ orientation = o; // save last orientation
nextEvent();
got_any_animation = true;
restart = true;
@@ -803,20 +790,18 @@ bool Scene::render(bool tick_game, bool tick_mark, uint32 delta) {
if (_idle_timer < 50)
actor_animation_position = teenagent.render(surface, position, orientation, 0, actor_talking, zoom);
else
- actor_animation_position = teenagent_idle.renderIdle(surface, position, orientation, mark_delta, zoom, _engine->_rnd);
+ actor_animation_position = teenagent_idle.renderIdle(surface, position, orientation, mark_delta, zoom, _vm->_rnd);
}
}
if (restart) {
- _system->unlockScreen();
+ _vm->_system->unlockScreen();
continue;
}
- //removed mark == null. In final scene of chapter 2 mark rendered above table.
- //if it'd cause any bugs, add hack here. (_id != 23 && mark == NULL)
- if (on_enabled &&
- debug_features.feature[DebugFeatures::kShowOn]) {
+ // removed mark == null. In final scene of chapter 2 mark rendered above table.
+ // if it'd cause any bugs, add hack here. (_id != 23 && mark == NULL)
+ if (on_enabled && debug_features.feature[DebugFeatures::kShowOn])
on.render(surface, actor_animation_position);
- }
for (; z_order_it != z_order.end(); ++z_order_it) {
Surface *s = *z_order_it;
@@ -827,7 +812,7 @@ bool Scene::render(bool tick_game, bool tick_mark, uint32 delta) {
bool visible = true;
if (message_first_frame != 0 && message_animation != NULL) {
int index = message_animation->currentIndex() + 1;
- //debug(0, "message: %s first: %u index: %u", message.c_str(), message_first_frame, index);
+ debugC(0, kDebugScene, "message: %s first: %u index: %u", message.c_str(), message_first_frame, index);
if (index < message_first_frame)
visible = false;
if (index > message_last_frame) {
@@ -837,18 +822,18 @@ bool Scene::render(bool tick_game, bool tick_mark, uint32 delta) {
}
if (visible) {
- res->font7.render(surface, message_pos.x, message_pos.y, message, message_color);
+ _vm->res->font7.render(surface, message_pos.x, message_pos.y, message, message_color);
busy = true;
}
}
if (!busy && !restart && tick_game && callback_timer) {
if (--callback_timer == 0) {
- if (_engine->inventory->active())
- _engine->inventory->activate(false);
- _engine->processCallback(callback);
+ if (_vm->inventory->active())
+ _vm->inventory->activate(false);
+ _vm->processCallback(callback);
}
- //debug(0, "callback timer = %u", callback_timer);
+ debugC(0, kDebugScene, "callback timer = %u", callback_timer);
}
//if (!current_event.empty())
@@ -872,7 +857,7 @@ bool Scene::render(bool tick_game, bool tick_mark, uint32 delta) {
}
}
- _system->unlockScreen();
+ _vm->_system->unlockScreen();
if (current_event.type == SceneEvent::kWait) {
if (current_event.timer > delta) {
@@ -886,7 +871,7 @@ bool Scene::render(bool tick_game, bool tick_mark, uint32 delta) {
}
if (!restart && current_event.type == SceneEvent::kWaitForAnimation && !got_any_animation) {
- debug(0, "no animations, nextevent");
+ debugC(0, kDebugScene, "no animations, nextevent");
nextEvent();
restart = true;
}
@@ -900,8 +885,8 @@ bool Scene::render(bool tick_game, bool tick_mark, uint32 delta) {
for (Sounds::iterator i = sounds.begin(); i != sounds.end();) {
Sound &sound = *i;
if (sound.delay == 0) {
- debug(1, "sound %u started", sound.id);
- _engine->playSoundNow(sound.id);
+ debugC(1, kDebugScene, "sound %u started", sound.id);
+ _vm->playSoundNow(sound.id);
i = sounds.erase(i);
} else {
sound.delay -= game_delta;
@@ -914,7 +899,7 @@ bool Scene::render(bool tick_game, bool tick_mark, uint32 delta) {
bool Scene::processEventQueue() {
while (!events.empty() && current_event.empty()) {
- //debug(0, "processing next event");
+ debugC(0, kDebugScene, "processing next event");
current_event = events.front();
events.pop_front();
switch (current_event.type) {
@@ -924,11 +909,11 @@ bool Scene::processEventQueue() {
if (on_id != 0) {
--on_id;
byte *ptr = getOns(current_event.scene == 0 ? _id : current_event.scene);
- debug(0, "on[%u] = %02x", on_id, current_event.color);
+ debugC(0, kDebugScene, "on[%u] = %02x", on_id, current_event.color);
ptr[on_id] = current_event.color;
} else {
on_enabled = current_event.color != 0;
- debug(0, "%s on rendering", on_enabled ? "enabling" : "disabling");
+ debugC(0, kDebugScene, "%s on rendering", on_enabled ? "enabling" : "disabling");
}
loadOns();
current_event.clear();
@@ -937,7 +922,7 @@ bool Scene::processEventQueue() {
case SceneEvent::kSetLan: {
if (current_event.lan != 0) {
- debug(0, "lan[%u] = %02x", current_event.lan - 1, current_event.color);
+ debugC(0, kDebugScene, "lan[%u] = %02x", current_event.lan - 1, current_event.color);
byte *ptr = getLans(current_event.scene == 0 ? _id : current_event.scene);
ptr[current_event.lan - 1] = current_event.color;
}
@@ -952,7 +937,7 @@ bool Scene::processEventQueue() {
if (current_event.orientation != 0)
orientation = current_event.orientation;
} else {
- //special case, empty scene
+ // special case, empty scene
background.free();
on.free();
delete[] ons;
@@ -968,7 +953,7 @@ bool Scene::processEventQueue() {
case SceneEvent::kWalk: {
Common::Point dst = current_event.dst;
- if ((current_event.color & 2) != 0) { //relative move
+ if ((current_event.color & 2) != 0) { // relative move
dst.x += position.x;
dst.y += position.y;
}
@@ -994,7 +979,7 @@ bool Scene::processEventQueue() {
// message_animation = animation + current_event.slot;
} else
message_animation = &actor_animation;
- debug(0, "async message %d-%d (slot %u)", message_first_frame, message_last_frame, current_event.slot);
+ debugC(0, kDebugScene, "async message %d-%d (slot %u)", message_first_frame, message_last_frame, current_event.slot);
} else {
message_timer = current_event.timer ? current_event.timer * 110 : messageDuration(message);
message_first_frame = message_last_frame = 0;
@@ -1024,14 +1009,14 @@ bool Scene::processEventQueue() {
message_color = current_event.color;
if (message_first_frame)
- current_event.clear(); //async message, clearing event
+ current_event.clear(); // async message, clearing event
}
break;
case SceneEvent::kPlayAnimation: {
- byte slot = current_event.slot & 7; //0 - mark's
+ byte slot = current_event.slot & 7; // 0 - mark's
if (current_event.animation != 0) {
- debug(0, "playing animation %u in slot %u(%02x)", current_event.animation, slot, current_event.slot);
+ debugC(0, kDebugScene, "playing animation %u in slot %u(%02x)", current_event.animation, slot, current_event.slot);
if (slot != 0) {
--slot;
assert(slot < 4);
@@ -1041,7 +1026,7 @@ bool Scene::processEventQueue() {
} else {
if (slot != 0) {
--slot;
- debug(0, "cancelling animation in slot %u", slot);
+ debugC(0, kDebugScene, "cancelling animation in slot %u", slot);
assert(slot < 4);
custom_animation[slot].free();
} else
@@ -1052,10 +1037,10 @@ bool Scene::processEventQueue() {
break;
case SceneEvent::kPauseAnimation: {
- byte slot = current_event.slot & 7; //0 - mark's
+ byte slot = current_event.slot & 7; // 0 - mark's
if (slot != 0) {
--slot;
- debug(1, "pause animation in slot %u", slot);
+ debugC(1, kDebugScene, "pause animation in slot %u", slot);
custom_animation[slot].paused = (current_event.slot & 0x80) != 0;
} else {
actor_talking = false;
@@ -1072,26 +1057,26 @@ bool Scene::processEventQueue() {
break;
case SceneEvent::kPlayActorAnimation:
- debug(0, "playing actor animation %u", current_event.animation);
+ debugC(0, kDebugScene, "playing actor animation %u", current_event.animation);
playActorAnimation(current_event.animation, (current_event.slot & 0x80) != 0, (current_event.slot & 0x20) != 0);
current_event.clear();
break;
case SceneEvent::kPlayMusic:
- debug(0, "setting music %u", current_event.music);
- _engine->setMusic(current_event.music);
- Resources::instance()->dseg.set_byte(0xDB90, current_event.music);
+ debugC(0, kDebugScene, "setting music %u", current_event.music);
+ _vm->setMusic(current_event.music);
+ _vm->res->dseg.set_byte(0xdb90, current_event.music);
current_event.clear();
break;
case SceneEvent::kPlaySound:
- debug(0, "playing sound %u, delay: %u", current_event.sound, current_event.color);
+ debugC(0, kDebugScene, "playing sound %u, delay: %u", current_event.sound, current_event.color);
sounds.push_back(Sound(current_event.sound, current_event.color));
current_event.clear();
break;
case SceneEvent::kEnableObject: {
- debug(0, "%s object #%u", current_event.color ? "enabling" : "disabling", current_event.object - 1);
+ debugC(0, kDebugScene, "%s object #%u", current_event.color ? "enabling" : "disabling", current_event.object - 1);
Object *obj = getObject(current_event.object - 1, current_event.scene == 0 ? _id : current_event.scene);
obj->enabled = current_event.color;
obj->save();
@@ -1105,36 +1090,36 @@ bool Scene::processEventQueue() {
break;
case SceneEvent::kWaitForAnimation:
- debug(0, "waiting for the animation");
+ debugC(0, kDebugScene, "waiting for the animation");
break;
case SceneEvent::kWaitLanAnimationFrame:
- debug(0, "waiting for the frame %d in slot %d", current_event.animation, current_event.slot);
+ debugC(0, kDebugScene, "waiting for the frame %d in slot %d", current_event.animation, current_event.slot);
break;
case SceneEvent::kTimer:
callback = current_event.callback;
callback_timer = current_event.timer;
- debug(0, "triggering callback %04x in %u frames", callback, callback_timer);
+ debugC(0, kDebugScene, "triggering callback %04x in %u frames", callback, callback_timer);
current_event.clear();
break;
case SceneEvent::kEffect:
- _system->delayMillis(80); //2 vsyncs
- _system->setShakePos(8);
- _system->updateScreen();
+ _vm->_system->delayMillis(80); // 2 vsyncs
+ _vm->_system->setShakePos(8);
+ _vm->_system->updateScreen();
- _system->delayMillis(80); //2 vsyncs
- _system->setShakePos(0);
- _system->updateScreen();
+ _vm->_system->delayMillis(80); // 2 vsyncs
+ _vm->_system->setShakePos(0);
+ _vm->_system->updateScreen();
- _system->delayMillis(80); //2 vsyncs
- _system->setShakePos(4);
- _system->updateScreen();
+ _vm->_system->delayMillis(80); // 2 vsyncs
+ _vm->_system->setShakePos(4);
+ _vm->_system->updateScreen();
- _system->delayMillis(80); //2 vsyncs
- _system->setShakePos(0);
- _system->updateScreen();
+ _vm->_system->delayMillis(80); // 2 vsyncs
+ _vm->_system->setShakePos(0);
+ _vm->_system->updateScreen();
current_event.clear();
break;
@@ -1145,21 +1130,21 @@ bool Scene::processEventQueue() {
break;
case SceneEvent::kWait:
- debug(0, "wait %u", current_event.timer);
+ debugC(0, kDebugScene, "wait %u", current_event.timer);
break;
case SceneEvent::kCredits:
- debug(0, "showing credits");
+ debugC(0, kDebugScene, "showing credits");
break;
case SceneEvent::kQuit:
- debug(0, "quit!");
- _engine->quitGame();
+ debugC(0, kDebugScene, "quit!");
+ _vm->quitGame();
break;
case SceneEvent::kSetFlag:
- debug(0, "async set_flag(%04x, %d)", current_event.callback, current_event.color);
- Resources::instance()->dseg.set_byte(current_event.callback, current_event.color);
+ debugC(0, kDebugScene, "async set_flag(%04x, %d)", current_event.callback, current_event.color);
+ _vm->res->dseg.set_byte(current_event.callback, current_event.color);
current_event.clear();
break;
@@ -1167,22 +1152,24 @@ bool Scene::processEventQueue() {
error("empty/unhandler event[%d]", (int)current_event.type);
}
}
+
if (events.empty()) {
message_color = 0xd1;
hide_actor = false;
}
+
return !current_event.empty();
}
void Scene::setPalette(unsigned mul) {
- //debug(0, "setPalette(%u)", mul);
+ debugC(0, kDebugScene, "setPalette(%u)", mul);
byte p[3 * 256];
for (int i = 0; i < 3 * 256; ++i) {
p[i] = (unsigned)palette[i] * mul;
}
- _system->getPaletteManager()->setPalette(p, 0, 256);
+ _vm->_system->getPaletteManager()->setPalette(p, 0, 256);
}
Object *Scene::getObject(int id, int scene_id) {
@@ -1203,14 +1190,13 @@ Object *Scene::getObject(int id, int scene_id) {
}
Common::Point Scene::messagePosition(const Common::String &str, Common::Point message_position) {
- Resources *res = Resources::instance();
int lines = 1;
for (uint i = 0; i < str.size(); ++i)
if (str[i] == '\n')
++lines;
- uint w = res->font7.render(NULL, 0, 0, str, 0);
- uint h = res->font7.height * lines + 3;
+ uint w = _vm->res->font7.render(NULL, 0, 0, str, 0);
+ uint h = _vm->res->font7.height * lines + 3;
message_position.x -= w / 2;
message_position.y -= h;
@@ -1228,23 +1214,23 @@ Common::Point Scene::messagePosition(const Common::String &str, Common::Point me
}
uint Scene::messageDuration(const Common::String &str) {
- //original game uses static delays: 100-slow, 50, 20 and 1 tick - crazy speed.
- //total delay = total message length * delay / 8 + 60.
+ // original game uses static delays: 100-slow, 50, 20 and 1 tick - crazy speed.
+ // total delay = total message length * delay / 8 + 60.
uint total_width = str.size();
- int speed = Common::ConfigManager::instance().getInt("talkspeed");
+ int speed = ConfMan.getInt("talkspeed");
if (speed < 0)
speed = 60;
uint delay_delta = 1 + (255 - speed) * 99 / 255;
uint delay = 60 + (total_width * delay_delta) / 8;
- //debug(0, "delay = %u, delta: %u", delay, delay_delta);
+ debugC(0, kDebugScene, "delay = %u, delta: %u", delay, delay_delta);
return delay * 10;
}
void Scene::displayMessage(const Common::String &str, byte color, const Common::Point &pos) {
//assert(!str.empty());
- //debug(0, "displayMessage: %s", str.c_str());
+ debugC(0, kDebugScene, "displayMessage: %s", str.c_str());
message = str;
message_pos = (pos.x | pos.y) ? pos : messagePosition(str, position);
message_color = color;
diff --git a/engines/teenagent/scene.h b/engines/teenagent/scene.h
index 32e784bb60..7270b2ec9a 100644
--- a/engines/teenagent/scene.h
+++ b/engines/teenagent/scene.h
@@ -27,8 +27,8 @@
#include "teenagent/objects.h"
#include "teenagent/surface.h"
#include "teenagent/surface_list.h"
+#include "teenagent/teenagent.h"
-#include "common/system.h"
#include "common/array.h"
#include "common/list.h"
@@ -39,7 +39,6 @@ struct Event;
namespace TeenAgent {
class TeenAgentEngine;
-class Dialog;
struct SceneEvent {
enum Type {
@@ -118,7 +117,7 @@ struct SceneEvent {
}
void dump() const {
- debug(0, "event[%d]: \"%s\"[%02x], slot: %d, animation: %u, timer: %u, dst: (%d, %d) [%u], scene: %u, ons: %u, lan: %u, object: %u, music: %u, sound: %u",
+ debugC(0, kDebugScene, "event[%d]: \"%s\"[%02x], slot: %d, animation: %u, timer: %u, dst: (%d, %d) [%u], scene: %u, ons: %u, lan: %u, object: %u, music: %u, sound: %u",
(int)type, message.c_str(), color, slot, animation, timer, dst.x, dst.y, orientation, scene, ons, lan, object, music, sound
);
}
@@ -126,7 +125,7 @@ struct SceneEvent {
class Scene {
public:
- Scene(TeenAgentEngine *engine, OSystem *system);
+ Scene(TeenAgentEngine *engine);
~Scene();
bool intro;
@@ -177,8 +176,8 @@ private:
void paletteEffect(byte step);
byte findFade() const;
- static Common::Point messagePosition(const Common::String &str, Common::Point position);
- static uint messageDuration(const Common::String &str);
+ Common::Point messagePosition(const Common::String &str, Common::Point position);
+ uint messageDuration(const Common::String &str);
bool processEventQueue();
inline bool nextEvent() {
@@ -187,8 +186,7 @@ private:
}
void clearMessage();
- TeenAgentEngine *_engine;
- OSystem *_system;
+ TeenAgentEngine *_vm;
int _id;
Graphics::Surface background;
@@ -229,6 +227,8 @@ private:
uint16 callback, callback_timer;
int _fade_timer;
+ byte _fadeOld;
+
uint _idle_timer;
struct Sound {
diff --git a/engines/teenagent/segment.h b/engines/teenagent/segment.h
index 303198b071..286337d120 100644
--- a/engines/teenagent/segment.h
+++ b/engines/teenagent/segment.h
@@ -41,26 +41,21 @@ public:
assert(offset < _size);
return _data[offset];
}
+
inline uint16 get_word(uint32 offset) const {
assert(offset + 1 < _size);
return READ_LE_UINT16(_data + offset);
}
- inline uint32 get_quad(uint32 offset) const {
- assert(offset + 3 < _size);
- return READ_LE_UINT32(_data + offset);
- }
+
inline void set_byte(uint32 offset, byte v) const {
assert(offset < _size);
_data[offset] = v;
}
+
inline void set_word(uint32 offset, uint16 v) const {
assert(offset + 1 < _size);
return WRITE_LE_UINT16(_data + offset, v);
}
- inline void set_quad(uint32 offset, uint32 v) const {
- assert(offset + 3 < _size);
- return WRITE_LE_UINT32(_data + offset, v);
- }
const byte *ptr(uint32 addr) const {
assert(addr < _size);
@@ -71,6 +66,7 @@ public:
assert(addr < _size);
return _data + addr;
}
+
uint size() const { return _size; }
};
diff --git a/engines/teenagent/surface.cpp b/engines/teenagent/surface.cpp
index 63312990ee..fa67f28096 100644
--- a/engines/teenagent/surface.cpp
+++ b/engines/teenagent/surface.cpp
@@ -21,6 +21,8 @@
#include "teenagent/surface.h"
#include "teenagent/pack.h"
+#include "teenagent/teenagent.h"
+
#include "common/stream.h"
#include "common/debug.h"
@@ -34,7 +36,7 @@ Surface::~Surface() {
}
void Surface::load(Common::SeekableReadStream &stream, Type type) {
- //debug(0, "load()");
+ debugC(0, kDebugSurface, "load()");
free();
x = y = 0;
@@ -48,16 +50,16 @@ void Surface::load(Common::SeekableReadStream &stream, Type type) {
y = pos / 320;
}
- //debug(0, "declared info: %ux%u (%04xx%04x) -> %u,%u", w_, h_, w_, h_, x, y);
+ debugC(0, kDebugSurface, "declared info: %ux%u (%04xx%04x) -> %u,%u", w_, h_, w_, h_, x, y);
if (stream.eos() || w_ == 0)
return;
if (w_ * h_ > stream.size()) {
- debug(0, "invalid surface %ux%u -> %u,%u", w_, h_, x, y);
+ debugC(0, kDebugSurface, "invalid surface %ux%u -> %u,%u", w_, h_, x, y);
return;
}
- //debug(0, "creating surface %ux%u -> %u,%u", w_, h_, x, y);
+ debugC(0, kDebugSurface, "creating surface %ux%u -> %u,%u", w_, h_, x, y);
create(w_, h_, Graphics::PixelFormat::createFormatCLUT8());
stream.read(pixels, w_ * h_);
diff --git a/engines/teenagent/surface_list.cpp b/engines/teenagent/surface_list.cpp
index 31387ac3cb..f1e021888b 100644
--- a/engines/teenagent/surface_list.cpp
+++ b/engines/teenagent/surface_list.cpp
@@ -19,9 +19,10 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
-#include "teenagent/surface.h"
#include "teenagent/surface_list.h"
-#include "objects.h"
+#include "teenagent/surface.h"
+#include "teenagent/objects.h"
+#include "teenagent/teenagent.h"
namespace TeenAgent {
@@ -39,7 +40,7 @@ void SurfaceList::load(Common::SeekableReadStream &stream, Type type, int sub_ha
return;
surfaces_n = fn - sub_hack;
- debug(0, "loading %u surfaces from list (skip %d)", surfaces_n, sub_hack);
+ debugC(0, kDebugSurface, "loading %u surfaces from list (skip %d)", surfaces_n, sub_hack);
if (surfaces_n == 0)
return;
diff --git a/engines/teenagent/surface_list.h b/engines/teenagent/surface_list.h
index 2d7be0d52b..f1359ec346 100644
--- a/engines/teenagent/surface_list.h
+++ b/engines/teenagent/surface_list.h
@@ -23,6 +23,7 @@
#define TEENAGENT_SURFACE_LIST_H__
#include "common/stream.h"
+#include "graphics/surface.h"
namespace TeenAgent {
class Surface;
diff --git a/engines/teenagent/teenagent.cpp b/engines/teenagent/teenagent.cpp
index f06de6f803..bf626e2aff 100644
--- a/engines/teenagent/teenagent.cpp
+++ b/engines/teenagent/teenagent.cpp
@@ -21,6 +21,7 @@
#include "common/config-manager.h"
#include "common/debug.h"
+#include "common/debug-channels.h"
#include "common/events.h"
#include "common/savefile.h"
#include "common/system.h"
@@ -39,26 +40,46 @@
#include "graphics/thumbnail.h"
#include "teenagent/console.h"
+#include "teenagent/dialog.h"
+#include "teenagent/inventory.h"
#include "teenagent/music.h"
#include "teenagent/objects.h"
#include "teenagent/pack.h"
+#include "teenagent/resources.h"
#include "teenagent/scene.h"
#include "teenagent/teenagent.h"
namespace TeenAgent {
TeenAgentEngine::TeenAgentEngine(OSystem *system, const ADGameDescription *gd)
- : Engine(system), action(kActionNone), _gameDescription(gd),
- _rnd("teenagent") {
- music = new MusicPlayer();
+ : Engine(system), action(kActionNone), _gameDescription(gd), _rnd("teenagent") {
+ DebugMan.addDebugChannel(kDebugActor, "Actor", "Enable Actor Debug");
+ DebugMan.addDebugChannel(kDebugAnimation, "Animation", "Enable Animation Debug");
+ DebugMan.addDebugChannel(kDebugCallbacks, "Callbacks", "Enable Callbacks Debug");
+ DebugMan.addDebugChannel(kDebugDialog, "Dialog", "Enable Dialog Debug");
+ DebugMan.addDebugChannel(kDebugFont, "Font", "Enable Font Debug");
+ DebugMan.addDebugChannel(kDebugInventory, "Inventory", "Enable Inventory Debug");
+ DebugMan.addDebugChannel(kDebugMusic, "Music", "Enable Music Debug");
+ DebugMan.addDebugChannel(kDebugObject, "Object", "Enable Object Debug");
+ DebugMan.addDebugChannel(kDebugPack, "Pack", "Enable Pack Debug");
+ DebugMan.addDebugChannel(kDebugScene, "Scene", "Enable Scene Debug");
+ DebugMan.addDebugChannel(kDebugSurface, "Surface", "Enable Surface Debug");
+
+ music = new MusicPlayer(this);
+ dialog = new Dialog(this);
+ res = new Resources();
console = 0;
}
TeenAgentEngine::~TeenAgentEngine() {
delete music;
+ delete dialog;
+ res->deinit();
+ delete res;
delete console;
+ DebugMan.clearAllDebugChannels();
}
bool TeenAgentEngine::trySelectedObject() {
@@ -66,8 +87,7 @@ bool TeenAgentEngine::trySelectedObject() {
if (inv == NULL)
return false;
- Resources *res = Resources::instance();
- debug(0, "checking active object %u on %u", inv->id, dst_object->id);
+ debugC(0, kDebugObject, "checking active object %u on %u", inv->id, dst_object->id);
//mouse time challenge hack:
if ((res->dseg.get_byte(0) == 1 && inv->id == 49 && dst_object->id == 5) ||
@@ -81,18 +101,18 @@ bool TeenAgentEngine::trySelectedObject() {
for (uint i = 0; i < hotspots.size(); ++i) {
const UseHotspot &spot = hotspots[i];
if (spot.inventory_id == inv->id && dst_object->id == spot.object_id) {
- debug(0, "use object on hotspot!");
+ debugC(0, kDebugObject, "use object on hotspot!");
spot.dump();
if (spot.actor_x != 0xffff && spot.actor_y != 0xffff)
moveTo(spot.actor_x, spot.actor_y, spot.orientation);
if (!processCallback(spot.callback))
- debug(0, "fixme! display proper description");
+ debugC(0, kDebugObject, "FIXME: display proper description");
inventory->resetSelectedObject();
return true;
}
}
- //error
+ // error
inventory->resetSelectedObject();
displayMessage(0x3457);
return true;
@@ -102,7 +122,6 @@ void TeenAgentEngine::processObject() {
if (dst_object == NULL)
return;
- Resources *res = Resources::instance();
switch (action) {
case kActionExamine: {
if (trySelectedObject())
@@ -134,7 +153,6 @@ void TeenAgentEngine::processObject() {
}
}
-
void TeenAgentEngine::use(Object *object) {
if (object == NULL || scene->eventRunning())
return;
@@ -156,14 +174,14 @@ void TeenAgentEngine::examine(const Common::Point &point, Object *object) {
if (object != NULL) {
Common::Point dst = object->actor_rect.center();
- debug(0, "click %d, %d, object %d, %d", point.x, point.y, dst.x, dst.y);
+ debugC(0, kDebugObject, "click %d, %d, object %d, %d", point.x, point.y, dst.x, dst.y);
action = kActionExamine;
if (object->actor_rect.valid())
- scene->moveTo(dst, object->actor_orientation, true); //validate examine message. Original engine does not let you into walkboxes
+ scene->moveTo(dst, object->actor_orientation, true); // validate examine message. Original engine does not let you into walkboxes
dst_object = object;
} else if (!scene_busy) {
- //do not reset anything while scene is busy, but allow interrupts while walking.
- debug(0, "click %d, %d", point.x, point.y);
+ // do not reset anything while scene is busy, but allow interrupts while walking.
+ debugC(0, kDebugObject, "click %d, %d", point.x, point.y);
action = kActionNone;
scene->moveTo(point, 0, true);
dst_object = NULL;
@@ -174,7 +192,6 @@ void TeenAgentEngine::init() {
_mark_delay = 80;
_game_delay = 110;
- Resources *res = Resources::instance();
use_hotspots.resize(42);
byte *scene_hotspots = res->dseg.ptr(0xbb87);
for (byte i = 0; i < 42; ++i) {
@@ -198,7 +215,7 @@ void TeenAgentEngine::deinit() {
//delete music;
//music = NULL;
use_hotspots.clear();
- Resources::instance()->deinit();
+ res->deinit();
CursorMan.popCursor();
}
@@ -211,22 +228,19 @@ Common::Error TeenAgentEngine::loadGameState(int slot) {
if (!in)
return Common::kReadPermissionDenied;
- Resources *res = Resources::instance();
-
- const uint dataSize = 0x777a;
- assert(res->dseg.size() >= 0x6478 + dataSize);
+ assert(res->dseg.size() >= dsAddr_saveState + saveStateSize);
- char *data = (char *)malloc(dataSize);
+ char *data = (char *)malloc(saveStateSize);
if (!data)
error("[TeenAgentEngine::loadGameState] Cannot allocate buffer");
in->seek(0);
- if (in->read(data, dataSize) != dataSize) {
+ if (in->read(data, saveStateSize) != saveStateSize) {
free(data);
return Common::kReadingFailed;
}
- memcpy(res->dseg.ptr(0x6478), data, dataSize);
+ memcpy(res->dseg.ptr(dsAddr_saveState), data, saveStateSize);
free(data);
@@ -234,10 +248,10 @@ Common::Error TeenAgentEngine::loadGameState(int slot) {
inventory->activate(false);
inventory->reload();
- setMusic(Resources::instance()->dseg.get_byte(0xDB90));
+ setMusic(res->dseg.get_byte(0xdb90));
- int id = res->dseg.get_byte(0xB4F3);
- uint16 x = res->dseg.get_word(0x64AF), y = res->dseg.get_word(0x64B1);
+ int id = res->dseg.get_byte(0xb4f3);
+ uint16 x = res->dseg.get_word(0x64af), y = res->dseg.get_word(0x64b1);
scene->loadObjectData();
scene->init(id, Common::Point(x, y));
scene->setPalette(4);
@@ -251,15 +265,14 @@ Common::Error TeenAgentEngine::saveGameState(int slot, const Common::String &des
if (!out)
return Common::kWritingFailed;
- Resources *res = Resources::instance();
- res->dseg.set_byte(0xB4F3, scene->getId());
+ res->dseg.set_byte(0xb4f3, scene->getId());
Common::Point pos = scene->getPosition();
- res->dseg.set_word(0x64AF, pos.x);
- res->dseg.set_word(0x64B1, pos.y);
+ res->dseg.set_word(0x64af, pos.x);
+ res->dseg.set_word(0x64b1, pos.y);
- assert(res->dseg.size() >= 0x6478 + 0x777a);
- strncpy((char *)res->dseg.ptr(0x6478), desc.c_str(), 0x16);
- out->write(res->dseg.ptr(0x6478), 0x777a);
+ assert(res->dseg.size() >= dsAddr_saveState + saveStateSize);
+ strncpy((char *)res->dseg.ptr(dsAddr_saveState), desc.c_str(), 0x16);
+ out->write(res->dseg.ptr(dsAddr_saveState), saveStateSize);
if (!Graphics::saveThumbnail(*out))
warning("saveThumbnail failed");
@@ -267,7 +280,6 @@ Common::Error TeenAgentEngine::saveGameState(int slot, const Common::String &des
return Common::kNoError;
}
-
int TeenAgentEngine::skipEvents() const {
Common::EventManager *_event = _system->getEventManager();
Common::Event event;
@@ -314,7 +326,7 @@ bool TeenAgentEngine::showCDLogo() {
for (uint c = 0; c < paletteSize; ++c)
palette[c] *= 4;
- _system->getPaletteManager()->setPalette(palette, 0, 0x100);
+ _system->getPaletteManager()->setPalette(palette, 0, 256);
_system->copyRectToScreen(bg, 320, 0, 0, 320, 200);
_system->updateScreen();
@@ -360,7 +372,7 @@ bool TeenAgentEngine::showLogo() {
for (uint c = 0; c < paletteSize; ++c)
palette[c] *= 4;
- _system->getPaletteManager()->setPalette(palette, 0, 0x100);
+ _system->getPaletteManager()->setPalette(palette, 0, 256);
free(palette);
@@ -419,7 +431,7 @@ bool TeenAgentEngine::showMetropolis() {
palette[c] *= 4;
}
- _system->getPaletteManager()->setPalette(palette, 0, 0x100);
+ _system->getPaletteManager()->setPalette(palette, 0, 256);
free(palette);
@@ -517,7 +529,6 @@ bool TeenAgentEngine::showMetropolis() {
}
Common::Error TeenAgentEngine::run() {
- Resources *res = Resources::instance();
if (!res->loadArchives(_gameDescription))
return Common::kUnknownError;
@@ -526,7 +537,7 @@ Common::Error TeenAgentEngine::run() {
initGraphics(320, 200, false);
console = new Console(this);
- scene = new Scene(this, _system);
+ scene = new Scene(this);
inventory = new Inventory(this);
init();
@@ -539,7 +550,7 @@ Common::Error TeenAgentEngine::run() {
setMusic(1);
music->start();
- int load_slot = Common::ConfigManager::instance().getInt("save_slot");
+ int load_slot = ConfMan.getInt("save_slot");
if (load_slot >= 0) {
loadGameState(load_slot);
} else {
@@ -551,7 +562,7 @@ Common::Error TeenAgentEngine::run() {
return Common::kNoError;
scene->intro = true;
scene_busy = true;
- processCallback(0x24c);
+ processCallback(0x024c);
}
CursorMan.showMouse(true);
@@ -575,7 +586,7 @@ Common::Error TeenAgentEngine::run() {
if ((!scene_busy && inventory->processEvent(event)) || scene->processEvent(event))
continue;
- //debug(0, "event");
+ debug(5, "event");
switch (event.type) {
case Common::EVENT_KEYDOWN:
if ((event.kbd.hasFlags(Common::KBD_CTRL) && event.kbd.keycode == Common::KEYCODE_d) ||
@@ -585,7 +596,7 @@ Common::Error TeenAgentEngine::run() {
openMainMenuDialog();
} if (event.kbd.hasFlags(Common::KBD_CTRL) && event.kbd.keycode == Common::KEYCODE_f) {
_mark_delay = _mark_delay == 80 ? 40 : 80;
- debug(0, "mark_delay = %u", _mark_delay);
+ debug(5, "mark_delay = %u", _mark_delay);
}
break;
case Common::EVENT_LBUTTONDOWN:
@@ -594,8 +605,8 @@ Common::Error TeenAgentEngine::run() {
examine(event.mouse, current_object);
break;
case Common::EVENT_RBUTTONDOWN:
- //if (current_object)
- // debug(0, "%d, %s", current_object->id, current_object->name.c_str());
+ if (current_object)
+ debugC(0, kDebugObject, "%d, %s", current_object->id, current_object->name.c_str());
if (scene->getId() < 0)
break;
@@ -603,11 +614,11 @@ Common::Error TeenAgentEngine::run() {
break;
if (res->dseg.get_byte(0) == 3 && current_object->id == 1) {
- processCallback(0x5189); //boo!
+ processCallback(0x5189); // guard is drinking, boo!
break;
}
if (res->dseg.get_byte(0) == 4 && current_object->id == 5) {
- processCallback(0x99e0); //getting an anchor
+ processCallback(0x99e0); // success getting an anchor
break;
}
use(current_object);
@@ -697,7 +708,7 @@ Common::Error TeenAgentEngine::run() {
Common::String TeenAgentEngine::parseMessage(uint16 addr) {
Common::String message;
for (
- const char *str = (const char *)Resources::instance()->dseg.ptr(addr);
+ const char *str = (const char *)res->dseg.ptr(addr);
str[0] != 0 || str[1] != 0;
++str) {
char c = str[0];
@@ -714,7 +725,7 @@ void TeenAgentEngine::displayMessage(const Common::String &str, byte color, uint
return;
}
- if (color == 0xd1) { //mark's
+ if (color == 0xd1) { // mark's
SceneEvent e(SceneEvent::kPlayAnimation);
e.animation = 0;
e.slot = 0x80;
@@ -767,18 +778,17 @@ void TeenAgentEngine::displayAsyncMessageInSlot(uint16 addr, byte slot, uint16 f
scene->push(event);
}
-
void TeenAgentEngine::displayCredits(uint16 addr, uint16 timer) {
SceneEvent event(SceneEvent::kCreditsMessage);
- const byte *src = Resources::instance()->dseg.ptr(addr);
+ const byte *src = res->dseg.ptr(addr);
event.orientation = *src++;
event.color = *src++;
event.lan = 8;
event.dst.y = *src;
while (true) {
- ++src; //skip y position
+ ++src; // skip y position
Common::String line((const char *)src);
event.message += line;
src += line.size() + 1;
@@ -786,7 +796,7 @@ void TeenAgentEngine::displayCredits(uint16 addr, uint16 timer) {
break;
event.message += "\n";
}
- int w = Resources::instance()->font8.render(NULL, 0, 0, event.message, 0xd1);
+ int w = res->font8.render(NULL, 0, 0, event.message, 0xd1);
event.dst.x = (320 - w) / 2;
event.timer = timer;
scene->push(event);
@@ -801,9 +811,9 @@ void TeenAgentEngine::displayCredits() {
for (uint i = 0; i < event.message.size(); ++i)
if (event.message[i] == '\n')
++lines;
- event.dst.x = (320 - Resources::instance()->font7.render(NULL, 0, 0, event.message, 0xd1)) / 2;
+ event.dst.x = (320 - res->font7.render(NULL, 0, 0, event.message, 0xd1)) / 2;
event.timer = 11 * lines - event.dst.y + 22;
- //debug(0, "credits = %s", event.message.c_str());
+ debug(2, "credits = %s", event.message.c_str());
scene->push(event);
}
@@ -866,7 +876,6 @@ void TeenAgentEngine::playActorAnimation(uint16 id, bool async, bool ignore) {
waitAnimation();
}
-
void TeenAgentEngine::loadScene(byte id, const Common::Point &pos, byte o) {
loadScene(id, pos.x, pos.y, o);
}
@@ -926,7 +935,6 @@ void TeenAgentEngine::reloadLan() {
scene->push(event);
}
-
void TeenAgentEngine::playMusic(byte id) {
SceneEvent event(SceneEvent::kPlayMusic);
event.music = id;
@@ -1016,7 +1024,6 @@ void TeenAgentEngine::wait(uint16 frames) {
}
void TeenAgentEngine::playSoundNow(byte id) {
- Resources *res = Resources::instance();
uint size = res->sam_sam.getSize(id);
if (size == 0) {
warning("skipping invalid sound %u", id);
@@ -1025,28 +1032,26 @@ void TeenAgentEngine::playSoundNow(byte id) {
byte *data = (byte *)malloc(size);
res->sam_sam.read(id, data, size);
- //debug(0, "playing %u samples...", size);
+ debug(3, "playing %u samples...", size);
Audio::AudioStream *stream = Audio::makeRawStream(data, size, 11025, 0);
- _mixer->playStream(Audio::Mixer::kSFXSoundType, &_soundHandle, stream); //dispose is YES by default
+ _mixer->playStream(Audio::Mixer::kSFXSoundType, &_soundHandle, stream); // dispose is YES by default
}
-
void TeenAgentEngine::setMusic(byte id) {
- debug(0, "starting music %u", id);
- Resources *res = Resources::instance();
+ debugC(0, kDebugMusic, "starting music %u", id);
- if (id != 1) //intro music
- *res->dseg.ptr(0xDB90) = id;
+ if (id != 1) // intro music
+ *res->dseg.ptr(0xdb90) = id;
if (_gameDescription->flags & ADGF_CD) {
byte track2cd[] = {7, 2, 0, 9, 3, 6, 8, 10, 4, 5, 11};
if (id == 0 || id > 11 || track2cd[id - 1] == 0) {
- debug(0, "no cd music for id %u", id);
+ debugC(0, kDebugMusic, "no cd music for id %u", id);
return;
}
byte track = track2cd[id - 1];
- debug(0, "playing cd track %u", track);
+ debugC(0, kDebugMusic, "playing cd track %u", track);
_system->getAudioCDManager()->play(track, -1, 0, 0);
} else if (music->load(id))
music->start();
diff --git a/engines/teenagent/teenagent.h b/engines/teenagent/teenagent.h
index 737f07ba85..823f096ebc 100644
--- a/engines/teenagent/teenagent.h
+++ b/engines/teenagent/teenagent.h
@@ -23,12 +23,13 @@
#define TEENAGENT_ENGINE_H
#include "engines/engine.h"
-#include "teenagent/pack.h"
-#include "teenagent/resources.h"
-#include "teenagent/inventory.h"
+
#include "audio/audiostream.h"
#include "audio/mixer.h"
+
#include "common/random.h"
+#include "common/rect.h"
+#include "common/array.h"
struct ADGameDescription;
@@ -43,9 +44,28 @@ struct ADGameDescription;
namespace TeenAgent {
struct Object;
+struct UseHotspot;
class Scene;
class MusicPlayer;
+class Dialog;
class Console;
+class Resources;
+class Inventory;
+
+// Engine Debug Flags
+enum {
+ kDebugActor = (1 << 0),
+ kDebugAnimation = (1 << 1),
+ kDebugCallbacks = (1 << 2),
+ kDebugDialog = (1 << 3),
+ kDebugFont = (1 << 4),
+ kDebugInventory = (1 << 5),
+ kDebugMusic = (1 << 6),
+ kDebugObject = (1 << 7),
+ kDebugPack = (1 << 8),
+ kDebugScene = (1 << 9),
+ kDebugSurface = (1 << 10)
+};
class TeenAgentEngine : public Engine {
public:
@@ -76,7 +96,7 @@ public:
bool showMetropolis();
int skipEvents() const;
- static Common::String parseMessage(uint16 addr);
+ Common::String parseMessage(uint16 addr);
//event driven:
void displayMessage(uint16 addr, byte color = 0xd1, uint16 position = 0);
@@ -119,9 +139,11 @@ public:
Common::RandomSource _rnd;
+ Resources *res;
Scene *scene;
Inventory *inventory;
MusicPlayer *music;
+ Dialog *dialog;
Console *console;
void setMusic(byte id);