diff options
author | Littleboy | 2012-07-16 23:47:49 -0400 |
---|---|---|
committer | Littleboy | 2012-07-16 23:51:32 -0400 |
commit | d830c0edc9e53b5a3274535139179c2ef029a5d5 (patch) | |
tree | e79c80dd324fd29e07c19d4e9ac7cef6e39720cc /engines | |
parent | 0181a464eb864e15a02acd3ab7fb700a7cac0007 (diff) | |
download | scummvm-rg350-d830c0edc9e53b5a3274535139179c2ef029a5d5.tar.gz scummvm-rg350-d830c0edc9e53b5a3274535139179c2ef029a5d5.tar.bz2 scummvm-rg350-d830c0edc9e53b5a3274535139179c2ef029a5d5.zip |
LASTEXPRESS: Replace TIME_CHECK_SAVEPOINT and TIME_CHECK_OBJECT macros
Diffstat (limited to 'engines')
-rw-r--r-- | engines/lastexpress/entities/abbot.cpp | 4 | ||||
-rw-r--r-- | engines/lastexpress/entities/august.cpp | 6 | ||||
-rw-r--r-- | engines/lastexpress/entities/coudert.cpp | 12 | ||||
-rw-r--r-- | engines/lastexpress/entities/entity.cpp | 19 | ||||
-rw-r--r-- | engines/lastexpress/entities/entity.h | 7 | ||||
-rw-r--r-- | engines/lastexpress/entities/entity_intern.h | 22 | ||||
-rw-r--r-- | engines/lastexpress/entities/kahina.cpp | 2 | ||||
-rw-r--r-- | engines/lastexpress/entities/mertens.cpp | 2 | ||||
-rw-r--r-- | engines/lastexpress/entities/milos.cpp | 4 | ||||
-rw-r--r-- | engines/lastexpress/entities/rebecca.cpp | 2 | ||||
-rw-r--r-- | engines/lastexpress/entities/tatiana.cpp | 2 |
11 files changed, 48 insertions, 34 deletions
diff --git a/engines/lastexpress/entities/abbot.cpp b/engines/lastexpress/entities/abbot.cpp index eef64bdf07..9280068fae 100644 --- a/engines/lastexpress/entities/abbot.cpp +++ b/engines/lastexpress/entities/abbot.cpp @@ -415,7 +415,7 @@ IMPLEMENT_FUNCTION(22, Abbot, function22) break; case kActionNone: - TIME_CHECK_SAVEPOINT(kTime1971000, params->param1, kEntityAbbot, kEntityServers0, kAction218586752); + Entity::timeCheckSavepoint(kTime1971000, params->param1, kEntityAbbot, kEntityServers0, kAction218586752); if (getState()->time > kTime1989000 && getEntities()->isSomebodyInsideRestaurantOrSalon()) { getData()->inventoryItem = kItemNone; @@ -1319,7 +1319,7 @@ IMPLEMENT_FUNCTION(41, Abbot, chapter4Handler) break; case kActionNone: - TIME_CHECK_SAVEPOINT(kTime2358000, params->param1, kEntityAbbot, kEntityServers0, kAction218128129); + Entity::timeCheckSavepoint(kTime2358000, params->param1, kEntityAbbot, kEntityServers0, kAction218128129); if (getState()->time > kTime2389500 && getEntities()->isSomebodyInsideRestaurantOrSalon()) setup_function42(); diff --git a/engines/lastexpress/entities/august.cpp b/engines/lastexpress/entities/august.cpp index 86c02e4301..f255d041f8 100644 --- a/engines/lastexpress/entities/august.cpp +++ b/engines/lastexpress/entities/august.cpp @@ -1811,7 +1811,7 @@ IMPLEMENT_FUNCTION(36, August, chapter2Handler) break; case kActionNone: - TIME_CHECK_SAVEPOINT(kTime1755000, params->param2, kEntityAugust, kEntityServers0, kAction252568704); + Entity::timeCheckSavepoint(kTime1755000, params->param2, kEntityAugust, kEntityServers0, kAction252568704); if (getState()->time > kTime1773000 && params->param1 && getEntities()->isSomebodyInsideRestaurantOrSalon()) { getData()->inventoryItem = kItemNone; @@ -1960,7 +1960,7 @@ IMPLEMENT_FUNCTION(38, August, function38) break; case kActionNone: - TIME_CHECK_SAVEPOINT(kTime1801800, params->param1, kEntityAugust, kEntityRebecca, kAction155980128); + Entity::timeCheckSavepoint(kTime1801800, params->param1, kEntityAugust, kEntityRebecca, kAction155980128); TIME_CHECK_CALLBACK(kTime1820700, params->param2, 3, setup_callbackActionRestaurantOrSalon); break; @@ -2210,7 +2210,7 @@ IMPLEMENT_FUNCTION(43, August, chapter3Handler) break; case kActionNone: - TIME_CHECK_SAVEPOINT(kTime1953000, params->param2, kEntityAugust, kEntityAnna, kAction291662081); + Entity::timeCheckSavepoint(kTime1953000, params->param2, kEntityAugust, kEntityAnna, kAction291662081); // Set as same position as Anna if (params->param1) { diff --git a/engines/lastexpress/entities/coudert.cpp b/engines/lastexpress/entities/coudert.cpp index eea9dda718..77cddddf48 100644 --- a/engines/lastexpress/entities/coudert.cpp +++ b/engines/lastexpress/entities/coudert.cpp @@ -2285,9 +2285,9 @@ label_callback_10: if (!ENTITY_PARAM(0, 2)) break; - TIME_CHECK_OBJECT(kTime1107000, params->param4, kObject111, kObjectLocation2); - TIME_CHECK_OBJECT(kTime1161000, params->param5, kObject111, kObjectLocation3); - TIME_CHECK_OBJECT(kTime1206000, params->param6, kObject111, kObjectLocation4); + timeCheckObject(kTime1107000, params->param4, kObject111, kObjectLocation2); + timeCheckObject(kTime1161000, params->param5, kObject111, kObjectLocation3); + timeCheckObject(kTime1206000, params->param6, kObject111, kObjectLocation4); break; case kAction1: @@ -2835,9 +2835,9 @@ label_callback_18: 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_PARAM(1, 1), kObject111, kObjectLocation9); + timeCheckObject(kTime2025000, params->param7, kObject111, kObjectLocation7); + timeCheckObject(kTime2133000, params->param8, kObject111, kObjectLocation8); + timeCheckObject(kTime2173500, CURRENT_PARAM(1, 1), kObject111, kObjectLocation9); } break; diff --git a/engines/lastexpress/entities/entity.cpp b/engines/lastexpress/entities/entity.cpp index a412dc9b65..743adc3201 100644 --- a/engines/lastexpress/entities/entity.cpp +++ b/engines/lastexpress/entities/entity.cpp @@ -29,6 +29,7 @@ #include "lastexpress/game/action.h" #include "lastexpress/game/entities.h" #include "lastexpress/game/logic.h" +#include "lastexpress/game/object.h" #include "lastexpress/game/scenes.h" #include "lastexpress/game/state.h" #include "lastexpress/game/savegame.h" @@ -592,4 +593,22 @@ void Entity::callbackAction() { getSavePoints()->call(_entityIndex, _entityIndex, kActionCallback); } +////////////////////////////////////////////////////////////////////////// +// Helper functions +////////////////////////////////////////////////////////////////////////// + +void Entity::timeCheckSavepoint(TimeValue timeValue, uint ¶meter, EntityIndex entity1, EntityIndex entity2, ActionIndex action) { + if (getState()->time > timeValue && !parameter) { + parameter = 1; + getSavePoints()->push(entity1, entity2, action); + } +} + +void Entity::timeCheckObject(TimeValue timeValue, uint ¶meter, ObjectIndex object, ObjectLocation location) { + if (getState()->time > timeValue && !parameter) { + parameter = 1; + getObjects()->updateLocation2(object, location); + } +} + } // End of namespace LastExpress diff --git a/engines/lastexpress/entities/entity.h b/engines/lastexpress/entities/entity.h index 01a19553ec..f29d78e181 100644 --- a/engines/lastexpress/entities/entity.h +++ b/engines/lastexpress/entities/entity.h @@ -845,6 +845,13 @@ protected: * Store the current callback information and perform the callback action */ void callbackAction(); + + ////////////////////////////////////////////////////////////////////////// + // Helper functions + ////////////////////////////////////////////////////////////////////////// + + void timeCheckSavepoint(TimeValue timeValue, uint ¶meter, EntityIndex entity1, EntityIndex entity2, ActionIndex action); + void timeCheckObject(TimeValue timeValue, uint ¶meter, ObjectIndex index, ObjectLocation location); }; diff --git a/engines/lastexpress/entities/entity_intern.h b/engines/lastexpress/entities/entity_intern.h index c622ff9f0e..64814a1b40 100644 --- a/engines/lastexpress/entities/entity_intern.h +++ b/engines/lastexpress/entities/entity_intern.h @@ -326,12 +326,6 @@ void class::setup_##name() { \ break; \ } -#define TIME_CHECK_SAVEPOINT(timeValue, parameter, entity1, entity2, action) \ - if (getState()->time > timeValue && !parameter) { \ - parameter = 1; \ - getSavePoints()->push(entity1, entity2, action); \ - } - #define TIME_CHECK_CALLBACK(timeValue, parameter, callback, function) \ if (getState()->time > timeValue && !parameter) { \ parameter = 1; \ @@ -366,11 +360,11 @@ void class::setup_##name() { \ #define TIME_CHECK_CALLBACK_INVENTORY(timeValue, parameter, callback, function) \ if (getState()->time > timeValue && !parameter) { \ - parameter = 1; \ - getData()->inventoryItem = kItemNone; \ - setCallback(callback); \ - function(); \ - break; \ + parameter = 1; \ + getData()->inventoryItem = kItemNone; \ + setCallback(callback); \ + function(); \ + break; \ } #define TIME_CHECK_CALLBACK_ACTION(timeValue, parameter) \ @@ -389,12 +383,6 @@ void class::setup_##name() { \ break; \ } -#define TIME_CHECK_OBJECT(timeValue, parameter, object, location) \ - if (getState()->time > timeValue && !parameter) { \ - parameter = 1; \ - getObjects()->updateLocation2(object, location); \ - } - #define TIME_CHECK_CAR(timeValue, parameter, callback, function) {\ if ((getState()->time <= timeValue && !getEntities()->isPlayerInCar(kCarGreenSleeping)) || !parameter) \ parameter = (uint)getState()->time + 75; \ diff --git a/engines/lastexpress/entities/kahina.cpp b/engines/lastexpress/entities/kahina.cpp index 0c4045097a..6bb2e6b90a 100644 --- a/engines/lastexpress/entities/kahina.cpp +++ b/engines/lastexpress/entities/kahina.cpp @@ -267,7 +267,7 @@ IMPLEMENT_FUNCTION(11, Kahina, chapter1Handler) return; if (getProgress().jacket != kJacketOriginal) - TIME_CHECK_SAVEPOINT(kTime1107000, params->param1, kEntityKahina, kEntityMertens, kAction238732837); + Entity::timeCheckSavepoint(kTime1107000, params->param1, kEntityKahina, kEntityMertens, kAction238732837); if (getProgress().eventMertensKronosInvitation) setup_function12(); diff --git a/engines/lastexpress/entities/mertens.cpp b/engines/lastexpress/entities/mertens.cpp index 517ff76362..328c8e88d8 100644 --- a/engines/lastexpress/entities/mertens.cpp +++ b/engines/lastexpress/entities/mertens.cpp @@ -2993,7 +2993,7 @@ IMPLEMENT_FUNCTION(42, Mertens, function42) getData()->inventoryItem = kItemInvalid; if (!params->param2) { - TIME_CHECK_SAVEPOINT(kTime1125000, params->param3, kEntityMertens, kEntityMahmud, kAction170483072); + Entity::timeCheckSavepoint(kTime1125000, params->param3, kEntityMertens, kEntityMahmud, kAction170483072); if (params->param4 != kTimeInvalid && getState()->time > kTimeCityChalons) { diff --git a/engines/lastexpress/entities/milos.cpp b/engines/lastexpress/entities/milos.cpp index 21f3b06896..c33a8b887e 100644 --- a/engines/lastexpress/entities/milos.cpp +++ b/engines/lastexpress/entities/milos.cpp @@ -720,7 +720,7 @@ IMPLEMENT_FUNCTION(15, Milos, chapter1Handler) break; case kActionNone: - TIME_CHECK_SAVEPOINT(kTime1071000, params->param3, kEntityMilos, kEntityServers1, kAction223002560); + Entity::timeCheckSavepoint(kTime1071000, params->param3, kEntityMilos, kEntityServers1, kAction223002560); if (getState()->time > kTime1089000 && getEntities()->isSomebodyInsideRestaurantOrSalon()) { setup_function16(); @@ -1534,7 +1534,7 @@ IMPLEMENT_FUNCTION(29, Milos, chapter4Handler) TIME_CHECK_PLAYSOUND_MILOS(kTime2370600, params->param5, "Mil4015"); - TIME_CHECK_SAVEPOINT(kTime2407500, params->param6, kEntityMilos, kEntityVesna, kAction55996766); + Entity::timeCheckSavepoint(kTime2407500, params->param6, kEntityMilos, kEntityVesna, kAction55996766); break; case kActionCallback: diff --git a/engines/lastexpress/entities/rebecca.cpp b/engines/lastexpress/entities/rebecca.cpp index 4f7be385ce..3ef266994f 100644 --- a/engines/lastexpress/entities/rebecca.cpp +++ b/engines/lastexpress/entities/rebecca.cpp @@ -841,7 +841,7 @@ IMPLEMENT_FUNCTION(24, Rebecca, function24) break; case kActionNone: - TIME_CHECK_SAVEPOINT(kTime1134000, params->param2, kEntityRebecca, kEntityServers0, kAction223712416); + Entity::timeCheckSavepoint(kTime1134000, params->param2, kEntityRebecca, kEntityServers0, kAction223712416); if (!params->param1) break; diff --git a/engines/lastexpress/entities/tatiana.cpp b/engines/lastexpress/entities/tatiana.cpp index 3b9cc6d322..b15a0a18b2 100644 --- a/engines/lastexpress/entities/tatiana.cpp +++ b/engines/lastexpress/entities/tatiana.cpp @@ -440,7 +440,7 @@ IMPLEMENT_FUNCTION(19, Tatiana, chapter1Handler) } label_tatiana_chapter1_2: - TIME_CHECK_SAVEPOINT(kTime1084500, params->param7, kEntityTatiana, kEntityPascale, kAction257489762); + Entity::timeCheckSavepoint(kTime1084500, params->param7, kEntityTatiana, kEntityPascale, kAction257489762); if (params->param1) { UPDATE_PARAM(params->param8, getState()->timeTicks, 90); |