aboutsummaryrefslogtreecommitdiff
path: root/engines/teenagent
diff options
context:
space:
mode:
authorVladimir Menshakov2009-09-05 17:15:28 +0000
committerVladimir Menshakov2009-09-05 17:15:28 +0000
commit549e2b054092d3ba2ef1c53245227107d406b4c8 (patch)
tree21775394a617c743382a95b28501c7934098142b /engines/teenagent
parent6ed62584ed39c5cffea17893ed4eab3e23f1a786 (diff)
downloadscummvm-rg350-549e2b054092d3ba2ef1c53245227107d406b4c8.tar.gz
scummvm-rg350-549e2b054092d3ba2ef1c53245227107d406b4c8.tar.bz2
scummvm-rg350-549e2b054092d3ba2ef1c53245227107d406b4c8.zip
more callbacks, removed anotherMansionTry()
svn-id: r43964
Diffstat (limited to 'engines/teenagent')
-rw-r--r--engines/teenagent/callbacks.cpp326
-rw-r--r--engines/teenagent/scene.cpp12
-rw-r--r--engines/teenagent/teenagent.cpp28
-rw-r--r--engines/teenagent/teenagent.h3
4 files changed, 278 insertions, 91 deletions
diff --git a/engines/teenagent/callbacks.cpp b/engines/teenagent/callbacks.cpp
index 4dbecee4f2..8fe9e6ebf5 100644
--- a/engines/teenagent/callbacks.cpp
+++ b/engines/teenagent/callbacks.cpp
@@ -41,22 +41,6 @@ void TeenAgentEngine::rejectMessage() {
scene->displayMessage((const char *)res->dseg.ptr(res->dseg.get_word(0x339e + 2 * i)));
}
-void TeenAgentEngine::anotherMansionTry() {
- Resources * res = Resources::instance();
- byte tries = ++ *(res->dseg.ptr(0xDBEA));
- debug(0, "another mansion try: %u", tries);
- if (tries >= 7)
- return;
- uint16 ptr = res->dseg.get_word(res->dseg.get_word((tries - 2) * 2 + 0x6035));
-
- playMusic(11);
- debug(0, "FIXME: cutscene: meanwhile in a mansion #%u, %04x", tries, ptr);
- processCallback(ptr);
- playMusic(6);
- if (scene->getId() == 11 && CHECK_FLAG(0xDBEC, 1))
- return;
- //call 0xac27
-}
bool TeenAgentEngine::processCallback(uint16 addr) {
if (addr == 0)
@@ -534,17 +518,20 @@ bool TeenAgentEngine::processCallback(uint16 addr) {
return true;
case 0x4cf1: { //talking with mansion guard
- playAnimation(529, 1);
SET_FLAG(0xda96, 1);
- if (Dialog::pop(scene, 0xdaa6) != 0x1b4)
+ if (Dialog::pop(scene, 0xdaa6, 529) != 0x1b4)
return true;
+
Common::Point p = scene->getPosition();
moveTo(159, 189, 0);
-
- playAnimation(550);
- playAnimation(551, 1);
- moveTo(p, 0);
+ playSound(5, 2);
+ playSound(5, 19);
+ playAnimation(550, 0, true);
+ playAnimation(551, 1, true);
+ waitAnimation();
+
+ moveTo(p, 2);
inventory->add(0x13);
playAnimation(529, 1);
Dialog::pop(scene, 0xdaa6);
@@ -555,6 +542,24 @@ bool TeenAgentEngine::processCallback(uint16 addr) {
loadScene(14, 280, 198);
return true;
+ case 0x4d56:
+ inventory->add(16);
+ disableObject(2);
+ setOns(0, 0);
+ playSound(5);
+ playAnimation(547);
+ return true;
+
+
+ case 0x4eb9://Pick up wrapper
+ playSound(5, 12);
+ playSound(5, 18);
+ inventory->add(0x12);
+ setOns(1, 0);
+ playAnimation(549);
+ disableObject(13);
+ return true;
+
case 0x4f25:
playAnimation(967);
displayMessage(0x3542);
@@ -598,7 +603,14 @@ bool TeenAgentEngine::processCallback(uint16 addr) {
setOns(0, 16);
enableObject(2);
Dialog::show(scene, 0x0917);
+ return true;
+ case 0x51f0:
+ setOns(0, 0);
+ playSound(5, 11);
+ playAnimation(637);
+ disableObject(7);
+ inventory->add(49);
return true;
case 0x5217:
@@ -708,6 +720,27 @@ bool TeenAgentEngine::processCallback(uint16 addr) {
playAnimation(541);
}
return true;
+
+ case 0x6205:
+ if (CHECK_FLAG(0xDBA4, 1))
+ displayMessage(0x450e);
+ else
+ processCallback(0x61fe);
+ return true;
+
+ case 0x6217:
+ if (CHECK_FLAG(0xDBA4, 1))
+ displayMessage(0x44d6);
+ else
+ processCallback(0x61fe);
+ return true;
+
+ case 0x62c1:
+ if (CHECK_FLAG(0xDBA4, 1))
+ return false;
+
+ processCallback(0x61fe);
+ return true;
case 0x646e:
case 0x6475:
@@ -799,6 +832,12 @@ bool TeenAgentEngine::processCallback(uint16 addr) {
Dialog::show(scene, 0x2193);
SET_FLAG(0xDBAF, 1);
return true;
+
+ case 0x79c3:
+ if (CHECK_FLAG(0xDBA4, 1))
+ return false;
+ processCallback(0x61fe);
+ return true;
case 0x7b26: //cutting the fence
setOns(0, 0);
@@ -963,8 +1002,9 @@ bool TeenAgentEngine::processCallback(uint16 addr) {
//alredy shown
displayMessage(0x53F2);
} else {
- playSound(5);
displayMessage(0x53DD);
+ playSound(5, 2);
+ playSound(5, 18);
playAnimation(810, false);
Dialog::show(scene, 0x60BF);
SET_FLAG(0xDBDA, 1);
@@ -988,22 +1028,6 @@ bool TeenAgentEngine::processCallback(uint16 addr) {
//Shore
- case 0x4d56:
- inventory->add(16);
- disableObject(2);
- setOns(0, 0);
- playSound(5);
- playAnimation(547);
- return true;
-
-
- case 0x4eb9://Pick up wrapper
- inventory->add(0x12);
- setOns(1, 0);
- playAnimation(549);
- disableObject(13);
- return true;
-
case 0x5348:
if (CHECK_FLAG(0xdb99, 1)) { //got broken paddle from boat
displayMessage(0x351f);
@@ -1285,24 +1309,51 @@ bool TeenAgentEngine::processCallback(uint16 addr) {
}
return true;
+ case 0x607f:
+ processCallback(0x60b5);
+ return true;
+
+ case 0x6083:
+ if (CHECK_FLAG(0xDBA4, 1)) {
+ setOns(0, 0);
+ playSound(56, 10);
+ playAnimation(599);
+ inventory->add(37);
+ disableObject(2);
+ } else
+ processCallback(0x60b5);
+ return true;
+
case 0x60b5:
if (CHECK_FLAG(0xDBAE, 1)) {
processCallback(0x60d9);
- Dialog::show(scene, 0x2FDD);
+ Dialog::show(scene, 0x2fdd);
} else {
- Dialog::show(scene, 0x2E41);
+ Dialog::show(scene, 0x2e41);
processCallback(0x60d9);
- Dialog::show(scene, 0x2E6d);
+ Dialog::show(scene, 0x2e6d);
}
return true;
case 0x60d9: {
Object *obj = scene->getObject(3);
- moveTo(obj->actor_rect.right, obj->actor_rect.bottom, obj->actor_orientation);
+ moveTo(obj);
processCallback(0x612b);
moveTo(48, 190, 3);
}
return true;
+
+ case 0x612b:
+ playSound(52, 10);
+ playSound(52, 14);
+ playSound(52, 18);
+ playSound(52, 21);
+ playSound(52, 25);
+ playSound(52, 28);
+ playSound(52, 32);
+ playAnimation(600);
+ loadScene(21, 297, 178, 3);
+ return true;
case 0x6176:
if (CHECK_FLAG(0xDBA4, 1)) {
@@ -1311,15 +1362,55 @@ bool TeenAgentEngine::processCallback(uint16 addr) {
}
playSound(71, 6);
playAnimation(598);
+ loadScene(24, scene->getPosition());
setOns(2, 0);
+ setLan(1, 0);
playAnimation(660, 1);
disableObject(1);
- setLan(1, 0);
SET_FLAG(0xDBA4, 1);
loadScene(24, scene->getPosition());
return true;
+ case 0x61e9:
+ if (CHECK_FLAG(0xDBA4, 1)) {
+ Dialog::pop(scene, 0xdb1e);
+ } else
+ processCallback(0x61fe);
+
+ return true;
+
+ case 0x6229: //shelves in cellar
+ if (CHECK_FLAG(0xDBA4, 1)) {
+ Common::Point p = scene->getPosition();
+ byte v = GET_FLAG(0xDBB4);
+ switch(v) {
+ case 0:
+ displayMessage(0x4532);
+ moveRel(-34, 0, 1);
+ displayMessage(0x4555);
+ moveRel(20, 0, 1);
+ displayMessage(0x4568);
+ moveRel(20, 0, 1);
+ displayMessage(0x457b);
+ moveRel(20, 0, 1);
+ displayMessage(0x458e);
+ moveTo(p, 3);
+ SET_FLAG(0xDBB4, 1);
+ break;
+ case 1:
+ displayMessage(0x45b8);
+ displayMessage(0x45da);
+ SET_FLAG(0xDBB4, 2);
+ break;
+ default:
+ displayMessage(0x4603);
+ }
+ } else
+ processCallback(0x61fe);
+
+ return true;
+
case 0x6480: //flips
if (CHECK_FLAG(0xDB96, 1)) {
setOns(3, 36);
@@ -1350,36 +1441,6 @@ bool TeenAgentEngine::processCallback(uint16 addr) {
} else
return false;
- case 0x612b://climb basement ladder(exit)
- playSound(52, 10);
- playSound(52, 14);
- playSound(52, 18);
- playSound(52, 21);
- playSound(52, 25);
- playSound(52, 28);
- playAnimation(600);
- loadScene(21, 297, 178, 3);
- return true;
-
- case 0x6351:
- if (CHECK_FLAG(0xdaca, 1)) { //cave bush is cut down
- playMusic(8);
- loadScene(26, 319, 169);
- return true;
- } else {
- displayMessage(0x3bd2);
- return true;
- }
-
- case 0x6592: //Rake
- setOns(1, 0);
- playSound(18, 10);
- playAnimation(553);
- inventory->add(0x15);
- displayMessage(0x3605);
- disableObject(11);
- return true;
-
case 0x62d0://Get bone from under rock
playSound(26, 6);
setOns(0, 0);
@@ -1393,6 +1454,16 @@ bool TeenAgentEngine::processCallback(uint16 addr) {
displayMessage(0x3790);
return true;
+ case 0x6351:
+ if (CHECK_FLAG(0xdaca, 1)) { //cave bush is cut down
+ playMusic(8);
+ loadScene(26, 319, 169);
+ return true;
+ } else {
+ displayMessage(0x3bd2);
+ return true;
+ }
+
case 0x6411://Kick hen
if (CHECK_FLAG(0xdb93, 1)) { //already kicked hen
displayMessage(0x3e08);
@@ -1410,6 +1481,21 @@ bool TeenAgentEngine::processCallback(uint16 addr) {
return true;
}
+ case 0x6592: //Rake
+ setOns(1, 0);
+ playSound(18, 10);
+ playAnimation(553);
+ inventory->add(0x15);
+ displayMessage(0x3605);
+ disableObject(11);
+ return true;
+
+ case 0x66b5:
+ playAnimation(969);
+ playSound(89);
+ loadScene(33, 319, 181);
+ return true;
+
case 0x6519://Sickle
setOns(4, 0);
playSound(5, 11);
@@ -1510,6 +1596,20 @@ bool TeenAgentEngine::processCallback(uint16 addr) {
displayMessage(0x3DAF);
return true;
+
+ case 0x7975:
+ if (CHECK_FLAG(0xDBA4, 1))
+ return false;
+ displayMessage(0x3832);
+ return true;
+
+ case 0x7987:
+ case 0x7996:
+ case 0x79a5:
+ case 0x79b4:
+ if (CHECK_FLAG(0xDBA4, 1))
+ return false;
+ return processCallback(0x61fe);
case 0x8174:
setOns(0, 0);
@@ -1849,6 +1949,50 @@ bool TeenAgentEngine::processCallback(uint16 addr) {
playAnimation(971);
loadScene(32, 139, 199);
return true;
+
+ case 0x9002:
+
+ return true;
+
+ case 0x9aca:
+ if (scene->getId() == 13) {
+ moveTo(172, 181, 1);
+ playSound(26, 19);
+ for(uint i = 0; i < 8; ++i)
+ playSound(26, 30 + i * 11);
+ playAnimation(661);
+ //cutscene 3c80 at 30484
+ playSound(56, 10);
+ playSound(56, 21);
+
+ playSound(8, 48);
+ for(uint i = 0; i < 7; ++i)
+ playSound(26, 117 + i * 11);
+
+ moveRel(-20, 0, 0, true);
+ playAnimation(662, 0, true);
+ playAnimation(663, 2, true);
+ waitAnimation();
+ setOns(1, 49);
+
+ //cutscene 0x3c9a at 30453
+ moveTo(162, 184, 0, true);
+ playSound(26, 6);
+ playSound(26, 17);
+ playSound(56, 10);
+ playSound(56, 21);
+ playSound(19, 27);
+ playSound(24, 38);
+ playSound(23, 44);
+ playAnimation(664);
+ playAnimation(665, 2);
+ displayMessage(0x3cbc);
+ displayMessage(0x3cea);
+ inventory->remove(37);
+ processCallback(0x9d45); //another mansion try
+ } else
+ displayMessage(0x3c58);
+ return true;
case 0x9c79:
if (scene->getId() != 36) {
@@ -1884,13 +2028,35 @@ bool TeenAgentEngine::processCallback(uint16 addr) {
}
return true;
- case 0x66b5:
- playAnimation(969);
- playSound(89);
- loadScene(33, 319, 181);
- return true;
+ case 0x9d45: {
+ byte tries = ++ *(res->dseg.ptr(0xDBEA));
+ debug(0, "another mansion try: %u", tries);
+ if (tries >= 7)
+ return false;
+
+ uint16 ptr = res->dseg.get_word((tries - 2) * 2 + 0x6035);
+ byte id = scene->getId();
+
+ playMusic(11);
+ debug(0, "FIXME: cutscene: meanwhile in a mansion #%u, %04x", tries, ptr);
+ processCallback(ptr);
+ playMusic(6);
+ if (scene->getId() == 11 && CHECK_FLAG(0xDBEC, 1))
+ return true;
+ //some effect
+ loadScene(id, scene->getPosition());
+ }
+ return true;
+
+ case 0x9d90:
+ loadScene(34, scene->getPosition());
+ Dialog::show(scene, 0x6f60, 987, 986);
+ playAnimation(990, 0, true);
+ playAnimation(991, 1, true);
+ waitAnimation();
+ return true;
}
-
+
//unimplemented callback :(
for (uint i = 0; i < 32; ++i) {
debug(0, "code[%u] = %02x ", i, code[i]);
diff --git a/engines/teenagent/scene.cpp b/engines/teenagent/scene.cpp
index fa2f61614b..c699e9d653 100644
--- a/engines/teenagent/scene.cpp
+++ b/engines/teenagent/scene.cpp
@@ -402,15 +402,21 @@ bool Scene::processEventQueue() {
case SceneEvent::LoadScene: {
init(current_event.scene, current_event.dst);
+ sounds.clear();
current_event.clear();
} break;
case SceneEvent::Walk: {
- if (current_event.color != 0) {
- warp(current_event.dst, current_event.orientation);
+ Common::Point dst = current_event.dst;
+ if ((current_event.color & 2) != 0) { //relative move
+ dst.x += position.x;
+ dst.y += position.y;
+ }
+ if ((current_event.color & 1) != 0) {
+ warp(dst, current_event.orientation);
current_event.clear();
} else
- moveTo(current_event.dst, current_event.orientation);
+ moveTo(dst, current_event.orientation);
} break;
case SceneEvent::Message: {
diff --git a/engines/teenagent/teenagent.cpp b/engines/teenagent/teenagent.cpp
index de2ad35e35..6e08f72898 100644
--- a/engines/teenagent/teenagent.cpp
+++ b/engines/teenagent/teenagent.cpp
@@ -51,13 +51,11 @@ void TeenAgentEngine::processObject() {
dcall = res->dseg.ptr(READ_LE_UINT16(dcall + scene->getId() * 2 - 2));
dcall += 2 * dst_object->id - 2;
uint16 callback = READ_LE_UINT16(dcall);
- if (callback == 0) {
+ if (callback == 0 || !processCallback(callback)) {
Common::String desc = dst_object->description();
scene->displayMessage(desc);
//debug(0, "%s[%u]: description: %s", current_object->name, current_object->id, desc.c_str());
- break;
}
- processCallback(callback);
}
break;
case ActionUse:
@@ -70,8 +68,9 @@ void TeenAgentEngine::processObject() {
if (obj->inventory_id == inv->id && dst_object->id == obj->object_id) {
debug(0, "combine! %u,%u", obj->x, obj->y);
//moveTo(Common::Point(obj->x, obj->y), NULL, Examine);
- processCallback(obj->callback);
inventory->resetSelectedObject();
+ if (!processCallback(obj->callback))
+ debug(0, "fixme! display proper description");
return;
}
}
@@ -86,7 +85,8 @@ void TeenAgentEngine::processObject() {
dcall = res->dseg.ptr(READ_LE_UINT16(dcall + scene->getId() * 2 - 2));
dcall += 2 * dst_object->id - 2;
uint16 callback = READ_LE_UINT16(dcall);
- processCallback(callback);
+ if (!processCallback(callback))
+ scene->displayMessage(dst_object->description());
}
}
break;
@@ -104,8 +104,9 @@ void TeenAgentEngine::use(Object *object) {
dst_object = object;
object->rect.dump();
object->actor_rect.dump();
- if (object->actor_rect.valid()) //some objects have 0xffff in left/right
- scene->moveTo(object->actor_rect.center(), object->actor_orientation);
+
+ if (object->actor_rect.valid())
+ scene->moveTo(Common::Point(object->actor_rect.right, object->actor_rect.bottom), object->actor_orientation);
if (object->actor_orientation > 0)
scene->setOrientation(object->actor_orientation);
action = ActionUse;
@@ -352,6 +353,10 @@ void TeenAgentEngine::moveTo(const Common::Point & dst, byte o, bool warp) {
moveTo(dst.x, dst.y, o, warp);
}
+void TeenAgentEngine::moveTo(Object *obj) {
+ moveTo(obj->actor_rect.right, obj->actor_rect.bottom, obj->actor_orientation);
+}
+
void TeenAgentEngine::moveTo(uint16 x, uint16 y, byte o, bool warp) {
SceneEvent event(SceneEvent::Walk);
event.dst.x = x;
@@ -361,6 +366,15 @@ void TeenAgentEngine::moveTo(uint16 x, uint16 y, byte o, bool warp) {
scene->push(event);
}
+void TeenAgentEngine::moveRel(int16 x, int16 y, byte o, bool warp) {
+ SceneEvent event(SceneEvent::Walk);
+ event.dst.x = x;
+ event.dst.y = y;
+ event.orientation = o;
+ event.color = (warp? 1: 0) | 2;
+ scene->push(event);
+}
+
void TeenAgentEngine::playAnimation(uint16 id, byte slot, bool async) {
SceneEvent event(SceneEvent::PlayAnimation);
event.animation = id;
diff --git a/engines/teenagent/teenagent.h b/engines/teenagent/teenagent.h
index 328e865f65..8e7354f995 100644
--- a/engines/teenagent/teenagent.h
+++ b/engines/teenagent/teenagent.h
@@ -69,6 +69,8 @@ public:
void displayMessage(const Common::String &str, byte color = 0xd1);
void moveTo(const Common::Point & dst, byte o, bool warp = false);
void moveTo(uint16 x, uint16 y, byte o, bool warp = false);
+ void moveTo(Object * obj);
+ void moveRel(int16 x, int16 y, byte o, bool warp = false);
void playAnimation(uint16 id, byte slot = 0, bool async = false);
void loadScene(byte id, const Common::Point &pos, byte o = 0);
void loadScene(byte id, uint16 x, uint16 y, byte o = 0);
@@ -94,7 +96,6 @@ public:
private:
void processObject();
- void anotherMansionTry();
bool scene_busy;
Action action;