diff options
author | Julien | 2012-07-23 14:28:41 -0400 |
---|---|---|
committer | Julien | 2012-07-27 00:15:00 -0400 |
commit | 8545991739848d878e61ff058e8fa1326261e634 (patch) | |
tree | 109b942affed199343d96240354f580054f245a0 /engines/lastexpress/entities | |
parent | e985f7374fd20efc4574bc8320967deef7489d5a (diff) | |
download | scummvm-rg350-8545991739848d878e61ff058e8fa1326261e634.tar.gz scummvm-rg350-8545991739848d878e61ff058e8fa1326261e634.tar.bz2 scummvm-rg350-8545991739848d878e61ff058e8fa1326261e634.zip |
LASTEXPRESS: Remove several TIME_CHECK* macros
Diffstat (limited to 'engines/lastexpress/entities')
30 files changed, 251 insertions, 156 deletions
diff --git a/engines/lastexpress/entities/abbot.cpp b/engines/lastexpress/entities/abbot.cpp index 7916f88662..e0fe429520 100644 --- a/engines/lastexpress/entities/abbot.cpp +++ b/engines/lastexpress/entities/abbot.cpp @@ -691,7 +691,7 @@ IMPLEMENT_FUNCTION(28, Abbot, function28) break; case kActionNone: - TIME_CHECK_CALLBACK(kTime2052000, params->param1, 1, setup_function29); + Entity::timeCheckCallback(kTime2052000, params->param1, 1, WRAP_SETUP_FUNCTION(Abbot, setup_function29)); break; case kActionDefault: @@ -1428,7 +1428,8 @@ IMPLEMENT_FUNCTION(43, Abbot, function43) } label_callback_1: - TIME_CHECK(kTime2466000, params->param5, setup_function44); + if (Entity::timeCheck(kTime2466000, params->param5, WRAP_SETUP_FUNCTION(Abbot, setup_function44))) + break; if (params->param3) { if (!Entity::updateParameter(params->param6, getState()->timeTicks, 75)) @@ -1657,7 +1658,7 @@ IMPLEMENT_FUNCTION(48, Abbot, function48) setup_updatePosition("126C", kCarRedSleeping, 52); } - TIME_CHECK_CALLBACK_INVENTORY(kTime2533500, params->param2, 5, setup_callbackActionRestaurantOrSalon); + Entity::timeCheckCallbackInventory(kTime2533500, params->param2, 5, WRAP_SETUP_FUNCTION(Abbot, setup_callbackActionRestaurantOrSalon)); break; case kAction1: @@ -1709,7 +1710,7 @@ IMPLEMENT_FUNCTION(48, Abbot, function48) getEntities()->drawSequenceLeft(kEntityAbbot, "126B"); params->param1 = 0; - TIME_CHECK_CALLBACK_INVENTORY(kTime2533500, params->param2, 5, setup_callbackActionRestaurantOrSalon); + Entity::timeCheckCallbackInventory(kTime2533500, params->param2, 5, WRAP_SETUP_FUNCTION(Abbot, setup_callbackActionRestaurantOrSalon)); break; case 5: diff --git a/engines/lastexpress/entities/alexei.cpp b/engines/lastexpress/entities/alexei.cpp index b31a9956bc..115c890f6f 100644 --- a/engines/lastexpress/entities/alexei.cpp +++ b/engines/lastexpress/entities/alexei.cpp @@ -446,7 +446,7 @@ IMPLEMENT_FUNCTION(17, Alexei, chapter1) break; case kActionNone: - TIME_CHECK(kTimeChapter1, params->param1, setup_chapter1Handler) + Entity::timeCheck(kTimeChapter1, params->param1, WRAP_SETUP_FUNCTION(Alexei, setup_chapter1Handler)); break; case kActionDefault: @@ -978,7 +978,7 @@ IMPLEMENT_FUNCTION(26, Alexei, function26) break; case kActionNone: - TIME_CHECK(kTime1512000, params->param1, setup_function27) + Entity::timeCheck(kTime1512000, params->param1, WRAP_SETUP_FUNCTION(Alexei, setup_function27)); break; case kActionDefault: diff --git a/engines/lastexpress/entities/alouan.cpp b/engines/lastexpress/entities/alouan.cpp index 7549aaf6e6..2f086de46b 100644 --- a/engines/lastexpress/entities/alouan.cpp +++ b/engines/lastexpress/entities/alouan.cpp @@ -111,7 +111,7 @@ IMPLEMENT_FUNCTION(10, Alouan, chapter1) break; case kActionNone: - TIME_CHECK(kTimeChapter1, params->param1, setup_chapter1Handler); + Entity::timeCheck(kTimeChapter1, params->param1, WRAP_SETUP_FUNCTION(Alouan, setup_chapter1Handler)); break; case kActionDefault: @@ -131,7 +131,8 @@ IMPLEMENT_FUNCTION(11, Alouan, chapter1Handler) case kActionNone: - TIME_CHECK_CALLBACK(kTime1096200, params->param1, 1, setup_compartment8to6); + if (Entity::timeCheckCallback(kTime1096200, params->param1, 1, WRAP_SETUP_FUNCTION(Alouan, setup_compartment8to6))) + break; label_callback1: if (getState()->time > kTime1162800 && !params->param2) { @@ -281,21 +282,27 @@ IMPLEMENT_FUNCTION(16, Alouan, chapter3Handler) break; case kActionNone: - TIME_CHECK_CALLBACK(kTimeCitySalzbourg, params->param1, 1, setup_compartment8to6); + if (Entity::timeCheckCallback(kTimeCitySalzbourg, params->param1, 1, WRAP_SETUP_FUNCTION(Alouan, setup_compartment8to6))) + break; label_callback1: - if (params->param2 != kTimeInvalid && getState()->time > kTime1989000) - TIME_CHECK_CAR(kTime2119500, params->param5, 5, setup_compartment8); + if (params->param2 != kTimeInvalid && getState()->time > kTime1989000) { + if (Entity::timeCheckCar(kTime2119500, params->param5, 5, WRAP_SETUP_FUNCTION(Alouan, setup_compartment8))) + break; + } label_callback2: TIME_CHECK_CALLBACK_1(kTime2052000, params->param3, 3, setup_playSound, "Har1005"); label_callback3: - TIME_CHECK_CALLBACK(kTime2133000, params->param4, 4, setup_compartment6to8); + if (Entity::timeCheckCallback(kTime2133000, params->param4, 4, WRAP_SETUP_FUNCTION(Alouan, setup_compartment6to8))) + break; label_callback4: - if (params->param5 != kTimeInvalid && getState()->time > kTime2151000) - TIME_CHECK_CAR(kTime2241000, params->param5, 5, setup_compartment8); + if (params->param5 != kTimeInvalid && getState()->time > kTime2151000) { + if (Entity::timeCheckCar(kTime2241000, params->param5, 5, WRAP_SETUP_FUNCTION(Alouan, setup_compartment8))) + break; + } break; case kActionDefault: @@ -352,11 +359,14 @@ IMPLEMENT_FUNCTION(18, Alouan, chapter4Handler) break; case kActionNone: - if (params->param1 != kTimeInvalid) - TIME_CHECK_CAR(kTime2443500, params->param1, 1, setup_compartment8); + if (params->param1 != kTimeInvalid) { + if (Entity::timeCheckCar(kTime2443500, params->param1, 1, WRAP_SETUP_FUNCTION(Alouan, setup_compartment8))) + break; + } label_callback1: - TIME_CHECK_CALLBACK(kTime2455200, params->param2, 2, setup_compartment8to6); + if (Entity::timeCheckCallback(kTime2455200, params->param2, 2, WRAP_SETUP_FUNCTION(Alouan, setup_compartment8to6))) + break; label_callback2: if (getState()->time > kTime2475000 && !params->param3) { diff --git a/engines/lastexpress/entities/anna.cpp b/engines/lastexpress/entities/anna.cpp index 0f326792eb..f8768032b5 100644 --- a/engines/lastexpress/entities/anna.cpp +++ b/engines/lastexpress/entities/anna.cpp @@ -547,7 +547,7 @@ IMPLEMENT_FUNCTION(16, Anna, chapter1) break; case kActionNone: - TIME_CHECK(kTimeChapter1, params->param1, setup_chapter1Handler); + Entity::timeCheck(kTimeChapter1, params->param1, WRAP_SETUP_FUNCTION(Anna, setup_chapter1Handler)); break; case kActionDefault: @@ -1423,7 +1423,7 @@ IMPLEMENT_FUNCTION(34, Anna, function34) } label_callback_1: - TIME_CHECK(kTime1489500, params->param3, setup_function35); + Entity::timeCheck(kTime1489500, params->param3, WRAP_SETUP_FUNCTION(Anna, setup_function35)); break; case kActionKnock: @@ -2544,7 +2544,8 @@ IMPLEMENT_FUNCTION(54, Anna, function54) case kActionNone: if (params->param3) { - TIME_CHECK(kTime2079000, params->param5, setup_function55); + if (Entity::timeCheck(kTime2079000, params->param5, WRAP_SETUP_FUNCTION(Anna, setup_function55))) + break; if (Entity::updateParameter(params->param6, getState()->time, 9000)) { params->param4 = !params->param4; @@ -3429,7 +3430,7 @@ IMPLEMENT_FUNCTION(69, Anna, function69) break; } - TIME_CHECK_CALLBACK(kTime2535300, params->param3, 4, setup_callbackActionRestaurantOrSalon); + Entity::timeCheckCallback(kTime2535300, params->param3, 4, WRAP_SETUP_FUNCTION(Anna, setup_callbackActionRestaurantOrSalon)); break; case kActionDefault: diff --git a/engines/lastexpress/entities/august.cpp b/engines/lastexpress/entities/august.cpp index e863fe1d87..0412da69ac 100644 --- a/engines/lastexpress/entities/august.cpp +++ b/engines/lastexpress/entities/august.cpp @@ -752,7 +752,7 @@ IMPLEMENT_FUNCTION(22, August, chapter1) break; case kActionNone: - TIME_CHECK(kTimeChapter1, params->param1, setup_chapter1Handler); + Entity::timeCheck(kTimeChapter1, params->param1, WRAP_SETUP_FUNCTION(August, setup_chapter1Handler)); break; case kActionDefault: @@ -1966,7 +1966,7 @@ IMPLEMENT_FUNCTION(38, August, function38) case kActionNone: Entity::timeCheckSavepoint(kTime1801800, params->param1, kEntityAugust, kEntityRebecca, kAction155980128); - TIME_CHECK_CALLBACK(kTime1820700, params->param2, 3, setup_callbackActionRestaurantOrSalon); + Entity::timeCheckCallback(kTime1820700, params->param2, 3, WRAP_SETUP_FUNCTION(August, setup_callbackActionRestaurantOrSalon)); break; case kActionDefault: @@ -2404,7 +2404,7 @@ IMPLEMENT_FUNCTION_END IMPLEMENT_FUNCTION(46, August, function46) switch (savepoint.action) { default: - TIME_CHECK_CALLBACK(kTime2088000, params->param1, 1, setup_function47); + Entity::timeCheckCallback(kTime2088000, params->param1, 1, WRAP_SETUP_FUNCTION(August, setup_function47)); break; case kActionNone: @@ -2489,7 +2489,7 @@ IMPLEMENT_FUNCTION(48, August, function48) break; case kActionNone: - TIME_CHECK(kTimeCityLinz, params->param1, setup_function49); + Entity::timeCheck(kTimeCityLinz, params->param1, WRAP_SETUP_FUNCTION(August, setup_function49)); break; case kActionKnock: diff --git a/engines/lastexpress/entities/boutarel.cpp b/engines/lastexpress/entities/boutarel.cpp index 2a8c6603a4..3c13cb121e 100644 --- a/engines/lastexpress/entities/boutarel.cpp +++ b/engines/lastexpress/entities/boutarel.cpp @@ -617,7 +617,7 @@ IMPLEMENT_FUNCTION(19, Boutarel, chapter1) break; case kActionNone: - TIME_CHECK(kTimeChapter1, params->param1, setup_chapter1Handler); + Entity::timeCheck(kTimeChapter1, params->param1, WRAP_SETUP_FUNCTION(Boutarel, setup_chapter1Handler)); break; case kActionDefault: @@ -1047,7 +1047,7 @@ IMPLEMENT_FUNCTION(32, Boutarel, chapter4Handler) break; case kActionNone: - TIME_CHECK(kTime2367000, params->param1, setup_function33); + Entity::timeCheck(kTime2367000, params->param1, WRAP_SETUP_FUNCTION(Boutarel, setup_function33)); break; case kActionDefault: @@ -1113,7 +1113,8 @@ IMPLEMENT_FUNCTION(34, Boutarel, function34) break; case kActionNone: - TIME_CHECK(kTime2470500, params->param1, setup_function35); + if (Entity::timeCheck(kTime2470500, params->param1, WRAP_SETUP_FUNCTION(Boutarel, setup_function35))) + break; if (getState()->time > kTime2457000 && getEvent(kEventAugustDrink)) { getSavePoints()->push(kEntityBoutarel, kEntityAbbot, kAction159003408); diff --git a/engines/lastexpress/entities/cooks.cpp b/engines/lastexpress/entities/cooks.cpp index 62a1e0fdb6..5e8a2df8cb 100644 --- a/engines/lastexpress/entities/cooks.cpp +++ b/engines/lastexpress/entities/cooks.cpp @@ -239,7 +239,7 @@ IMPLEMENT_FUNCTION(5, Cooks, chapter1) break; case kActionNone: - TIME_CHECK(kTimeChapter1, params->param1, setup_chapter1Handler); + Entity::timeCheck(kTimeChapter1, params->param1, WRAP_SETUP_FUNCTION(Cooks, setup_chapter1Handler)); break; case kActionDefault: diff --git a/engines/lastexpress/entities/coudert.cpp b/engines/lastexpress/entities/coudert.cpp index 4458632f2d..b604277903 100644 --- a/engines/lastexpress/entities/coudert.cpp +++ b/engines/lastexpress/entities/coudert.cpp @@ -1963,7 +1963,7 @@ IMPLEMENT_FUNCTION(36, Coudert, chapter1) break; case kActionNone: - TIME_CHECK_CALLBACK(kTimeChapter1, params->param1, 1, setup_chapter1Handler) + Entity::timeCheckCallback(kTimeChapter1, params->param1, 1, WRAP_SETUP_FUNCTION(Coudert, setup_chapter1Handler)); break; case kActionDefault: @@ -2825,22 +2825,28 @@ label_callback_12: } label_callback_13: - TIME_CHECK_CALLBACK(kTime2088900, params->param1, 14, setup_function32); + if (Entity::timeCheckCallback(kTime2088900, params->param1, 14, WRAP_SETUP_FUNCTION(Coudert, setup_function32))) + break; label_callback_14: - TIME_CHECK_CALLBACK(kTime2119500, params->param2, 15, setup_function32); + if (Entity::timeCheckCallback(kTime2119500, params->param2, 15, WRAP_SETUP_FUNCTION(Coudert, setup_function32))) + break; label_callback_15: - TIME_CHECK_CALLBACK(kTime2138400, params->param3, 16, setup_function32); + if (Entity::timeCheckCallback(kTime2138400, params->param3, 16, WRAP_SETUP_FUNCTION(Coudert, setup_function32))) + break; label_callback_16: - TIME_CHECK_CALLBACK(kTime2147400, params->param4, 17, setup_function32); + if (Entity::timeCheckCallback(kTime2147400, params->param4, 17, WRAP_SETUP_FUNCTION(Coudert, setup_function32))) + break; label_callback_17: - TIME_CHECK_CALLBACK(kTime2160000, params->param5, 18, setup_function32); + if (Entity::timeCheckCallback(kTime2160000, params->param5, 18, WRAP_SETUP_FUNCTION(Coudert, setup_function32))) + break; label_callback_18: - TIME_CHECK_CALLBACK(kTime2205000, params->param6, 19, setup_function32); + if (Entity::timeCheckCallback(kTime2205000, params->param6, 19, WRAP_SETUP_FUNCTION(Coudert, setup_function32))) + break; label_callback_19: if (ENTITY_PARAM(0, 2)) { @@ -3556,13 +3562,16 @@ label_callback_2: label_callback_3: if (!params->param1) { - TIME_CHECK_CALLBACK(kTime2394000, params->param4, 4, setup_function56); + if (Entity::timeCheckCallback(kTime2394000, params->param4, 4, WRAP_SETUP_FUNCTION(Coudert, setup_function56))) + break; label_callback_4: - TIME_CHECK_CALLBACK(kTime2434500, params->param5, 5, setup_function32); + if (Entity::timeCheckCallback(kTime2434500, params->param5, 5, WRAP_SETUP_FUNCTION(Coudert, setup_function32))) + break; label_callback_5: - TIME_CHECK_CALLBACK(kTime2448000, params->param6, 6, setup_function32); + if (Entity::timeCheckCallback(kTime2448000, params->param6, 6, WRAP_SETUP_FUNCTION(Coudert, setup_function32))) + break; } label_callback_6: diff --git a/engines/lastexpress/entities/entity.cpp b/engines/lastexpress/entities/entity.cpp index 04ae6493c3..48856a7bc4 100644 --- a/engines/lastexpress/entities/entity.cpp +++ b/engines/lastexpress/entities/entity.cpp @@ -637,6 +637,57 @@ bool Entity::updateParameterCheck(uint ¶meter, uint timeType, uint delta) { return true; } +bool Entity::timeCheck(TimeValue timeValue, uint ¶meter, Common::Functor0<void> *function) { + if (getState()->time > timeValue && !parameter) { + parameter = 1; + (*function)(); + + return true; + } + + return false; +} + +bool Entity::timeCheckCallback(TimeValue timeValue, uint ¶meter, byte callback, Common::Functor0<void> *function) { + if (getState()->time > timeValue && !parameter) { + parameter = 1; + setCallback(callback); + (*function)(); + + return true; + } + + return false; +} + +bool Entity::timeCheckCallbackInventory(TimeValue timeValue, uint ¶meter, byte callback, Common::Functor0<void> *function) { + if (getState()->time > timeValue && !parameter) { + parameter = 1; + getData()->inventoryItem = kItemNone; + setCallback(callback); + (*function)(); + + return true; + } + + return false; +} + +bool Entity::timeCheckCar(TimeValue timeValue, uint ¶meter, byte callback, Common::Functor0<void> *function) { + if ((getState()->time <= timeValue && !getEntities()->isPlayerInCar(kCarGreenSleeping)) || !parameter) + parameter = (uint)getState()->time + 75; + + if (getState()->time > timeValue || parameter < getState()->time) { + parameter = kTimeInvalid; + setCallback(callback); + (*function)(); + + return true; + } + + return false; +} + void Entity::timeCheckSavepoint(TimeValue timeValue, uint ¶meter, EntityIndex entity1, EntityIndex entity2, ActionIndex action) { if (getState()->time > timeValue && !parameter) { parameter = 1; diff --git a/engines/lastexpress/entities/entity.h b/engines/lastexpress/entities/entity.h index 76abab6c2f..6e55e21b74 100644 --- a/engines/lastexpress/entities/entity.h +++ b/engines/lastexpress/entities/entity.h @@ -82,6 +82,9 @@ struct SavePoint; #define ADD_NULL_FUNCTION() \ _callbacks.push_back(new ENTITY_CALLBACK(Entity, nullfunction, this)); +#define WRAP_SETUP_FUNCTION(className, method) \ + new Common::Functor0Mem<void, className>(this, &className::method) + ////////////////////////////////////////////////////////////////////////// // Parameters macros ////////////////////////////////////////////////////////////////////////// @@ -903,10 +906,15 @@ protected: bool updateParameterCheck(uint ¶meter, uint timeType, uint delta); bool updateParameterTime(TimeValue timeValue, bool check, uint ¶meter, uint delta); + bool timeCheck(TimeValue timeValue, uint ¶meter, Common::Functor0<void> *function); + bool timeCheckCallback(TimeValue timeValue, uint ¶meter, byte callback, Common::Functor0<void> *function); + bool timeCheckCallbackInventory(TimeValue timeValue, uint ¶meter, byte callback, Common::Functor0<void> *function); + bool timeCheckCar(TimeValue timeValue, uint ¶meter, byte callback, Common::Functor0<void> *function); void timeCheckSavepoint(TimeValue timeValue, uint ¶meter, EntityIndex entity1, EntityIndex entity2, ActionIndex action); void timeCheckObject(TimeValue timeValue, uint ¶meter, ObjectIndex index, ObjectLocation location); bool timeCheckCallbackAction(TimeValue timeValue, uint ¶meter); bool timeCheckPlaySoundUpdatePosition(TimeValue timeValue, uint ¶meter, byte callback, const char* sound, EntityPosition position); + }; diff --git a/engines/lastexpress/entities/entity_intern.h b/engines/lastexpress/entities/entity_intern.h index e62eeb0c56..1d6c462a88 100644 --- a/engines/lastexpress/entities/entity_intern.h +++ b/engines/lastexpress/entities/entity_intern.h @@ -269,21 +269,6 @@ void class::setup_##name() { \ ////////////////////////////////////////////////////////////////////////// // Time check macros ////////////////////////////////////////////////////////////////////////// -#define TIME_CHECK(timeValue, parameter, function) \ - if (getState()->time > timeValue && !parameter) { \ - parameter = 1; \ - function(); \ - break; \ - } - -#define TIME_CHECK_CALLBACK(timeValue, parameter, callback, function) \ - if (getState()->time > timeValue && !parameter) { \ - parameter = 1; \ - setCallback(callback); \ - function(); \ - break; \ - } - #define TIME_CHECK_CALLBACK_1(timeValue, parameter, callback, function, param1) \ if (getState()->time > timeValue && !parameter) { \ parameter = 1; \ @@ -308,26 +293,6 @@ void class::setup_##name() { \ break; \ } -#define TIME_CHECK_CALLBACK_INVENTORY(timeValue, parameter, callback, function) \ - if (getState()->time > timeValue && !parameter) { \ - parameter = 1; \ - getData()->inventoryItem = kItemNone; \ - setCallback(callback); \ - function(); \ - break; \ - } - -#define TIME_CHECK_CAR(timeValue, parameter, callback, function) {\ - if ((getState()->time <= timeValue && !getEntities()->isPlayerInCar(kCarGreenSleeping)) || !parameter) \ - parameter = (uint)getState()->time + 75; \ - if (getState()->time > timeValue || parameter < getState()->time) { \ - parameter = kTimeInvalid; \ - setCallback(callback); \ - function(); \ - break; \ - } \ -} - } // End of namespace LastExpress #endif // LASTEXPRESS_ENTITY_INTERN_H diff --git a/engines/lastexpress/entities/francois.cpp b/engines/lastexpress/entities/francois.cpp index e4d401d202..89fdcaf668 100644 --- a/engines/lastexpress/entities/francois.cpp +++ b/engines/lastexpress/entities/francois.cpp @@ -848,7 +848,7 @@ IMPLEMENT_FUNCTION(17, Francois, chapter1) break; case kActionNone: - TIME_CHECK(kTimeChapter1, params->param1, setup_chapter1Handler); + Entity::timeCheck(kTimeChapter1, params->param1, WRAP_SETUP_FUNCTION(Francois, setup_chapter1Handler)); break; case kActionDefault: @@ -883,7 +883,7 @@ IMPLEMENT_FUNCTION(19, Francois, function19) break; case kActionNone: - TIME_CHECK_CALLBACK(kTime1161000, params->param1, 2, setup_function12); + Entity::timeCheckCallback(kTime1161000, params->param1, 2, WRAP_SETUP_FUNCTION(Francois, setup_function12)); break; case kAction101107728: @@ -981,7 +981,8 @@ label_callback_1: TIME_CHECK_CALLBACK_1(kTime1764000, params->param1, 2, setup_playSound, "Fra2011"); label_callback_2: - TIME_CHECK_CALLBACK(kTime1800000, params->param2, 3, setup_function13); + if (Entity::timeCheckCallback(kTime1800000, params->param2, 3, WRAP_SETUP_FUNCTION(Francois, setup_function13))) + break; label_callback_3: if (!getInventory()->hasItem(kItemWhistle) && getInventory()->get(kItemWhistle)->location != kObjectLocation3) { @@ -1085,25 +1086,32 @@ IMPLEMENT_FUNCTION(25, Francois, chapter3Handler) } label_callback_2: - TIME_CHECK_CALLBACK(kTime2025000, params->param3, 3, setup_function12); + if (Entity::timeCheckCallback(kTime2025000, params->param3, 3, WRAP_SETUP_FUNCTION(Francois, setup_function12))) + break; label_callback_3: - TIME_CHECK_CALLBACK(kTime2052000, params->param4, 4, setup_function12); + if (Entity::timeCheckCallback(kTime2052000, params->param4, 4, WRAP_SETUP_FUNCTION(Francois, setup_function12))) + break; label_callback_4: - TIME_CHECK_CALLBACK(kTime2079000, params->param5, 5, setup_function12); + if (Entity::timeCheckCallback(kTime2079000, params->param5, 5, WRAP_SETUP_FUNCTION(Francois, setup_function12))) + break; label_callback_5: - TIME_CHECK_CALLBACK(kTime2092500, params->param6, 6, setup_function12); + if (Entity::timeCheckCallback(kTime2092500, params->param6, 6, WRAP_SETUP_FUNCTION(Francois, setup_function12))) + break; label_callback_6: - TIME_CHECK_CALLBACK(kTime2173500, params->param7, 7, setup_function12); + if (Entity::timeCheckCallback(kTime2173500, params->param7, 7, WRAP_SETUP_FUNCTION(Francois, setup_function12))) + break; label_callback_7: - TIME_CHECK_CALLBACK(kTime2182500, params->param8, 8, setup_function12); + if (Entity::timeCheckCallback(kTime2182500, params->param8, 8, WRAP_SETUP_FUNCTION(Francois, setup_function12))) + break; label_callback_8: - TIME_CHECK_CALLBACK(kTime2241000, CURRENT_PARAM(1, 1), 9, setup_function12); + if (Entity::timeCheckCallback(kTime2241000, CURRENT_PARAM(1, 1), 9, WRAP_SETUP_FUNCTION(Francois, setup_function12))) + break; label_callback_9: if (!getInventory()->hasItem(kItemWhistle) && getInventory()->get(kItemWhistle)->location != kObjectLocation3) { diff --git a/engines/lastexpress/entities/gendarmes.cpp b/engines/lastexpress/entities/gendarmes.cpp index 22697b396c..a912fa4ecb 100644 --- a/engines/lastexpress/entities/gendarmes.cpp +++ b/engines/lastexpress/entities/gendarmes.cpp @@ -66,7 +66,7 @@ IMPLEMENT_FUNCTION(2, Gendarmes, chapter1) break; case kActionNone: - TIME_CHECK(kTimeChapter1, params->param1, setup_chapter1Handler); + Entity::timeCheck(kTimeChapter1, params->param1, WRAP_SETUP_FUNCTION(Gendarmes, setup_chapter1Handler)); break; case kActionDefault: diff --git a/engines/lastexpress/entities/hadija.cpp b/engines/lastexpress/entities/hadija.cpp index 62badc46a6..e9abcd888a 100644 --- a/engines/lastexpress/entities/hadija.cpp +++ b/engines/lastexpress/entities/hadija.cpp @@ -111,7 +111,7 @@ IMPLEMENT_FUNCTION(10, Hadija, chapter1) break; case kActionNone: - TIME_CHECK(kTimeChapter1, params->param1, setup_chapter1Handler); + Entity::timeCheck(kTimeChapter1, params->param1, WRAP_SETUP_FUNCTION(Hadija, setup_chapter1Handler)); break; case kActionDefault: @@ -134,7 +134,8 @@ IMPLEMENT_FUNCTION(11, Hadija, chapter1Handler) break; label_callback1: - TIME_CHECK_CALLBACK(kTime1084500, params->param2, 2, setup_compartment6to8); + if (Entity::timeCheckCallback(kTime1084500, params->param2, 2, WRAP_SETUP_FUNCTION(Hadija, setup_compartment6to8))) + break; label_callback2: if (params->param3 != kTimeInvalid && getState()->time > kTime1093500) { @@ -162,7 +163,8 @@ label_callback2: } label_callback3: - TIME_CHECK_CALLBACK(kTime1156500, params->param4, 4, setup_compartment8to6); + if (Entity::timeCheckCallback(kTime1156500, params->param4, 4, WRAP_SETUP_FUNCTION(Hadija, setup_compartment8to6))) + break; label_callback4: if (params->param5 != kTimeInvalid && getState()->time > kTime1165500) { @@ -252,7 +254,7 @@ IMPLEMENT_FUNCTION(14, Hadija, chapter2Handler) } if (params->param2 == kTimeInvalid || getState()->time <= kTime1786500) { - TIME_CHECK_CALLBACK(kTime1822500, params->param3, 2, setup_compartment8to6); + Entity::timeCheckCallback(kTime1822500, params->param3, 2, WRAP_SETUP_FUNCTION(Hadija, setup_compartment8to6)); break; } @@ -262,7 +264,7 @@ IMPLEMENT_FUNCTION(14, Hadija, chapter2Handler) params->param2 = (uint)getState()->time + 75; if (params->param2 >= getState()->time) { - TIME_CHECK_CALLBACK(kTime1822500, params->param3, 2, setup_compartment8to6); + Entity::timeCheckCallback(kTime1822500, params->param3, 2, WRAP_SETUP_FUNCTION(Hadija, setup_compartment8to6)); break; } } @@ -279,7 +281,7 @@ IMPLEMENT_FUNCTION(14, Hadija, chapter2Handler) break; case 1: - TIME_CHECK_CALLBACK(kTime1822500, params->param3, 2, setup_compartment8to6); + Entity::timeCheckCallback(kTime1822500, params->param3, 2, WRAP_SETUP_FUNCTION(Hadija, setup_compartment8to6)); break; case 2: @@ -319,20 +321,26 @@ IMPLEMENT_FUNCTION(16, Hadija, chapter3Handler) break; case kActionNone: - TIME_CHECK_CALLBACK(kTime1998000, params->param1, 1, setup_compartment6to8); + if (Entity::timeCheckCallback(kTime1998000, params->param1, 1, WRAP_SETUP_FUNCTION(Hadija, setup_compartment6to8))) + break; label_callback1: - TIME_CHECK_CALLBACK(kTime2020500, params->param2, 2, setup_compartment8to6); + if (Entity::timeCheckCallback(kTime2020500, params->param2, 2, WRAP_SETUP_FUNCTION(Hadija, setup_compartment8to6))) + break; label_callback2: - TIME_CHECK_CALLBACK(kTime2079000, params->param3, 3, setup_compartment6to8); + if (Entity::timeCheckCallback(kTime2079000, params->param3, 3, WRAP_SETUP_FUNCTION(Hadija, setup_compartment6to8))) + break; label_callback3: - TIME_CHECK_CALLBACK(kTime2187000, params->param4, 4, setup_compartment8to6); + if (Entity::timeCheckCallback(kTime2187000, params->param4, 4, WRAP_SETUP_FUNCTION(Hadija, setup_compartment8to6))) + break; label_callback4: - if (params->param5 != kTimeInvalid && getState()->time > kTime2196000) - TIME_CHECK_CAR(kTime2254500, params->param5, 5, setup_compartment6); + if (params->param5 != kTimeInvalid && getState()->time > kTime2196000) { + if (Entity::timeCheckCar(kTime2254500, params->param5, 5, WRAP_SETUP_FUNCTION(Hadija, setup_compartment6))) + break; + } break; case kActionDefault: @@ -385,18 +393,24 @@ IMPLEMENT_FUNCTION(18, Hadija, chapter4Handler) break; case kActionNone: - if (params->param1 != kTimeInvalid) - TIME_CHECK_CAR(kTime1714500, params->param1, 1, setup_compartment6); + if (params->param1 != kTimeInvalid) { + if (Entity::timeCheckCar(kTime1714500, params->param1, 1, WRAP_SETUP_FUNCTION(Hadija, setup_compartment6))) + break; + } label_callback1: - TIME_CHECK_CALLBACK(kTime2367000, params->param2, 2, setup_compartment6to8); + if (Entity::timeCheckCallback(kTime2367000, params->param2, 2, WRAP_SETUP_FUNCTION(Hadija, setup_compartment6to8))) + break; label_callback2: - TIME_CHECK_CALLBACK(kTime2421000, params->param3, 3, setup_compartment8to6); + if (Entity::timeCheckCallback(kTime2421000, params->param3, 3, WRAP_SETUP_FUNCTION(Hadija, setup_compartment8to6))) + break; label_callback3: - if (params->param4 != kTimeInvalid && getState()->time > kTime2425500) - TIME_CHECK_CAR(kTime2484000, params->param4, 4, setup_compartment6); + if (params->param4 != kTimeInvalid && getState()->time > kTime2425500) { + if (Entity::timeCheckCar(kTime2484000, params->param4, 4, WRAP_SETUP_FUNCTION(Hadija, setup_compartment6))) + break; + } break; case kActionCallback: diff --git a/engines/lastexpress/entities/ivo.cpp b/engines/lastexpress/entities/ivo.cpp index cb0fb92b74..c53f4689fb 100644 --- a/engines/lastexpress/entities/ivo.cpp +++ b/engines/lastexpress/entities/ivo.cpp @@ -246,7 +246,7 @@ IMPLEMENT_FUNCTION(14, Ivo, chapter1) break; case kActionNone: - TIME_CHECK(kTimeChapter1, params->param1, setup_chapter1Handler); + Entity::timeCheck(kTimeChapter1, params->param1, WRAP_SETUP_FUNCTION(Ivo, setup_chapter1Handler)); break; case kActionDefault: @@ -371,7 +371,7 @@ IMPLEMENT_FUNCTION(18, Ivo, chapter2) break; case kActionNone: - TIME_CHECK(kTime1777500, params->param1, setup_function19); + Entity::timeCheck(kTime1777500, params->param1, WRAP_SETUP_FUNCTION(Ivo, setup_function19)); break; case kActionDefault: diff --git a/engines/lastexpress/entities/kahina.cpp b/engines/lastexpress/entities/kahina.cpp index 08f845f5ba..7860836a26 100644 --- a/engines/lastexpress/entities/kahina.cpp +++ b/engines/lastexpress/entities/kahina.cpp @@ -247,7 +247,7 @@ IMPLEMENT_FUNCTION(10, Kahina, chapter1) break; case kActionNone: - TIME_CHECK(kTimeChapter1, params->param1, setup_chapter1Handler); + Entity::timeCheck(kTimeChapter1, params->param1, WRAP_SETUP_FUNCTION(Kahina, setup_chapter1Handler)); break; case kActionDefault: @@ -280,7 +280,7 @@ IMPLEMENT_FUNCTION(12, Kahina, function12) break; case kActionNone: - TIME_CHECK(kTime1485000, params->param2, setup_function13); + Entity::timeCheck(kTime1485000, params->param2, WRAP_SETUP_FUNCTION(Kahina, setup_function13)); break; case kActionKnock: diff --git a/engines/lastexpress/entities/kronos.cpp b/engines/lastexpress/entities/kronos.cpp index 5dd790ce12..26ce3ca424 100644 --- a/engines/lastexpress/entities/kronos.cpp +++ b/engines/lastexpress/entities/kronos.cpp @@ -126,7 +126,7 @@ IMPLEMENT_FUNCTION(7, Kronos, chapter1) break; case kActionNone: - TIME_CHECK(kTimeChapter1, params->param1, setup_chapter1Handler); + Entity::timeCheck(kTimeChapter1, params->param1, WRAP_SETUP_FUNCTION(Kronos, setup_chapter1Handler)); break; case kActionDefault: @@ -147,7 +147,7 @@ IMPLEMENT_FUNCTION(8, Kronos, chapter1Handler) break; case kActionNone: - TIME_CHECK(kTime1489500, params->param2, setup_function11); + Entity::timeCheck(kTime1489500, params->param2, WRAP_SETUP_FUNCTION(Kronos, setup_function11)); break; case kAction171849314: @@ -189,7 +189,7 @@ IMPLEMENT_FUNCTION(10, Kronos, function10) break; case kActionNone: - TIME_CHECK(kTime1489500, params->param1, setup_function11); + Entity::timeCheck(kTime1489500, params->param1, WRAP_SETUP_FUNCTION(Kronos, setup_function11)); break; case kActionDefault: @@ -405,8 +405,7 @@ IMPLEMENT_FUNCTION(18, Kronos, function18) params->param2 = 1; } - TIME_CHECK(kTime2106000, params->param3, setup_function19) - else { + if (!Entity::timeCheck(kTime2106000, params->param3, WRAP_SETUP_FUNCTION(Kronos, setup_function19))) { if (params->param1 && getEntities()->isInKronosSanctum(kEntityPlayer)) { setCallback(1); setup_savegame(kSavegameTypeEvent, kEventKahinaPunchSuite4); diff --git a/engines/lastexpress/entities/mahmud.cpp b/engines/lastexpress/entities/mahmud.cpp index 1e7df5c870..af86ef8cdd 100644 --- a/engines/lastexpress/entities/mahmud.cpp +++ b/engines/lastexpress/entities/mahmud.cpp @@ -560,7 +560,8 @@ IMPLEMENT_FUNCTION(14, Mahmud, chaptersHandler) if (!params->param2 && getProgress().chapter == kChapter1) { - TIME_CHECK_CALLBACK(kTime1098000, params->param6, 1, setup_function13); + if (Entity::timeCheckCallback(kTime1098000, params->param6, 1, WRAP_SETUP_FUNCTION(Mahmud, setup_function13))) + break; if (!getSoundQueue()->isBuffered("HAR1104") && getState()->time > kTime1167300 && !params->param7) { params->param7 = 1; @@ -733,7 +734,7 @@ IMPLEMENT_FUNCTION(15, Mahmud, chapter1) break; case kActionNone: - TIME_CHECK(kTimeChapter1, params->param1, setup_chaptersHandler); + Entity::timeCheck(kTimeChapter1, params->param1, WRAP_SETUP_FUNCTION(Mahmud, setup_chaptersHandler)); break; case kActionDefault: diff --git a/engines/lastexpress/entities/max.cpp b/engines/lastexpress/entities/max.cpp index 5c43346cde..abd2aae9e4 100644 --- a/engines/lastexpress/entities/max.cpp +++ b/engines/lastexpress/entities/max.cpp @@ -324,7 +324,7 @@ IMPLEMENT_FUNCTION(10, Max, chapter1) break; case kActionNone: - TIME_CHECK(kTimeChapter1, params->param1, setup_chapter12_handler); + Entity::timeCheck(kTimeChapter1, params->param1, WRAP_SETUP_FUNCTION(Max, setup_chapter12_handler)); break; case kActionDefault: diff --git a/engines/lastexpress/entities/mertens.cpp b/engines/lastexpress/entities/mertens.cpp index 9d9225f49b..b6ea86cd0e 100644 --- a/engines/lastexpress/entities/mertens.cpp +++ b/engines/lastexpress/entities/mertens.cpp @@ -2498,7 +2498,7 @@ IMPLEMENT_FUNCTION(34, Mertens, chapter1) break; case kActionNone: - TIME_CHECK(kTimeChapter1, params->param1, setup_chapter1Handler); + Entity::timeCheck(kTimeChapter1, params->param1, WRAP_SETUP_FUNCTION(Mertens, setup_chapter1Handler)); break; case kActionDefault: @@ -3535,16 +3535,18 @@ label_callback_6: TIME_CHECK_CALLBACK_1(kTime1971000, params->param1, 7, setup_function28, "CON3012"); label_callback_7: - TIME_CHECK_CALLBACK(kTime2117700, params->param2, 8, setup_function32); + if (Entity::timeCheckCallback(kTime2117700, params->param2, 8, WRAP_SETUP_FUNCTION(Mertens, setup_function32))) + break; label_callback_8: TIME_CHECK_CALLBACK_1(kTime2124000, params->param3, 9, setup_function28, "CON2010"); label_callback_9: - TIME_CHECK_CALLBACK(kTime2146500, params->param4, 10, setup_function32); + if (Entity::timeCheckCallback(kTime2146500, params->param4, 10, WRAP_SETUP_FUNCTION(Mertens, setup_function32))) + break; label_callback_10: - TIME_CHECK_CALLBACK(kTime2169000, params->param5, 11, setup_function32); + Entity::timeCheckCallback(kTime2169000, params->param5, 11, WRAP_SETUP_FUNCTION(Mertens, setup_function32)); break; case kAction11: @@ -3727,16 +3729,20 @@ label_callback_3: label_callback_4: if (!params->param1) { - TIME_CHECK_CALLBACK(kTime2403000, params->param2, 5, setup_function49); + if (Entity::timeCheckCallback(kTime2403000, params->param2, 5, WRAP_SETUP_FUNCTION(Mertens, setup_function49))) + break; label_callback_5: - TIME_CHECK_CALLBACK(kTime2430000, params->param3, 6, setup_function32); + if (Entity::timeCheckCallback(kTime2430000, params->param3, 6, WRAP_SETUP_FUNCTION(Mertens, setup_function32))) + break; label_callback_6: - TIME_CHECK_CALLBACK(kTime2439000, params->param4, 7, setup_function32); + if (Entity::timeCheckCallback(kTime2439000, params->param4, 7, WRAP_SETUP_FUNCTION(Mertens, setup_function32))) + break; label_callback_7: - TIME_CHECK_CALLBACK(kTime2448000, params->param5, 8, setup_function32); + if (Entity::timeCheckCallback(kTime2448000, params->param5, 8, WRAP_SETUP_FUNCTION(Mertens, setup_function32))) + break; } label_callback_8: diff --git a/engines/lastexpress/entities/milos.cpp b/engines/lastexpress/entities/milos.cpp index 5c5d481938..519a613497 100644 --- a/engines/lastexpress/entities/milos.cpp +++ b/engines/lastexpress/entities/milos.cpp @@ -362,7 +362,7 @@ IMPLEMENT_FUNCTION(12, Milos, chapter1) break; case kActionNone: - TIME_CHECK(kTimeChapter1, params->param1, setup_chapter1Handler); + Entity::timeCheck(kTimeChapter1, params->param1, WRAP_SETUP_FUNCTION(Milos, setup_chapter1Handler)); break; case kActionDefault: diff --git a/engines/lastexpress/entities/mmeboutarel.cpp b/engines/lastexpress/entities/mmeboutarel.cpp index 888adeb372..950644cb8f 100644 --- a/engines/lastexpress/entities/mmeboutarel.cpp +++ b/engines/lastexpress/entities/mmeboutarel.cpp @@ -244,7 +244,7 @@ IMPLEMENT_FUNCTION(10, MmeBoutarel, chapter1) break; case kActionNone: - TIME_CHECK(kTimeChapter1, params->param1, setup_chapter1Handler); + Entity::timeCheck(kTimeChapter1, params->param1, WRAP_SETUP_FUNCTION(MmeBoutarel, setup_chapter1Handler)); break; case kActionDefault: @@ -424,7 +424,8 @@ label_callback_1: } } - TIME_CHECK(kTime1094400, params->param8, setup_function14); + if (Entity::timeCheck(kTime1094400, params->param8, WRAP_SETUP_FUNCTION(MmeBoutarel, setup_function14))) + break; if (params->param4) { if (!Entity::updateParameter(CURRENT_PARAM(1, 1), getState()->timeTicks, 75)) @@ -1065,7 +1066,8 @@ IMPLEMENT_FUNCTION(24, MmeBoutarel, function24) break; case kActionNone: - TIME_CHECK(kTime2470500, params->param4, setup_function25); + if (Entity::timeCheck(kTime2470500, params->param4, WRAP_SETUP_FUNCTION(MmeBoutarel, setup_function25))) + break; if (params->param2) { if (!Entity::updateParameter(params->param5, getState()->timeTicks, 75)) diff --git a/engines/lastexpress/entities/rebecca.cpp b/engines/lastexpress/entities/rebecca.cpp index c0c22fa1da..5ad8a1b985 100644 --- a/engines/lastexpress/entities/rebecca.cpp +++ b/engines/lastexpress/entities/rebecca.cpp @@ -655,7 +655,7 @@ IMPLEMENT_FUNCTION(21, Rebecca, chapter1) break; case kActionNone: - TIME_CHECK(kTimeChapter1, params->param1, setup_chapter1Handler); + Entity::timeCheck(kTimeChapter1, params->param1, WRAP_SETUP_FUNCTION(Rebecca, setup_chapter1Handler)); break; case kActionDefault: @@ -848,7 +848,8 @@ IMPLEMENT_FUNCTION(24, Rebecca, function24) if (!params->param1) break; - TIME_CHECK_CALLBACK(kTime1165500, params->param3, 6, setup_function19); + if (Entity::timeCheckCallback(kTime1165500, params->param3, 6, WRAP_SETUP_FUNCTION(Rebecca, setup_function19))) + break; if (params->param4 != kTimeInvalid) { if (getState()->time <= kTime1161000) { @@ -1224,7 +1225,7 @@ IMPLEMENT_FUNCTION(34, Rebecca, function34) params->param2 = (uint)getState()->time; if (params->param2 >= getState()->time) { - TIME_CHECK_CALLBACK(kTime2052000, params->param3, 1, setup_function19); + Entity::timeCheckCallback(kTime2052000, params->param3, 1, WRAP_SETUP_FUNCTION(Rebecca, setup_function19)); break; } } @@ -1234,7 +1235,7 @@ IMPLEMENT_FUNCTION(34, Rebecca, function34) getSavePoints()->push(kEntityRebecca, kEntityServers0, kAction223712416); } - TIME_CHECK_CALLBACK(kTime2052000, params->param3, 1, setup_function19); + Entity::timeCheckCallback(kTime2052000, params->param3, 1, WRAP_SETUP_FUNCTION(Rebecca, setup_function19)); break; case kActionEndSound: @@ -1633,7 +1634,7 @@ label_next: label_callback_2: if (params->param2) - TIME_CHECK_CALLBACK(kTime2443500, params->param5, 3, setup_function19); + Entity::timeCheckCallback(kTime2443500, params->param5, 3, WRAP_SETUP_FUNCTION(Rebecca, setup_function19)); break; case kActionEndSound: diff --git a/engines/lastexpress/entities/salko.cpp b/engines/lastexpress/entities/salko.cpp index b799564b46..e8b4b4247b 100644 --- a/engines/lastexpress/entities/salko.cpp +++ b/engines/lastexpress/entities/salko.cpp @@ -156,7 +156,7 @@ IMPLEMENT_FUNCTION(9, Salko, chapter1) break; case kActionNone: - TIME_CHECK(kTimeChapter1, params->param1, setup_chapter1Handler); + Entity::timeCheck(kTimeChapter1, params->param1, WRAP_SETUP_FUNCTION(Salko, setup_chapter1Handler)); break; case kActionDefault: diff --git a/engines/lastexpress/entities/sophie.cpp b/engines/lastexpress/entities/sophie.cpp index 10c414763c..170090005f 100644 --- a/engines/lastexpress/entities/sophie.cpp +++ b/engines/lastexpress/entities/sophie.cpp @@ -179,7 +179,7 @@ IMPLEMENT_FUNCTION(4, Sophie, chapter1) break; case kActionNone: - TIME_CHECK(kTimeChapter1, params->param1, setup_chaptersHandler); + Entity::timeCheck(kTimeChapter1, params->param1, WRAP_SETUP_FUNCTION(Sophie, setup_chaptersHandler)); break; case kActionDefault: diff --git a/engines/lastexpress/entities/tatiana.cpp b/engines/lastexpress/entities/tatiana.cpp index b7c26bdd1c..432def6253 100644 --- a/engines/lastexpress/entities/tatiana.cpp +++ b/engines/lastexpress/entities/tatiana.cpp @@ -341,7 +341,7 @@ IMPLEMENT_FUNCTION(17, Tatiana, chapter1) break; case kActionNone: - TIME_CHECK(kTimeChapter1, params->param1, setup_chapter1Handler); + Entity::timeCheck(kTimeChapter1, params->param1, WRAP_SETUP_FUNCTION(Tatiana, setup_chapter1Handler)); break; case kActionDefault: diff --git a/engines/lastexpress/entities/vassili.cpp b/engines/lastexpress/entities/vassili.cpp index 5344e705f5..4695f8831f 100644 --- a/engines/lastexpress/entities/vassili.cpp +++ b/engines/lastexpress/entities/vassili.cpp @@ -83,7 +83,7 @@ IMPLEMENT_FUNCTION(4, Vassili, chapter1) break; case kActionNone: - TIME_CHECK(kTimeChapter1, params->param1, setup_chapter1Handler); + Entity::timeCheck(kTimeChapter1, params->param1, WRAP_SETUP_FUNCTION(Vassili, setup_chapter1Handler)); break; case kActionDefault: diff --git a/engines/lastexpress/entities/verges.cpp b/engines/lastexpress/entities/verges.cpp index f459b6f8e7..dfeae21338 100644 --- a/engines/lastexpress/entities/verges.cpp +++ b/engines/lastexpress/entities/verges.cpp @@ -572,7 +572,7 @@ IMPLEMENT_FUNCTION(18, Verges, chapter1) break; case kActionNone: - TIME_CHECK(kTimeChapter1, params->param1, setup_chapter1Handler); + Entity::timeCheck(kTimeChapter1, params->param1, WRAP_SETUP_FUNCTION(Verges, setup_chapter1Handler)); break; case kActionDefault: @@ -910,7 +910,8 @@ label_callback3: TIME_CHECK_CALLBACK_1(kTimeChapter1, params->param7, 4, setup_function9, "TRA1001"); label_callback4: - TIME_CHECK_CALLBACK(kTime1089000, params->param8, 5, setup_function12); + if (Entity::timeCheckCallback(kTime1089000, params->param8, 5, WRAP_SETUP_FUNCTION(Verges, setup_function12))) + break; params->param8 = 1; @@ -1445,7 +1446,8 @@ label_callback_4: TIME_CHECK_CALLBACK_1(kTime1998000, params->param2, 5, setup_function9, "Tra3010a"); label_callback_5: - TIME_CHECK_CALLBACK(kTime2016000, params->param3, 6, setup_function35); + if (Entity::timeCheckCallback(kTime2016000, params->param3, 6, WRAP_SETUP_FUNCTION(Verges, setup_function35))) + break; label_callback_6: TIME_CHECK_CALLBACK_1(kTime2070000, params->param4, 7, setup_function9, "Tra3002"); @@ -1457,7 +1459,7 @@ label_callback_8: TIME_CHECK_CALLBACK_1(kTime2173500, params->param6, 9, setup_function30, "Tra3012"); label_callback_9: - TIME_CHECK_CALLBACK(kTime2218500, params->param7, 10, setup_function32); + Entity::timeCheckCallback(kTime2218500, params->param7, 10, WRAP_SETUP_FUNCTION(Verges, setup_function32)); break; case kActionOpenDoor: diff --git a/engines/lastexpress/entities/vesna.cpp b/engines/lastexpress/entities/vesna.cpp index f54f0f3231..f29bce8b2b 100644 --- a/engines/lastexpress/entities/vesna.cpp +++ b/engines/lastexpress/entities/vesna.cpp @@ -255,7 +255,7 @@ IMPLEMENT_FUNCTION(12, Vesna, chapter1) break; case kActionNone: - TIME_CHECK(kTimeChapter1, params->param1, setup_chapter1Handler); + Entity::timeCheck(kTimeChapter1, params->param1, WRAP_SETUP_FUNCTION(Vesna, setup_chapter1Handler)); break; case kActionDefault: diff --git a/engines/lastexpress/entities/yasmin.cpp b/engines/lastexpress/entities/yasmin.cpp index f2b4d2edd1..acacbb547b 100644 --- a/engines/lastexpress/entities/yasmin.cpp +++ b/engines/lastexpress/entities/yasmin.cpp @@ -184,7 +184,7 @@ IMPLEMENT_FUNCTION(8, Yasmin, chapter1) break; case kActionNone: - TIME_CHECK(kTimeChapter1, params->param1, setup_chapter1Handler); + Entity::timeCheck(kTimeChapter1, params->param1, WRAP_SETUP_FUNCTION(Yasmin, setup_chapter1Handler)); break; case kActionDefault: @@ -202,13 +202,20 @@ IMPLEMENT_FUNCTION(9, Yasmin, chapter1Handler) break; case kActionNone: - TIME_CHECK_CALLBACK(kTime1093500, params->param1, 1, setup_function6); - TIME_CHECK_CALLBACK(kTime1161000, params->param2, 3, setup_function7); + if (Entity::timeCheckCallback(kTime1093500, params->param1, 1, WRAP_SETUP_FUNCTION(Yasmin, setup_function6))) + break; + + if (Entity::timeCheckCallback(kTime1161000, params->param2, 3, WRAP_SETUP_FUNCTION(Yasmin, setup_function7))) + break; + if (Entity::timeCheckPlaySoundUpdatePosition(kTime1162800, params->param3, 4, "Har1102", kPosition_4070)) break; + TIME_CHECK_CALLBACK_1(kTime1165500, params->param4, 5, setup_playSound, "Har1104"); + TIME_CHECK_CALLBACK_1(kTime1174500, params->param5, 6, setup_playSound, "Har1106"); - TIME_CHECK_CALLBACK(kTime1183500, params->param6, 7, setup_function6); + + Entity::timeCheckCallback(kTime1183500, params->param6, 7, WRAP_SETUP_FUNCTION(Yasmin, setup_function6)); break; case kActionCallback: @@ -223,7 +230,8 @@ IMPLEMENT_FUNCTION(9, Yasmin, chapter1Handler) break; case 2: - TIME_CHECK_CALLBACK(kTime1161000, params->param2, 3, setup_function7); + if (Entity::timeCheckCallback(kTime1161000, params->param2, 3, WRAP_SETUP_FUNCTION(Yasmin, setup_function7))) + break; // Fallback to case 3 case 3: @@ -240,7 +248,7 @@ IMPLEMENT_FUNCTION(9, Yasmin, chapter1Handler) // Fallback to case 6 case 6: - TIME_CHECK_CALLBACK(kTime1183500, params->param6, 7, setup_function6); + Entity::timeCheckCallback(kTime1183500, params->param6, 7, WRAP_SETUP_FUNCTION(Yasmin, setup_function6)); break; } break; @@ -281,7 +289,8 @@ IMPLEMENT_FUNCTION(12, Yasmin, chapter2Handler) break; case kActionNone: - TIME_CHECK_CALLBACK(kTime1759500, params->param1, 1, setup_function7); + if (Entity::timeCheckCallback(kTime1759500, params->param1, 1, WRAP_SETUP_FUNCTION(Yasmin, setup_function7))) + break; if (getState()->time > kTime1800000 && !params->param2) { params->param2 = 1; @@ -334,9 +343,13 @@ IMPLEMENT_FUNCTION(14, Yasmin, chapter3Handler) break; case kActionNone: - TIME_CHECK_CALLBACK(kTime2062800, params->param1, 1, setup_function6); - TIME_CHECK_CALLBACK(kTime2106000, params->param2, 2, setup_function7); - TIME_CHECK_CALLBACK(kTime2160000, params->param3, 3, setup_function6); + if (Entity::timeCheckCallback(kTime2062800, params->param1, 1, WRAP_SETUP_FUNCTION(Yasmin, setup_function6))) + break; + + if (Entity::timeCheckCallback(kTime2106000, params->param2, 2, WRAP_SETUP_FUNCTION(Yasmin, setup_function7))) + break; + + Entity::timeCheckCallback(kTime2160000, params->param3, 3, WRAP_SETUP_FUNCTION(Yasmin, setup_function6)); break; case kActionCallback: @@ -345,11 +358,12 @@ IMPLEMENT_FUNCTION(14, Yasmin, chapter3Handler) break; case 1: - TIME_CHECK_CALLBACK(kTime2106000, params->param2, 2, setup_function7); + if (Entity::timeCheckCallback(kTime2106000, params->param2, 2, WRAP_SETUP_FUNCTION(Yasmin, setup_function7))) + break; // Fallback to case 2 case 2: - TIME_CHECK_CALLBACK(kTime2160000, params->param3, 3, setup_function6); + Entity::timeCheckCallback(kTime2160000, params->param3, 3, WRAP_SETUP_FUNCTION(Yasmin, setup_function6)); break; } break; @@ -381,8 +395,10 @@ IMPLEMENT_FUNCTION(16, Yasmin, chapter4Handler) break; case kActionNone: - TIME_CHECK_CALLBACK(kTime2457000, params->param1, 1, setup_function7); - TIME_CHECK_CALLBACK(kTime2479500, params->param2, 3, setup_function6); + if (Entity::timeCheckCallback(kTime2457000, params->param1, 1, WRAP_SETUP_FUNCTION(Yasmin, setup_function7))) + break; + + Entity::timeCheckCallback(kTime2479500, params->param2, 3, WRAP_SETUP_FUNCTION(Yasmin, setup_function6)); break; case kActionCallback: @@ -397,7 +413,7 @@ IMPLEMENT_FUNCTION(16, Yasmin, chapter4Handler) break; case 2: - TIME_CHECK_CALLBACK(kTime2479500, params->param2, 3, setup_function6); + Entity::timeCheckCallback(kTime2479500, params->param2, 3, WRAP_SETUP_FUNCTION(Yasmin, setup_function6)); break; } break; |