diff options
Diffstat (limited to 'engines/lastexpress/entities/francois.cpp')
-rw-r--r-- | engines/lastexpress/entities/francois.cpp | 70 |
1 files changed, 46 insertions, 24 deletions
diff --git a/engines/lastexpress/entities/francois.cpp b/engines/lastexpress/entities/francois.cpp index d2fb66c7ce..9eb12fbfce 100644 --- a/engines/lastexpress/entities/francois.cpp +++ b/engines/lastexpress/entities/francois.cpp @@ -38,19 +38,19 @@ namespace LastExpress { Francois::Francois(LastExpressEngine *engine) : Entity(engine, kEntityFrancois) { ADD_CALLBACK_FUNCTION(Francois, reset); - ADD_CALLBACK_FUNCTION(Francois, updateFromTime); - ADD_CALLBACK_FUNCTION(Francois, draw); - ADD_CALLBACK_FUNCTION(Francois, enterExitCompartment); - ADD_CALLBACK_FUNCTION(Francois, enterExitCompartment2); - ADD_CALLBACK_FUNCTION(Francois, playSound); - ADD_CALLBACK_FUNCTION(Francois, savegame); - ADD_CALLBACK_FUNCTION(Francois, doWalk); + ADD_CALLBACK_FUNCTION_I(Francois, updateFromTime); + ADD_CALLBACK_FUNCTION_S(Francois, draw); + ADD_CALLBACK_FUNCTION_SI(Francois, enterExitCompartment); + ADD_CALLBACK_FUNCTION_SI(Francois, enterExitCompartment2); + ADD_CALLBACK_FUNCTION_S(Francois, playSound); + ADD_CALLBACK_FUNCTION_II(Francois, savegame); + ADD_CALLBACK_FUNCTION_II(Francois, doWalk); ADD_CALLBACK_FUNCTION(Francois, exitCompartment); ADD_CALLBACK_FUNCTION(Francois, enterCompartment); - ADD_CALLBACK_FUNCTION(Francois, rampage); + ADD_CALLBACK_FUNCTION_I(Francois, rampage); ADD_CALLBACK_FUNCTION(Francois, takeWalk); ADD_CALLBACK_FUNCTION(Francois, haremVisit); - ADD_CALLBACK_FUNCTION(Francois, chaseBeetle); + ADD_CALLBACK_FUNCTION_TYPE(Francois, chaseBeetle, EntityParametersIISS); ADD_CALLBACK_FUNCTION(Francois, findCath); ADD_CALLBACK_FUNCTION(Francois, letsGo); ADD_CALLBACK_FUNCTION(Francois, chapter1); @@ -72,7 +72,7 @@ Francois::Francois(LastExpressEngine *engine) : Entity(engine, kEntityFrancois) ////////////////////////////////////////////////////////////////////////// IMPLEMENT_FUNCTION(1, Francois, reset) - Entity::reset(savepoint, true); + Entity::reset(savepoint, kClothes1, true); IMPLEMENT_FUNCTION_END ////////////////////////////////////////////////////////////////////////// @@ -113,6 +113,7 @@ IMPLEMENT_FUNCTION_II(8, Francois, doWalk, CarIndex, EntityPosition) case kActionNone: if (getEntities()->updateEntity(_entityIndex, (CarIndex)params->param1, (EntityPosition)params->param2)) { + getData()->inventoryItem = kItemNone; callbackAction(); } else { if (!getEntities()->isDistanceBetweenEntities(kEntityFrancois, kEntityPlayer, 2000) @@ -126,6 +127,8 @@ IMPLEMENT_FUNCTION_II(8, Francois, doWalk, CarIndex, EntityPosition) && !getEvent(kEventFrancoisShowBeetle) && !getEvent(kEventFrancoisShowBeetleD)) getData()->inventoryItem = kItemMatchBox; + else + getData()->inventoryItem = kItemNone; } else { getData()->inventoryItem = kItemFirebird; } @@ -145,12 +148,12 @@ IMPLEMENT_FUNCTION_II(8, Francois, doWalk, CarIndex, EntityPosition) default: break; - case 1: + case kItemMatchBox: setCallback(2); setup_savegame(kSavegameTypeEvent, kEventFrancoisShowBeetle); break; - case 18: + case kItemFirebird: if (isNight()) getAction()->playAnimation(getData()->entityPosition < getEntityData(kEntityPlayer)->entityPosition ? kEventFrancoisShowEggNightD : kEventFrancoisShowEggNight); else @@ -588,6 +591,9 @@ IMPLEMENT_FUNCTION(13, Francois, haremVisit) } getEntities()->drawSequenceLeft(kEntityFrancois, "605He"); + getEntities()->enterCompartment(kEntityFrancois, kObjectCompartmentE, true); + setCallback(8); + setup_playSound(rnd(2) ? "Fra2005B" : "Fra2005C"); break; case 8: @@ -683,7 +689,7 @@ IMPLEMENT_FUNCTION_IIS(14, Francois, chaseBeetle, ObjectIndex, EntityPosition) break; case 8: - getEntities()->exitCompartment(kEntityFrancois, (ObjectIndex)parameters->param1); + getEntities()->exitCompartment(kEntityFrancois, (ObjectIndex)parameters->param1, true); // fall through case 9: @@ -788,6 +794,7 @@ IMPLEMENT_FUNCTION(16, Francois, letsGo) case kActionNone: getData()->entityPosition = getEntityData(kEntityBoutarel)->entityPosition; getData()->location = getEntityData(kEntityBoutarel)->location; + getData()->car = getEntityData(kEntityBoutarel)->car; break; case kActionDefault: @@ -828,6 +835,7 @@ IMPLEMENT_FUNCTION(16, Francois, letsGo) getData()->entityPosition = kPosition_5790; getData()->location = kLocationInsideCompartment; + getEntities()->clearSequences(kEntityFrancois); callbackAction(); break; @@ -996,8 +1004,22 @@ label_callback_4: } label_callback_5: - if (getInventory()->get(kItemWhistle)->location != kObjectLocation3) { - // TODO: do we also need to check if the whistle is in the inventory? + if (getInventory()->get(kItemBeetle)->location != kObjectLocation3) { + if (!getInventory()->hasItem(kItemWhistle) && getInventory()->get(kItemWhistle)->location != kObjectLocation3) { + // BUG in the original game: condition is always false + if (getState()->time < kTime1782000 && getState()->time > kTime1782000 && !params->param8) { + params->param8 = 1; + setCallback(9); + setup_takeWalk(); + break; + } + if (getState()->time < kTime1813500 && getState()->time > kTime1813500 && !CURRENT_PARAM(1, 1)) { + CURRENT_PARAM(1, 1) = 1; + setCallback(10); + setup_takeWalk(); + break; + } + } break; } @@ -1010,11 +1032,11 @@ label_callback_5: } label_callback_6: - if (timeCheckCallbackCompartment(kTime1782000, params->param6, 7, kObjectCompartmentC, kPosition_6470, "c")) + if (timeCheckCallbackCompartment(kTime1782000, params->param6, 7, kObjectCompartmentF, kPosition_4070, "f")) break; label_callback_7: - timeCheckCallbackCompartment(kTime1813500, params->param7, 8, kObjectCompartmentF, kPosition_4070, "f"); + timeCheckCallbackCompartment(kTime1813500, params->param7, 8, kObjectCompartmentC, kPosition_6470, "c"); break; case kActionCallback: @@ -1128,13 +1150,13 @@ label_callback_10: } label_callback_11: - if (getInventory()->get(kItemWhistle)->location == kObjectLocation3) { + if (getInventory()->get(kItemBeetle)->location == kObjectLocation3) { if (getState()->time <= kTimeEnd) - if (!getEntities()->isDistanceBetweenEntities(kEntityFrancois, kEntityPlayer, 2000) || !params->param4) - params->param4 = (uint)(getState()->time + 75); + if (!getEntities()->isDistanceBetweenEntities(kEntityFrancois, kEntityPlayer, 2000) || !CURRENT_PARAM(1, 4)) + CURRENT_PARAM(1, 4) = (uint)(getState()->time + 75); - if (params->param4 < getState()->time || getState()->time > kTimeEnd) { - params->param4 = kTimeInvalid; + if (CURRENT_PARAM(1, 4) < getState()->time || getState()->time > kTimeEnd) { + CURRENT_PARAM(1, 4) = kTimeInvalid; setCallback(12); setup_playSound("Fra2010"); @@ -1146,11 +1168,11 @@ label_callback_12: break; label_callback_13: - if (timeCheckCallbackCompartment(kTime2040300, CURRENT_PARAM(1, 6), 14, kObjectCompartmentF, kPosition_4070, "f")) + if (timeCheckCallbackCompartment(kTime2146500, CURRENT_PARAM(1, 6), 14, kObjectCompartmentF, kPosition_4070, "f")) break; label_callback_14: - timeCheckCallbackCompartment(kTime2040300, CURRENT_PARAM(1, 7), 15, kObjectCompartmentB, kPosition_7500, "b"); + timeCheckCallbackCompartment(kTime2218500, CURRENT_PARAM(1, 7), 15, kObjectCompartmentB, kPosition_7500, "b"); } } break; |