Skip to content

Commit

Permalink
TEENAGENT: Migrate Dialog Stack Address usages to symbols.
Browse files Browse the repository at this point in the history
  • Loading branch information
digitall committed Aug 5, 2012
1 parent 2e84894 commit 6c06a83
Show file tree
Hide file tree
Showing 4 changed files with 86 additions and 142 deletions.
59 changes: 30 additions & 29 deletions engines/teenagent/callbacks.cpp
Expand Up @@ -457,7 +457,7 @@ void TeenAgentEngine::fnGivingFlowerToOldLady() {
}

void TeenAgentEngine::fnGiveAnotherFlowerToOldLady() {
dialog->pop(scene, 0xdaf0, 0, 523, textColorMark, textColorOldLady, 0, 1);
dialog->pop(scene, dsAddr_dialogStackOldLady, 0, 523, textColorMark, textColorOldLady, 0, 1);
}

void TeenAgentEngine::fnGivingFlowerToAnne() {
Expand All @@ -479,7 +479,7 @@ void TeenAgentEngine::fnGivingFlowerToAnne() {
}

void TeenAgentEngine::fnGiveAnotherFlowerToAnne() {
dialog->pop(scene, 0xdb02, 0, 524, textColorMark, textColorAnne, 0, 2);
dialog->pop(scene, dsAddr_dialogStackAnotherFlowerToAnne, 0, 524, textColorMark, textColorAnne, 0, 2);
}

void TeenAgentEngine::rejectMessage() {
Expand Down Expand Up @@ -548,7 +548,7 @@ bool TeenAgentEngine::processCallback(uint16 addr) {
case 0x4056:
// FIXME - This is the bird use callback in the first act at
// the mudpool. Current Code based on behaviour. Need to analyse cseg data.
dialog->popMark(scene, 0xdb7a);
dialog->popMark(scene, dsAddr_dialogStackMudpoolBird);
break;

case 0x4060:
Expand Down Expand Up @@ -589,7 +589,7 @@ bool TeenAgentEngine::processCallback(uint16 addr) {
SET_FLAG(dsAddr_gotMugOfMudFlag, 1);
} else {
fnPoleClimbFail();
dialog->popMark(scene, 0xdb72);
dialog->popMark(scene, dsAddr_dialogStackFallIntoMudpool);
}
}
break;
Expand Down Expand Up @@ -779,7 +779,7 @@ bool TeenAgentEngine::processCallback(uint16 addr) {
SET_FLAG(dsAddr_JailCableAndBowlState, 3);
scene->getObject(4)->setName("body");
} else {
if (dialog->pop(scene, 0xdb5c, 0, 0, textColorMark, textColorMark, 0, 0) == 0x636b) { // 'im getting hungry'
if (dialog->pop(scene, dsAddr_dialogStackJailDoorGrates, 0, 0, textColorMark, textColorMark, 0, 0) == 0x636b) { // 'im getting hungry'
wait(100);
playSound(52, 8);
playSound(52, 13);
Expand Down Expand Up @@ -977,7 +977,7 @@ bool TeenAgentEngine::processCallback(uint16 addr) {
SET_FLAG(dsAddr_gotPasswordNeedSpeakBarmanFlag, 0);
}
} else {
dialog->pop(scene, 0xdb68, 0, 857, textColorMark, textColorBarman, 0, 1);
dialog->pop(scene, dsAddr_dialogStackBarman, 0, 857, textColorMark, textColorBarman, 0, 1);
}
}
break;
Expand Down Expand Up @@ -1043,7 +1043,7 @@ bool TeenAgentEngine::processCallback(uint16 addr) {
break;

case 0x483a:
dialog->popMark(scene, 0xdb82);
dialog->popMark(scene, dsAddr_dialogStackInterrogateCaptain);
break;

case 0x4844:
Expand All @@ -1068,7 +1068,7 @@ bool TeenAgentEngine::processCallback(uint16 addr) {
} else if (CHECK_FLAG(dsAddr_birdOnBarRadioAntennaFlag, 1)) {
displayMessage(dsAddr_barmanTooCloseMsg); // "The barman is too close"
} else {
dialog->pop(scene, 0xdb8a, 0, 857, textColorMark, textColorBarman, 0, 1);
dialog->pop(scene, dsAddr_dialogStackBarCellarDoor, 0, 857, textColorMark, textColorBarman, 0, 1);
}
break;

Expand Down Expand Up @@ -1132,9 +1132,9 @@ bool TeenAgentEngine::processCallback(uint16 addr) {
case 0x4c70:
if (CHECK_FLAG(dsAddr_act1GuardState, 0)) {
if (CHECK_FLAG(dsAddr_ShownPassToGuardFlag, 1)) { // papers are shown
dialog->pop(scene, 0xdb4c, 0, 809, textColorMark, textColorCampGuard, 0, 1);
dialog->pop(scene, dsAddr_dialogStackCampGuardReadingNews, 0, 809, textColorMark, textColorCampGuard, 0, 1);
} else {
dialog->pop(scene, 0xdb40, 0, 809, textColorMark, textColorCampGuard, 0, 1);
dialog->pop(scene, dsAddr_dialogStackCampGuardWantsDocuments, 0, 809, textColorMark, textColorCampGuard, 0, 1);
}
} else {
displayMessage(dsAddr_helloQMsg); // "Hello?"
Expand All @@ -1158,13 +1158,13 @@ bool TeenAgentEngine::processCallback(uint16 addr) {
} else {
dialog->show(144, scene, 0, 809, textColorMark, textColorCampGuard, 0, 1);
moveTo(269, 175, 4);
dialog->pop(scene, 0xdb56, 0, 809, textColorMark, textColorCampGuard, 0, 1);
dialog->pop(scene, dsAddr_dialogStackCampGuardShowPass, 0, 809, textColorMark, textColorCampGuard, 0, 1);
}
break;

case 0x4cf1: // talking with mansion guard
SET_FLAG(dsAddr_spokenWithMansionGuardFlag, 1);
if (dialog->pop(scene, 0xdaa6, 0, 529, textColorMark, textColorMansionGuard, 0, 1) == 0x1b4) {
if (dialog->pop(scene, dsAddr_dialogStackPleadingToMansionGuard, 0, 529, textColorMark, textColorMansionGuard, 0, 1) == 0x01b4) { // 2nd try
Common::Point p = scene->getPosition();
moveTo(189, 159, 0);
//waitLanAnimationFrame(1, 1);
Expand All @@ -1177,7 +1177,7 @@ bool TeenAgentEngine::processCallback(uint16 addr) {

moveTo(p, 2);
inventory->add(invItemChocCandy);
dialog->pop(scene, 0xdaa6, 0, 529, textColorMark, textColorMansionGuard, 0, 1);
dialog->pop(scene, dsAddr_dialogStackPleadingToMansionGuard, 0, 529, textColorMark, textColorMansionGuard, 0, 1);
}
break;

Expand Down Expand Up @@ -1434,8 +1434,8 @@ bool TeenAgentEngine::processCallback(uint16 addr) {

case 0x55a8:
{
uint16 d = dialog->popMark(scene, 0xdb08);
if (d == 0x2c5d) {
uint16 d = dialog->popMark(scene, dsAddr_dialogStackSquirrel);
if (d == 0x2c5d) { // 4th try - Throw Nut
waitLanAnimationFrame(1, 0x23);
setOns(0, 0);
playSound(52, 9);
Expand All @@ -1447,7 +1447,7 @@ bool TeenAgentEngine::processCallback(uint16 addr) {
displayMessage(dsAddr_ThanksMsg); // "Thanks."
disableObject(5);
SET_FLAG(dsAddr_squirrelNutState, 1);
} else if (d != 0x2c9b) {
} else if (d != 0x2c9b) { // 5th (last) try
waitLanAnimationFrame(1, 0x23);
playSound(52, 9);
playSound(52, 11);
Expand Down Expand Up @@ -1653,8 +1653,8 @@ bool TeenAgentEngine::processCallback(uint16 addr) {
playAnimation(605, 0);
dialog->show(47, scene, 0, 523, textColorMark, textColorOldLady, 0, 1);
} else {
uint16 d = dialog->pop(scene, 0xdada, 0, 523, textColorMark, textColorOldLady, 0, 1);
if (d == 0x1913) {
uint16 d = dialog->pop(scene, dsAddr_dialogStackAskOldLadyOK, 0, 523, textColorMark, textColorOldLady, 0, 1);
if (d == 0x1913) { // 3rd time
wait(100);
moveRel(0, 0, 3);
wait(50);
Expand Down Expand Up @@ -1686,7 +1686,7 @@ bool TeenAgentEngine::processCallback(uint16 addr) {

case 0x5ff3: // get duster
if (CHECK_FLAG(dsAddr_givenFlowerToOldLadyAlreadyFlag, 0)) {
dialog->pop(scene, 0xdaf6, 0, 523, textColorMark, textColorOldLady, 0, 1);
dialog->pop(scene, dsAddr_dialogStackBorrowDusterFromOldLady, 0, 523, textColorMark, textColorOldLady, 0, 1);
} else {
dialog->show(43, scene, 0, 523, textColorMark, textColorOldLady, 0, 1);
wait(50);
Expand Down Expand Up @@ -2421,7 +2421,7 @@ bool TeenAgentEngine::processCallback(uint16 addr) {
break;

case 0x58a2:
dialog->pop(scene, 0xdaba, 0, 502, textColorMark, textColorSonny, 0, 1);
dialog->pop(scene, dsAddr_dialogStackSonny, 0, 502, textColorMark, textColorSonny, 0, 1);
scene->getObject(13)->setName((const char *)res->dseg.ptr(dsAddr_scnObjNameSonny));
break;

Expand Down Expand Up @@ -2488,7 +2488,7 @@ bool TeenAgentEngine::processCallback(uint16 addr) {
break;

case 0x5b3a: // Click on dog
dialog->popMark(scene, 0xdb14);
dialog->popMark(scene, dsAddr_dialogStackDog);
break;

case 0x5b59: // picking up the rope
Expand All @@ -2510,7 +2510,7 @@ bool TeenAgentEngine::processCallback(uint16 addr) {
break;

case 0x5be1: // Talk to grandpa
dialog->pop(scene, 0xdac4, 0, 522, textColorMark, textColorGrandpa, 0, 1);
dialog->pop(scene, dsAddr_dialogStackGrandpa, 0, 522, textColorMark, textColorGrandpa, 0, 1);
break;

case 0x5bee:
Expand Down Expand Up @@ -2544,7 +2544,7 @@ bool TeenAgentEngine::processCallback(uint16 addr) {
setOns(0, 0);
playActorAnimation(520);
} else {
dialog->pop(scene, 0xdace, 0, 522, textColorMark, textColorGrandpa, 0, 1);
dialog->pop(scene, dsAddr_dialogStackGrandpaShotgun, 0, 522, textColorMark, textColorGrandpa, 0, 1);
}
break;

Expand All @@ -2562,7 +2562,7 @@ bool TeenAgentEngine::processCallback(uint16 addr) {
disableObject(13);
inventory->add(invItemFan);
} else {
dialog->pop(scene, 0xdad4, 0, 522, textColorMark, textColorGrandpa, 0, 1);
dialog->pop(scene, dsAddr_dialogStackGrandpaFan, 0, 522, textColorMark, textColorGrandpa, 0, 1);
}
break;

Expand Down Expand Up @@ -2608,7 +2608,7 @@ bool TeenAgentEngine::processCallback(uint16 addr) {
if (CHECK_FLAG(dsAddr_nutSwappedForAppleFlag, 1)) {
displayMessage(dsAddr_noFruitMsg); // "There are no more interesting fruits here"
} else {
dialog->pop(scene, 0xdafc, 0, 523, textColorMark, textColorOldLady, 0, 1);
dialog->pop(scene, dsAddr_dialogStackGetAppleOldLady, 0, 523, textColorMark, textColorOldLady, 0, 1);
}
break;

Expand Down Expand Up @@ -2657,7 +2657,7 @@ bool TeenAgentEngine::processCallback(uint16 addr) {

case 0x61e9:
if (CHECK_FLAG(dsAddr_lightOnFlag, 1))
dialog->popMark(scene, 0xdb1e);
dialog->popMark(scene, dsAddr_dialogStackTakeAxe);
else
fnTooDark();
break;
Expand Down Expand Up @@ -2843,7 +2843,7 @@ bool TeenAgentEngine::processCallback(uint16 addr) {
break;

case 0x70bb:
dialog->pop(scene, 0xdb24, 0, 709, textColorMark, textColorCook, 0, 1);
dialog->pop(scene, dsAddr_dialogStackBusyCook, 0, 709, textColorMark, textColorCook, 0, 1);
break;

case 0x71ae:
Expand Down Expand Up @@ -3104,7 +3104,7 @@ bool TeenAgentEngine::processCallback(uint16 addr) {
break;

case 0x783d:
dialog->pop(scene, 0xdb36, 0, 797, textColorMark, textColorJohnNoty, 0, 1);
dialog->pop(scene, dsAddr_dialogStackJohnNotyEndgame, 0, 797, textColorMark, textColorJohnNoty, 0, 1);
break;

case 0x7966:
Expand Down Expand Up @@ -3589,6 +3589,7 @@ bool TeenAgentEngine::processCallback(uint16 addr) {
inventory->remove(invItemWrappedCandy);
playSound(5, 6);
dialog->show(60, scene, 0, 524, textColorMark, textColorAnne, 0, 2);
// FIXME - Dialog #61 not explicitly called. Does Dialog #60 run on somehow?
playActorAnimation(555, true);
playAnimation(556, 1, true);
waitAnimation();
Expand Down Expand Up @@ -4094,7 +4095,7 @@ bool TeenAgentEngine::processCallback(uint16 addr) {

case 0x6c83:
waitLanAnimationFrame(1, 1);
dialog->pop(scene, 0xdb2e, 0, 727, textColorMark, textColorMike, 0, 1);
dialog->pop(scene, dsAddr_dialogStackRobotSafe, 0, 727, textColorMark, textColorMike, 0, 1);
scene->getObject(1)->setName((const char *)res->dseg.ptr(dsAddr_scnObjNameMike));
SET_FLAG(dsAddr_MansionRobotSafeUnlockedFlag, 1);
break;
Expand Down
2 changes: 2 additions & 0 deletions engines/teenagent/dialog.cpp
Expand Up @@ -32,6 +32,8 @@ void Dialog::show(uint16 dialogNum, Scene *scene, uint16 animation1, uint16 anim
// 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.
// Similar issue occurs with Dialog 190 which is used from dialogue stack at 0x7403, rather than start of 0x7405
// Similar issue occurs with Dialog 0 which is used from dialogue stack at 0x0001, rather than start of 0x0000
if (dialogNum == 163)
addr -= 2;
show(scene, addr, animation1, animation2, color1, color2, slot1, slot2);
Expand Down
112 changes: 0 additions & 112 deletions engines/teenagent/notes.txt

This file was deleted.

0 comments on commit 6c06a83

Please sign in to comment.