aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulien Templier2010-10-21 23:43:04 +0000
committerJulien Templier2010-10-21 23:43:04 +0000
commita3d4181e00398ccf304aefb1360a7ab843b17236 (patch)
tree5fcc70f99d7fa8de2b8bea6e5a9d0f8c68fbf499
parentf22c915a9168e20d6f9b22836fec5f43b5cffc3d (diff)
downloadscummvm-rg350-a3d4181e00398ccf304aefb1360a7ab843b17236.tar.gz
scummvm-rg350-a3d4181e00398ccf304aefb1360a7ab843b17236.tar.bz2
scummvm-rg350-a3d4181e00398ccf304aefb1360a7ab843b17236.zip
LASTEXPRESS: Implement remaining AI logic functions for Coudert
svn-id: r53687
-rw-r--r--engines/lastexpress/entities/coudert.cpp388
-rw-r--r--engines/lastexpress/shared.h9
2 files changed, 395 insertions, 2 deletions
diff --git a/engines/lastexpress/entities/coudert.cpp b/engines/lastexpress/entities/coudert.cpp
index d585205eb0..e4f7cad068 100644
--- a/engines/lastexpress/entities/coudert.cpp
+++ b/engines/lastexpress/entities/coudert.cpp
@@ -2731,7 +2731,240 @@ IMPLEMENT_FUNCTION(44, Coudert, chapter3)
//////////////////////////////////////////////////////////////////////////
IMPLEMENT_FUNCTION(45, Coudert, function45)
- error("Coudert: callback function 45 not implemented!");
+ switch (savepoint.action) {
+ default:
+ break;
+
+ case kActionNone:
+ if (ENTITY_PARAM(0, 8)) {
+ setCallback(1);
+ setup_function15(true);
+ break;
+ }
+
+label_callback_1:
+ if (ENTITY_PARAM(1, 1)) {
+ setCallback(2);
+ setup_function15(false);
+ break;
+ }
+
+label_callback_2:
+ if (ENTITY_PARAM(0, 3)) {
+ setCallback(3);
+ setup_function14(kEntityVerges);
+ break;
+ }
+
+label_callback_3:
+ if (ENTITY_PARAM(0, 5)) {
+ setCallback(4);
+ setup_function14(kEntityMertens);
+ break;
+ }
+
+label_callback_4:
+ if (ENTITY_PARAM(1, 3)) {
+ setCallback(5);
+ setup_function46();
+ break;
+ }
+
+label_callback_5:
+ if (ENTITY_PARAM(1, 5)) {
+ setCallback(6);
+ setup_function47(true);
+ break;
+ }
+
+label_callback_6:
+ if (ENTITY_PARAM(1, 6)) {
+ setCallback(7);
+ setup_function47(false);
+ break;
+ }
+
+label_callback_7:
+ if (ENTITY_PARAM(1, 8)) {
+ setCallback(8);
+ setup_function48();
+ break;
+ }
+
+label_callback_8:
+ if (ENTITY_PARAM(2, 4)) {
+ setCallback(9);
+ setup_function49();
+ break;
+ }
+
+label_callback_9:
+ if (ENTITY_PARAM(1, 4)) {
+ setCallback(10);
+ setup_function34(true);
+ break;
+ }
+
+label_callback_10:
+ if (ENTITY_PARAM(1, 7)) {
+ setCallback(11);
+ setup_function34(false);
+ break;
+ }
+
+label_callback_11:
+ if (ENTITY_PARAM(0, 4)) {
+ setCallback(12);
+ setup_function14(kEntityMmeBoutarel);
+ break;
+ }
+
+label_callback_12:
+ // BUG: Can never be called... FAIL!
+ if (ENTITY_PARAM(2, 5) && getState()->time > kTime2056500 && getState()->time < kTime1417500) {
+ setCallback(13);
+ setup_function50();
+ break;
+ }
+
+label_callback_13:
+ TIME_CHECK_CALLBACK(kTime2088900, params->param1, 14, setup_function32);
+
+label_callback_14:
+ TIME_CHECK_CALLBACK(kTime2119500, params->param2, 15, setup_function32);
+
+label_callback_15:
+ TIME_CHECK_CALLBACK(kTime2138400, params->param3, 16, setup_function32);
+
+label_callback_16:
+ TIME_CHECK_CALLBACK(kTime2147400, params->param4, 17, setup_function32);
+
+label_callback_17:
+ TIME_CHECK_CALLBACK(kTime2160000, params->param5, 18, setup_function32);
+
+label_callback_18:
+ TIME_CHECK_CALLBACK(kTime2205000, params->param6, 19, setup_function32);
+
+label_callback_19:
+ if (ENTITY_PARAM(0, 2)) {
+ TIME_CHECK_OBJECT(kTime2025000, params->param7, kObject111, kObjectLocation7);
+ TIME_CHECK_OBJECT(kTime2133000, params->param8, kObject111, kObjectLocation8);
+ TIME_CHECK_OBJECT(kTime2173500, CURRENT_PARAMS(1, 1), kObject111, kObjectLocation9);
+ }
+ break;
+
+ case kAction11:
+ if (!ENTITY_PARAM(2, 1)) {
+ setCallback(20);
+ setup_function13(savepoint.param.intValue, savepoint.entity2);
+ }
+ break;
+
+ case kActionDrawScene:
+ if (!ENTITY_PARAM(2, 1)) {
+ if (getEntities()->isPlayerPosition(kCarRedSleeping, 1)) {
+ setCallback(21);
+ setup_function13(true, kEntityPlayer);
+ } else if (getEntities()->isPlayerPosition(kCarRedSleeping, 23)) {
+ setCallback(22);
+ setup_function13(false, kEntityPlayer);
+ }
+ }
+ break;
+
+ case kActionCallback:
+ switch (getCallback()) {
+ default:
+ break;
+
+ case 1:
+ goto label_callback_1;
+
+ case 2:
+ goto label_callback_2;
+
+ case 3:
+ goto label_callback_3;
+
+ case 4:
+ goto label_callback_4;
+
+ case 5:
+ goto label_callback_5;
+
+ case 6:
+ goto label_callback_6;
+
+ case 7:
+ goto label_callback_7;
+
+ case 8:
+ goto label_callback_8;
+
+ case 9:
+ goto label_callback_9;
+
+ case 10:
+ goto label_callback_10;
+
+ case 11:
+ goto label_callback_11;
+
+ case 12:
+ getSavePoints()->push(kEntityCoudert, kEntityVerges, kAction168255788);
+ goto label_callback_12;
+
+ case 13:
+ goto label_callback_13;
+
+ case 14:
+ goto label_callback_14;
+
+ case 15:
+ goto label_callback_15;
+
+ case 16:
+ goto label_callback_16;
+
+ case 17:
+ goto label_callback_17;
+
+ case 18:
+ goto label_callback_18;
+
+ case 19:
+ goto label_callback_19;
+
+ case 23:
+ setCallback(24);
+ setup_function18();
+ break;
+ }
+ break;
+
+ case kAction225358684:
+ if (!ENTITY_PARAM(0, 1)) {
+ setCallback(25);
+ setup_function30((ObjectIndex)savepoint.param.intValue);
+ }
+ break;
+
+ case kAction226078300:
+ if (!ENTITY_PARAM(2, 1) && !ENTITY_PARAM(0, 1)) {
+ getSound()->playSound(kEntityCoudert, "JAC2020");
+
+ setCallback(23);
+ setup_bloodJacket("697D");
+ }
+ break;
+
+ case kAction305159806:
+ if (!ENTITY_PARAM(2, 1) && !ENTITY_PARAM(0, 1)) {
+ setCallback(26);
+ setup_function31(savepoint.param.intValue);
+ }
+ break;
+ }
}
//////////////////////////////////////////////////////////////////////////
@@ -3276,7 +3509,158 @@ IMPLEMENT_FUNCTION(52, Coudert, chapter4)
//////////////////////////////////////////////////////////////////////////
IMPLEMENT_FUNCTION(53, Coudert, function53)
- error("Coudert: callback function 53 not implemented!");
+ switch (savepoint.action) {
+ default:
+ break;
+
+ case kActionNone:
+ if (ENTITY_PARAM(2, 3)) {
+ ENTITY_PARAM(1, 2) = 0;
+ ENTITY_PARAM(1, 7) = 0;
+
+ params->param1 = 1;
+
+ getObjects()->updateLocation2(kObjectCompartmentA, kObjectLocation1);
+ getObjects()->updateLocation2(kObjectCompartmentB, kObjectLocation1);
+ getObjects()->updateLocation2(kObjectCompartmentC, kObjectLocation1);
+ getObjects()->updateLocation2(kObjectCompartmentD, kObjectLocation1);
+ getObjects()->updateLocation2(kObjectCompartmentE, kObjectLocation1);
+ getObjects()->updateLocation2(kObjectCompartmentF, kObjectLocation1);
+ getObjects()->updateLocation2(kObjectCompartmentG, kObjectLocation1);
+ getObjects()->updateLocation2(kObjectCompartmentH, kObjectLocation1);
+
+ ENTITY_PARAM(2, 3) = 0;
+
+ setCallback(1);
+ setup_function54();
+ break;
+ }
+
+label_callback_1:
+ if (ENTITY_PARAM(1, 2)) {
+ if (!params->param2)
+ params->param2 = getState()->time + 4500;
+
+ if (params->param3 != kTimeInvalid) {
+ UPDATE_PARAM_PROC_TIME(params->param2, !getEntities()->isPlayerInCar(kCarRedSleeping), params->param3, 0)
+ setCallback(2);
+ setup_function55();
+ break;
+ UPDATE_PARAM_PROC_END
+ }
+ }
+
+label_callback_2:
+ if (ENTITY_PARAM(1, 7)) {
+ setCallback(3);
+ setup_function34(false);
+ break;
+ }
+
+label_callback_3:
+ if (!params->param1) {
+ TIME_CHECK_CALLBACK(kTime2394000, params->param4, 4, setup_function56);
+
+label_callback_4:
+ TIME_CHECK_CALLBACK(kTime2434500, params->param5, 5, setup_function32);
+
+label_callback_5:
+ TIME_CHECK_CALLBACK(kTime2448000, params->param6, 6, setup_function32);
+ }
+
+label_callback_6:
+ if (getState()->time > kTime2538000 && !ENTITY_PARAM(0, 1) && !ENTITY_PARAM(2, 1)) {
+ UPDATE_PARAM(params->param7, getState()->time, 2700);
+
+ ENTITY_PARAM(0, 2) = 0;
+ ENTITY_PARAM(0, 1) = 1;
+
+ getEntities()->drawSequenceLeft(kEntityCoudert, "697F");
+
+ params->param7 = 0;
+ }
+ break;
+
+ case kAction11:
+ if (!ENTITY_PARAM(2, 1) && !ENTITY_PARAM(0, 1)) {
+ setCallback(7);
+ setup_function13(savepoint.param.intValue, savepoint.entity2);
+ }
+ break;
+
+ case kActionDefault:
+ getData()->car = kCarRedSleeping;
+ getData()->entityPosition = kPosition_1500;
+ getData()->location = kLocationOutsideCompartment;
+
+ getScenes()->loadSceneFromItemPosition(kItem5);
+ break;
+
+ case kActionDrawScene:
+ if (!ENTITY_PARAM(2, 1) && !ENTITY_PARAM(0, 1)) {
+ if (getEntities()->isPlayerPosition(kCarRedSleeping, 1)) {
+ setCallback(8);
+ setup_function13(true, kEntityPlayer);
+ } else if (getEntities()->isPlayerPosition(kCarRedSleeping, 23)) {
+ setCallback(9);
+ setup_function13(false, kEntityPlayer);
+ }
+ }
+ break;
+
+ case kActionCallback:
+ switch (getCallback()) {
+ default:
+ break;
+
+ case 1:
+ goto label_callback_1;
+
+ case 2:
+ goto label_callback_2;
+
+ case 3:
+ goto label_callback_3;
+
+ case 4:
+ goto label_callback_4;
+
+ case 5:
+ goto label_callback_5;
+
+ case 6:
+ goto label_callback_6;
+
+ case 10:
+ setCallback(11);
+ setup_function18();
+ break;
+ }
+ break;
+
+ case kAction225358684:
+ if (!ENTITY_PARAM(0, 1)) {
+ setCallback(12);
+ setup_function30((ObjectIndex)savepoint.param.intValue);
+ }
+ break;
+
+ case kAction226078300:
+ if (!ENTITY_PARAM(2, 1) && !ENTITY_PARAM(0, 1)) {
+ getSound()->playSound(kEntityCoudert, "JAC2020");
+
+ setCallback(10);
+ setup_bloodJacket("697D");
+ }
+ break;
+
+ case kAction305159806:
+ if (!ENTITY_PARAM(2, 1) && !ENTITY_PARAM(0, 1)) {
+ setCallback(13);
+ setup_function31(savepoint.param.intValue);
+ }
+ break;
+ }
}
//////////////////////////////////////////////////////////////////////////
diff --git a/engines/lastexpress/shared.h b/engines/lastexpress/shared.h
index b04a6519dd..fecd59c11a 100644
--- a/engines/lastexpress/shared.h
+++ b/engines/lastexpress/shared.h
@@ -99,6 +99,7 @@ enum TimeValue {
kTimeExitDeutschAvricourt = 1370700,
kTime1386000 = 1386000,
kTimeBedTime = 1404000,
+ kTime1417500 = 1417500,
kTimeEnterStrasbourg = 1424700,
kTime1449000 = 1449000,
kTime1458000 = 1458000,
@@ -174,6 +175,7 @@ enum TimeValue {
kTimeCityAttnangPuchheim = 2049300,
kTime2052000 = 2052000,
kTimeExitAttnangPuchheim = 2052900,
+ kTime2056500 = 2056500,
kTime2061000 = 2061000,
kTime2062800 = 2062800,
kTime2065500 = 2065500,
@@ -184,6 +186,7 @@ enum TimeValue {
kTimeExitWels = 2079900,
kTime2083500 = 2083500,
kTime2088000 = 2088000,
+ kTime2088900 = 2088900,
kTime2092500 = 2092500,
kTime2097000 = 2097000,
kTimeEnterLinz = 2099700,
@@ -195,8 +198,10 @@ enum TimeValue {
kTime2119500 = 2119500,
kTime2124000 = 2124000,
kTime2133000 = 2133000,
+ kTime2138400 = 2138400,
kTime2142000 = 2142000,
kTime2146500 = 2146500,
+ kTime2147400 = 2147400,
kTime2151000 = 2151000,
kTimeCityAmstetten = 2154600,
kTime2155500 = 2155500,
@@ -207,6 +212,7 @@ enum TimeValue {
kTime2182500 = 2182500,
kTime2196000 = 2196000,
kTime2200500 = 2200500,
+ kTime2205000 = 2205000,
kTime2214000 = 2214000,
kTime2218500 = 2218500,
kTime2223000 = 2223000,
@@ -253,6 +259,7 @@ enum TimeValue {
kTime2428200 = 2428200,
kTime2425500 = 2425500,
kTime2430000 = 2430000,
+ kTime2434500 = 2434500,
kTime2439000 = 2439000,
kTime2443500 = 2443500,
kTime2448000 = 2448000,
@@ -674,6 +681,8 @@ enum ObjectLocation {
kObjectLocation5 = 5,
kObjectLocation6 = 6,
kObjectLocation7 = 7,
+ kObjectLocation8 = 8,
+ kObjectLocation9 = 9,
kObjectLocation10 = 10,
kObjectLocation18 = 18
};