aboutsummaryrefslogtreecommitdiff
path: root/engines/lastexpress
diff options
context:
space:
mode:
authorJulien Templier2010-10-18 20:39:54 +0000
committerJulien Templier2010-10-18 20:39:54 +0000
commit6a67bfd85d33e0cf87267ab56e286bafc96ece27 (patch)
tree78d19e12626820f7c4402862f60635fe33d18738 /engines/lastexpress
parentf7645fea4504450370a81da4ea4d9248660860c9 (diff)
downloadscummvm-rg350-6a67bfd85d33e0cf87267ab56e286bafc96ece27.tar.gz
scummvm-rg350-6a67bfd85d33e0cf87267ab56e286bafc96ece27.tar.bz2
scummvm-rg350-6a67bfd85d33e0cf87267ab56e286bafc96ece27.zip
LASTEXPRESS: Implement 3 more AI logic functions
svn-id: r53587
Diffstat (limited to 'engines/lastexpress')
-rw-r--r--engines/lastexpress/entities/alexei.cpp107
-rw-r--r--engines/lastexpress/entities/august.cpp111
-rw-r--r--engines/lastexpress/entities/kahina.cpp86
-rw-r--r--engines/lastexpress/shared.h2
4 files changed, 303 insertions, 3 deletions
diff --git a/engines/lastexpress/entities/alexei.cpp b/engines/lastexpress/entities/alexei.cpp
index 30e1c4384b..974025ec14 100644
--- a/engines/lastexpress/entities/alexei.cpp
+++ b/engines/lastexpress/entities/alexei.cpp
@@ -1871,7 +1871,112 @@ IMPLEMENT_FUNCTION(45, Alexei, function45)
//////////////////////////////////////////////////////////////////////////
IMPLEMENT_FUNCTION(46, Alexei, function46)
- error("Alexei: callback function 46 not implemented!");
+ switch (savepoint.action) {
+ default:
+ break;
+
+ case kActionNone:
+ if (params->param1 == kTimeInvalid)
+ break;
+
+ if (getState()->time <= kTime2493000) {
+
+ if (getEntities()->isInSalon(kEntityPlayer) || getEntities()->isInSalon(kEntityAugust) || !params->param1)
+ params->param1 = getState()->time;
+
+ if (params->param1 >= getState()->time)
+ break;
+ }
+
+ params->param1 = kTimeInvalid;
+
+ getScenes()->loadSceneFromItemPosition(kItem22);
+
+ if (getEntities()->isInSalon(kEntityPlayer)) {
+ getSound()->excuseMe(kEntityAlexei);
+
+ getScenes()->loadSceneFromPosition(kCarRestaurant, getScenes()->get(getState()->scene)->position);
+ }
+
+ setCallback(4);
+ setup_function13();
+ break;
+
+ case kActionDefault:
+ setCallback(1);
+ setup_function16(kTime2488500, "411");
+ break;
+
+ case kActionCallback:
+ switch (getCallback()) {
+ default:
+ break;
+
+ case 1:
+ setCallback(2);
+ setup_function14();
+ break;
+
+ case 2:
+ setCallback(3);
+ setup_updateEntity(kCarRedSleeping, kPosition_9460);
+ break;
+
+ case 4:
+ if (getEntities()->isPlayerPosition(kCarGreenSleeping, 66))
+ getScenes()->loadSceneFromPosition(kCarGreenSleeping, 49);
+
+ setCallback(5);
+ setup_function16(kTime2507400, "412");
+ break;
+
+ case 5:
+ setCallback(6);
+ setup_enterExitCompartment("602Fb", kObjectCompartment2);
+ break;
+
+ case 6:
+ getObjects()->update(kObjectCompartment2, kEntityPlayer, kObjectLocationNone, kCursorHandKnock, kCursorHand);
+ getData()->location = kLocationOutsideCompartment;
+
+ setCallback(7);
+ setup_updateEntity(kCarRedSleeping, kPosition_7500);
+ break;
+
+ case 7:
+ getEntities()->drawSequenceRight(kEntityAlexei, "602Eb");
+ getEntities()->enterCompartment(kEntityAlexei, kObjectCompartmentB);
+ getData()->location = kLocationInsideCompartment;
+
+ if (getEntities()->checkFields19(kEntityPlayer, kCarRedSleeping, kPosition_7850)) {
+ getAction()->playAnimation(isNight() ? kEventCathTurningNight : kEventCathTurningDay);
+ getSound()->playSound(kEntityPlayer, "BUMP");
+ getScenes()->loadSceneFromObject(kObjectCompartmentB);
+ }
+
+ setCallback(8);
+ setup_callbackActionOnDirection();
+ break;
+
+ case 8:
+ getEntities()->exitCompartment(kEntityAlexei, kObjectCompartmentB);
+ getEntities()->clearSequences(kEntityAlexei);
+ getData()->entityPosition = kPosition_8200;
+ getData()->location = kLocationInsideCompartment;
+ getObjects()->update(kObjectCompartmentA, kEntityPlayer, kObjectLocation1, kCursorNormal, kCursorNormal);
+ getObjects()->update(kObject48, kEntityPlayer, kObjectLocation1, kCursorNormal, kCursorNormal);
+
+ setCallback(9);
+ setup_playSound("TAT4167");
+ break;
+
+ case 9:
+ getSavePoints()->push(kEntityAlexei, kEntityChapters, kAction156435676);
+ setup_function47();
+ break;
+ }
+ break;
+ }
}
//////////////////////////////////////////////////////////////////////////
diff --git a/engines/lastexpress/entities/august.cpp b/engines/lastexpress/entities/august.cpp
index 419d716ced..8b0481f00f 100644
--- a/engines/lastexpress/entities/august.cpp
+++ b/engines/lastexpress/entities/august.cpp
@@ -2760,7 +2760,116 @@ IMPLEMENT_FUNCTION(67, August, chapter5Handler)
//////////////////////////////////////////////////////////////////////////
IMPLEMENT_FUNCTION(68, August, function68)
- error("August: callback function 68 not implemented!");
+ switch (savepoint.action) {
+ default:
+ break;
+
+ case kActionNone:
+ if (params->param1) {
+ UPDATE_PARAM(params->param4, getState()->timeTicks, 75);
+
+ params->param1 = 0;
+ params->param2 = 1;
+
+ getObjects()->update(kObjectCompartment3, kEntityAugust, kObjectLocation1, kCursorNormal, kCursorNormal);
+ }
+
+ params->param4 = 0;
+ break;
+
+ case kActionKnock:
+ case kActionOpenDoor:
+ if (params->param1) {
+ getObjects()->update(kObjectCompartment3, kEntityAugust, kObjectLocation1, kCursorNormal, kCursorNormal);
+
+ setCallback(1);
+ setup_playSound(getSound()->justCheckingCath());
+ } else {
+ setCallback(savepoint.action == kActionKnock ? 2 : 3);
+ setup_playSound(savepoint.action == kActionKnock ? "LIB012" : "LIB013");
+ }
+ break;
+
+ case kActionDefault:
+ getData()->entityPosition = kPosition_6470;
+ getData()->location = kLocationInsideCompartment;
+ getData()->car = kCarGreenSleeping;
+
+ getObjects()->update(kObjectCompartment3, kEntityAugust, kObjectLocation1, kCursorHandKnock, kCursorHand);
+ break;
+
+ case kActionDrawScene:
+ if (params->param1 || params->param2) {
+ params->param1 = 0;
+ params->param2 = 0;
+ params->param3 = 0;
+
+ getObjects()->update(kObjectCompartment3, kEntityAugust, kObjectLocation1, kCursorHandKnock, kCursorHand);
+ }
+ break;
+
+ case kActionCallback:
+ switch (getCallback()) {
+ default:
+ break;
+
+ case 1:
+ params->param1 = 0;
+ getObjects()->update(kObjectCompartment3, kEntityAugust, kObjectLocation1, kCursorHandKnock, kCursorHand);
+ break;
+
+ case 2:
+ case 3:
+ ++params->param3;
+
+ switch (params->param3) {
+ default:
+ break;
+
+ case 1:
+ getObjects()->update(kObjectCompartment3, kEntityAugust, kObjectLocation1, kCursorNormal, kCursorNormal);
+
+ setCallback(4);
+ setup_playSound("Aug5002");
+ break;
+
+ case 2:
+ getObjects()->update(kObjectCompartment3, kEntityAugust, kObjectLocation1, kCursorNormal, kCursorNormal);
+
+ setCallback(5);
+ setup_playSound("Aug5002A");
+ break;
+
+ case 3:
+ getObjects()->update(kObjectCompartment3, kEntityAugust, kObjectLocation1, kCursorNormal, kCursorNormal);
+
+ setCallback(6);
+ setup_playSound("Aug5002B");
+ break;
+ }
+ break;
+
+ case 4:
+ params->param1 = 1;
+ getObjects()->update(kObjectCompartment3, kEntityAugust, kObjectLocation1, kCursorTalk, kCursorNormal);
+ break;
+
+ case 5:
+ getObjects()->update(kObjectCompartment3, kEntityAugust, kObjectLocation1, kCursorHandKnock, kCursorHand);
+ break;
+
+ case 6:
+ params->param2 = 1;
+ break;
+ }
+ break;
+
+ case kAction203078272:
+ getSavePoints()->push(kEntityAugust, kEntityTatiana, kAction203078272);
+
+ setup_unhookCars();
+ break;
+ }
}
//////////////////////////////////////////////////////////////////////////
diff --git a/engines/lastexpress/entities/kahina.cpp b/engines/lastexpress/entities/kahina.cpp
index b10b60476b..ffcf19862c 100644
--- a/engines/lastexpress/entities/kahina.cpp
+++ b/engines/lastexpress/entities/kahina.cpp
@@ -104,7 +104,91 @@ IMPLEMENT_FUNCTION_NOSETUP(5, Kahina, updateFromTicks)
//////////////////////////////////////////////////////////////////////////
IMPLEMENT_FUNCTION_I(6, Kahina, function6, TimeValue)
- error("Kahina: callback function 6 not implemented!");
+ switch (savepoint.action) {
+ default:
+ break;
+
+ case kActionNone:
+ if (params->param1 < getState()->time && !params->param2) {
+ params->param2 = 1;
+
+ CALLBACK_ACTION();
+ break;
+ }
+
+ if (getEntities()->isPlayerInCar(kCarGreenSleeping) || getEntities()->isPlayerInCar(kCarRedSleeping)) {
+ if (getEntities()->isInsideTrainCar(kEntityPlayer, kCarGreenSleeping)) {
+ setCallback(2);
+ setup_updateEntity2(kCarGreenSleeping, kPosition_540);
+ } else {
+ setCallback(3);
+ setup_updateEntity2(kCarRedSleeping, kPosition_9460);
+ }
+ }
+ break;
+
+ case kActionDefault:
+ ENTITY_PARAM(0, 1) = 0;
+ ENTITY_PARAM(0, 2) = 0;
+
+ setCallback(1);
+ setup_updateEntity2(kCarRedSleeping, kPosition_540);
+ break;
+
+ case kActionCallback:
+ switch (getCallback()) {
+ default:
+ break;
+
+ case 1:
+ if (ENTITY_PARAM(0, 1) || ENTITY_PARAM(0, 2)) {
+ CALLBACK_ACTION();
+ break;
+ }
+
+ getEntities()->clearSequences(kEntityKahina);
+ break;
+
+ case 2:
+ case 3:
+ if (ENTITY_PARAM(0, 1) || ENTITY_PARAM(0, 2)) {
+ CALLBACK_ACTION();
+ break;
+ }
+
+ getEntities()->clearSequences(kEntityKahina);
+
+ setCallback(4);
+ setup_updateFromTime(450);
+ break;
+
+ case 4:
+ if (ENTITY_PARAM(0, 2)) {
+ CALLBACK_ACTION();
+ break;
+ }
+
+ setCallback(5);
+ setup_updateEntity2(kCarRedSleeping, kPosition_540);
+ break;
+
+ case 5:
+ if (ENTITY_PARAM(0, 1) || ENTITY_PARAM(0, 2)) {
+ CALLBACK_ACTION();
+ break;
+ }
+
+ getEntities()->clearSequences(kEntityKahina);
+ break;
+ }
+ break;
+
+ case kAction137503360:
+ ENTITY_PARAM(0, 2) = 1;
+
+ CALLBACK_ACTION();
+ break;
+ }
}
//////////////////////////////////////////////////////////////////////////
diff --git a/engines/lastexpress/shared.h b/engines/lastexpress/shared.h
index 3cfcbb334f..a85d535c50 100644
--- a/engines/lastexpress/shared.h
+++ b/engines/lastexpress/shared.h
@@ -247,7 +247,9 @@ enum TimeValue {
kTime2479500 = 2479500,
kTime2484000 = 2484000,
kTime2488500 = 2488500,
+ kTime2493000 = 2493000,
kTime2506500 = 2506500,
+ kTime2507400 = 2507400,
kTime2511000 = 2511000,
kTime2511900 = 2511900,
kTime2517300 = 2517300,