aboutsummaryrefslogtreecommitdiff
path: root/engines/lastexpress/entities
diff options
context:
space:
mode:
authorEvgeny Grechnikov2018-09-24 01:57:44 +0300
committerEvgeny Grechnikov2018-09-24 01:57:44 +0300
commitf057ac75ce86db465a75193a40358b3226bcf099 (patch)
tree3fdab724ef78fa76864a4ff241203a52cc12cdcb /engines/lastexpress/entities
parent875ce8101c9c67d7c38bad9ddc263a46eb0c758a (diff)
downloadscummvm-rg350-f057ac75ce86db465a75193a40358b3226bcf099.tar.gz
scummvm-rg350-f057ac75ce86db465a75193a40358b3226bcf099.tar.bz2
scummvm-rg350-f057ac75ce86db465a75193a40358b3226bcf099.zip
LASTEXPRESS: more fixes in NPC logic
Diffstat (limited to 'engines/lastexpress/entities')
-rw-r--r--engines/lastexpress/entities/mahmud.cpp10
-rw-r--r--engines/lastexpress/entities/mertens.cpp20
-rw-r--r--engines/lastexpress/entities/milos.cpp14
-rw-r--r--engines/lastexpress/entities/mmeboutarel.cpp2
-rw-r--r--engines/lastexpress/entities/rebecca.cpp6
-rw-r--r--engines/lastexpress/entities/salko.cpp2
-rw-r--r--engines/lastexpress/entities/tatiana.cpp8
-rw-r--r--engines/lastexpress/entities/vassili.cpp14
-rw-r--r--engines/lastexpress/entities/verges.cpp3
-rw-r--r--engines/lastexpress/entities/vesna.cpp3
-rw-r--r--engines/lastexpress/entities/waiter2.cpp2
11 files changed, 49 insertions, 35 deletions
diff --git a/engines/lastexpress/entities/mahmud.cpp b/engines/lastexpress/entities/mahmud.cpp
index 9f43c695ea..1468bce5a7 100644
--- a/engines/lastexpress/entities/mahmud.cpp
+++ b/engines/lastexpress/entities/mahmud.cpp
@@ -664,15 +664,15 @@ IMPLEMENT_FUNCTION(14, Mahmud, chaptersHandler)
break;
case 5: {
- CursorStyle cursor = kCursorHand;
- CursorStyle cursor2 = kCursorHandKnock;
+ CursorStyle cursor = kCursorHandKnock;
+ CursorStyle cursor2 = kCursorHand;
if (getProgress().jacket == kJacketBlood
|| getEvent(kEventMahmudWrongDoor)
|| getEvent(kEventMahmudWrongDoorOriginalJacket)
|| getEvent(kEventMahmudWrongDoorDay)) {
- cursor = kCursorNormal;
- cursor2 = kCursorTalk;
+ cursor = kCursorTalk;
+ cursor2 = kCursorNormal;
}
getObjects()->update(kObjectCompartment4, kEntityMahmud, kObjectLocation1, cursor, cursor2);
@@ -825,7 +825,7 @@ IMPLEMENT_FUNCTION(19, Mahmud, chapter4)
getData()->location = kLocationInsideCompartment;
getData()->car = kCarGreenSleeping;
getData()->clothes = kClothesDefault;
- getData()->inventoryItem = kItemNone;
+ getData()->inventoryItem = kItemNone; // not in the original game, but it does no harm, I suppose?
break;
}
diff --git a/engines/lastexpress/entities/mertens.cpp b/engines/lastexpress/entities/mertens.cpp
index 573a35013e..cb2311fddd 100644
--- a/engines/lastexpress/entities/mertens.cpp
+++ b/engines/lastexpress/entities/mertens.cpp
@@ -400,6 +400,10 @@ IMPLEMENT_FUNCTION_II(10, Mertens, updateEntity, CarIndex, EntityPosition)
if (params->param1 != 3 || (params->param2 != kPosition_8200 && params->param2 != kPosition_9510)) {
loadSceneFromPosition();
+ if (getEntities()->updateEntity(kEntityMertens, (CarIndex)params->param1, (EntityPosition)params->param2)) {
+ getData()->inventoryItem = kItemNone;
+ callbackAction();
+ }
break;
}
@@ -432,6 +436,10 @@ IMPLEMENT_FUNCTION_II(10, Mertens, updateEntity, CarIndex, EntityPosition)
}
loadSceneFromPosition();
+ if (getEntities()->updateEntity(kEntityMertens, (CarIndex)params->param1, (EntityPosition)params->param2)) {
+ getData()->inventoryItem = kItemNone;
+ callbackAction();
+ }
break;
case 4:
@@ -439,6 +447,10 @@ IMPLEMENT_FUNCTION_II(10, Mertens, updateEntity, CarIndex, EntityPosition)
ENTITY_PARAM(2, 4) = 0;
loadSceneFromPosition();
+ if (getEntities()->updateEntity(kEntityMertens, (CarIndex)params->param1, (EntityPosition)params->param2)) {
+ getData()->inventoryItem = kItemNone;
+ callbackAction();
+ }
break;
case 5:
@@ -501,7 +513,6 @@ IMPLEMENT_FUNCTION_I(12, Mertens, bonsoir, EntityIndex)
getSound()->playSound(kEntityMertens, "CON1112F");
} else {
switch (rnd(3)) {
- default:
case 0:
getSound()->playSound(kEntityMertens, "CON1061");
break;
@@ -1964,6 +1975,7 @@ label_callback11:
case 27:
getAction()->playAnimation(kEventMertensBloodJacket);
getLogic()->gameOver(kSavegameTypeIndex, 1, kSceneGameOverBloodJacket, true);
+ // BUG: for [case 13] the original game continues executing code here
break;
case 14:
@@ -3040,10 +3052,10 @@ IMPLEMENT_FUNCTION(42, Mertens, function42)
}
if (params->param4 >= getState()->time)
- break;
+ goto label_callback_8;
}
- ENTITY_PARAM(0, 4) = kTimeInvalid;
+ params->param4 = kTimeInvalid;
getData()->inventoryItem = kItemNone;
setCallback(8);
@@ -3240,7 +3252,7 @@ label_callback_5_6:
goto label_callback_2_4;
case 3:
- getAction()->playAnimation(getProgress().jacket == kJacketOriginal ? kEventMertensLastCarOriginalJacket : kEventMertensLastCar);
+ getAction()->playAnimation(getProgress().jacket == kJacketGreen ? kEventMertensLastCar : kEventMertensLastCarOriginalJacket);
getEntities()->drawSequenceRight(kEntityMertens, "601A");
getScenes()->loadSceneFromPosition(kCarGreenSleeping, 6);
getScenes()->loadSceneFromItemPosition(kItem7);
diff --git a/engines/lastexpress/entities/milos.cpp b/engines/lastexpress/entities/milos.cpp
index 8177f99ff6..d982b5585a 100644
--- a/engines/lastexpress/entities/milos.cpp
+++ b/engines/lastexpress/entities/milos.cpp
@@ -141,7 +141,6 @@ IMPLEMENT_FUNCTION_II(10, Milos, enterCompartmentDialog, CarIndex, EntityPositio
if (getEvent(kEventMilosTylerCompartmentDefeat)) {
// Robert saying: "Milos"
switch(rnd(3)) {
- default:
case 0:
getSound()->playSound(kEntityPlayer, "CAT1014");
break;
@@ -443,7 +442,7 @@ IMPLEMENT_FUNCTION(14, Milos, function14)
++params->param5;
switch (params->param5) {
default:
- getObjects()->update(kObjectCompartment1, kEntityMilos, getObjects()->get(kObjectCompartment1).status, params->param3 < 1 ? kCursorTalk : kCursorNormal, kCursorHand);
+ getObjects()->update(kObjectCompartment1, kEntityMilos, getObjects()->get(kObjectCompartment1).status, params->param3 == 0 ? kCursorTalk : kCursorNormal, kCursorHand);
CURRENT_PARAM(1, 2) = 0;
break;
@@ -467,7 +466,7 @@ IMPLEMENT_FUNCTION(14, Milos, function14)
if (params->param7 < 3) {
params->param5 = 1;
- getObjects()->update(kObjectCompartment1, kEntityMilos, getObjects()->get(kObjectCompartment1).status, params->param3 < 1 ? kCursorTalk : kCursorNormal, kCursorHand);
+ getObjects()->update(kObjectCompartment1, kEntityMilos, getObjects()->get(kObjectCompartment1).status, params->param3 == 0 ? kCursorTalk : kCursorNormal, kCursorHand);
CURRENT_PARAM(1, 2) = 0;
break;
}
@@ -645,7 +644,7 @@ label_callback_12:
case 7:
case 9:
case 11:
- getObjects()->update(kObjectCompartment1, kEntityMilos, getObjects()->get(kObjectCompartment1).status, params->param3 < 1 ? kCursorTalk : kCursorNormal, kCursorHand);
+ getObjects()->update(kObjectCompartment1, kEntityMilos, getObjects()->get(kObjectCompartment1).status, params->param3 == 0 ? kCursorTalk : kCursorNormal, kCursorHand);
CURRENT_PARAM(1, 2) = 0;
break;
@@ -1367,9 +1366,13 @@ IMPLEMENT_FUNCTION(25, Milos, function25)
case 3:
getObjects()->update(kObjectCompartmentG, kEntityMilos, kObjectLocation1, kCursorTalk, kCursorNormal);
- getObjects()->update(kObjectCompartmentG, kEntityMilos, kObjectLocation1, kCursorHandKnock, kCursorHand);
params->param1 = 1;
+ // BUG: the original game executes the last line of [case 4:] here too, resetting cursor once again.
+ // We get here when Cath knocks or tries to enter the compartment G when Vesna is there,
+ // after Vesna says VES1015A (in Serbian, supposedly a variant of "Who is it?").
+ // The action for next knock / attempt to enter is saying CAT1505/CAT1505A,
+ // so the cursor should be kCursorTalk and not kCursorHandKnock as in the original game.
break;
case 4:
@@ -1524,7 +1527,6 @@ IMPLEMENT_FUNCTION(29, Milos, chapter4Handler)
getSound()->playSound(kEntityMilos, sound); \
if (getEntities()->isDistanceBetweenEntities(kEntityMilos, kEntityPlayer, 2000)) \
getProgress().field_94 = 1; \
- break; \
}
switch (savepoint.action) {
diff --git a/engines/lastexpress/entities/mmeboutarel.cpp b/engines/lastexpress/entities/mmeboutarel.cpp
index 994a0ceda6..d9a7ea1db6 100644
--- a/engines/lastexpress/entities/mmeboutarel.cpp
+++ b/engines/lastexpress/entities/mmeboutarel.cpp
@@ -887,7 +887,7 @@ IMPLEMENT_FUNCTION(21, MmeBoutarel, chapter3Handler)
if (getState()->time <= kTime2038500) {
if (!getEntities()->isPlayerInCar(kCarRedSleeping)
|| !params->param1
- || getSoundQueue()->isBuffered("FRA2012")
+ || getSoundQueue()->isBuffered("FRA2012") // the original game tests this sound twice. Maybe a bug?
|| getSoundQueue()->isBuffered("FRA2010")
||!params->param2)
params->param2 = (uint)getState()->time;
diff --git a/engines/lastexpress/entities/rebecca.cpp b/engines/lastexpress/entities/rebecca.cpp
index acb58f7870..fec0891ce9 100644
--- a/engines/lastexpress/entities/rebecca.cpp
+++ b/engines/lastexpress/entities/rebecca.cpp
@@ -309,7 +309,7 @@ IMPLEMENT_FUNCTION_I(17, Rebecca, function17, bool)
break;
case 2:
- getEntities()->clearSequences(kEntitySophie);
+ getEntities()->clearSequences(kEntityRebecca);
break;
case 3:
@@ -1371,7 +1371,7 @@ IMPLEMENT_FUNCTION(36, Rebecca, function36)
getSound()->playSound(kEntityRebecca, "Reb3007");
setCallback(2);
- setup_updatePosition("118E", kCarRedSleeping, 52);
+ setup_updatePosition("118E", kCarRestaurant, 52);
break;
}
}
@@ -1726,7 +1726,7 @@ label_callback_2:
break;
case kAction123712592:
- getEntities()->drawSequenceLeft(kEntityRebecca, "BLANK");
+ getEntities()->drawSequenceLeft(kEntityWaiter1, "BLANK");
getSound()->playSound(kEntityRebecca, "Reb4003");
setCallback(4);
diff --git a/engines/lastexpress/entities/salko.cpp b/engines/lastexpress/entities/salko.cpp
index f93d13c849..f1595d6d0f 100644
--- a/engines/lastexpress/entities/salko.cpp
+++ b/engines/lastexpress/entities/salko.cpp
@@ -181,7 +181,7 @@ IMPLEMENT_FUNCTION(10, Salko, chapter1Handler)
case kActionCallback:
if (getCallback() == 1) {
- getEntities()->clearSequences(kEntitySalko);
+ getEntities()->drawSequenceLeft(kEntitySalko, "BLANK");
setup_function8();
}
break;
diff --git a/engines/lastexpress/entities/tatiana.cpp b/engines/lastexpress/entities/tatiana.cpp
index 5dd61e3f46..31de491983 100644
--- a/engines/lastexpress/entities/tatiana.cpp
+++ b/engines/lastexpress/entities/tatiana.cpp
@@ -209,7 +209,7 @@ IMPLEMENT_FUNCTION(15, Tatiana, exitCompartment)
case kActionDefault:
setCallback(getProgress().chapter == kChapter1 ? 1 : 2);
- setup_enterExitCompartment2(getProgress().chapter == kChapter1 ? "603Bb" : "673Bb", kObjectCompartmentB);
+ setup_enterExitCompartment(getProgress().chapter == kChapter1 ? "603Bb" : "673Bb", kObjectCompartmentB);
break;
case kActionCallback:
@@ -615,8 +615,7 @@ IMPLEMENT_FUNCTION(22, Tatiana, getSomeAir)
if (params->param1 == kTimeInvalid || getState()->time <= kTime1179000)
goto label_update;
- if (Entity::updateParameterTime(kTime1233000, ((!getEvent(kEventTatianaAskMatchSpeakRussian) && !getEvent(kEventTatianaAskMatch)) || getEntities()->isInGreenCarEntrance(kEntityPlayer)), params->param1, 0)) {
- params->param1 = kTimeInvalid;
+ if (!Entity::updateParameterTime(kTime1233000, ((!getEvent(kEventTatianaAskMatchSpeakRussian) && !getEvent(kEventTatianaAskMatch)) || getEntities()->isInGreenCarEntrance(kEntityPlayer)), params->param1, 0)) {
label_update:
if (!getEvent(kEventTatianaAskMatchSpeakRussian)
@@ -1036,6 +1035,7 @@ IMPLEMENT_FUNCTION(32, Tatiana, playChess)
break;
case kActionEndSound:
+ parameters->param2 = 0;
++parameters->param3;
switch (parameters->param3) {
@@ -1200,7 +1200,7 @@ IMPLEMENT_FUNCTION(35, Tatiana, concert)
label_callback_1:
if (getState()->time > kTime2133000) {
- if (getData()->car >= kCarRedSleeping || (getData()->car == kCarGreenSleeping && getData()->entityPosition > kPosition_5790))
+ if (getEntityData(kEntityAugust)->car >= kCarRedSleeping || (getEntityData(kEntityAugust)->car == kCarGreenSleeping && getEntityData(kEntityAugust)->entityPosition > kPosition_5790))
setup_leaveConcert();
}
break;
diff --git a/engines/lastexpress/entities/vassili.cpp b/engines/lastexpress/entities/vassili.cpp
index 1c25ce2cb0..cff6ec472c 100644
--- a/engines/lastexpress/entities/vassili.cpp
+++ b/engines/lastexpress/entities/vassili.cpp
@@ -108,7 +108,7 @@ IMPLEMENT_FUNCTION(5, Vassili, chapter1Handler)
if (!Entity::updateParameterCheck(params->param3, getState()->time, 450))
break;
- if (!params->param2 && getObjects()->get(kObjectCompartmentA).status == kObjectLocation1) {
+ if (!params->param2 && getObjects()->get(kObjectCompartmentA).model == kObjectLocation1) {
params->param2 = 1;
getEntities()->drawSequenceLeft(kEntityVassili, "303A");
getObjects()->update(kObjectCompartmentA, kEntityPlayer, kObjectLocationNone, kCursorHandKnock, kCursorHand);
@@ -313,19 +313,19 @@ IMPLEMENT_FUNCTION(10, Vassili, seizure)
// Check that we have removed the body from the train and changed jacket
if (!getProgress().eventCorpseMovedFromFloor) {
getAction()->playAnimation(kEventMertensCorpseFloor);
- getLogic()->gameOver(kSavegameTypeIndex, 0, kSceneNone, false);
+ getLogic()->gameOver(kSavegameTypeIndex, 0, kSceneNone, true);
break;
}
if (!getProgress().eventCorpseThrown) {
getAction()->playAnimation(kEventMertensCorpseBed);
- getLogic()->gameOver(kSavegameTypeIndex, 0, kSceneNone, false);
+ getLogic()->gameOver(kSavegameTypeIndex, 0, kSceneNone, true);
break;
}
if (getProgress().jacket == kJacketBlood) {
getAction()->playAnimation(kEventMertensBloodJacket);
- getLogic()->gameOver(kSavegameTypeIndex, 0, kSceneNone, false);
+ getLogic()->gameOver(kSavegameTypeIndex, 0, kSceneNone, true);
break;
}
@@ -410,7 +410,7 @@ IMPLEMENT_FUNCTION(13, Vassili, sleeping)
break;
case kActionDefault:
- params->param5 = 5 * (3 * rnd(25) + 15);
+ params->param1 = 5 * (3 * rnd(25) + 15);
getEntities()->drawSequenceLeft(kEntityVassili, "303A");
break;
@@ -475,7 +475,7 @@ IMPLEMENT_FUNCTION(15, Vassili, stealEgg)
break;
case kActionDefault:
- params->param5 = 5 * (3 * rnd(25) + 15);
+ params->param1 = 5 * (3 * rnd(25) + 15);
getEntities()->drawSequenceLeft(kEntityVassili, "303A");
break;
@@ -555,7 +555,7 @@ IMPLEMENT_FUNCTION(17, Vassili, chapter4Handler)
break;
case kActionDefault:
- params->param5 = 5 * (3 * rnd(25) + 15);
+ params->param1 = 5 * (3 * rnd(25) + 15);
getEntities()->drawSequenceLeft(kEntityVassili, "303A");
break;
diff --git a/engines/lastexpress/entities/verges.cpp b/engines/lastexpress/entities/verges.cpp
index c3e56d98c1..7811aa880f 100644
--- a/engines/lastexpress/entities/verges.cpp
+++ b/engines/lastexpress/entities/verges.cpp
@@ -1083,6 +1083,7 @@ IMPLEMENT_FUNCTION(28, Verges, chapter2Handler)
if (getEntities()->isInBaggageCarEntrance(kEntityPlayer)) {
setCallback(1);
setup_baggageCar(false);
+ break;
}
label_callback_1:
@@ -1708,7 +1709,7 @@ IMPLEMENT_FUNCTION(38, Verges, resetState)
getData()->entityPosition = kPosition_6469;
getData()->location = kLocationOutsideCompartment;
- getData()->car = kCarGreenSleeping;
+ getData()->car = kCarRedSleeping;
break;
case kActionCallback:
diff --git a/engines/lastexpress/entities/vesna.cpp b/engines/lastexpress/entities/vesna.cpp
index 7ac53ce6e7..af7adfa327 100644
--- a/engines/lastexpress/entities/vesna.cpp
+++ b/engines/lastexpress/entities/vesna.cpp
@@ -1049,8 +1049,6 @@ IMPLEMENT_FUNCTION(29, Vesna, guarding)
case kActionOpenDoor:
setCallback(1);
-
- getData()->currentCall++;
setup_savegame(kSavegameTypeEvent, kEventCathVesnaRestaurantKilled);
break;
@@ -1118,6 +1116,7 @@ IMPLEMENT_FUNCTION(30, Vesna, climbing)
getLogic()->gameOver(kSavegameTypeIndex, 0, kSceneNone, params->param2 == Fight::kFightEndLost);
} else {
getSound()->playSound(kEntityPlayer, "TUNNEL");
+ // TODO: fade to black screen
getState()->time = (TimeValue)(getState()->time + 1800);
diff --git a/engines/lastexpress/entities/waiter2.cpp b/engines/lastexpress/entities/waiter2.cpp
index 2be7b4e7c6..f009551498 100644
--- a/engines/lastexpress/entities/waiter2.cpp
+++ b/engines/lastexpress/entities/waiter2.cpp
@@ -131,7 +131,7 @@ IMPLEMENT_FUNCTION(7, Waiter2, monsieurServeUs)
case 2:
getSavePoints()->push(kEntityWaiter2, kEntityBoutarel, kAction122288808);
- setCallback(2);
+ setCallback(3);
setup_draw("926");
break;