From 923c05faf5de95b3b80b1cbc4f9b6675f61bc9aa Mon Sep 17 00:00:00 2001 From: D G Turner Date: Wed, 11 Jul 2012 18:20:26 +0100 Subject: TEENAGENT: Migrate Dialog functions to using dialog numbers. This removes the hardcoded address/offsets from the callback functions. --- devtools/create_teenagent/static_tables.h | 4 + engines/teenagent/callbacks.cpp | 247 +++++++++++++++--------------- engines/teenagent/dialog.cpp | 11 ++ engines/teenagent/dialog.h | 12 +- engines/teenagent/resources.h | 3 +- 5 files changed, 146 insertions(+), 131 deletions(-) diff --git a/devtools/create_teenagent/static_tables.h b/devtools/create_teenagent/static_tables.h index e4d11913fb..b57aed4735 100644 --- a/devtools/create_teenagent/static_tables.h +++ b/devtools/create_teenagent/static_tables.h @@ -16232,6 +16232,10 @@ const static char* dialog_162[] = { END_DIALOG }; +// Note: +// 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. const static char* dialog_163[] = { NEW_LINE, "OH GIMMIE GIMMIE GIMMIE!!!", diff --git a/engines/teenagent/callbacks.cpp b/engines/teenagent/callbacks.cpp index a1fd1829ed..b8007509a4 100644 --- a/engines/teenagent/callbacks.cpp +++ b/engines/teenagent/callbacks.cpp @@ -96,7 +96,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); @@ -114,12 +114,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); @@ -134,7 +134,7 @@ 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); @@ -150,17 +150,17 @@ 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); @@ -214,6 +214,7 @@ bool TeenAgentEngine::processCallback(uint16 addr) { } return true; } + case 0x4173: //fail! moveTo(86, 195, 1, true); @@ -228,7 +229,6 @@ bool TeenAgentEngine::processCallback(uint16 addr) { inventory->add(0x5c); return true; - case 0x41ce: moveTo(197, 159, 4); setOns(0, 0); @@ -285,15 +285,15 @@ 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); } @@ -490,7 +490,7 @@ bool TeenAgentEngine::processCallback(uint16 addr) { 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? + dialog->showMono(177, scene, 0, 0xd1, 0); displayMessage(0x5883, 0xef, 21472); //reloadLan(); setLan(1, 0); @@ -509,15 +509,15 @@ bool TeenAgentEngine::processCallback(uint16 addr) { } else { if (CHECK_FLAG(0xDBDF, 3)) { if (CHECK_FLAG(0xDBE3, 1)) { - dialog->show(scene, 0x6BD6, 0, 857, 0xd1, 0xef, 0, 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); @@ -590,17 +590,17 @@ 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); @@ -639,7 +639,7 @@ bool TeenAgentEngine::processCallback(uint16 addr) { 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); } @@ -667,19 +667,19 @@ bool TeenAgentEngine::processCallback(uint16 addr) { return true; case 0x4d94: //talking with fatso - dialog->show(scene, 0x33bd, 0, 666, 0xd1, 0xd0, 0, 2); + 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); reloadLan(); playSound(82, 19); playAnimation(669, 1); - dialog->showMark(scene, 0x3779); + dialog->showMark(89, scene); enableObject(15); disableObject(8); return true; @@ -798,7 +798,7 @@ bool TeenAgentEngine::processCallback(uint16 addr) { playSound(17, 5); playAnimation(545, 0); - dialog->show(scene, 0x0917, 0, 546, 0xd1, 0xd9, 0, 1); + dialog->show(5, scene, 0, 546, 0xd1, 0xd9, 0, 1); SET_FLAG(0xDA96, 1); SET_FLAG(0xDA97, 0); return true; @@ -910,7 +910,7 @@ bool TeenAgentEngine::processCallback(uint16 addr) { case 0x5d88: if (CHECK_FLAG(0xDBA5, 1)) { //dry laundry SET_FLAG(0xDBA5, 2); - dialog->show(scene, 0x1F4F, 0, 523, 0xd1, 0xe5, 0, 1); + dialog->show(46, scene, 0, 523, 0xd1, 0xe5, 0, 1); //waitLanAnimationFrame(1, 1); //another long waiting playAnimation(604, 0); @@ -923,7 +923,7 @@ 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); if (d == 0x1913) { @@ -940,7 +940,7 @@ bool TeenAgentEngine::processCallback(uint16 addr) { 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); @@ -993,16 +993,16 @@ bool TeenAgentEngine::processCallback(uint16 addr) { return true; case 0x63dc: - dialog->showMono(scene, 0x3375, 0, 0xd1, 0); + dialog->showMono(86, scene, 0, 0xd1, 0); return true; case 0x646e: case 0x6475: - dialog->showMono(scene, 0x32C1, 0, 0xd1, 0); + dialog->showMono(85, scene, 0, 0xd1, 0); return true; case 0x6479: - dialog->showMono(scene, 0x325e, 0, 0xd1, 0); + dialog->showMono(84, scene, 0, 0xd1, 0); return true; case 0x6507: @@ -1090,7 +1090,7 @@ bool TeenAgentEngine::processCallback(uint16 addr) { if (CHECK_FLAG(0xDBAF, 1)) return false; - dialog->showMono(scene, 0x2193, 0, 0xd1, 0); + dialog->showMono(50, scene, 0, 0xd1, 0); SET_FLAG(0xDBAF, 1); return true; @@ -1197,12 +1197,12 @@ 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); @@ -1223,14 +1223,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; case 0x7e4f: //giving magazine to captain - dialog->show(scene, 0x66c0, 0, 856, 0xd1, 0xec, 0, 1); + dialog->show(162, scene, 0, 856, 0xd1, 0xec, 0, 1); playSound(5, 3); playActorAnimation(852, true); playActorAnimation(853, true); @@ -1242,7 +1242,7 @@ 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); @@ -1262,7 +1262,7 @@ 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); @@ -1292,13 +1292,13 @@ bool TeenAgentEngine::processCallback(uint16 addr) { playSound(5, 2); playSound(5, 18); playActorAnimation(810); - dialog->show(scene, 0x60BF, 0, 809, 0xd1, 0xd0, 0, 1); + dialog->show(147, scene, 0, 809, 0xd1, 0xd0, 0, 1); SET_FLAG(0xDBDA, 1); } return true; case 0x80c3: //show kaleydoscope to the guard - dialog->show(scene, 0x6811, 0, 809, 0xd1, 0xd0, 0, 1); + dialog->show(165, scene, 0, 809, 0xd1, 0xd0, 0, 1); playSound(5, 3); playSound(5, 30); playSound(26, 14); @@ -1323,7 +1323,7 @@ bool TeenAgentEngine::processCallback(uint16 addr) { 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; @@ -1531,9 +1531,9 @@ bool TeenAgentEngine::processCallback(uint16 addr) { return true; case 0x5b59: //picking up the rope - dialog->showMark(scene, 0x2cbd); + dialog->showMark(70, scene); wait(150); - dialog->showMark(scene, 0x2dc2); + dialog->showMark(71, scene); moveRel(0, -12, 0); playSound(34, 5); playActorAnimation(607); @@ -1564,7 +1564,7 @@ bool TeenAgentEngine::processCallback(uint16 addr) { displayMessage(0x3bac); } else { if (!CHECK_FLAG(0xDB92, 1)) - dialog->show(scene, 0x15a0, 0, 522, 0xd1, 0xd8, 0, 1); //can I search your drawers? + dialog->show(24, scene, 0, 522, 0xd1, 0xd8, 0, 1); playSound(66, 5); playSound(67, 20); @@ -1610,7 +1610,7 @@ bool TeenAgentEngine::processCallback(uint16 addr) { displayMessage(0x3d59); } else { moveTo(245, 198, 1); - dialog->show(scene, 0x21d7, 0, 524, 0xd1, 0xe5, 0, 2); + 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) @@ -1632,7 +1632,7 @@ 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; @@ -1668,12 +1668,12 @@ bool TeenAgentEngine::processCallback(uint16 addr) { case 0x60b5: 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; @@ -1916,7 +1916,7 @@ bool TeenAgentEngine::processCallback(uint16 addr) { SET_FLAG(0xDBCE, 1); } } else - dialog->showMark(scene, 0x3c9d); + dialog->showMark(97, scene); return true; case 0x70c8: @@ -2037,7 +2037,7 @@ 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); } @@ -2048,7 +2048,7 @@ bool TeenAgentEngine::processCallback(uint16 addr) { displayMessage(0x4dbb); } else { SET_FLAG(0xDBC9, 1); - dialog->showMark(scene, 0x3aca); + dialog->showMark(94, scene); playSound(61, 5); playSound(5, 14); playActorAnimation(705); @@ -2072,10 +2072,10 @@ bool TeenAgentEngine::processCallback(uint16 addr) { 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); @@ -2089,11 +2089,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); //i have to kill you anyway playAnimation(779, 0, true, true, true); playAnimation(780, 1, true, true, true); @@ -2150,7 +2150,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); @@ -2184,7 +2184,7 @@ bool TeenAgentEngine::processCallback(uint16 addr) { case 0x7ab9: if (CHECK_FLAG(0xDBB6, 1)) return false; - dialog->showMono(scene, 0x37d0, 0, 0xd1, 0); + dialog->showMono(90, scene, 0, 0xd1, 0); SET_FLAG(0xDBB6, 1); return true; @@ -2308,18 +2308,18 @@ bool TeenAgentEngine::processCallback(uint16 addr) { return false; 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; @@ -2386,7 +2386,7 @@ bool TeenAgentEngine::processCallback(uint16 addr) { case 0x8312: //hedgehog + plastic apple - dialog->showMark(scene, 0x3000); + dialog->showMark(76, scene); setLan(1, 0); playSound(5, 24); playSound(26, 32); @@ -2508,7 +2508,7 @@ bool TeenAgentEngine::processCallback(uint16 addr) { displayMessage(0x3d40); } else { SET_FLAG(0xDB92, 1); - dialog->show(scene, 0x0fcd, 0, 502, 0xd0, 0xe5, 0, 1); + dialog->show(17, scene, 0, 502, 0xd0, 0xe5, 0, 1); waitLanAnimationFrame(1, 7); playSound(5, 16); playSound(1, 25); @@ -2598,12 +2598,12 @@ bool TeenAgentEngine::processCallback(uint16 addr) { 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); + dialog->show(38, scene, 0, 523, 0xd1, 0xe5, 0, 1); return true; case 0x890b: @@ -2629,19 +2629,19 @@ bool TeenAgentEngine::processCallback(uint16 addr) { return true; 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; @@ -2662,14 +2662,14 @@ bool TeenAgentEngine::processCallback(uint16 addr) { 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; @@ -2679,21 +2679,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); + dialog->show(44, scene, 0, 523, 0xd1, 0xe5, 0, 1); + dialog->show(45, scene, 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(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); @@ -2865,7 +2865,7 @@ bool TeenAgentEngine::processCallback(uint16 addr) { return true; case 0x8f1d: - dialog->showMark(scene, 0x2dd6); + dialog->showMark(72, scene); for (uint i = 16; i <= 30; i += 2) playSound(56, i); playSound(2, 64); @@ -3077,7 +3077,7 @@ bool TeenAgentEngine::processCallback(uint16 addr) { } if (!CHECK_FLAG(0xDBC3, 1)) { playActorAnimation(695); - dialog->showMark(scene, 0x386a); + dialog->showMark(91, scene); SET_FLAG(0xDBC3, 1); } @@ -3185,7 +3185,6 @@ bool TeenAgentEngine::processCallback(uint16 addr) { } return true; - case 0x6b86: if (CHECK_FLAG(0xDBBD, 1)) { displayMessage(0x4b39); @@ -3243,49 +3242,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()); @@ -3294,15 +3291,15 @@ 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); @@ -3322,7 +3319,7 @@ bool TeenAgentEngine::processCallback(uint16 addr) { 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); @@ -3338,9 +3335,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(); @@ -3558,7 +3555,7 @@ bool TeenAgentEngine::processCallback(uint16 addr) { playActorAnimation(728); waitLanAnimationFrame(1, 1); - dialog->show(scene, 0x3d17, 0, 727, 0xd1, 0xef, 0, 1); + dialog->show(98, scene, 0, 727, 0xd1, 0xef, 0, 1); SET_FLAG(0xDBD2, 1); processCallback(0x9175); return true; @@ -3579,7 +3576,7 @@ bool TeenAgentEngine::processCallback(uint16 addr) { playActorAnimation(729); waitLanAnimationFrame(1, 1); - dialog->show(scene, 0x3d70, 0, 727, 0xd1, 0xef, 0, 1); + dialog->show(99, scene, 0, 727, 0xd1, 0xef, 0, 1); SET_FLAG(0xDBD3, 1); processCallback(0x9175); return true; @@ -3600,7 +3597,7 @@ bool TeenAgentEngine::processCallback(uint16 addr) { playActorAnimation(730); waitLanAnimationFrame(1, 1); - dialog->show(scene, 0x3dd6, 0, 727, 0xd1, 0xef, 0, 1); + dialog->show(100, scene, 0, 727, 0xd1, 0xef, 0, 1); SET_FLAG(0xDBD4, 1); processCallback(0x9175); return true; @@ -3611,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); @@ -3621,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); @@ -3743,7 +3740,7 @@ bool TeenAgentEngine::processCallback(uint16 addr) { SET_FLAG(0xDBC6, 1); reloadLan(); if (!CHECK_FLAG(0xDBC7, 1)) { - dialog->show(scene, 0x392c, 0, 702, 0xd1, 0xd0, 0, 1); + dialog->show(93, scene, 0, 702, 0xd1, 0xd0, 0, 1); SET_FLAG(0xDBC7, 1); } } else @@ -3813,7 +3810,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); @@ -3834,9 +3831,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); @@ -3844,16 +3841,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); @@ -3866,10 +3863,10 @@ 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) scene->push(SceneEvent(SceneEvent::kQuit)); @@ -4022,7 +4019,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; @@ -4066,7 +4063,7 @@ 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(); @@ -4079,12 +4076,12 @@ 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; @@ -4094,11 +4091,11 @@ 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; @@ -4108,13 +4105,13 @@ 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; @@ -4124,8 +4121,8 @@ 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); diff --git a/engines/teenagent/dialog.cpp b/engines/teenagent/dialog.cpp index 477ec2f7fc..bb55b6f405 100644 --- a/engines/teenagent/dialog.cpp +++ b/engines/teenagent/dialog.cpp @@ -26,6 +26,17 @@ 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) { debugC(0, kDebugDialog, "Dialog::show(%04x, %u:%u, %u:%u)", addr, slot1, animation1, slot2, animation2); int n = 0; diff --git a/engines/teenagent/dialog.h b/engines/teenagent/dialog.h index b22eff7091..e756c18f73 100644 --- a/engines/teenagent/dialog.h +++ b/engines/teenagent/dialog.h @@ -40,18 +40,20 @@ public: return pop(scene, addr, 0, 0, 0xd1, 0xd1, 0, 0); } - void show(Scene *scene, uint16 addr, uint16 animation1, uint16 animation2, byte color1, byte color2, byte slot1, byte slot2); + void show(uint16 dialogNum, Scene *scene, uint16 animation1, uint16 animation2, byte color1, byte color2, byte slot1, byte slot2); - void showMono(Scene *scene, uint16 addr, uint16 animation, byte color, byte slot) { - show(scene, addr, animation, animation, color, color, slot, slot); + void showMono(uint16 dialogNum, Scene *scene, uint16 animation, byte color, byte slot) { + show(dialogNum, scene, animation, animation, color, color, slot, slot); } - 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/resources.h b/engines/teenagent/resources.h index d4cde18db8..1f14f2cbea 100644 --- a/engines/teenagent/resources.h +++ b/engines/teenagent/resources.h @@ -55,7 +55,8 @@ public: Segment cseg, dseg; Font font7, font8; - const byte *getDialog(uint16 dialogNum) { return eseg.ptr(dialogOffsets[dialogNum]); } + //const byte *getDialog(uint16 dialogNum) { return eseg.ptr(dialogOffsets[dialogNum]); } + uint16 getDialogAddr(uint16 dialogNum) { return dialogOffsets[dialogNum]; } Segment eseg; private: -- cgit v1.2.3