[Scummvm-cvs-logs] scummvm master -> 3d6807b35905a951688508d3b696ee48c1453c4d

Littleboy littleboy22 at gmail.com
Fri Jul 27 06:17:13 CEST 2012


This automated email contains information about 20 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
2c4518d615 LASTEXPRESS: Move some macros to entity.h
5d4a8f1e15 LASTEXPRESS: Remove use of function wrappers in shared entity functions
c589e69ec9 LASTEXPRESS: Replace TIME_CHECK_CALLBACK_ACTION macro
2e20e1d1e2 LASTEXPRESS: Replace TIME_CHECK_PLAYSOUND_UPDATEPOSITION macro
95503250f8 LASTEXPRESS: Replace UPDATE_PARAM macro
e13290a028 LASTEXPRESS: Replace UPDATE_PARAM_CHECK macro
8de4cb6547 LASTEXPRESS: Replace UPDATE_PARAM_PROC and UPDATE_PARAM_PROC_TIME macros
82ad017a8e LASTEXPRESS: Replace UPDATE_PARAM_GOTO macro
e985f7374f LASTEXPRESS: Move Entity function declaration macros to entity.h
8545991739 LASTEXPRESS: Remove several TIME_CHECK* macros
552e8d45b2 LASTEXPRESS: Switch some warnings to debug console output
7974b62b71 LASTEXPRESS: Reduce nesting in Entities::processEntity()
7450ae23fb LASTEXPRESS: Move RESET_ENTITY_STATE macro to entity.h
37770212c0 LASTEXPRESS: Remove TIME_CHECK_CALLBACK_2 macro
b6b98483c5 LASTEXPRESS: Remove TIME_CHECK_CALLBACK_3 macro
938961e237 LASTEXPRESS: Remove TIME_CHECK_CALLBACK_1 macro
813c2bb965 LASTEXPRESS: Merge the remaining macros in entity_intern.h into entity.h
2d6f799235 LASTEXPRESS: Cleanup unused arguments from BEGIN_SETUP macro
b4b4a7d127 LASTEXPRESS: Replace setup macros by functions
3d6807b359 LASTEXPRESS: Implement Logic::resetState()


Commit: 2c4518d6154a0ae9772fe19a629f05c750ab19c8
    https://github.com/scummvm/scummvm/commit/2c4518d6154a0ae9772fe19a629f05c750ab19c8
Author: Julien (julien at powerinbox.com)
Date: 2012-07-26T21:14:54-07:00

Commit Message:
LASTEXPRESS: Move some macros to entity.h

Changed paths:
    engines/lastexpress/entities/entity.h
    engines/lastexpress/entities/entity_intern.h



diff --git a/engines/lastexpress/entities/entity.h b/engines/lastexpress/entities/entity.h
index 5ba78ab..7ff574d 100644
--- a/engines/lastexpress/entities/entity.h
+++ b/engines/lastexpress/entities/entity.h
@@ -41,6 +41,29 @@ class Sequence;
 class SequenceFrame;
 struct SavePoint;
 
+
+//////////////////////////////////////////////////////////////////////////
+// Callbacks
+#define ENTITY_CALLBACK(class, name, pointer) \
+	Common::Functor1Mem<const SavePoint&, void, class>(pointer, &class::name)
+
+#define ADD_CALLBACK_FUNCTION(class, name) \
+	_callbacks.push_back(new ENTITY_CALLBACK(class, name, this));
+
+#define ADD_NULL_FUNCTION() \
+	_callbacks.push_back(new ENTITY_CALLBACK(Entity, nullfunction, this));
+
+//////////////////////////////////////////////////////////////////////////
+// Parameters macros
+//////////////////////////////////////////////////////////////////////////
+#define CURRENT_PARAM(index, id) \
+	((EntityData::EntityParametersIIII*)_data->getCurrentParameters(index))->param##id
+
+#define ENTITY_PARAM(index, id) \
+	((EntityData::EntityParametersIIII*)_data->getParameters(8, index))->param##id
+
+
+
 class EntityData : Common::Serializable {
 public:
 
diff --git a/engines/lastexpress/entities/entity_intern.h b/engines/lastexpress/entities/entity_intern.h
index 64814a1..5767656 100644
--- a/engines/lastexpress/entities/entity_intern.h
+++ b/engines/lastexpress/entities/entity_intern.h
@@ -26,17 +26,6 @@
 namespace LastExpress {
 
 //////////////////////////////////////////////////////////////////////////
-// Callbacks
-#define ENTITY_CALLBACK(class, name, pointer) \
-	Common::Functor1Mem<const SavePoint&, void, class>(pointer, &class::name)
-
-#define ADD_CALLBACK_FUNCTION(class, name) \
-	_callbacks.push_back(new ENTITY_CALLBACK(class, name, this));
-
-#define ADD_NULL_FUNCTION() \
-	_callbacks.push_back(new ENTITY_CALLBACK(Entity, nullfunction, this));
-
-//////////////////////////////////////////////////////////////////////////
 // Declaration
 //////////////////////////////////////////////////////////////////////////
 
@@ -308,15 +297,6 @@ void class::setup_##name() { \
 	((class *)getEntities()->get(entity))->function();
 
 //////////////////////////////////////////////////////////////////////////
-// Parameters macros (for default IIII parameters)
-//////////////////////////////////////////////////////////////////////////
-#define CURRENT_PARAM(index, id) \
-	((EntityData::EntityParametersIIII*)_data->getCurrentParameters(index))->param##id
-
-#define ENTITY_PARAM(index, id) \
-	((EntityData::EntityParametersIIII*)_data->getParameters(8, index))->param##id
-
-//////////////////////////////////////////////////////////////////////////
 // Time check macros
 //////////////////////////////////////////////////////////////////////////
 #define TIME_CHECK(timeValue, parameter, function) \


Commit: 5d4a8f1e15c9b90209cbd4572ef17552cc06d65c
    https://github.com/scummvm/scummvm/commit/5d4a8f1e15c9b90209cbd4572ef17552cc06d65c
Author: Julien (julien at powerinbox.com)
Date: 2012-07-26T21:14:54-07:00

Commit Message:
LASTEXPRESS: Remove use of function wrappers in shared entity functions

Changed paths:
    engines/lastexpress/entities/alouan.cpp
    engines/lastexpress/entities/coudert.cpp
    engines/lastexpress/entities/entity.cpp
    engines/lastexpress/entities/entity.h
    engines/lastexpress/entities/hadija.cpp
    engines/lastexpress/entities/mertens.cpp



diff --git a/engines/lastexpress/entities/alouan.cpp b/engines/lastexpress/entities/alouan.cpp
index 8e56ae4..589b712 100644
--- a/engines/lastexpress/entities/alouan.cpp
+++ b/engines/lastexpress/entities/alouan.cpp
@@ -86,22 +86,22 @@ IMPLEMENT_FUNCTION_END
 
 //////////////////////////////////////////////////////////////////////////
 IMPLEMENT_FUNCTION(6, Alouan, compartment6)
-	Entity::goToCompartment(savepoint, kObjectCompartment6, kPosition_4070, "621Cf", "621Df", WRAP_ENTER_FUNCTION(Alouan, setup_enterExitCompartment));
+	Entity::goToCompartment(savepoint, kObjectCompartment6, kPosition_4070, "621Cf", "621Df");
 IMPLEMENT_FUNCTION_END
 
 //////////////////////////////////////////////////////////////////////////
 IMPLEMENT_FUNCTION(7, Alouan, compartment8)
-	Entity::goToCompartment(savepoint, kObjectCompartment8, kPosition_2740, "621Ch", "621Dh", WRAP_ENTER_FUNCTION(Alouan, setup_enterExitCompartment));
+	Entity::goToCompartment(savepoint, kObjectCompartment8, kPosition_2740, "621Ch", "621Dh");
 IMPLEMENT_FUNCTION_END
 
 //////////////////////////////////////////////////////////////////////////
 IMPLEMENT_FUNCTION(8, Alouan, compartment6to8)
-	Entity::goToCompartmentFromCompartment(savepoint, kObjectCompartment6, kPosition_4070, "621Bf", kObjectCompartment8, kPosition_2740, "621Ah", WRAP_ENTER_FUNCTION(Alouan, setup_enterExitCompartment), WRAP_UPDATE_FUNCTION(Alouan, setup_updateEntity));
+	Entity::goToCompartmentFromCompartment(savepoint, kObjectCompartment6, kPosition_4070, "621Bf", kObjectCompartment8, kPosition_2740, "621Ah");
 IMPLEMENT_FUNCTION_END
 
 //////////////////////////////////////////////////////////////////////////
 IMPLEMENT_FUNCTION(9, Alouan, compartment8to6)
-	Entity::goToCompartmentFromCompartment(savepoint, kObjectCompartment8, kPosition_2740, "621Bh", kObjectCompartment6, kPosition_4070, "621Af", WRAP_ENTER_FUNCTION(Alouan, setup_enterExitCompartment), WRAP_UPDATE_FUNCTION(Alouan, setup_updateEntity));
+	Entity::goToCompartmentFromCompartment(savepoint, kObjectCompartment8, kPosition_2740, "621Bh", kObjectCompartment6, kPosition_4070, "621Af");
 IMPLEMENT_FUNCTION_END
 
 //////////////////////////////////////////////////////////////////////////
diff --git a/engines/lastexpress/entities/coudert.cpp b/engines/lastexpress/entities/coudert.cpp
index 77cdddd..e79d4cd 100644
--- a/engines/lastexpress/entities/coudert.cpp
+++ b/engines/lastexpress/entities/coudert.cpp
@@ -115,7 +115,7 @@ IMPLEMENT_FUNCTION_S(2, Coudert, bloodJacket)
 		break;
 
 	case kActionNone:
-		Entity::savegameBloodJacket(WRAP_SAVE_FUNCTION(Coudert, setup_savegame));
+		Entity::savegameBloodJacket();
 		break;
 
 	case kActionExitCompartment:
@@ -142,7 +142,7 @@ IMPLEMENT_FUNCTION_SI(3, Coudert, enterExitCompartment, ObjectIndex)
 		break;
 
 	case kActionNone:
-		Entity::savegameBloodJacket(WRAP_SAVE_FUNCTION(Coudert, setup_savegame));
+		Entity::savegameBloodJacket();
 		return;
 
 	case kActionCallback:
@@ -168,7 +168,7 @@ IMPLEMENT_FUNCTION(4, Coudert, callbackActionOnDirection)
 			break;
 		}
 
-		Entity::savegameBloodJacket(WRAP_SAVE_FUNCTION(Coudert, setup_savegame));
+		Entity::savegameBloodJacket();
 		break;
 
 	case kActionExitCompartment:
@@ -191,7 +191,7 @@ IMPLEMENT_FUNCTION_SIII(5, Coudert, enterExitCompartment2, ObjectIndex, EntityPo
 		break;
 
 	case kActionNone:
-		Entity::savegameBloodJacket(WRAP_SAVE_FUNCTION(Coudert, setup_savegame));
+		Entity::savegameBloodJacket();
 		return;
 
 	case kActionCallback:
@@ -212,7 +212,7 @@ IMPLEMENT_FUNCTION_S(6, Coudert, playSound)
 		break;
 
 	case kActionNone:
-		Entity::savegameBloodJacket(WRAP_SAVE_FUNCTION(Coudert, setup_savegame));
+		Entity::savegameBloodJacket();
 		break;
 
 	case kActionEndSound:
@@ -241,7 +241,7 @@ IMPLEMENT_FUNCTION_NOSETUP(7, Coudert, playSound16)
 		break;
 
 	case kActionNone:
-		Entity::savegameBloodJacket(WRAP_SAVE_FUNCTION(Coudert, setup_savegame));
+		Entity::savegameBloodJacket();
 		break;
 
 	case kActionEndSound:
@@ -354,7 +354,7 @@ IMPLEMENT_FUNCTION_I(10, Coudert, updateFromTime, uint32)
 		break;
 
 	case kActionNone:
-		Entity::savegameBloodJacket(WRAP_SAVE_FUNCTION(Coudert, setup_savegame));
+		Entity::savegameBloodJacket();
 
 		UPDATE_PARAM(params->param2, getState()->time, params->param1);
 
@@ -377,7 +377,7 @@ IMPLEMENT_FUNCTION_I(11, Coudert, updateFromTicks, uint32)
 		break;
 
 	case kActionNone:
-		Entity::savegameBloodJacket(WRAP_SAVE_FUNCTION(Coudert, setup_savegame));
+		Entity::savegameBloodJacket();
 
 		UPDATE_PARAM(params->param2, getState()->timeTicks, params->param1);
 
@@ -451,7 +451,7 @@ IMPLEMENT_FUNCTION_II(13, Coudert, function13, bool, EntityIndex)
 		break;
 
 	case kActionNone:
-		Entity::savegameBloodJacket(WRAP_SAVE_FUNCTION(Coudert, setup_savegame));
+		Entity::savegameBloodJacket();
 
 		if (!params->param2 && !params->param3) {
 
@@ -573,7 +573,7 @@ IMPLEMENT_FUNCTION_I(14, Coudert, function14, EntityIndex)
 		break;
 
 	case kActionNone:
-		Entity::savegameBloodJacket(WRAP_SAVE_FUNCTION(Coudert, setup_savegame));
+		Entity::savegameBloodJacket();
 		break;
 
 	case kActionDefault:
diff --git a/engines/lastexpress/entities/entity.cpp b/engines/lastexpress/entities/entity.cpp
index 1ad6d08..4c661a4 100644
--- a/engines/lastexpress/entities/entity.cpp
+++ b/engines/lastexpress/entities/entity.cpp
@@ -254,7 +254,7 @@ void Entity::savegame(const SavePoint &savepoint) {
 	}
 }
 
-void Entity::savegameBloodJacket(SaveFunction *saveFunction) {
+void Entity::savegameBloodJacket() {
 	if (getProgress().jacket == kJacketBlood
 	 && getEntities()->isDistanceBetweenEntities(_entityIndex, kEntityPlayer, 1000)
 	 && !getEntities()->isInsideCompartments(kEntityPlayer)
@@ -266,11 +266,11 @@ void Entity::savegameBloodJacket(SaveFunction *saveFunction) {
 			break;
 
 		case kEntityCoudert:
-			(*saveFunction)(kSavegameTypeEvent, kEventCoudertBloodJacket);
+			setup_savegame(kSavegameTypeEvent, kEventCoudertBloodJacket);
 			break;
 
 		case kEntityMertens:
-			(*saveFunction)(kSavegameTypeEvent, kEventCoudertBloodJacket);
+			setup_savegame(kSavegameTypeEvent, kEventCoudertBloodJacket);
 			break;
 		}
 	}
@@ -488,7 +488,7 @@ void Entity::enterExitCompartment(const SavePoint &savepoint, EntityPosition pos
 	}
 }
 
-void Entity::goToCompartment(const SavePoint &savepoint, ObjectIndex compartmentFrom, EntityPosition positionFrom, Common::String sequenceFrom, Common::String sequenceTo, Entity::EnterFunction *enterFunction) {
+void Entity::goToCompartment(const SavePoint &savepoint, ObjectIndex compartmentFrom, EntityPosition positionFrom, Common::String sequenceFrom, Common::String sequenceTo) {
 	switch (savepoint.action) {
 	default:
 		break;
@@ -496,7 +496,7 @@ void Entity::goToCompartment(const SavePoint &savepoint, ObjectIndex compartment
 	case kActionDefault:
 		getData()->entityPosition = positionFrom;
 		setCallback(1);
-		(*enterFunction)(sequenceFrom.c_str(), compartmentFrom);
+		setup_enterExitCompartment(sequenceFrom.c_str(), compartmentFrom);
 		break;
 
 	case kActionCallback:
@@ -506,7 +506,7 @@ void Entity::goToCompartment(const SavePoint &savepoint, ObjectIndex compartment
 
 		case 1:
 			setCallback(2);
-			(*enterFunction)(sequenceTo.c_str(), compartmentFrom);
+			setup_enterExitCompartment(sequenceTo.c_str(), compartmentFrom);
 			break;
 
 		case 2:
@@ -519,7 +519,7 @@ void Entity::goToCompartment(const SavePoint &savepoint, ObjectIndex compartment
 	}
 }
 
-void Entity::goToCompartmentFromCompartment(const SavePoint &savepoint, ObjectIndex compartmentFrom, EntityPosition positionFrom, Common::String sequenceFrom, ObjectIndex compartmentTo, EntityPosition positionTo, Common::String sequenceTo, Entity::EnterFunction *enterFunction, Entity::UpdateFunction *updateFunction) {
+void Entity::goToCompartmentFromCompartment(const SavePoint &savepoint, ObjectIndex compartmentFrom, EntityPosition positionFrom, Common::String sequenceFrom, ObjectIndex compartmentTo, EntityPosition positionTo, Common::String sequenceTo) {
 	switch (savepoint.action) {
 	default:
 		break;
@@ -528,7 +528,7 @@ void Entity::goToCompartmentFromCompartment(const SavePoint &savepoint, ObjectIn
 		getData()->entityPosition = positionFrom;
 		getData()->location = kLocationOutsideCompartment;
 		setCallback(1);
-		(*enterFunction)(sequenceFrom.c_str(), compartmentFrom);
+		setup_enterExitCompartment(sequenceFrom.c_str(), compartmentFrom);
 		break;
 
 	case kActionCallback:
@@ -538,12 +538,12 @@ void Entity::goToCompartmentFromCompartment(const SavePoint &savepoint, ObjectIn
 
 		case 1:
 			setCallback(2);
-			(*updateFunction)(kCarGreenSleeping, positionTo);
+			setup_updateEntity(kCarGreenSleeping, positionTo);
 			break;
 
 		case 2:
 			setCallback(3);
-			(*enterFunction)(sequenceTo.c_str(), compartmentTo);
+			setup_enterExitCompartment(sequenceTo.c_str(), compartmentTo);
 			break;
 
 		case 3:
diff --git a/engines/lastexpress/entities/entity.h b/engines/lastexpress/entities/entity.h
index 7ff574d..77c3793 100644
--- a/engines/lastexpress/entities/entity.h
+++ b/engines/lastexpress/entities/entity.h
@@ -689,6 +689,11 @@ public:
 	virtual void setup_chapter4() = 0;
 	virtual void setup_chapter5() = 0;
 
+	// Shared functions
+	virtual void setup_savegame(SavegameType, uint32) { error("[Entity::setup_savegame] Trying to call the parent setup function. Use the specific entity function directly"); }
+	virtual void setup_enterExitCompartment(const char *, ObjectIndex) { error("[Entity::setup_enterExitCompartment] Trying to call the parent setup function. Use the specific entity function directly"); }
+	virtual void setup_updateEntity(CarIndex, EntityPosition) { error("[Entity::setup_updateEntity] Trying to call the parent setup function. Use the specific entity function directly"); }
+
 	// Serializable
 	void saveLoadWithSerializer(Common::Serializer &ser) { _data->saveLoadWithSerializer(ser); }
 
@@ -701,14 +706,6 @@ protected:
 	EntityData                *_data;
 	Common::Array<Callback *>  _callbacks;
 
-	typedef Common::Functor2<const char *, ObjectIndex, void> EnterFunction;
-	typedef Common::Functor2<CarIndex, EntityPosition, void> UpdateFunction;
-	typedef Common::Functor2<SavegameType, uint32, void> SaveFunction;
-
-	#define WRAP_ENTER_FUNCTION(className, method) new Common::Functor2Mem<const char *, ObjectIndex, void, className>(this, &className::method)
-	#define WRAP_UPDATE_FUNCTION(className, method) new Common::Functor2Mem<CarIndex, EntityPosition, void, className>(this, &className::method)
-	#define WRAP_SAVE_FUNCTION(className, method) new Common::Functor2Mem<SavegameType, uint32, void, className>(this, &className::method)
-
 	/**
 	 * Saves the game
 	 *
@@ -723,7 +720,7 @@ protected:
 	 *
 	 * @param	saveFunction	The setup function to call to save the game
 	 */
-	void savegameBloodJacket(SaveFunction *saveFunction);
+	void savegameBloodJacket();
 
 	/**
 	 * Play sound
@@ -836,9 +833,8 @@ protected:
 	 * @param	positionFrom		 	The position from.
 	 * @param	sequenceFrom		 	The sequence from.
 	 * @param	sequenceTo			 	The sequence to.
-	 * @param	enterFunction			The enter/exit compartment function.
 	 */
-	void goToCompartment(const SavePoint &savepoint, ObjectIndex compartmentFrom, EntityPosition positionFrom, Common::String sequenceFrom, Common::String sequenceTo, EnterFunction *enterFunction);
+	void goToCompartment(const SavePoint &savepoint, ObjectIndex compartmentFrom, EntityPosition positionFrom, Common::String sequenceFrom, Common::String sequenceTo);
 
 	/**
 	 * Go to compartment from compartment.
@@ -850,10 +846,8 @@ protected:
 	 * @param	compartmentTo		  	The compartment to.
 	 * @param	positionTo			  	The position to.
 	 * @param	sequenceTo			  	The sequence to.
-	 * @param	enterFunction			The enter/exit compartment function.
-	 * @param	updateFunction			The update entity function.
 	 */
-	void goToCompartmentFromCompartment(const SavePoint &savepoint, ObjectIndex compartmentFrom, EntityPosition positionFrom, Common::String sequenceFrom, ObjectIndex compartmentTo, EntityPosition positionTo, Common::String sequenceTo, Entity::EnterFunction *enterFunction, Entity::UpdateFunction *updateFunction);
+	void goToCompartmentFromCompartment(const SavePoint &savepoint, ObjectIndex compartmentFrom, EntityPosition positionFrom, Common::String sequenceFrom, ObjectIndex compartmentTo, EntityPosition positionTo, Common::String sequenceTo);
 
 	/**
 	 * Updates the position
diff --git a/engines/lastexpress/entities/hadija.cpp b/engines/lastexpress/entities/hadija.cpp
index 2dd239d..8d757d5 100644
--- a/engines/lastexpress/entities/hadija.cpp
+++ b/engines/lastexpress/entities/hadija.cpp
@@ -86,22 +86,22 @@ IMPLEMENT_FUNCTION_END
 
 //////////////////////////////////////////////////////////////////////////
 IMPLEMENT_FUNCTION(6, Hadija, compartment6)
-	Entity::goToCompartment(savepoint, kObjectCompartment6, kPosition_4070, "619Cf", "619Df", WRAP_ENTER_FUNCTION(Hadija, setup_enterExitCompartment));
+	Entity::goToCompartment(savepoint, kObjectCompartment6, kPosition_4070, "619Cf", "619Df");
 IMPLEMENT_FUNCTION_END
 
 //////////////////////////////////////////////////////////////////////////
 IMPLEMENT_FUNCTION(7, Hadija, compartment8)
-	Entity::goToCompartment(savepoint, kObjectCompartment8, kPosition_2740, "619Ch", "619Dh", WRAP_ENTER_FUNCTION(Hadija, setup_enterExitCompartment));
+	Entity::goToCompartment(savepoint, kObjectCompartment8, kPosition_2740, "619Ch", "619Dh");
 IMPLEMENT_FUNCTION_END
 
 //////////////////////////////////////////////////////////////////////////
 IMPLEMENT_FUNCTION(8, Hadija, compartment6to8)
-	Entity::goToCompartmentFromCompartment(savepoint, kObjectCompartment6, kPosition_4070, "619Bf", kObjectCompartment8, kPosition_2740, "619Ah", WRAP_ENTER_FUNCTION(Hadija, setup_enterExitCompartment), WRAP_UPDATE_FUNCTION(Hadija, setup_updateEntity));
+	Entity::goToCompartmentFromCompartment(savepoint, kObjectCompartment6, kPosition_4070, "619Bf", kObjectCompartment8, kPosition_2740, "619Ah");
 IMPLEMENT_FUNCTION_END
 
 //////////////////////////////////////////////////////////////////////////
 IMPLEMENT_FUNCTION(9, Hadija, compartment8to6)
-	Entity::goToCompartmentFromCompartment(savepoint, kObjectCompartment8, kPosition_2740, "619Bh", kObjectCompartment6, kPosition_4070, "619Af", WRAP_ENTER_FUNCTION(Hadija, setup_enterExitCompartment), WRAP_UPDATE_FUNCTION(Hadija, setup_updateEntity));
+	Entity::goToCompartmentFromCompartment(savepoint, kObjectCompartment8, kPosition_2740, "619Bh", kObjectCompartment6, kPosition_4070, "619Af");
 IMPLEMENT_FUNCTION_END
 
 //////////////////////////////////////////////////////////////////////////
diff --git a/engines/lastexpress/entities/mertens.cpp b/engines/lastexpress/entities/mertens.cpp
index 328c8e8..37e7bf5 100644
--- a/engines/lastexpress/entities/mertens.cpp
+++ b/engines/lastexpress/entities/mertens.cpp
@@ -107,7 +107,7 @@ IMPLEMENT_FUNCTION_S(2, Mertens, bloodJacket)
 		break;
 
 	case kActionNone:
-		Entity::savegameBloodJacket(WRAP_SAVE_FUNCTION(Mertens, setup_savegame));
+		Entity::savegameBloodJacket();
 		break;
 
 	case kActionExitCompartment:
@@ -134,7 +134,7 @@ IMPLEMENT_FUNCTION_SI(3, Mertens, enterExitCompartment, ObjectIndex)
 		break;
 
 	case kActionNone:
-		Entity::savegameBloodJacket(WRAP_SAVE_FUNCTION(Mertens, setup_savegame));
+		Entity::savegameBloodJacket();
 		return;
 
 	case kActionCallback:
@@ -155,7 +155,7 @@ IMPLEMENT_FUNCTION_SI(4, Mertens, enterExitCompartment2, ObjectIndex)
 		break;
 
 	case kActionNone:
-		Entity::savegameBloodJacket(WRAP_SAVE_FUNCTION(Mertens, setup_savegame));
+		Entity::savegameBloodJacket();
 		return;
 
 	case kAction4:
@@ -181,7 +181,7 @@ IMPLEMENT_FUNCTION_SIII(5, Mertens, enterExitCompartment3, ObjectIndex, EntityPo
 		break;
 
 	case kActionNone:
-		Entity::savegameBloodJacket(WRAP_SAVE_FUNCTION(Mertens, setup_savegame));
+		Entity::savegameBloodJacket();
 		break;
 
 	case kActionExitCompartment:
@@ -223,7 +223,7 @@ IMPLEMENT_FUNCTION(6, Mertens, callbackActionOnDirection)
 			break;
 		}
 
-		Entity::savegameBloodJacket(WRAP_SAVE_FUNCTION(Mertens, setup_savegame));
+		Entity::savegameBloodJacket();
 		break;
 
 	case kActionExitCompartment:
@@ -246,7 +246,7 @@ IMPLEMENT_FUNCTION_S(7, Mertens, playSound)
 		break;
 
 	case kActionNone:
-		Entity::savegameBloodJacket(WRAP_SAVE_FUNCTION(Mertens, setup_savegame));
+		Entity::savegameBloodJacket();
 		break;
 
 	case kActionEndSound:
@@ -273,7 +273,7 @@ IMPLEMENT_FUNCTION_S(8, Mertens, playSound16)
 		break;
 
 	case kActionNone:
-		Entity::savegameBloodJacket(WRAP_SAVE_FUNCTION(Mertens, setup_savegame));
+		Entity::savegameBloodJacket();
 		break;
 
 	case kActionEndSound:
@@ -462,7 +462,7 @@ IMPLEMENT_FUNCTION_I(11, Mertens, function11, uint32)
 		break;
 
 	case kActionNone:
-		Entity::savegameBloodJacket(WRAP_SAVE_FUNCTION(Mertens, setup_savegame));
+		Entity::savegameBloodJacket();
 
 		UPDATE_PARAM(params->param2, getState()->time, params->param1)
 
@@ -530,7 +530,7 @@ IMPLEMENT_FUNCTION_II(13, Mertens, function13, bool, bool)
 		break;
 
 	case kActionNone:
-		Entity::savegameBloodJacket(WRAP_SAVE_FUNCTION(Mertens, setup_savegame));
+		Entity::savegameBloodJacket();
 
 		if (!params->param2 && !params->param3) {
 			UPDATE_PARAM_PROC(params->param4, getState()->timeTicks, 75)
@@ -652,7 +652,7 @@ IMPLEMENT_FUNCTION_I(14, Mertens, function14, EntityIndex)
 		break;
 
 	case kActionNone:
-		Entity::savegameBloodJacket(WRAP_SAVE_FUNCTION(Mertens, setup_savegame));
+		Entity::savegameBloodJacket();
 		break;
 
 	case kActionDefault:


Commit: c589e69ec9f29e59fc4358e5045fcc613f9ab6a8
    https://github.com/scummvm/scummvm/commit/c589e69ec9f29e59fc4358e5045fcc613f9ab6a8
Author: Julien (julien at powerinbox.com)
Date: 2012-07-26T21:14:55-07:00

Commit Message:
LASTEXPRESS: Replace TIME_CHECK_CALLBACK_ACTION macro

Changed paths:
    engines/lastexpress/entities/boutarel.cpp
    engines/lastexpress/entities/entity.cpp
    engines/lastexpress/entities/entity.h
    engines/lastexpress/entities/entity_intern.h
    engines/lastexpress/entities/gendarmes.cpp



diff --git a/engines/lastexpress/entities/boutarel.cpp b/engines/lastexpress/entities/boutarel.cpp
index 95ec37b..ab5f019 100644
--- a/engines/lastexpress/entities/boutarel.cpp
+++ b/engines/lastexpress/entities/boutarel.cpp
@@ -476,7 +476,8 @@ IMPLEMENT_FUNCTION_IS(17, Boutarel, function17, TimeValue)
 		break;
 
 	case kActionNone:
-		TIME_CHECK_CALLBACK_ACTION(params->param1, params->param6);
+		if (Entity::timeCheckCallbackAction((TimeValue)params->param1, params->param6))
+			break;
 
 		if (params->param5) {
 			UPDATE_PARAM(params->param7, getState()->timeTicks, 90)
diff --git a/engines/lastexpress/entities/entity.cpp b/engines/lastexpress/entities/entity.cpp
index 4c661a4..9cb6825 100644
--- a/engines/lastexpress/entities/entity.cpp
+++ b/engines/lastexpress/entities/entity.cpp
@@ -611,4 +611,14 @@ void Entity::timeCheckObject(TimeValue timeValue, uint &parameter, ObjectIndex o
 	}
 }
 
+bool Entity::timeCheckCallbackAction(TimeValue timeValue, uint &parameter) {
+	if (getState()->time > timeValue && !parameter) {
+		parameter = 1;
+		callbackAction();
+		return true;
+	}
+
+	return false;
+}
+
 } // End of namespace LastExpress
diff --git a/engines/lastexpress/entities/entity.h b/engines/lastexpress/entities/entity.h
index 77c3793..fb5c958 100644
--- a/engines/lastexpress/entities/entity.h
+++ b/engines/lastexpress/entities/entity.h
@@ -871,6 +871,7 @@ protected:
 
 	void timeCheckSavepoint(TimeValue timeValue, uint &parameter, EntityIndex entity1, EntityIndex entity2, ActionIndex action);
 	void timeCheckObject(TimeValue timeValue, uint &parameter, ObjectIndex index, ObjectLocation location);
+	bool timeCheckCallbackAction(TimeValue timeValue, uint &parameter);
 };
 
 
diff --git a/engines/lastexpress/entities/entity_intern.h b/engines/lastexpress/entities/entity_intern.h
index 5767656..cb4f7b9 100644
--- a/engines/lastexpress/entities/entity_intern.h
+++ b/engines/lastexpress/entities/entity_intern.h
@@ -347,13 +347,6 @@ void class::setup_##name() { \
 		break; \
 	}
 
-#define TIME_CHECK_CALLBACK_ACTION(timeValue, parameter) \
-	if (getState()->time > timeValue && !parameter) { \
-		parameter = 1; \
-		callbackAction(); \
-		break; \
-	}
-
 #define TIME_CHECK_PLAYSOUND_UPDATEPOSITION(timeValue, parameter, callback, sound, position) \
 	if (getState()->time > timeValue && !parameter) { \
 		parameter = 1; \
diff --git a/engines/lastexpress/entities/gendarmes.cpp b/engines/lastexpress/entities/gendarmes.cpp
index 877c0c2..fe9f6f0 100644
--- a/engines/lastexpress/entities/gendarmes.cpp
+++ b/engines/lastexpress/entities/gendarmes.cpp
@@ -551,7 +551,8 @@ void Gendarmes::arrest(const SavePoint &savepoint, bool shouldPlaySound, SoundFl
 	case kActionNone:
 		if (checkCallback) {
 			EXPOSE_PARAMS(EntityData::EntityParametersIIII);
-			TIME_CHECK_CALLBACK_ACTION(params->param1, params->param2);
+			if (Entity::timeCheckCallbackAction((TimeValue)params->param1, params->param2))
+				break;
 		}
 
 		if (shouldUpdateEntity) {


Commit: 2e20e1d1e259dc6d9de8a90fa8417245f5a481b4
    https://github.com/scummvm/scummvm/commit/2e20e1d1e259dc6d9de8a90fa8417245f5a481b4
Author: Julien (julien at powerinbox.com)
Date: 2012-07-26T21:14:55-07:00

Commit Message:
LASTEXPRESS: Replace TIME_CHECK_PLAYSOUND_UPDATEPOSITION macro

Changed paths:
    engines/lastexpress/entities/entity.cpp
    engines/lastexpress/entities/entity.h
    engines/lastexpress/entities/entity_intern.h
    engines/lastexpress/entities/hadija.cpp
    engines/lastexpress/entities/yasmin.cpp



diff --git a/engines/lastexpress/entities/entity.cpp b/engines/lastexpress/entities/entity.cpp
index 9cb6825..43f039d 100644
--- a/engines/lastexpress/entities/entity.cpp
+++ b/engines/lastexpress/entities/entity.cpp
@@ -621,4 +621,17 @@ bool Entity::timeCheckCallbackAction(TimeValue timeValue, uint &parameter) {
 	return false;
 }
 
+bool Entity::timeCheckPlaySoundUpdatePosition(TimeValue timeValue, uint &parameter, byte callback, const char* sound, EntityPosition position) {
+	if (getState()->time > timeValue && !parameter) {
+		parameter = 1;
+		getData()->entityPosition = position;
+		setCallback(callback);
+		setup_playSound(sound);
+		return true;
+	}
+
+	return false;
+}
+
+
 } // End of namespace LastExpress
diff --git a/engines/lastexpress/entities/entity.h b/engines/lastexpress/entities/entity.h
index fb5c958..3370659 100644
--- a/engines/lastexpress/entities/entity.h
+++ b/engines/lastexpress/entities/entity.h
@@ -693,6 +693,7 @@ public:
 	virtual void setup_savegame(SavegameType, uint32) { error("[Entity::setup_savegame] Trying to call the parent setup function. Use the specific entity function directly"); }
 	virtual void setup_enterExitCompartment(const char *, ObjectIndex) { error("[Entity::setup_enterExitCompartment] Trying to call the parent setup function. Use the specific entity function directly"); }
 	virtual void setup_updateEntity(CarIndex, EntityPosition) { error("[Entity::setup_updateEntity] Trying to call the parent setup function. Use the specific entity function directly"); }
+	virtual void setup_playSound(const char*) { error("[Entity::setup_playSound] Trying to call the parent setup function. Use the specific entity function directly"); }
 
 	// Serializable
 	void saveLoadWithSerializer(Common::Serializer &ser) { _data->saveLoadWithSerializer(ser); }
@@ -872,6 +873,7 @@ protected:
 	void timeCheckSavepoint(TimeValue timeValue, uint &parameter, EntityIndex entity1, EntityIndex entity2, ActionIndex action);
 	void timeCheckObject(TimeValue timeValue, uint &parameter, ObjectIndex index, ObjectLocation location);
 	bool timeCheckCallbackAction(TimeValue timeValue, uint &parameter);
+	bool timeCheckPlaySoundUpdatePosition(TimeValue timeValue, uint &parameter, byte callback, const char* sound, EntityPosition position);
 };
 
 
diff --git a/engines/lastexpress/entities/entity_intern.h b/engines/lastexpress/entities/entity_intern.h
index cb4f7b9..15a0a37 100644
--- a/engines/lastexpress/entities/entity_intern.h
+++ b/engines/lastexpress/entities/entity_intern.h
@@ -347,15 +347,6 @@ void class::setup_##name() { \
 		break; \
 	}
 
-#define TIME_CHECK_PLAYSOUND_UPDATEPOSITION(timeValue, parameter, callback, sound, position) \
-	if (getState()->time > timeValue && !parameter) { \
-		parameter = 1; \
-		getData()->entityPosition = position; \
-		setCallback(callback); \
-		setup_playSound(sound); \
-		break; \
-	}
-
 #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/hadija.cpp b/engines/lastexpress/entities/hadija.cpp
index 8d757d5..4e72ce5 100644
--- a/engines/lastexpress/entities/hadija.cpp
+++ b/engines/lastexpress/entities/hadija.cpp
@@ -130,7 +130,8 @@ IMPLEMENT_FUNCTION(11, Hadija, chapter1Handler)
 		break;
 
 	case kActionNone:
-		TIME_CHECK_PLAYSOUND_UPDATEPOSITION(kTimeParisEpernay, params->param1, 1, "Har1100", kPosition_4840);
+		if (Entity::timeCheckPlaySoundUpdatePosition(kTimeParisEpernay, params->param1, 1, "Har1100", kPosition_4840))
+			break;
 
 label_callback1:
 		TIME_CHECK_CALLBACK(kTime1084500, params->param2, 2, setup_compartment6to8);
diff --git a/engines/lastexpress/entities/yasmin.cpp b/engines/lastexpress/entities/yasmin.cpp
index ebf9074..6fb1936 100644
--- a/engines/lastexpress/entities/yasmin.cpp
+++ b/engines/lastexpress/entities/yasmin.cpp
@@ -204,7 +204,8 @@ IMPLEMENT_FUNCTION(9, Yasmin, chapter1Handler)
 	case kActionNone:
 		TIME_CHECK_CALLBACK(kTime1093500, params->param1, 1, setup_function6);
 		TIME_CHECK_CALLBACK(kTime1161000, params->param2, 3, setup_function7);
-		TIME_CHECK_PLAYSOUND_UPDATEPOSITION(kTime1162800, params->param3, 4, "Har1102", kPosition_4070);
+		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);
@@ -226,7 +227,8 @@ IMPLEMENT_FUNCTION(9, Yasmin, chapter1Handler)
 			// Fallback to case 3
 
 		case 3:
-			TIME_CHECK_PLAYSOUND_UPDATEPOSITION(kTime1162800, params->param3, 4, "Har1102", kPosition_4070);
+			if (Entity::timeCheckPlaySoundUpdatePosition(kTime1162800, params->param3, 4, "Har1102", kPosition_4070))
+				break;
 			// Fallback to case 4
 
 		case 4:


Commit: 95503250f82c71b4ca6849c5eb5581d3c6645202
    https://github.com/scummvm/scummvm/commit/95503250f82c71b4ca6849c5eb5581d3c6645202
Author: Julien (julien at powerinbox.com)
Date: 2012-07-26T21:14:56-07:00

Commit Message:
LASTEXPRESS: Replace UPDATE_PARAM macro

Changed paths:
    engines/lastexpress/entities/abbot.cpp
    engines/lastexpress/entities/alexei.cpp
    engines/lastexpress/entities/alouan.cpp
    engines/lastexpress/entities/anna.cpp
    engines/lastexpress/entities/august.cpp
    engines/lastexpress/entities/boutarel.cpp
    engines/lastexpress/entities/chapters.cpp
    engines/lastexpress/entities/cooks.cpp
    engines/lastexpress/entities/coudert.cpp
    engines/lastexpress/entities/entity.cpp
    engines/lastexpress/entities/entity.h
    engines/lastexpress/entities/entity_intern.h
    engines/lastexpress/entities/gendarmes.cpp
    engines/lastexpress/entities/hadija.cpp
    engines/lastexpress/entities/kahina.cpp
    engines/lastexpress/entities/mahmud.cpp
    engines/lastexpress/entities/max.cpp
    engines/lastexpress/entities/mertens.cpp
    engines/lastexpress/entities/milos.cpp
    engines/lastexpress/entities/mmeboutarel.cpp
    engines/lastexpress/entities/pascale.cpp
    engines/lastexpress/entities/rebecca.cpp
    engines/lastexpress/entities/salko.cpp
    engines/lastexpress/entities/tatiana.cpp
    engines/lastexpress/entities/vassili.cpp
    engines/lastexpress/entities/verges.cpp
    engines/lastexpress/entities/vesna.cpp
    engines/lastexpress/entities/yasmin.cpp



diff --git a/engines/lastexpress/entities/abbot.cpp b/engines/lastexpress/entities/abbot.cpp
index 9280068..c224b57 100644
--- a/engines/lastexpress/entities/abbot.cpp
+++ b/engines/lastexpress/entities/abbot.cpp
@@ -514,7 +514,8 @@ IMPLEMENT_FUNCTION(24, Abbot, function24)
 		break;
 
 	case kActionNone:
-		UPDATE_PARAM(params->param1, getState()->time, 900);
+		if (!Entity::updateParameter(params->param1, getState()->time, 900))
+			break;
 
 		setup_function25();
 		break;
@@ -615,7 +616,8 @@ IMPLEMENT_FUNCTION(26, Abbot, function26)
 		break;
 
 	case kActionNone:
-		UPDATE_PARAM(params->param2, getState()->time, 4500);
+		if (!Entity::updateParameter(params->param2, getState()->time, 4500))
+			break;
 
 		if (getEntities()->isSomebodyInsideRestaurantOrSalon())
 			setup_function27();
@@ -862,7 +864,8 @@ IMPLEMENT_FUNCTION(31, Abbot, function31)
 		if (!params->param1)
 			break;
 
-		UPDATE_PARAM(params->param5, getState()->time, 450);
+		if (!Entity::updateParameter(params->param5, getState()->time, 450))
+			break;
 
 		setCallback(6);
 		setup_callbackActionRestaurantOrSalon();
@@ -918,7 +921,8 @@ IMPLEMENT_FUNCTION(31, Abbot, function31)
 			getSavePoints()->push(kEntityAbbot, kEntityAlexei, kAction122288808);
 			params->param1 = 1;
 
-			UPDATE_PARAM(params->param5, getState()->time, 450);
+			if (!Entity::updateParameter(params->param5, getState()->time, 450))
+				break;
 
 			setCallback(6);
 			setup_callbackActionRestaurantOrSalon();
@@ -1161,7 +1165,8 @@ IMPLEMENT_FUNCTION(36, Abbot, function36)
 			break;
 
 		case 2:
-			UPDATE_PARAM(params->param4, getState()->time, 900);
+			if (!Entity::updateParameter(params->param4, getState()->time, 900))
+				break;
 
 			getSound()->playSound(kEntityAbbot, "Abb3042");
 			break;
@@ -1426,7 +1431,8 @@ label_callback_1:
 		TIME_CHECK(kTime2466000, params->param5, setup_function44);
 
 		if (params->param3) {
-			UPDATE_PARAM(params->param6, getState()->timeTicks, 75);
+			if (!Entity::updateParameter(params->param6, getState()->timeTicks, 75))
+				break;
 
 			params->param2 = 1;
 			params->param3 = 0;
@@ -1748,7 +1754,8 @@ IMPLEMENT_FUNCTION(49, Abbot, pickBomb)
 		break;
 
 	case kActionNone:
-		UPDATE_PARAM(params->param1, getState()->timeTicks, 150);
+		if (!Entity::updateParameter(params->param1, getState()->timeTicks, 150))
+			break;
 
 		getSavePoints()->push(kEntityAbbot, kEntityAbbot, kAction157489665);
 		break;
diff --git a/engines/lastexpress/entities/alexei.cpp b/engines/lastexpress/entities/alexei.cpp
index 437c31c..c77b103 100644
--- a/engines/lastexpress/entities/alexei.cpp
+++ b/engines/lastexpress/entities/alexei.cpp
@@ -314,7 +314,8 @@ IMPLEMENT_FUNCTION_IS(16, Alexei, function16, TimeValue)
 		}
 
 		if (params->param5) {
-			UPDATE_PARAM(CURRENT_PARAM(1, 1), getState()->timeTicks, 75);
+			if (!Entity::updateParameter(CURRENT_PARAM(1, 1), getState()->timeTicks, 75))
+				break;
 
 			params->param5 = 0;
 			params->param6 = 1;
@@ -482,7 +483,9 @@ IMPLEMENT_FUNCTION(18, Alexei, chapter1Handler)
 		}
 
 		if (params->param1) {
-			UPDATE_PARAM(params->param3, getState()->timeTicks, 90);
+			if (!Entity::updateParameter(params->param3, getState()->timeTicks, 90))
+				break;
+
 			getScenes()->loadSceneFromPosition(kCarRestaurant, 61);
 		} else {
 			params->param3 = 0;
@@ -1348,7 +1351,8 @@ IMPLEMENT_FUNCTION(35, Alexei, function35)
 		UPDATE_PARAM_PROC_END
 
 label_callback_3:
-		UPDATE_PARAM(params->param4, getState()->time, 9000);
+		if (!Entity::updateParameter(params->param4, getState()->time, 9000))
+			break;
 
 		setCallback(4);
 		setup_callbackActionRestaurantOrSalon();
@@ -1397,7 +1401,8 @@ IMPLEMENT_FUNCTION(36, Alexei, function36)
 		if (params->param3 || params->param2)
 			break;
 
-		UPDATE_PARAM(params->param4, getState()->timeTicks, params->param1);
+		if (!Entity::updateParameter(params->param4, getState()->timeTicks, params->param1))
+			break;
 
 		getEntities()->drawSequenceRight(kEntityAlexei, "124B");
 
diff --git a/engines/lastexpress/entities/alouan.cpp b/engines/lastexpress/entities/alouan.cpp
index 589b712..7549aaf 100644
--- a/engines/lastexpress/entities/alouan.cpp
+++ b/engines/lastexpress/entities/alouan.cpp
@@ -438,7 +438,9 @@ IMPLEMENT_FUNCTION(22, Alouan, function22)
 		break;
 
 	case kActionNone:
-		UPDATE_PARAM(params->param1, getState()->time, 2700);
+		if (!Entity::updateParameter(params->param1, getState()->time, 2700))
+			break;
+
 		setup_function23();
 		break;
 
diff --git a/engines/lastexpress/entities/anna.cpp b/engines/lastexpress/entities/anna.cpp
index 806beae..80a5144 100644
--- a/engines/lastexpress/entities/anna.cpp
+++ b/engines/lastexpress/entities/anna.cpp
@@ -207,7 +207,8 @@ IMPLEMENT_FUNCTION(12, Anna, function12)
 		}
 
 		if (params->param4) {
-			UPDATE_PARAM(params->param8, getState()->timeTicks, 75);
+			if (!Entity::updateParameter(params->param8, getState()->timeTicks, 75))
+				break;
 
 			params->param4 = 0;
 			params->param5 = 1;
@@ -427,7 +428,8 @@ IMPLEMENT_FUNCTION_IS(15, Anna, function15, TimeValue)
 		}
 
 		if (params->param5) {
-			UPDATE_PARAM(params->param8, getState()->timeTicks, 75);
+			if (!Entity::updateParameter(params->param8, getState()->timeTicks, 75))
+				break;
 
 			params->param5 = 0;
 			params->param6 = 1;
@@ -675,7 +677,8 @@ IMPLEMENT_FUNCTION_I(18, Anna, function18, TimeValue)
 		}
 
 		if (params->param3) {
-			UPDATE_PARAM(params->param7, getState()->timeTicks, 90);
+			if (!Entity::updateParameter(params->param7, getState()->timeTicks, 90))
+				break;
 
 			getScenes()->loadSceneFromPosition(kCarRestaurant, 61);
 		} else {
@@ -1157,7 +1160,8 @@ IMPLEMENT_FUNCTION(29, Anna, function29)
 		}
 
 		if (params->param1) {
-			UPDATE_PARAM(params->param4, getState()->timeTicks, 90);
+			if (!Entity::updateParameter(params->param4, getState()->timeTicks, 90))
+				break;
 
 			getScenes()->loadSceneFromPosition(kCarRestaurant, 55);
 		} else {
@@ -1279,7 +1283,9 @@ IMPLEMENT_FUNCTION(30, Anna, function30)
 		}
 
 		if (params->param1) {
-			UPDATE_PARAM(params->param5, getState()->timeTicks, 90);
+			if (!Entity::updateParameter(params->param5, getState()->timeTicks, 90))
+				break;
+
 			getScenes()->loadSceneFromPosition(kCarRestaurant, 55);
 		} else {
 			params->param5 = 0;
@@ -1483,7 +1489,8 @@ IMPLEMENT_FUNCTION(35, Anna, function35)
 		if (!params->param1)
 			break;
 
-		UPDATE_PARAM(params->param3, getState()->timeTicks, 75);
+		if (!Entity::updateParameter(params->param3, getState()->timeTicks, 75))
+			break;
 
 		switch (params->param2) {
 		default:
@@ -1797,7 +1804,8 @@ IMPLEMENT_FUNCTION(41, Anna, function41)
 		break;
 
 	case kActionNone:
-		UPDATE_PARAM(params->param2, getState()->time, 2700);
+		if (!Entity::updateParameter(params->param2, getState()->time, 2700))
+			break;
 
 		params->param5++;
 		switch (params->param5) {
@@ -2399,7 +2407,8 @@ IMPLEMENT_FUNCTION(53, Anna, function53)
 		}
 
 		if (params->param1) {
-			UPDATE_PARAM(params->param7, getState()->timeTicks, 75);
+			if (!Entity::updateParameter(params->param7, getState()->timeTicks, 75))
+				break;
 
 			CursorStyle cursor = getEntities()->isInsideCompartment(kEntityMax, kCarRedSleeping, kPosition_4070) ? kCursorHand : kCursorNormal;
 
@@ -2545,7 +2554,8 @@ IMPLEMENT_FUNCTION(54, Anna, function54)
 		}
 
 		if (params->param1) {
-			UPDATE_PARAM(params->param7, getState()->timeTicks, 75);
+			if (!Entity::updateParameter(params->param7, getState()->timeTicks, 75))
+				break;
 
 			CursorStyle cursor = getEntities()->isInsideCompartment(kEntityMax, kCarRedSleeping, kPosition_4070) ? kCursorHand : kCursorNormal;
 
@@ -2892,7 +2902,8 @@ IMPLEMENT_FUNCTION(59, Anna, function59)
 		}
 
 		if (params->param1) {
-			UPDATE_PARAM(params->param5, getState()->timeTicks, 75);
+			if (!Entity::updateParameter(params->param5, getState()->timeTicks, 75))
+				break;
 
 			CursorStyle style = getEntities()->isInsideCompartment(kEntityMax, kCarRedSleeping, kPosition_4070) ? kCursorHand : kCursorNormal;
 			getObjects()->update(kObjectCompartmentF, kEntityAnna, kObjectLocation1, kCursorNormal, style);
@@ -3275,7 +3286,8 @@ IMPLEMENT_FUNCTION(67, Anna, chapter4Handler)
 
 label_next:
 		if (params->param1) {
-			UPDATE_PARAM(params->param5, getState()->timeTicks, 75);
+			if (!Entity::updateParameter(params->param5, getState()->timeTicks, 75))
+				break;
 
 			params->param1 = 0;
 			params->param2 = 1;
@@ -3405,7 +3417,8 @@ IMPLEMENT_FUNCTION(69, Anna, function69)
 
 	case kActionNone:
 		if (params->param1) {
-			UPDATE_PARAM(params->param2, getState()->time, 4500);
+			if (!Entity::updateParameter(params->param2, getState()->time, 4500))
+				break;
 
 			getData()->car = kCarRedSleeping;
 			getData()->entityPosition = kPosition_9270;
@@ -3909,7 +3922,8 @@ IMPLEMENT_FUNCTION(80, Anna, function80)
 		break;
 
 	case kActionNone:
-		UPDATE_PARAM(params->param1, getState()->timeTicks, 450);
+		if (!Entity::updateParameter(params->param1, getState()->timeTicks, 450))
+			break;
 
 		getSound()->playSound(kEntityPlayer, "Kro5001", kFlagDefault);
 		break;
@@ -3978,7 +3992,8 @@ IMPLEMENT_FUNCTION(81, Anna, finalSequence)
 		break;
 
 	case kActionNone:
-		UPDATE_PARAM(params->param1, getState()->timeTicks, 180);
+		if (!Entity::updateParameter(params->param1, getState()->timeTicks, 180))
+			break;
 
 		getSound()->playSound(kEntityTrain, "LIB069");
 		getLogic()->gameOver(kSavegameTypeIndex, 2, kSceneNone, true);
diff --git a/engines/lastexpress/entities/august.cpp b/engines/lastexpress/entities/august.cpp
index f255d04..d874c66 100644
--- a/engines/lastexpress/entities/august.cpp
+++ b/engines/lastexpress/entities/august.cpp
@@ -840,7 +840,8 @@ label_callback_9:
 			break;
 
 		if (getObjects()->get(kObjectCompartment1).location == kObjectLocation1) {
-			UPDATE_PARAM(CURRENT_PARAM(1, 2), getState()->timeTicks, 75);
+			if (!Entity::updateParameter(CURRENT_PARAM(1, 2), getState()->timeTicks, 75))
+				break;
 
 			getObjects()->update(kObjectCompartment1, kEntityAugust, getObjects()->get(kObjectCompartment1).location, kCursorNormal, kCursorNormal);
 
@@ -1483,7 +1484,8 @@ IMPLEMENT_FUNCTION(30, August, restaurant)
 		break;
 
 	case kActionNone:
-		UPDATE_PARAM(params->param3, getState()->timeTicks, 75);
+		if (!Entity::updateParameter(params->param3, getState()->timeTicks, 75))
+			break;
 
 		getData()->inventoryItem = kItemInvalid;
 		break;
@@ -1654,7 +1656,8 @@ IMPLEMENT_FUNCTION(32, August, function32)
 		}
 
 		if (params->param3) {
-			UPDATE_PARAM(params->param8, getState()->timeTicks, 90);
+			if (!Entity::updateParameter(params->param8, getState()->timeTicks, 90))
+				break;
 
 			getScenes()->loadSceneFromPosition(kCarRestaurant, 55);
 		} else {
@@ -2768,7 +2771,8 @@ IMPLEMENT_FUNCTION(54, August, function54)
 			getData()->inventoryItem = kItemInvalid;
 
 		if (!params->param2 && params->param1) {
-			UPDATE_PARAM(params->param5, getState()->time, params->param1);
+			if (!Entity::updateParameter(params->param5, getState()->time, params->param1))
+				break;
 
 			getData()->inventoryItem = kItemNone;
 			setup_function55();
@@ -3044,7 +3048,8 @@ IMPLEMENT_FUNCTION(60, August, function60)
 		if (!params->param1)
 			break;
 
-		UPDATE_PARAM(params->param3, getState()->time, 9000);
+		if (!Entity::updateParameter(params->param3, getState()->time, 9000))
+			break;
 
 		setCallback(1);
 		setup_callbackActionRestaurantOrSalon();
@@ -3140,7 +3145,8 @@ IMPLEMENT_FUNCTION(62, August, function62)
 		break;
 
 	case kActionNone:
-		UPDATE_PARAM(params->param1, getState()->time, 900);
+		if (!Entity::updateParameter(params->param1, getState()->time, 900))
+			break;
 
 		getSound()->playSound(kEntityAugust, "Aug4003A");
 
@@ -3229,7 +3235,8 @@ IMPLEMENT_FUNCTION(63, August, function63)
 			break;
 		}
 
-		UPDATE_PARAM(params->param5, getState()->timeTicks, params->param1);
+		if (!Entity::updateParameter(params->param5, getState()->timeTicks, params->param1))
+			break;
 
 		params->param2 = (params->param6 < 1 ? 1 : 0);
 
@@ -3386,7 +3393,8 @@ IMPLEMENT_FUNCTION(68, August, function68)
 
 	case kActionNone:
 		if (params->param1) {
-			UPDATE_PARAM(params->param4, getState()->timeTicks, 75);
+			if (!Entity::updateParameter(params->param4, getState()->timeTicks, 75))
+				break;
 
 			params->param1 = 0;
 			params->param2 = 1;
diff --git a/engines/lastexpress/entities/boutarel.cpp b/engines/lastexpress/entities/boutarel.cpp
index ab5f019..ab8a0b9 100644
--- a/engines/lastexpress/entities/boutarel.cpp
+++ b/engines/lastexpress/entities/boutarel.cpp
@@ -480,7 +480,9 @@ IMPLEMENT_FUNCTION_IS(17, Boutarel, function17, TimeValue)
 			break;
 
 		if (params->param5) {
-			UPDATE_PARAM(params->param7, getState()->timeTicks, 90)
+			if (!Entity::updateParameter(params->param7, getState()->timeTicks, 90))
+				break;
+
 			getScenes()->loadSceneFromPosition(kCarRestaurant, 51);
 		} else {
 			params->param7 = 0;
@@ -515,7 +517,8 @@ IMPLEMENT_FUNCTION_I(18, Boutarel, function18, TimeValue)
 		}
 
 		if (params->param2) {
-			UPDATE_PARAM(params->param5, getState()->timeTicks, 75);
+			if (!Entity::updateParameter(params->param5, getState()->timeTicks, 75))
+				break;
 
 			params->param2 = 0;
 			params->param3 = 1;
diff --git a/engines/lastexpress/entities/chapters.cpp b/engines/lastexpress/entities/chapters.cpp
index b497816..7616580 100644
--- a/engines/lastexpress/entities/chapters.cpp
+++ b/engines/lastexpress/entities/chapters.cpp
@@ -809,7 +809,8 @@ IMPLEMENT_FUNCTION(12, Chapters, chapter2Handler)
 		if (!getProgress().isTrainRunning)
 			break;
 
-		UPDATE_PARAM(params->param2, getState()->timeTicks, params->param1);
+		if (!Entity::updateParameter(params->param2, getState()->timeTicks, params->param1))
+			break;
 
 		getSound()->playLocomotiveSound();
 
diff --git a/engines/lastexpress/entities/cooks.cpp b/engines/lastexpress/entities/cooks.cpp
index 63494e6..a3fb69a 100644
--- a/engines/lastexpress/entities/cooks.cpp
+++ b/engines/lastexpress/entities/cooks.cpp
@@ -260,7 +260,8 @@ IMPLEMENT_FUNCTION(6, Cooks, chapter1Handler)
 		break;
 
 	case kActionNone:
-		UPDATE_PARAM(params->param4, getState()->time, params->param2);
+		if (!Entity::updateParameter(params->param4, getState()->time, params->param2))
+			break;
 
 		// Broken plate sound
 		getSound()->playSound(kEntityPlayer, "LIB122",  getSound()->getSoundFlag(kEntityCooks));
@@ -373,7 +374,8 @@ IMPLEMENT_FUNCTION(9, Cooks, chapter2Handler)
 		break;
 
 	case kActionNone:
-		UPDATE_PARAM(params->param3, getState()->time, params->param1);
+		if (!Entity::updateParameter(params->param3, getState()->time, params->param1))
+			break;
 
 		// Broken plate sound
 		getSound()->playSound(kEntityPlayer, "LIB122",  getSound()->getSoundFlag(kEntityCooks));
@@ -524,7 +526,8 @@ IMPLEMENT_FUNCTION(13, Cooks, chapter4Handler)
 		break;
 
 	case kActionNone:
-		UPDATE_PARAM(params->param3, getState()->time, params->param1)
+		if (!Entity::updateParameter(params->param3, getState()->time, params->param1))
+			break;
 
 		// Broken plate sound
 		getSound()->playSound(kEntityPlayer, "LIB122",  getSound()->getSoundFlag(kEntityCooks));
diff --git a/engines/lastexpress/entities/coudert.cpp b/engines/lastexpress/entities/coudert.cpp
index e79d4cd..c589b8f 100644
--- a/engines/lastexpress/entities/coudert.cpp
+++ b/engines/lastexpress/entities/coudert.cpp
@@ -356,7 +356,8 @@ IMPLEMENT_FUNCTION_I(10, Coudert, updateFromTime, uint32)
 	case kActionNone:
 		Entity::savegameBloodJacket();
 
-		UPDATE_PARAM(params->param2, getState()->time, params->param1);
+		if (!Entity::updateParameter(params->param2, getState()->time, params->param1))
+			break;
 
 		callbackAction();
 		break;
@@ -379,7 +380,8 @@ IMPLEMENT_FUNCTION_I(11, Coudert, updateFromTicks, uint32)
 	case kActionNone:
 		Entity::savegameBloodJacket();
 
-		UPDATE_PARAM(params->param2, getState()->timeTicks, params->param1);
+		if (!Entity::updateParameter(params->param2, getState()->timeTicks, params->param1))
+			break;
 
 		callbackAction();
 		break;
@@ -476,7 +478,8 @@ IMPLEMENT_FUNCTION_II(13, Coudert, function13, bool, EntityIndex)
 			}
 		}
 
-		UPDATE_PARAM(params->param5, getState()->timeTicks, 225);
+		if (!Entity::updateParameter(params->param5, getState()->timeTicks, 225))
+			break;
 
 		getData()->inventoryItem = kItemNone;
 		setCallback(5);
@@ -909,7 +912,8 @@ IMPLEMENT_FUNCTION_II(20, Coudert, function20, ObjectIndex, ObjectIndex)
 			getSound()->playSound(kEntityPlayer, "ZFX1004", getSound()->getSoundFlag(kEntityCoudert));
 		UPDATE_PARAM_PROC_END
 
-		UPDATE_PARAM(CURRENT_PARAM(1, 4), getState()->time, 900);
+		if (!Entity::updateParameter(CURRENT_PARAM(1, 4), getState()->time, 900))
+			break;
 
 		getObjects()->updateLocation2((ObjectIndex)params->param1, kObjectLocation1);
 
@@ -988,7 +992,8 @@ IMPLEMENT_FUNCTION(21, Coudert, function21)
 
 	case kActionNone:
 		if (!params->param1) {
-			UPDATE_PARAM(params->param2, getState()->timeTicks, 75);
+			if (!Entity::updateParameter(params->param2, getState()->timeTicks, 75))
+				break;
 
 			setCallback(3);
 			setup_enterExitCompartment("627Zh", kObjectCompartmentH);
@@ -1089,7 +1094,8 @@ IMPLEMENT_FUNCTION(22, Coudert, function22)
 
 	case kActionNone:
 		if (!params->param1) {
-			UPDATE_PARAM(params->param2, getState()->timeTicks, 75);
+			if (!Entity::updateParameter(params->param2, getState()->timeTicks, 75))
+				break;
 
 			setCallback(3);
 			setup_enterExitCompartment("627Rg", kObjectCompartmentG);
@@ -1300,7 +1306,8 @@ IMPLEMENT_FUNCTION(26, Coudert, function26)
 
 	case kActionNone:
 		if (params->param1) {
-			UPDATE_PARAM(params->param2, getState()->timeTicks, 75);
+			if (!Entity::updateParameter(params->param2, getState()->timeTicks, 75))
+				break;
 
 			setCallback(3);
 			setup_enterExitCompartment2("627Zd", kObjectCompartmentD, kPosition_5790, kPosition_6130);
@@ -1391,7 +1398,8 @@ IMPLEMENT_FUNCTION(27, Coudert, function27)
 
 	case kActionNone:
 		if (!params->param1) {
-			UPDATE_PARAM(params->param2, getState()->timeTicks, 75);
+			if (!Entity::updateParameter(params->param2, getState()->timeTicks, 75))
+				break;
 
 			setCallback(3);
 			setup_enterExitCompartment2("627Rc", kObjectCompartmentC, kPosition_6470, kPosition_6130);
@@ -1891,7 +1899,8 @@ IMPLEMENT_FUNCTION_I(35, Coudert, function35, bool)
 			getScenes()->loadSceneFromPosition(kCarRestaurant, 65);
 		}
 
-		UPDATE_PARAM(params->param2, getState()->time, 2700);
+		if (!Entity::updateParameter(params->param2, getState()->time, 2700))
+			break;
 
 		getSavePoints()->push(kEntityCoudert, kEntityMax, kActionMaxFreeFromCage);
 
@@ -3558,7 +3567,8 @@ label_callback_5:
 
 label_callback_6:
 		if (getState()->time > kTime2538000 && !ENTITY_PARAM(0, 1) && !ENTITY_PARAM(2, 1)) {
-			UPDATE_PARAM(params->param7, getState()->time, 2700);
+			if (!Entity::updateParameter(params->param7, getState()->time, 2700))
+				break;
 
 			ENTITY_PARAM(0, 2) = 0;
 			ENTITY_PARAM(0, 1) = 1;
@@ -4023,7 +4033,8 @@ IMPLEMENT_FUNCTION(62, Coudert, function62)
 
 	case kActionNone:
 		if (params->param1) {
-			UPDATE_PARAM(params->param4, getState()->timeTicks, 75);
+			if (!Entity::updateParameter(params->param4, getState()->timeTicks, 75))
+				break;
 
 			params->param1 = 0;
 			params->param2 = 1;
diff --git a/engines/lastexpress/entities/entity.cpp b/engines/lastexpress/entities/entity.cpp
index 43f039d..1989c46 100644
--- a/engines/lastexpress/entities/entity.cpp
+++ b/engines/lastexpress/entities/entity.cpp
@@ -346,7 +346,9 @@ void Entity::updateFromTicks(const SavePoint &savepoint) {
 		break;
 
 	case kActionNone:
-		UPDATE_PARAM(params->param2, getState()->timeTicks, params->param1)
+		if (Entity::updateParameter(params->param2, getState()->timeTicks, params->param1))
+			break;
+
 		callbackAction();
 		break;
 	}
@@ -360,7 +362,9 @@ void Entity::updateFromTime(const SavePoint &savepoint) {
 		break;
 
 	case kActionNone:
-		UPDATE_PARAM(params->param2, getState()->time, params->param1)
+		if (Entity::updateParameter(params->param2, getState()->time, params->param1))
+			break;
+
 		callbackAction();
 		break;
 	}
@@ -597,6 +601,18 @@ void Entity::callbackAction() {
 // Helper functions
 //////////////////////////////////////////////////////////////////////////
 
+bool Entity::updateParameter(uint &parameter, uint timeValue, uint delta) {
+	if (!parameter)
+		parameter = (uint)(timeValue + delta);
+
+	if (parameter >= timeValue)
+		return false;
+
+	parameter = kTimeInvalid;
+
+	return true;
+}
+
 void Entity::timeCheckSavepoint(TimeValue timeValue, uint &parameter, 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 3370659..139f8ec 100644
--- a/engines/lastexpress/entities/entity.h
+++ b/engines/lastexpress/entities/entity.h
@@ -870,6 +870,8 @@ protected:
 	// Helper functions
 	//////////////////////////////////////////////////////////////////////////
 
+	bool updateParameter(uint &parameter, uint time, uint delta);
+
 	void timeCheckSavepoint(TimeValue timeValue, uint &parameter, EntityIndex entity1, EntityIndex entity2, ActionIndex action);
 	void timeCheckObject(TimeValue timeValue, uint &parameter, ObjectIndex index, ObjectLocation location);
 	bool timeCheckCallbackAction(TimeValue timeValue, uint &parameter);
diff --git a/engines/lastexpress/entities/entity_intern.h b/engines/lastexpress/entities/entity_intern.h
index 15a0a37..23f5e49 100644
--- a/engines/lastexpress/entities/entity_intern.h
+++ b/engines/lastexpress/entities/entity_intern.h
@@ -361,13 +361,6 @@ void class::setup_##name() { \
 //////////////////////////////////////////////////////////////////////////
 // Param update
 //////////////////////////////////////////////////////////////////////////
-#define UPDATE_PARAM(parameter, type, value) { \
-	if (!parameter) \
-		parameter = (uint)(type + value); \
-	if (parameter >= type) \
-		break; \
-	parameter = kTimeInvalid; \
-}
 
 // Todo: replace with UPDATE_PARAM_PROC as appropriate
 #define UPDATE_PARAM_GOTO(parameter, type, value, label) { \
diff --git a/engines/lastexpress/entities/gendarmes.cpp b/engines/lastexpress/entities/gendarmes.cpp
index fe9f6f0..22697b3 100644
--- a/engines/lastexpress/entities/gendarmes.cpp
+++ b/engines/lastexpress/entities/gendarmes.cpp
@@ -266,7 +266,8 @@ IMPLEMENT_FUNCTION_III(10, Gendarmes, function10, CarIndex, EntityPosition, Obje
 			getSound()->playSound(kEntityGendarmes, "POL1046A", kFlagDefault);
 		}
 
-		UPDATE_PARAM(params->param7, getState()->timeTicks, 300);
+		if (!Entity::updateParameter(params->param7, getState()->timeTicks, 300))
+			break;
 
 		if (!params->param4 && getEntities()->isOutsideAlexeiWindow()) {
 			getObjects()->update((ObjectIndex)params->param3, kEntityPlayer, kObjectLocationNone, kCursorHandKnock, kCursorHand);
diff --git a/engines/lastexpress/entities/hadija.cpp b/engines/lastexpress/entities/hadija.cpp
index 4e72ce5..62badc4 100644
--- a/engines/lastexpress/entities/hadija.cpp
+++ b/engines/lastexpress/entities/hadija.cpp
@@ -466,7 +466,9 @@ IMPLEMENT_FUNCTION(22, Hadija, function22)
 		break;
 
 	case kActionNone:
-		UPDATE_PARAM(params->param1, getState()->time, 2700);
+		if (!Entity::updateParameter(params->param1, getState()->time, 2700))
+			break;
+
 		setup_function23();
 		break;
 
diff --git a/engines/lastexpress/entities/kahina.cpp b/engines/lastexpress/entities/kahina.cpp
index 6bb2e6b..2124de1 100644
--- a/engines/lastexpress/entities/kahina.cpp
+++ b/engines/lastexpress/entities/kahina.cpp
@@ -794,7 +794,8 @@ label_callback_2:
 		if (getEvent(kEventKahinaAskSpeakFirebird)
 		 && !getEvent(kEventKronosConversationFirebird)
 		 && getEntities()->isInsideTrainCar(kEntityPlayer, kCarKronos)) {
-			UPDATE_PARAM(params->param4, getState()->time, 900);
+			if (!Entity::updateParameter(params->param4, getState()->time, 900))
+				break;
 
 			setCallback(3);
 			setup_savegame(kSavegameTypeEvent, kEventKronosConversationFirebird);
diff --git a/engines/lastexpress/entities/mahmud.cpp b/engines/lastexpress/entities/mahmud.cpp
index ebe754b..1e7df5c 100644
--- a/engines/lastexpress/entities/mahmud.cpp
+++ b/engines/lastexpress/entities/mahmud.cpp
@@ -84,7 +84,8 @@ IMPLEMENT_FUNCTION_SIII(4, Mahmud, enterExitCompartment2, ObjectIndex, uint32, O
 		break;
 
 	case kActionNone:
-		UPDATE_PARAM(params->param7, getState()->timeTicks, params->param5);
+		if (!Entity::updateParameter(params->param7, getState()->timeTicks, params->param5))
+			break;
 
 		if (!getScenes()->checkPosition(kSceneNone, SceneManager::kCheckPositionLookingUp))
 			getScenes()->loadSceneFromObject((ObjectIndex)params->param6, true);
@@ -144,7 +145,8 @@ IMPLEMENT_FUNCTION_II(10, Mahmud, function10, ObjectIndex, bool)
 		break;
 
 	case kActionNone:
-		UPDATE_PARAM(params->param6, getState()->time, 13500);
+		if (!Entity::updateParameter(params->param6, getState()->time, 13500))
+			break;
 
 		getObjects()->update(kObjectCompartment5, kEntityTrain, kObjectLocation3, kCursorHandKnock, kCursorHand);
 		getObjects()->update(kObjectCompartment6, kEntityTrain, kObjectLocation3, kCursorHandKnock, kCursorHand);
@@ -570,7 +572,8 @@ IMPLEMENT_FUNCTION(14, Mahmud, chaptersHandler)
 		}
 
 		if (params->param5) {
-			UPDATE_PARAM(params->param8, getState()->timeTicks, 75);
+			if (!Entity::updateParameter(params->param8, getState()->timeTicks, 75))
+				break;
 
 			params->param4 = 1;
 			params->param5 = 0;
diff --git a/engines/lastexpress/entities/max.cpp b/engines/lastexpress/entities/max.cpp
index cecfe64..5c43346 100644
--- a/engines/lastexpress/entities/max.cpp
+++ b/engines/lastexpress/entities/max.cpp
@@ -89,7 +89,8 @@ IMPLEMENT_FUNCTION(6, Max, chapter12_handler)
 		break;
 
 	case kActionNone:
-		UPDATE_PARAM(params->param2, getState()->time, params->param1);
+		if (!Entity::updateParameter(params->param2, getState()->time, params->param1))
+			break;
 
 		if (!getSoundQueue()->isBuffered(kEntityMax))
 			getSound()->playSound(kEntityMax, "Max1122");
@@ -123,7 +124,8 @@ IMPLEMENT_FUNCTION(7, Max, function7)
 		break;
 
 	case kActionNone:
-		UPDATE_PARAM(params->param2, getState()->time, params->param1)
+		if (!Entity::updateParameter(params->param2, getState()->time, params->param1))
+			break;
 
 		if (!getSoundQueue()->isBuffered(kEntityMax))
 			getSound()->playSound(kEntityMax, "Max1122");
@@ -212,7 +214,8 @@ IMPLEMENT_FUNCTION(8, Max, chapter4Handler)
 		break;
 
 	case kActionNone:
-		UPDATE_PARAM(params->param3, getState()->time, params->param2);
+		if (!Entity::updateParameter(params->param3, getState()->time, params->param2))
+			break;
 
 		if (!getSoundQueue()->isBuffered(kEntityMax))
 			getSound()->playSound(kEntityMax, "Max3101");
@@ -390,7 +393,8 @@ IMPLEMENT_FUNCTION(13, Max, chapter3Handler)
 			break;
 		}
 
-		UPDATE_PARAM(params->param3, getState()->time, params->param1);
+		if (!Entity::updateParameter(params->param3, getState()->time, params->param1))
+			break;
 
 		if (!getSoundQueue()->isBuffered(kEntityMax))
 			getSound()->playSound(kEntityMax, "Max1122");
@@ -512,7 +516,8 @@ IMPLEMENT_FUNCTION(15, Max, function15)
 		}
 
 		if (!params->param1) {
-			UPDATE_PARAM(params->param3, getState()->time, 900);
+			if (!Entity::updateParameter(params->param3, getState()->time, 900))
+				break;
 
 			getSavePoints()->push(kEntityMax, kEntityCoudert, kAction157026693);
 		}
diff --git a/engines/lastexpress/entities/mertens.cpp b/engines/lastexpress/entities/mertens.cpp
index 37e7bf5..c093ac4 100644
--- a/engines/lastexpress/entities/mertens.cpp
+++ b/engines/lastexpress/entities/mertens.cpp
@@ -464,7 +464,8 @@ IMPLEMENT_FUNCTION_I(11, Mertens, function11, uint32)
 	case kActionNone:
 		Entity::savegameBloodJacket();
 
-		UPDATE_PARAM(params->param2, getState()->time, params->param1)
+		if (!Entity::updateParameter(params->param2, getState()->time, params->param1))
+			break;
 
 		callbackAction();
 		break;
@@ -1062,7 +1063,8 @@ IMPLEMENT_FUNCTION_II(21, Mertens, function21, ObjectIndex, ObjectIndex)
 			getSound()->playSound(kEntityPlayer, "ZFX1004", getSound()->getSoundFlag(kEntityMertens));
 		UPDATE_PARAM_PROC_END
 
-		UPDATE_PARAM(CURRENT_PARAM(1, 5), getState()->time, 900);
+		if (!Entity::updateParameter(CURRENT_PARAM(1, 5), getState()->time, 900))
+			break;
 
 		// Update objects
 		getObjects()->updateLocation2((ObjectIndex)params->param1, kObjectLocation1);
@@ -1286,7 +1288,8 @@ IMPLEMENT_FUNCTION(24, Mertens, function24)
 
 	case kActionNone:
 		if (!params->param1) {
-			UPDATE_PARAM(params->param2, getState()->timeTicks, 75);
+			if (!Entity::updateParameter(params->param2, getState()->timeTicks, 75))
+				break;
 
 			setCallback(3);
 			setup_enterExitCompartment3("601Rc", kObjectCompartment3, kPosition_6470, kPosition_6130);
@@ -1389,7 +1392,8 @@ IMPLEMENT_FUNCTION(25, Mertens, function25)
 
 	case kActionNone:
 		if (!params->param1) {
-			UPDATE_PARAM(params->param2, getState()->timeTicks, 75);
+			if (!Entity::updateParameter(params->param2, getState()->timeTicks, 75))
+				break;
 
 			setCallback(3);
 			setup_enterExitCompartment3("601Zb", kObjectCompartment2, kPosition_7500, kPositionNone);
@@ -1626,7 +1630,8 @@ label_callback10:
 
 		if (params->param3 >= getState()->timeTicks) {
 label_callback11:
-			UPDATE_PARAM(params->param4, getState()->timeTicks, 375);
+			if (!Entity::updateParameter(params->param4, getState()->timeTicks, 375))
+				break;
 
 			getSound()->playSound(kEntityPlayer, "LIB033");
 
@@ -3736,7 +3741,8 @@ label_callback_7:
 
 label_callback_8:
 		if (getState()->time > kTime2538000 && !ENTITY_PARAM(0, 1) && !ENTITY_PARAM(2, 1)) {
-			UPDATE_PARAM(params->param6, getState()->time, 2700);
+			if (!Entity::updateParameter(params->param6, getState()->time, 2700))
+				break;
 
 			getEntities()->drawSequenceLeft(kEntityMertens, "601E");
 
@@ -3990,7 +3996,8 @@ IMPLEMENT_FUNCTION(53, Mertens, function53)
 
 	case kActionNone:
 		if (params->param1) {
-			UPDATE_PARAM(params->param4, getState()->timeTicks, 75);
+			if (!Entity::updateParameter(params->param4, getState()->timeTicks, 75))
+				break;
 
 			params->param1 = 0;
 			params->param2 = 0;
diff --git a/engines/lastexpress/entities/milos.cpp b/engines/lastexpress/entities/milos.cpp
index c33a8b8..8ebb23b 100644
--- a/engines/lastexpress/entities/milos.cpp
+++ b/engines/lastexpress/entities/milos.cpp
@@ -434,7 +434,8 @@ IMPLEMENT_FUNCTION(14, Milos, function14)
 			if (CURRENT_PARAM(1, 1) < getState()->timeTicks) {
 
 				if (getObjects()->get(kObjectCompartment1).location == kObjectLocation1) {
-					UPDATE_PARAM(CURRENT_PARAM(1, 2), getState()->timeTicks, 75);
+					if (!Entity::updateParameter(CURRENT_PARAM(1, 2), getState()->timeTicks, 75))
+						break;
 
 					getObjects()->update(kObjectCompartment1, kEntityMilos, getObjects()->get(kObjectCompartment1).location, kCursorNormal, kCursorNormal);
 
@@ -505,7 +506,8 @@ IMPLEMENT_FUNCTION(14, Milos, function14)
 			}
 
 label_callback_12:
-			UPDATE_PARAM(CURRENT_PARAM(1, 4), getState()->timeTicks, 75);
+			if (!Entity::updateParameter(CURRENT_PARAM(1, 4), getState()->timeTicks, 75))
+				break;
 
 			getEntities()->exitCompartment(kEntityMilos, kObjectCompartment1, true);
 
@@ -736,7 +738,8 @@ IMPLEMENT_FUNCTION(15, Milos, chapter1Handler)
 		}
 
 		if (getEntities()->isPlayerPosition(kCarRestaurant, 70) && !params->param2) {
-			UPDATE_PARAM(params->param5, getState()->timeTicks, 45);
+			if (!Entity::updateParameter(params->param5, getState()->timeTicks, 45))
+				break;
 
 			setCallback(2);
 			setup_draw("009C");
@@ -951,7 +954,8 @@ IMPLEMENT_FUNCTION(21, Milos, function21)
 		break;
 
 	case kActionNone:
-		UPDATE_PARAM(params->param2, getState()->time, 4500);
+		if (!Entity::updateParameter(params->param2, getState()->time, 4500))
+			break;
 
 		params->param1 = 1;
 		break;
@@ -1116,7 +1120,8 @@ IMPLEMENT_FUNCTION(24, Milos, function24)
 		}
 
 		if (params->param1) {
-			UPDATE_PARAM(params->param5, getState()->timeTicks, 75);
+			if (!Entity::updateParameter(params->param5, getState()->timeTicks, 75))
+				break;
 
 			params->param1 = 0;
 			params->param2 = 1;
@@ -1289,7 +1294,8 @@ IMPLEMENT_FUNCTION(25, Milos, function25)
 		}
 
 		if (params->param1) {
-			UPDATE_PARAM(params->param4, getState()->timeTicks, 75);
+			if (!Entity::updateParameter(params->param4, getState()->timeTicks, 75))
+				break;
 
 			params->param1 = 0;
 			params->param2 = 1;
diff --git a/engines/lastexpress/entities/mmeboutarel.cpp b/engines/lastexpress/entities/mmeboutarel.cpp
index ace8637..323e686 100644
--- a/engines/lastexpress/entities/mmeboutarel.cpp
+++ b/engines/lastexpress/entities/mmeboutarel.cpp
@@ -427,7 +427,8 @@ label_callback_1:
 		TIME_CHECK(kTime1094400, params->param8, setup_function14);
 
 		if (params->param4) {
-			UPDATE_PARAM(CURRENT_PARAM(1, 1), getState()->timeTicks, 75);
+			if (!Entity::updateParameter(CURRENT_PARAM(1, 1), getState()->timeTicks, 75))
+				break;
 
 			params->param3 = 1;
 			params->param4 = 0;
@@ -587,7 +588,8 @@ IMPLEMENT_FUNCTION(15, MmeBoutarel, function15)
 
 label_callback_5:
 		if (params->param2) {
-			UPDATE_PARAM(params->param5, getState()->timeTicks, 75);
+			if (!Entity::updateParameter(params->param5, getState()->timeTicks, 75))
+				break;
 
 			params->param1 = 1;
 			params->param2 = 0;
@@ -1016,7 +1018,8 @@ IMPLEMENT_FUNCTION(23, MmeBoutarel, chapter4Handler)
 
 	case kActionNone:
 		if (params->param1) {
-			UPDATE_PARAM(params->param2, getState()->time, 900);
+			if (!Entity::updateParameter(params->param2, getState()->time, 900))
+				break;
 
 			getObjects()->update(kObjectCompartmentD, kEntityPlayer, kObjectLocation1, kCursorKeepValue, kCursorKeepValue);
 
@@ -1065,7 +1068,8 @@ IMPLEMENT_FUNCTION(24, MmeBoutarel, function24)
 		TIME_CHECK(kTime2470500, params->param4, setup_function25);
 
 		if (params->param2) {
-			UPDATE_PARAM(params->param5, getState()->timeTicks, 75);
+			if (!Entity::updateParameter(params->param5, getState()->timeTicks, 75))
+				break;
 
 			params->param1 = 1;
 			params->param2 = 0;
@@ -1208,7 +1212,8 @@ IMPLEMENT_FUNCTION(28, MmeBoutarel, function28)
 
 	case kActionNone:
 		if (params->param1) {
-			UPDATE_PARAM(params->param3, getState()->timeTicks, 75);
+			if (!Entity::updateParameter(params->param3, getState()->timeTicks, 75))
+				break;
 
 			params->param1 = 0;
 			params->param2 = 1;
diff --git a/engines/lastexpress/entities/pascale.cpp b/engines/lastexpress/entities/pascale.cpp
index 6620634..e74cf34 100644
--- a/engines/lastexpress/entities/pascale.cpp
+++ b/engines/lastexpress/entities/pascale.cpp
@@ -1126,7 +1126,8 @@ IMPLEMENT_FUNCTION(33, Pascale, function33)
 
 label_callback1:
 		if (params->param1) {
-			UPDATE_PARAM(params->param6, getState()->timeTicks, 75);
+			if (!Entity::updateParameter(params->param6, getState()->timeTicks, 75))
+				break;
 
 			params->param1 = 0;
 			params->param2 = 2;
diff --git a/engines/lastexpress/entities/rebecca.cpp b/engines/lastexpress/entities/rebecca.cpp
index 3ef2669..a890ebf 100644
--- a/engines/lastexpress/entities/rebecca.cpp
+++ b/engines/lastexpress/entities/rebecca.cpp
@@ -708,7 +708,9 @@ label_callback_4:
 
 label_callback_5:
 			if (params->param2) {
-				UPDATE_PARAM(params->param6, getState()->timeTicks, 90);
+				if (!Entity::updateParameter(params->param6, getState()->timeTicks, 90))
+					break;
+
 				getScenes()->loadSceneFromPosition(kCarRestaurant, 55);
 			} else {
 				params->param6 = 0;
@@ -966,7 +968,8 @@ IMPLEMENT_FUNCTION(26, Rebecca, function26)
 		TIME_CHECK_CALLBACK_3(kTime1224000, params->param2, 1, setup_updatePosition, "118H", kCarRestaurant, 52);
 
 		if (params->param1) {
-			UPDATE_PARAM(params->param3, getState()->timeTicks, 90);
+			if (!Entity::updateParameter(params->param3, getState()->timeTicks, 90))
+				break;
 
 			getScenes()->loadSceneFromPosition(kCarRestaurant, 51);
 		}
@@ -1753,7 +1756,8 @@ IMPLEMENT_FUNCTION(48, Rebecca, function48)
 
 	case kActionNone:
 		if (params->param1) {
-			UPDATE_PARAM(params->param3, getState()->timeTicks, 75);
+			if (!Entity::updateParameter(params->param3, getState()->timeTicks, 75))
+				break;
 
 			params->param1 = 0;
 			params->param2 = 1;
diff --git a/engines/lastexpress/entities/salko.cpp b/engines/lastexpress/entities/salko.cpp
index 70a26b5..b799564 100644
--- a/engines/lastexpress/entities/salko.cpp
+++ b/engines/lastexpress/entities/salko.cpp
@@ -299,7 +299,8 @@ IMPLEMENT_FUNCTION(15, Salko, chapter3Handler)
 
 	case kActionNone:
 		if (getState()->time < kTime2200500) {
-			UPDATE_PARAM(params->param1, getState()->time, 81000);
+			if (!Entity::updateParameter(params->param1, getState()->time, 81000))
+				break;
 
 			setCallback(1);
 			setup_function16();
@@ -329,7 +330,8 @@ IMPLEMENT_FUNCTION(16, Salko, function16)
 		}
 
 label_callback3:
-		UPDATE_PARAM(params->param1, getState()->time, 4500);
+		if (!Entity::updateParameter(params->param1, getState()->time, 4500))
+			break;
 
 		getSavePoints()->push(kEntitySalko, kEntitySalko, kAction101169464);
 		break;
diff --git a/engines/lastexpress/entities/tatiana.cpp b/engines/lastexpress/entities/tatiana.cpp
index b15a0a1..76068aa 100644
--- a/engines/lastexpress/entities/tatiana.cpp
+++ b/engines/lastexpress/entities/tatiana.cpp
@@ -249,7 +249,8 @@ IMPLEMENT_FUNCTION_I(16, Tatiana, function16, uint32)
 		}
 
 		if (params->param2) {
-			UPDATE_PARAM(params->param5, getState()->timeTicks, 75);
+			if (!Entity::updateParameter(params->param5, getState()->timeTicks, 75))
+				break;
 
 			params->param2 = 0;
 			params->param3 = 1;
@@ -443,7 +444,9 @@ label_tatiana_chapter1_2:
 		Entity::timeCheckSavepoint(kTime1084500, params->param7, kEntityTatiana, kEntityPascale, kAction257489762);
 
 		if (params->param1) {
-			UPDATE_PARAM(params->param8, getState()->timeTicks, 90);
+			if (!Entity::updateParameter(params->param8, getState()->timeTicks, 90))
+				break;
+
 			getScenes()->loadSceneFromPosition(kCarRestaurant, 65);
 		} else {
 			params->param8 = 0;
@@ -1292,7 +1295,8 @@ IMPLEMENT_FUNCTION(37, Tatiana, function37)
 		}
 
 		if (params->param1) {
-			UPDATE_PARAM(params->param5, getState()->timeTicks, 75);
+			if (!Entity::updateParameter(params->param5, getState()->timeTicks, 75))
+				break;
 
 			getObjects()->update(kObjectCompartmentB, kEntityTatiana, kObjectLocation1, kCursorNormal, kCursorNormal);
 			getObjects()->update(kObject49, kEntityTatiana, kObjectLocation1, kCursorNormal, kCursorNormal);
@@ -1401,7 +1405,8 @@ IMPLEMENT_FUNCTION(38, Tatiana, function38)
 		break;
 
 	case kActionNone:
-		UPDATE_PARAM(params->param1, getState()->time, 450);
+		if (!Entity::updateParameter(params->param1, getState()->time, 450))
+			break;
 
 		getEntities()->exitCompartment(kEntityTatiana, kObjectCompartmentF, true);
 
@@ -2197,7 +2202,8 @@ IMPLEMENT_FUNCTION(54, Tatiana, function54)
 		}
 
 		if (params->param1 > 3) {
-			UPDATE_PARAM(params->param3, getState()->timeTicks, 225);
+			if (!Entity::updateParameter(params->param3, getState()->timeTicks, 225))
+				break;
 
 			params->param1 = 0;
 			params->param3 = 0;
diff --git a/engines/lastexpress/entities/vassili.cpp b/engines/lastexpress/entities/vassili.cpp
index 5079fdb..6504df7 100644
--- a/engines/lastexpress/entities/vassili.cpp
+++ b/engines/lastexpress/entities/vassili.cpp
@@ -400,7 +400,8 @@ IMPLEMENT_FUNCTION(13, Vassili, sleeping)
 
 	case kActionNone:
 		if (getEntities()->isInsideCompartment(kEntityPlayer, kCarRedSleeping, kPosition_8200)) {
-			UPDATE_PARAM(params->param3, getState()->timeTicks, params->param1);
+			if (!Entity::updateParameter(params->param3, getState()->timeTicks, params->param1))
+				break;
 
 			setCallback(1);
 			setup_draw("303B");
@@ -459,7 +460,8 @@ IMPLEMENT_FUNCTION(15, Vassili, stealEgg)
 
 	case kActionNone:
 		if (getEntities()->isInsideCompartment(kEntityPlayer, kCarRedSleeping, kPosition_8200)) {
-			UPDATE_PARAM(params->param3, getState()->timeTicks, params->param1);
+			if (!Entity::updateParameter(params->param3, getState()->timeTicks, params->param1))
+				break;
 
 			setCallback(1);
 			setup_draw("303B");
@@ -543,7 +545,8 @@ IMPLEMENT_FUNCTION(17, Vassili, chapter4Handler)
 
 	case kActionNone:
 		if (getEntities()->isInsideCompartment(kEntityPlayer, kCarRedSleeping, kPosition_8200)) {
-			UPDATE_PARAM(params->param3, getState()->timeTicks, params->param1);
+			if (!Entity::updateParameter(params->param3, getState()->timeTicks, params->param1))
+				break;
 
 			setCallback(1);
 			setup_draw("303B");
diff --git a/engines/lastexpress/entities/verges.cpp b/engines/lastexpress/entities/verges.cpp
index bdd758a..f459b6f 100644
--- a/engines/lastexpress/entities/verges.cpp
+++ b/engines/lastexpress/entities/verges.cpp
@@ -244,7 +244,8 @@ IMPLEMENT_FUNCTION_IIS(10, Verges, function10, CarIndex, EntityPosition)
 		}
 
 		if (params->param6) {
-			UPDATE_PARAM(params->param8, getState()->timeTicks, 75);
+			if (!Entity::updateParameter(params->param8, getState()->timeTicks, 75))
+				break;
 
 			getSound()->playSound(kEntityVerges, (char *)&params->seq);
 
diff --git a/engines/lastexpress/entities/vesna.cpp b/engines/lastexpress/entities/vesna.cpp
index b0ee9bc..6889be4 100644
--- a/engines/lastexpress/entities/vesna.cpp
+++ b/engines/lastexpress/entities/vesna.cpp
@@ -162,7 +162,8 @@ IMPLEMENT_FUNCTION(11, Vesna, function11)
 
 	case kActionNone:
 		if (parameters->param3) {
-			UPDATE_PARAM(parameters->param7, getState()->timeTicks, 75);
+			if (!Entity::updateParameter(parameters->param7, getState()->timeTicks, 75))
+				break;
 
 			parameters->param2 = 1;
 			parameters->param3 = 0;
@@ -511,7 +512,8 @@ IMPLEMENT_FUNCTION(20, Vesna, chapter3Handler)
 		}
 
 		if (parameters->param2) {
-			UPDATE_PARAM(parameters->param8, getState()->timeTicks, 75);
+			if (!Entity::updateParameter(parameters->param8, getState()->timeTicks, 75))
+				break;
 
 			parameters->param1 = 1;
 			parameters->param2 = 0;
@@ -1086,7 +1088,8 @@ IMPLEMENT_FUNCTION(30, Vesna, function30)
 			UPDATE_PARAM_PROC_END
 		}
 
-		UPDATE_PARAM(params->param4, getState()->timeTicks, 180);
+		if (!Entity::updateParameter(params->param4, getState()->timeTicks, 180))
+			break;
 
 		setCallback(1);
 		setup_savegame(kSavegameTypeEvent, kEventCathVesnaTrainTopKilled);
diff --git a/engines/lastexpress/entities/yasmin.cpp b/engines/lastexpress/entities/yasmin.cpp
index 6fb1936..f2b4d2e 100644
--- a/engines/lastexpress/entities/yasmin.cpp
+++ b/engines/lastexpress/entities/yasmin.cpp
@@ -445,7 +445,9 @@ IMPLEMENT_FUNCTION(20, Yasmin, function20)
 		break;
 
 	case kActionNone:
-		UPDATE_PARAM(params->param1, getState()->time, 2700);
+		if (!Entity::updateParameter(params->param1, getState()->time, 2700))
+			break;
+
 		setup_function21();
 		break;
 


Commit: e13290a0286e86ee5c76f62ad74cb945a22cb38d
    https://github.com/scummvm/scummvm/commit/e13290a0286e86ee5c76f62ad74cb945a22cb38d
Author: Julien (julien at powerinbox.com)
Date: 2012-07-26T21:14:57-07:00

Commit Message:
LASTEXPRESS: Replace UPDATE_PARAM_CHECK macro

Changed paths:
    engines/lastexpress/entities/alexei.cpp
    engines/lastexpress/entities/entity.cpp
    engines/lastexpress/entities/entity.h
    engines/lastexpress/entities/entity_intern.h
    engines/lastexpress/entities/rebecca.cpp
    engines/lastexpress/entities/tatiana.cpp



diff --git a/engines/lastexpress/entities/alexei.cpp b/engines/lastexpress/entities/alexei.cpp
index c77b103..a2564dd 100644
--- a/engines/lastexpress/entities/alexei.cpp
+++ b/engines/lastexpress/entities/alexei.cpp
@@ -251,7 +251,7 @@ IMPLEMENT_FUNCTION(15, Alexei, function15)
 		break;
 
 	case kActionNone:
-		UPDATE_PARAM_CHECK(params->param2, getState()->time, params->param1)
+		if (Entity::updateParameterCheck(params->param2, getState()->time, params->param1)) {
 			if (getEntities()->isSomebodyInsideRestaurantOrSalon()) {
 				getData()->location = kLocationOutsideCompartment;
 
@@ -689,7 +689,7 @@ IMPLEMENT_FUNCTION(21, Alexei, function21)
 		break;
 
 	case kActionNone:
-		UPDATE_PARAM_CHECK(params->param2, getState()->time, params->param1)
+		if (Entity::updateParameterCheck(params->param2, getState()->time, params->param1)) {
 			getData()->location = kLocationOutsideCompartment;
 			getData()->inventoryItem = kItemNone;
 
diff --git a/engines/lastexpress/entities/entity.cpp b/engines/lastexpress/entities/entity.cpp
index 1989c46..664b3fa 100644
--- a/engines/lastexpress/entities/entity.cpp
+++ b/engines/lastexpress/entities/entity.cpp
@@ -613,6 +613,16 @@ bool Entity::updateParameter(uint &parameter, uint timeValue, uint delta) {
 	return true;
 }
 
+bool Entity::updateParameterCheck(uint &parameter, uint timeValue, uint delta) {
+	if (parameter && parameter >= timeValue)
+		return false;
+
+	if (!parameter)
+		parameter = (uint)(timeValue + delta);
+
+	return true;
+}
+
 void Entity::timeCheckSavepoint(TimeValue timeValue, uint &parameter, 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 139f8ec..ce8aa16 100644
--- a/engines/lastexpress/entities/entity.h
+++ b/engines/lastexpress/entities/entity.h
@@ -871,6 +871,7 @@ protected:
 	//////////////////////////////////////////////////////////////////////////
 
 	bool updateParameter(uint &parameter, uint time, uint delta);
+	bool updateParameterCheck(uint &parameter, uint time, uint delta);
 
 	void timeCheckSavepoint(TimeValue timeValue, uint &parameter, EntityIndex entity1, EntityIndex entity2, ActionIndex action);
 	void timeCheckObject(TimeValue timeValue, uint &parameter, ObjectIndex index, ObjectLocation location);
diff --git a/engines/lastexpress/entities/entity_intern.h b/engines/lastexpress/entities/entity_intern.h
index 23f5e49..4b97556 100644
--- a/engines/lastexpress/entities/entity_intern.h
+++ b/engines/lastexpress/entities/entity_intern.h
@@ -388,12 +388,6 @@ void class::setup_##name() { \
 
 #define UPDATE_PARAM_PROC_END }
 
-// Updating parameter with an added check (and code inside the check)
-#define UPDATE_PARAM_CHECK(parameter, type, value) \
-	if (!parameter || parameter < type) { \
-		if (!parameter) \
-			parameter = (uint)(type + value);
-
 } // End of namespace LastExpress
 
 #endif // LASTEXPRESS_ENTITY_INTERN_H
diff --git a/engines/lastexpress/entities/rebecca.cpp b/engines/lastexpress/entities/rebecca.cpp
index a890ebf..96deaaf 100644
--- a/engines/lastexpress/entities/rebecca.cpp
+++ b/engines/lastexpress/entities/rebecca.cpp
@@ -697,7 +697,7 @@ IMPLEMENT_FUNCTION(22, Rebecca, chapter1Handler)
 		if (params->param4 >= getState()->time) {
 label_callback_4:
 			if (params->param1) {
-				UPDATE_PARAM_CHECK(params->param5, getState()->time, 900)
+				if (Entity::updateParameterCheck(params->param5, getState()->time, 900)) {
 					if (getEntities()->isInSalon(kEntityPlayer)) {
 						setCallback(5);
 						setup_playSound("REB1013");
diff --git a/engines/lastexpress/entities/tatiana.cpp b/engines/lastexpress/entities/tatiana.cpp
index 76068aa..9c2c582 100644
--- a/engines/lastexpress/entities/tatiana.cpp
+++ b/engines/lastexpress/entities/tatiana.cpp
@@ -1023,7 +1023,7 @@ IMPLEMENT_FUNCTION(32, Tatiana, chapter3Handler)
 		}
 
 		if (parameters->param4 && parameters->param5) {
-			UPDATE_PARAM_CHECK(parameters->param4, getState()->time, 6300)
+			if (Entity::updateParameterCheck(parameters->param4, getState()->time, 6300)) {
 				if (getEntities()->isSomebodyInsideRestaurantOrSalon()) {
 					getData()->location = kLocationOutsideCompartment;
 


Commit: 8de4cb654782107100aaa3063cac79460546ed67
    https://github.com/scummvm/scummvm/commit/8de4cb654782107100aaa3063cac79460546ed67
Author: Julien (julien at powerinbox.com)
Date: 2012-07-26T21:14:58-07:00

Commit Message:
LASTEXPRESS: Replace UPDATE_PARAM_PROC and UPDATE_PARAM_PROC_TIME macros

Changed paths:
    engines/lastexpress/entities/abbot.cpp
    engines/lastexpress/entities/alexei.cpp
    engines/lastexpress/entities/anna.cpp
    engines/lastexpress/entities/august.cpp
    engines/lastexpress/entities/boutarel.cpp
    engines/lastexpress/entities/chapters.cpp
    engines/lastexpress/entities/cooks.cpp
    engines/lastexpress/entities/coudert.cpp
    engines/lastexpress/entities/entity.cpp
    engines/lastexpress/entities/entity.h
    engines/lastexpress/entities/entity_intern.h
    engines/lastexpress/entities/francois.cpp
    engines/lastexpress/entities/kahina.cpp
    engines/lastexpress/entities/kronos.cpp
    engines/lastexpress/entities/mertens.cpp
    engines/lastexpress/entities/milos.cpp
    engines/lastexpress/entities/mmeboutarel.cpp
    engines/lastexpress/entities/pascale.cpp
    engines/lastexpress/entities/rebecca.cpp
    engines/lastexpress/entities/servers0.cpp
    engines/lastexpress/entities/servers1.cpp
    engines/lastexpress/entities/tatiana.cpp
    engines/lastexpress/entities/vesna.cpp



diff --git a/engines/lastexpress/entities/abbot.cpp b/engines/lastexpress/entities/abbot.cpp
index c224b57..7916f88 100644
--- a/engines/lastexpress/entities/abbot.cpp
+++ b/engines/lastexpress/entities/abbot.cpp
@@ -1650,12 +1650,12 @@ IMPLEMENT_FUNCTION(48, Abbot, function48)
 		if (ENTITY_PARAM(0, 1))
 			getData()->inventoryItem = kItemInvalid;
 
-		UPDATE_PARAM_PROC(params->param1, getState()->time, 1800)
+		if (Entity::updateParameter(params->param1, getState()->time, 1800)) {
 			getData()->inventoryItem = kItemNone;
 
 			setCallback(4);
 			setup_updatePosition("126C", kCarRedSleeping, 52);
-		UPDATE_PARAM_PROC_END
+		}
 
 		TIME_CHECK_CALLBACK_INVENTORY(kTime2533500, params->param2, 5, setup_callbackActionRestaurantOrSalon);
 		break;
diff --git a/engines/lastexpress/entities/alexei.cpp b/engines/lastexpress/entities/alexei.cpp
index a2564dd..b31a995 100644
--- a/engines/lastexpress/entities/alexei.cpp
+++ b/engines/lastexpress/entities/alexei.cpp
@@ -751,7 +751,7 @@ IMPLEMENT_FUNCTION(22, Alexei, function22)
 		break;
 
 	case kActionNone:
-		UPDATE_PARAM_PROC(params->param2, getState()->time, params->param2)
+		if (Entity::updateParameter(params->param2, getState()->time, params->param2)) {
 			if (getEntities()->isSomebodyInsideRestaurantOrSalon()) {
 				getData()->location = kLocationOutsideCompartment;
 				getData()->inventoryItem = kItemNone;
@@ -760,7 +760,7 @@ IMPLEMENT_FUNCTION(22, Alexei, function22)
 				setup_updatePosition("103D", kCarRestaurant, 52);
 				break;
 			}
-		UPDATE_PARAM_PROC_END
+		}
 
 		if (params->param3 == kTimeInvalid || getState()->time <= kTime1111500)
 			break;
@@ -1333,22 +1333,22 @@ IMPLEMENT_FUNCTION(35, Alexei, function35)
 
 	case kActionNone:
 		if (getEntities()->isInSalon(kEntityPlayer)) {
-			UPDATE_PARAM_PROC(params->param2, getState()->time, 2700)
+			if (Entity::updateParameter(params->param2, getState()->time, 2700)) {
 				setCallback(1);
 				setup_callbackActionRestaurantOrSalon();
 				break;
-			UPDATE_PARAM_PROC_END
+			}
 		} else {
 			params->param2 = 0;
 		}
 
-		UPDATE_PARAM_PROC(params->param3, getState()->time, params->param1)
+		if (Entity::updateParameter(params->param3, getState()->time, params->param1)) {
 			if (getEntities()->isSomebodyInsideRestaurantOrSalon()) {
 				setCallback(3);
 				setup_function15();
 				break;
 			}
-		UPDATE_PARAM_PROC_END
+		}
 
 label_callback_3:
 		if (!Entity::updateParameter(params->param4, getState()->time, 9000))
diff --git a/engines/lastexpress/entities/anna.cpp b/engines/lastexpress/entities/anna.cpp
index 80a5144..ab7163a 100644
--- a/engines/lastexpress/entities/anna.cpp
+++ b/engines/lastexpress/entities/anna.cpp
@@ -198,12 +198,12 @@ IMPLEMENT_FUNCTION(12, Anna, function12)
 			params->param2 = 1;
 
 		if (params->param6) {
-			UPDATE_PARAM_PROC(params->param7, getState()->timeTicks, 75)
+			if (Entity::updateParameter(params->param7, getState()->timeTicks, 75)) {
 				getSavePoints()->push(kEntityAnna, kEntityAnna, kActionEndSound);
 
 				params->param6 = 0;
 				params->param7 = 0;
-			UPDATE_PARAM_PROC_END
+			}
 		}
 
 		if (params->param4) {
@@ -669,11 +669,11 @@ IMPLEMENT_FUNCTION_I(18, Anna, function18, TimeValue)
 		}
 
 		if (params->param5 && !params->param4) {
-			UPDATE_PARAM_PROC(params->param6, getState()->time, 900)
+			if (Entity::updateParameter(params->param6, getState()->time, 900)) {
 				params->param2 |= kItemScarf;
 				params->param5 = 0;
 				params->param6 = 0;
-			UPDATE_PARAM_PROC_END
+			}
 		}
 
 		if (params->param3) {
@@ -1152,11 +1152,11 @@ IMPLEMENT_FUNCTION(29, Anna, function29)
 
 	case kActionNone:
 		if (params->param2) {
-			UPDATE_PARAM_PROC(params->param3, getState()->time, 900)
+			if (Entity::updateParameter(params->param3, getState()->time, 900)) {
 				getData()->inventoryItem = (InventoryItem)(getData()->inventoryItem | kItemScarf);
 				params->param2 = 0;
 				params->param3 = 0;
-			UPDATE_PARAM_PROC_END
+			}
 		}
 
 		if (params->param1) {
@@ -1415,11 +1415,11 @@ IMPLEMENT_FUNCTION(34, Anna, function34)
 
 	case kActionNone:
 		if (!params->param1 && getEntities()->isPlayerPosition(kCarRedSleeping, 60)) {
-			UPDATE_PARAM_PROC(params->param2, getState()->time, 150)
+			if (Entity::updateParameter(params->param2, getState()->time, 150)) {
 				setCallback(1);
 				setup_draw("419B");
 				break;
-			UPDATE_PARAM_PROC_END
+			}
 		}
 
 label_callback_1:
@@ -2098,11 +2098,11 @@ IMPLEMENT_FUNCTION(48, Anna, function48)
 			break;
 
 		if (params->param3 != kTimeInvalid && getState()->time > kTime1969200) {
-			UPDATE_PARAM_PROC_TIME(kTime1983600, (!getEntities()->isInRestaurant(kEntityPlayer) || getSoundQueue()->isBuffered(kEntityBoutarel)), params->param3, 150)
+			if (Entity::updateParameterTime(kTime1983600, (!getEntities()->isInRestaurant(kEntityPlayer) || getSoundQueue()->isBuffered(kEntityBoutarel)), params->param3, 150)) {
 				setCallback(3);
 				setup_playSound("Aug3007A");
 				break;
-			UPDATE_PARAM_PROC_END
+			}
 		}
 
 label_callback_4:
@@ -2392,18 +2392,18 @@ IMPLEMENT_FUNCTION(53, Anna, function53)
 
 	case kActionNone:
 		if (getProgress().field_48 && params->param5 != kTimeInvalid) {
-			UPDATE_PARAM_PROC_TIME(kTime2065500, !getEntities()->isPlayerInCar(kCarRedSleeping), params->param5, 150)
+			if (Entity::updateParameterTime(kTime2065500, !getEntities()->isPlayerInCar(kCarRedSleeping), params->param5, 150)) {
 				setup_function54();
 				break;
-			UPDATE_PARAM_PROC_END
+			}
 		}
 
 		if (params->param3) {
-			UPDATE_PARAM_PROC(params->param6, getState()->time, 9000)
+			if (Entity::updateParameter(params->param6, getState()->time, 9000)) {
 				params->param4 = !params->param4;
 				getEntities()->drawSequenceLeft(kEntityAnna, params->param4 ? "417B" : "417A");
 				params->param6 = 0;
-			UPDATE_PARAM_PROC_END
+			}
 		}
 
 		if (params->param1) {
@@ -2546,11 +2546,11 @@ IMPLEMENT_FUNCTION(54, Anna, function54)
 		if (params->param3) {
 			TIME_CHECK(kTime2079000, params->param5, setup_function55);
 
-			UPDATE_PARAM_PROC(params->param6, getState()->time, 9000)
+			if (Entity::updateParameter(params->param6, getState()->time, 9000)) {
 				params->param4 = !params->param4;
 				getEntities()->drawSequenceLeft(kEntityAnna, params->param4 ? "417B" : "417A");
 				params->param6 = 0;
-			UPDATE_PARAM_PROC_END
+			}
 		}
 
 		if (params->param1) {
diff --git a/engines/lastexpress/entities/august.cpp b/engines/lastexpress/entities/august.cpp
index d874c66..5ae8d11 100644
--- a/engines/lastexpress/entities/august.cpp
+++ b/engines/lastexpress/entities/august.cpp
@@ -538,10 +538,10 @@ label_continue:
 			break;
 
 		if (params->param6) {
-			UPDATE_PARAM_PROC(CURRENT_PARAM(1, 1), getState()->time, 6300)
+			if (Entity::updateParameter(CURRENT_PARAM(1, 1), getState()->time, 6300)) {
 				params->param6 = 0;
 				CURRENT_PARAM(1, 1) = 0;
-			UPDATE_PARAM_PROC_END
+			}
 		}
 
 		if (!params->param4
@@ -804,7 +804,7 @@ IMPLEMENT_FUNCTION_I(23, August, function23, TimeValue)
 			}
 
 label_callback_8:
-			UPDATE_PARAM_PROC(CURRENT_PARAM(1, 4), getState()->timeTicks, 75)
+			if (Entity::updateParameter(CURRENT_PARAM(1, 4), getState()->timeTicks, 75)) {
 				getEntities()->exitCompartment(kEntityAugust, kObjectCompartment1, true);
 
 				if (getProgress().eventCorpseMovedFromFloor) {
@@ -820,7 +820,7 @@ label_callback_8:
 					setup_savegame(kSavegameTypeEvent, kEventAugustFindCorpse);
 				}
 				break;
-			UPDATE_PARAM_PROC_END
+			}
 
 label_callback_9:
 			if (params->param3 && params->param1 < getState()->time && !CURRENT_PARAM(1, 5)) {
@@ -1634,9 +1634,9 @@ IMPLEMENT_FUNCTION(32, August, function32)
 		break;
 
 	case kActionNone:
-		UPDATE_PARAM_PROC_TIME(kTime1179000, (!getEntities()->isInSalon(kEntityAnna) || getEntities()->isInSalon(kEntityPlayer)), params->param6, 0);
+		if (Entity::updateParameterTime(kTime1179000, (!getEntities()->isInSalon(kEntityAnna) || getEntities()->isInSalon(kEntityPlayer)), params->param6, 0)) {
 			getSavePoints()->push(kEntityAugust, kEntityAnna, kAction123712592);
-		UPDATE_PARAM_PROC_END
+		}
 
 		if (params->param1 && getEntities()->isSomebodyInsideRestaurantOrSalon()) {
 			if (!params->param4) {
@@ -1645,13 +1645,13 @@ IMPLEMENT_FUNCTION(32, August, function32)
 			}
 
 			if (params->param7 != kTimeInvalid && params->param4 < getState()->time) {
-				UPDATE_PARAM_PROC_TIME(params->param5, getEntities()->isInSalon(kEntityPlayer), params->param7, 0);
+				if (Entity::updateParameterTime((TimeValue)params->param5, getEntities()->isInSalon(kEntityPlayer), params->param7, 0)) {
 					getData()->location = kLocationOutsideCompartment;
 
 					setCallback(5);
 					setup_updatePosition("109D", kCarRestaurant, 56);
 					break;
-				UPDATE_PARAM_PROC_END
+				}
 			}
 		}
 
@@ -3224,9 +3224,9 @@ IMPLEMENT_FUNCTION(63, August, function63)
 		break;
 
 	case kActionNone:
-		UPDATE_PARAM_PROC(params->param3, getState()->time, 1800)
+		if (Entity::updateParameter(params->param3, getState()->time, 1800)) {
 			getData()->inventoryItem = kItemInvalid;
-		UPDATE_PARAM_PROC_END
+		}
 
 		if (getState()->time > kTime2488500 && !params->param4) {
 			params->param4 = 1;
diff --git a/engines/lastexpress/entities/boutarel.cpp b/engines/lastexpress/entities/boutarel.cpp
index ab8a0b9..2a8c660 100644
--- a/engines/lastexpress/entities/boutarel.cpp
+++ b/engines/lastexpress/entities/boutarel.cpp
@@ -646,11 +646,11 @@ IMPLEMENT_FUNCTION(20, Boutarel, function20)
 			break;
 
 		if (!params->param2) {
-			UPDATE_PARAM_PROC(params->param3, getState()->time, 4500)
+			if (Entity::updateParameter(params->param3, getState()->time, 4500)) {
 				setCallback(3);
 				setup_playSound("MRB1078A");
 				break;
-			UPDATE_PARAM_PROC_END
+			}
 		}
 
 		TIME_CHECK_CALLBACK_1(kTime1138500, params->param4, 4, setup_function14, false);
@@ -936,9 +936,9 @@ IMPLEMENT_FUNCTION(29, Boutarel, function29)
 		break;
 
 	case kActionNone:
-		UPDATE_PARAM_PROC(params->param2, getState()->time, 450)
+		if (Entity::updateParameter(params->param2, getState()->time, 450)) {
 			getSavePoints()->push(kEntityBoutarel, kEntityServers1, kAction256200848);
-		UPDATE_PARAM_PROC_END
+		}
 
 		if (!params->param1)
 			break;
diff --git a/engines/lastexpress/entities/chapters.cpp b/engines/lastexpress/entities/chapters.cpp
index 7616580..c563117 100644
--- a/engines/lastexpress/entities/chapters.cpp
+++ b/engines/lastexpress/entities/chapters.cpp
@@ -393,13 +393,13 @@ IMPLEMENT_FUNCTION(8, Chapters, chapter1Handler)
 		if (!getProgress().isTrainRunning || getState()->time >= kTime1458000)
 			goto label_processStations;
 
-		UPDATE_PARAM_PROC(params->param6, getState()->timeTicks, params->param2)
+		if (Entity::updateParameter(params->param6, getState()->timeTicks, params->param2)) {
 			// Play sound FX
 			getSound()->playLocomotiveSound();
 
 			params->param2 = 225 * (4 * rnd(5) + 20);
 			params->param6 = 0;
-		UPDATE_PARAM_PROC_END
+		}
 
 label_processStations:
 		// Process stations
@@ -896,15 +896,15 @@ IMPLEMENT_FUNCTION(15, Chapters, chapter3Handler)
 
 	case kActionNone:
 		if (getProgress().isTrainRunning) {
-			UPDATE_PARAM_PROC(params->param4, getState()->timeTicks, params->param1)
+			if (Entity::updateParameter(params->param4, getState()->timeTicks, params->param1)) {
 				getSound()->playLocomotiveSound();
 
 				params->param1 = 225 * (4 * rnd(5) + 20);
 				params->param4 = 0;
-			UPDATE_PARAM_PROC_END
+			}
 		}
 
-		UPDATE_PARAM_PROC(params->param5, getState()->timeTicks, params->param2)
+		if (Entity::updateParameter(params->param5, getState()->timeTicks, params->param2)) {
 			switch (rnd(2)) {
 			default:
 				break;
@@ -920,7 +920,7 @@ IMPLEMENT_FUNCTION(15, Chapters, chapter3Handler)
 
 			params->param2 = 225 * (4 * rnd(6) + 8);
 			params->param5 = 0;
-		UPDATE_PARAM_PROC_END
+		}
 
 		TIME_CHECK_CALLBACK_2(kTimeEnterSalzbourg, params->param6, 1, setup_enterStation, "Salzburg", kCitySalzbourg);
 
@@ -1195,15 +1195,15 @@ IMPLEMENT_FUNCTION(19, Chapters, chapter4Handler)
 
 	case kActionNone:
 		if (getProgress().isTrainRunning) {
-			UPDATE_PARAM_PROC(params->param6, getState()->timeTicks, params->param4);
+			if (Entity::updateParameter(params->param6, getState()->timeTicks, params->param4)) {
 				getSound()->playLocomotiveSound();
 
 				params->param4 = 225 * (4 * rnd(5) + 20);
 				params->param6 = 0;
-			UPDATE_PARAM_PROC_END
+			}
 		}
 
-		UPDATE_PARAM_PROC(params->param7, getState()->timeTicks, params->param5)
+		if (Entity::updateParameter(params->param7, getState()->timeTicks, params->param5)) {
 			switch (rnd(2)) {
 			default:
 				break;
@@ -1219,7 +1219,7 @@ IMPLEMENT_FUNCTION(19, Chapters, chapter4Handler)
 
 			params->param5 = 225 * (4 * rnd(6) + 8);
 			params->param7 = 0;
-		UPDATE_PARAM_PROC_END
+		}
 
 		TIME_CHECK_CALLBACK_2(kTimeEnterPoszony, params->param8, 1, setup_enterStation, "Pozsony", kCityPoszony);
 
diff --git a/engines/lastexpress/entities/cooks.cpp b/engines/lastexpress/entities/cooks.cpp
index a3fb69a..62a1e0f 100644
--- a/engines/lastexpress/entities/cooks.cpp
+++ b/engines/lastexpress/entities/cooks.cpp
@@ -434,12 +434,12 @@ IMPLEMENT_FUNCTION(11, Cooks, chapter3Handler)
 		break;
 
 	case kActionNone:
-		UPDATE_PARAM_PROC(params->param4, getState()->time, params->param2)
+		if (Entity::updateParameter(params->param4, getState()->time, params->param2)) {
 			// Broken plate sound
 			getSound()->playSound(kEntityPlayer, "LIB122",  getSound()->getSoundFlag(kEntityCooks));
 			params->param2 = 225 * (4 * rnd(30) + 120);
 			params->param4 = 0;
-		UPDATE_PARAM_PROC_END
+		}
 
 		if (getState()->time > kTime2079000 && !params->param5) {
 			params->param1 = 0;
diff --git a/engines/lastexpress/entities/coudert.cpp b/engines/lastexpress/entities/coudert.cpp
index c589b8f..4458632 100644
--- a/engines/lastexpress/entities/coudert.cpp
+++ b/engines/lastexpress/entities/coudert.cpp
@@ -908,9 +908,9 @@ IMPLEMENT_FUNCTION_II(20, Coudert, function20, ObjectIndex, ObjectIndex)
 		break;
 
 	case kActionNone:
-		UPDATE_PARAM_PROC(CURRENT_PARAM(1, 3), getState()->time, 300)
+		if (Entity::updateParameter(CURRENT_PARAM(1, 3), getState()->time, 300)) {
 			getSound()->playSound(kEntityPlayer, "ZFX1004", getSound()->getSoundFlag(kEntityCoudert));
-		UPDATE_PARAM_PROC_END
+		}
 
 		if (!Entity::updateParameter(CURRENT_PARAM(1, 4), getState()->time, 900))
 			break;
@@ -2281,14 +2281,14 @@ label_callback_9:
 
 label_callback_10:
 		if (getState()->time > kTime1189800 && !ENTITY_PARAM(0, 1) && !ENTITY_PARAM(2, 1)) {
-			UPDATE_PARAM_PROC(params->param3, getState()->time, 2700);
+			if (Entity::updateParameter(params->param3, getState()->time, 2700)) {
 				ENTITY_PARAM(0, 2) = 1;
 				ENTITY_PARAM(0, 1) = 1;
 
 				getEntities()->drawSequenceLeft(kEntityCoudert, "697F");
 
 				params->param3 = 0;
-			UPDATE_PARAM_PROC_END
+			}
 		}
 
 		if (!ENTITY_PARAM(0, 2))
@@ -3539,11 +3539,11 @@ label_callback_1:
 				params->param2 = (uint)(getState()->time + 4500);
 
 			if (params->param3 != kTimeInvalid) {
-				UPDATE_PARAM_PROC_TIME(params->param2, !getEntities()->isPlayerInCar(kCarRedSleeping), params->param3, 0)
+				if (Entity::updateParameterTime((TimeValue)params->param2, !getEntities()->isPlayerInCar(kCarRedSleeping), params->param3, 0)) {
 					setCallback(2);
 					setup_function55();
 					break;
-				UPDATE_PARAM_PROC_END
+				}
 			}
 		}
 
diff --git a/engines/lastexpress/entities/entity.cpp b/engines/lastexpress/entities/entity.cpp
index 664b3fa..04ae649 100644
--- a/engines/lastexpress/entities/entity.cpp
+++ b/engines/lastexpress/entities/entity.cpp
@@ -601,11 +601,11 @@ void Entity::callbackAction() {
 // Helper functions
 //////////////////////////////////////////////////////////////////////////
 
-bool Entity::updateParameter(uint &parameter, uint timeValue, uint delta) {
+bool Entity::updateParameter(uint &parameter, uint timeType, uint delta) {
 	if (!parameter)
-		parameter = (uint)(timeValue + delta);
+		parameter = (uint)(timeType + delta);
 
-	if (parameter >= timeValue)
+	if (parameter >= timeType)
 		return false;
 
 	parameter = kTimeInvalid;
@@ -613,12 +613,26 @@ bool Entity::updateParameter(uint &parameter, uint timeValue, uint delta) {
 	return true;
 }
 
-bool Entity::updateParameterCheck(uint &parameter, uint timeValue, uint delta) {
-	if (parameter && parameter >= timeValue)
+bool Entity::updateParameterTime(TimeValue timeValue, bool check, uint &parameter, uint delta) {
+	if (getState()->time <= timeValue) {
+		if (check || !parameter)
+			parameter = (uint)(getState()->time + delta);
+	}
+
+	if (parameter >= getState()->time && getState()->time <= timeValue)
+		return false;
+
+	parameter = kTimeInvalid;
+
+	return true;
+}
+
+bool Entity::updateParameterCheck(uint &parameter, uint timeType, uint delta) {
+	if (parameter && parameter >= timeType)
 		return false;
 
 	if (!parameter)
-		parameter = (uint)(timeValue + delta);
+		parameter = (uint)(timeType + delta);
 
 	return true;
 }
diff --git a/engines/lastexpress/entities/entity.h b/engines/lastexpress/entities/entity.h
index ce8aa16..73114a1 100644
--- a/engines/lastexpress/entities/entity.h
+++ b/engines/lastexpress/entities/entity.h
@@ -870,8 +870,9 @@ protected:
 	// Helper functions
 	//////////////////////////////////////////////////////////////////////////
 
-	bool updateParameter(uint &parameter, uint time, uint delta);
-	bool updateParameterCheck(uint &parameter, uint time, uint delta);
+	bool updateParameter(uint &parameter, uint timeType, uint delta);
+	bool updateParameterCheck(uint &parameter, uint timeType, uint delta);
+	bool updateParameterTime(TimeValue timeValue, bool check, uint &parameter, uint delta);
 
 	void timeCheckSavepoint(TimeValue timeValue, uint &parameter, EntityIndex entity1, EntityIndex entity2, ActionIndex action);
 	void timeCheckObject(TimeValue timeValue, uint &parameter, ObjectIndex index, ObjectLocation location);
diff --git a/engines/lastexpress/entities/entity_intern.h b/engines/lastexpress/entities/entity_intern.h
index 4b97556..c4fc36a 100644
--- a/engines/lastexpress/entities/entity_intern.h
+++ b/engines/lastexpress/entities/entity_intern.h
@@ -371,23 +371,6 @@ void class::setup_##name() { \
 	parameter = kTimeInvalid; \
 }
 
-// Updating parameter with code inside the check
-#define UPDATE_PARAM_PROC(parameter, type, value) \
-	if (!parameter) \
-		parameter = (uint)(type + value); \
-	if (parameter < type) { \
-		parameter = kTimeInvalid;
-
-#define UPDATE_PARAM_PROC_TIME(timeValue, test, parameter, value) \
-	if (getState()->time <= timeValue) { \
-		if (test || !parameter) \
-			parameter = (uint)(getState()->time + value); \
-	} \
-	if (parameter < getState()->time || getState()->time > timeValue) { \
-		parameter = kTimeInvalid;
-
-#define UPDATE_PARAM_PROC_END }
-
 } // End of namespace LastExpress
 
 #endif // LASTEXPRESS_ENTITY_INTERN_H
diff --git a/engines/lastexpress/entities/francois.cpp b/engines/lastexpress/entities/francois.cpp
index b99dbe4..e4d401d 100644
--- a/engines/lastexpress/entities/francois.cpp
+++ b/engines/lastexpress/entities/francois.cpp
@@ -278,7 +278,7 @@ IMPLEMENT_FUNCTION_I(11, Francois, function11, TimeValue)
 	case kActionNone:
 		if (!getSoundQueue()->isBuffered(kEntityFrancois)) {
 
-			UPDATE_PARAM_PROC(CURRENT_PARAM(1, 1), getState()->timeTicks, params->param6)
+			if (Entity::updateParameter(CURRENT_PARAM(1, 1), getState()->timeTicks, params->param6)) {
 				switch (rnd(7)) {
 				default:
 					break;
@@ -311,7 +311,7 @@ IMPLEMENT_FUNCTION_I(11, Francois, function11, TimeValue)
 
 				params->param6 = 15 * rnd(7);
 				CURRENT_PARAM(1, 1) = 0;
-			UPDATE_PARAM_PROC_END
+			}
 		}
 
 		if (!getEntities()->hasValidFrame(kEntityFrancois) || !getEntities()->isWalkingOppositeToPlayer(kEntityFrancois))
@@ -998,11 +998,11 @@ label_callback_5:
 		}
 
 		if (params->param5 != kTimeInvalid) {
-			UPDATE_PARAM_PROC_TIME(kTimeEnd, !getEntities()->isDistanceBetweenEntities(kEntityFrancois, kEntityPlayer, 2000), params->param5, 75);
+			if (Entity::updateParameterTime(kTimeEnd, !getEntities()->isDistanceBetweenEntities(kEntityFrancois, kEntityPlayer, 2000), params->param5, 75)) {
 				setCallback(6);
 				setup_playSound("Fra2010");
 				break;
-			UPDATE_PARAM_PROC_END
+			}
 		}
 
 label_callback_6:
diff --git a/engines/lastexpress/entities/kahina.cpp b/engines/lastexpress/entities/kahina.cpp
index 2124de1..08f845f 100644
--- a/engines/lastexpress/entities/kahina.cpp
+++ b/engines/lastexpress/entities/kahina.cpp
@@ -394,10 +394,10 @@ IMPLEMENT_FUNCTION(15, Kahina, function15)
 
 	case kActionNone:
 		if (params->param2 != kTimeInvalid) {
-			UPDATE_PARAM_PROC_TIME(params->param1, !getEntities()->isPlayerInCar(kCarRedSleeping), params->param2, 0)
+			if (Entity::updateParameterTime((TimeValue)params->param1, !getEntities()->isPlayerInCar(kCarRedSleeping), params->param2, 0)) {
 				setCallback(9);
 				setup_updateEntity(kCarRedSleeping, kPosition_4070);
-			UPDATE_PARAM_PROC_END
+			}
 		}
 		break;
 
@@ -580,18 +580,18 @@ IMPLEMENT_FUNCTION(17, Kahina, chapter2Handler)
 
 	case kActionNone:
 		if (params->param1) {
-			UPDATE_PARAM_PROC(params->param2, getState()->time, 9000)
+			if (Entity::updateParameter(params->param2, getState()->time, 9000)) {
 				params->param1 = 1;
 				params->param2 = 0;
-			UPDATE_PARAM_PROC_END
+			}
 		}
 
 		if (getEvent(kEventKahinaAskSpeakFirebird) && getEvent(kEventKronosConversationFirebird) && getEntities()->isInsideTrainCar(kEntityPlayer, kCarKronos)) {
-			UPDATE_PARAM_PROC(params->param3, getState()->time, 900)
+			if (Entity::updateParameter(params->param3, getState()->time, 900)) {
 				setCallback(1);
 				setup_savegame(kSavegameTypeEvent, kEventKronosConversationFirebird);
 				break;
-			UPDATE_PARAM_PROC_END
+			}
 		}
 
 label_callback_3:
@@ -785,10 +785,10 @@ label_callback_2:
 		}
 
 		if (!params->param1) {
-			UPDATE_PARAM_PROC(params->param3, getState()->time, 9000)
+			if (Entity::updateParameter(params->param3, getState()->time, 9000)) {
 				params->param1 = 1;
 				params->param3 = 0;
-			UPDATE_PARAM_PROC_END
+			}
 		}
 
 		if (getEvent(kEventKahinaAskSpeakFirebird)
@@ -927,11 +927,11 @@ IMPLEMENT_FUNCTION(21, Kahina, function21)
 				params->param3 = (uint)getState()->time + 4500;
 
 			if (params->param6 != kTimeInvalid) {
-				UPDATE_PARAM_PROC_TIME(params->param3, (getEntities()->isPlayerPosition(kCarKronos, 80) || getEntities()->isPlayerPosition(kCarKronos, 88)), params->param5, 0)
+				if (Entity::updateParameterTime((TimeValue)params->param3, (getEntities()->isPlayerPosition(kCarKronos, 80) || getEntities()->isPlayerPosition(kCarKronos, 88)), params->param5, 0)) {
 					setCallback(2);
 					setup_function23();
 					break;
-				UPDATE_PARAM_PROC_END
+				}
 			}
 		}
 
@@ -942,14 +942,14 @@ label_callback_2:
 				params->param4 = (uint)getState()->time + 4500;
 
 			if (params->param6 != kTimeInvalid) {
-				UPDATE_PARAM_PROC_TIME(params->param3, (getEntities()->isPlayerPosition(kCarKronos, 80) || getEntities()->isPlayerPosition(kCarKronos, 88)), params->param6, 0)
+				if (Entity::updateParameterTime((TimeValue)params->param3, (getEntities()->isPlayerPosition(kCarKronos, 80) || getEntities()->isPlayerPosition(kCarKronos, 88)), params->param6, 0)) {
 					getSound()->playSound(kEntityPlayer, "LIB014", getSound()->getSoundFlag(kEntityKahina));
 					getSound()->playSound(kEntityPlayer, "LIB015", getSound()->getSoundFlag(kEntityKahina));
 
 					getEntities()->drawSequenceLeft(kEntityKahina, "202a");
 
 					params->param2 = 0;
-				UPDATE_PARAM_PROC_END
+				}
 			}
 		}
 
diff --git a/engines/lastexpress/entities/kronos.cpp b/engines/lastexpress/entities/kronos.cpp
index c9fe0dc..5dd790c 100644
--- a/engines/lastexpress/entities/kronos.cpp
+++ b/engines/lastexpress/entities/kronos.cpp
@@ -293,10 +293,10 @@ IMPLEMENT_FUNCTION(15, Kronos, function15)
 
 	case kActionNone:
 		if (params->param1 && !getEntities()->isInSalon(kEntityBoutarel)) {
-			UPDATE_PARAM_PROC(params->param2, getState()->timeTicks, 75)
+			if (Entity::updateParameter(params->param2, getState()->timeTicks, 75)) {
 				setup_function16();
 				break;
-			UPDATE_PARAM_PROC_END
+			}
 		}
 
 		if (params->param3 != kTimeInvalid && getState()->time > kTime2002500) {
@@ -526,9 +526,9 @@ IMPLEMENT_FUNCTION(20, Kronos, function20)
 		}
 
 		if (CURRENT_PARAM(1, 2) != kTimeInvalid && params->param7 < getState()->time) {
-			UPDATE_PARAM_PROC_TIME(params->param8, !params->param1, CURRENT_PARAM(1, 2), 450)
+			if (Entity::updateParameterTime((TimeValue)params->param8, !params->param1, CURRENT_PARAM(1, 2), 450)) {
 				getSavePoints()->push(kEntityKronos, kEntityKahina, kAction237555748);
-			UPDATE_PARAM_PROC_END
+			}
 		}
 
 		if (!params->param1)
diff --git a/engines/lastexpress/entities/mertens.cpp b/engines/lastexpress/entities/mertens.cpp
index c093ac4..9d9225f 100644
--- a/engines/lastexpress/entities/mertens.cpp
+++ b/engines/lastexpress/entities/mertens.cpp
@@ -534,20 +534,20 @@ IMPLEMENT_FUNCTION_II(13, Mertens, function13, bool, bool)
 		Entity::savegameBloodJacket();
 
 		if (!params->param2 && !params->param3) {
-			UPDATE_PARAM_PROC(params->param4, getState()->timeTicks, 75)
+			if (Entity::updateParameter(params->param4, getState()->timeTicks, 75)) {
 				getData()->inventoryItem = kItemNone;
 				setCallback(5);
 				setup_function18();
 				break;
-			UPDATE_PARAM_PROC_END
+			}
 		}
 
-		UPDATE_PARAM_PROC(params->param5, getState()->timeTicks, 225)
+		if (Entity::updateParameter(params->param5, getState()->timeTicks, 225)) {
 			getData()->inventoryItem = kItemNone;
 			setCallback(6);
 			setup_function18();
 			break;
-		UPDATE_PARAM_PROC_END
+		}
 
 		getData()->inventoryItem = (getProgress().chapter == kChapter1
 								 && !ENTITY_PARAM(2, 1)
@@ -1059,9 +1059,9 @@ IMPLEMENT_FUNCTION_II(21, Mertens, function21, ObjectIndex, ObjectIndex)
 		break;
 
 	case kActionNone:
-		UPDATE_PARAM_PROC(CURRENT_PARAM(1, 4), getState()->time, 300)
+		if (Entity::updateParameter(CURRENT_PARAM(1, 4), getState()->time, 300)) {
 			getSound()->playSound(kEntityPlayer, "ZFX1004", getSound()->getSoundFlag(kEntityMertens));
-		UPDATE_PARAM_PROC_END
+		}
 
 		if (!Entity::updateParameter(CURRENT_PARAM(1, 5), getState()->time, 900))
 			break;
@@ -1616,13 +1616,13 @@ IMPLEMENT_FUNCTION_I(27, Mertens, tylerCompartment, MertensActionType)
 			break;
 		}
 
-		UPDATE_PARAM_PROC(params->param2, getState()->timeTicks, 150)
+		if (Entity::updateParameter(params->param2, getState()->timeTicks, 150)) {
 			getObjects()->update(kObjectCompartment1, kEntityPlayer, getObjects()->get(kObjectCompartment1).location, kCursorNormal, kCursorNormal);
 
 			setCallback(10);
 			setup_playSound16("CON1018A");
 			break;
-		UPDATE_PARAM_PROC_END
+		}
 
 label_callback10:
 		if (!params->param3)
@@ -3025,11 +3025,11 @@ IMPLEMENT_FUNCTION(42, Mertens, function42)
 
 label_callback_8:
 		if (getState()->time > kTime1215000 && !ENTITY_PARAM(0, 1) && !ENTITY_PARAM(2, 1)) {
-			UPDATE_PARAM_PROC(params->param5, getState()->time, 2700)
+			if (Entity::updateParameter(params->param5, getState()->time, 2700)) {
 				getEntities()->drawSequenceLeft(kEntityMertens, "601E");
 				ENTITY_PARAM(0, 1) = 1;
 				params->param5 = 0;
-			UPDATE_PARAM_PROC_END
+			}
 		}
 
 		if (ENTITY_PARAM(0, 8)) {
diff --git a/engines/lastexpress/entities/milos.cpp b/engines/lastexpress/entities/milos.cpp
index 8ebb23b..5c5d481 100644
--- a/engines/lastexpress/entities/milos.cpp
+++ b/engines/lastexpress/entities/milos.cpp
@@ -176,11 +176,11 @@ IMPLEMENT_FUNCTION_I(11, Milos, function11, TimeValue)
 		}
 
 		if (params->param2) {
-			UPDATE_PARAM_PROC(params->param8,  getState()->timeTicks, 75)
+			if (Entity::updateParameter(params->param8,  getState()->timeTicks, 75)) {
 				params->param2 = 0;
 				params->param3 = 1;
 				getObjects()->update(kObjectCompartmentG, kEntityMilos, kObjectLocation1, kCursorNormal, kCursorNormal);
-			UPDATE_PARAM_PROC_END
+			}
 		}
 
 		params->param8 = 0;
@@ -189,10 +189,10 @@ IMPLEMENT_FUNCTION_I(11, Milos, function11, TimeValue)
 			break;
 
 		if (params->param6) {
-			UPDATE_PARAM_PROC(CURRENT_PARAM(1, 1), getState()->time, 4500)
+			if (Entity::updateParameter(CURRENT_PARAM(1, 1), getState()->time, 4500)) {
 				params->param6 = 0;
 				CURRENT_PARAM(1, 1) = 0;
-			UPDATE_PARAM_PROC_END
+			}
 		}
 
 		if (!getProgress().field_CC) {
@@ -730,11 +730,11 @@ IMPLEMENT_FUNCTION(15, Milos, chapter1Handler)
 		}
 
 		if (getEntities()->isPlayerPosition(kCarRestaurant, 61) && !params->param1) {
-			UPDATE_PARAM_PROC(params->param4, getState()->timeTicks, 45)
+			if (Entity::updateParameter(params->param4, getState()->timeTicks, 45)) {
 				setCallback(1);
 				setup_draw("009C");
 				break;
-			UPDATE_PARAM_PROC_END
+			}
 		}
 
 		if (getEntities()->isPlayerPosition(kCarRestaurant, 70) && !params->param2) {
@@ -1287,10 +1287,10 @@ IMPLEMENT_FUNCTION(25, Milos, function25)
 
 	case kActionNone:
 		if (!getEvent(kEventMilosCompartmentVisitTyler) && !getProgress().field_54 && !ENTITY_PARAM(0, 4)) {
-			UPDATE_PARAM_PROC(params->param3, getState()->time, 13500)
+			if (Entity::updateParameter(params->param3, getState()->time, 13500)) {
 				getSavePoints()->push(kEntityMilos, kEntityVesna, kAction155913424);
 				params->param3 = 0;
-			UPDATE_PARAM_PROC_END
+			}
 		}
 
 		if (params->param1) {
diff --git a/engines/lastexpress/entities/mmeboutarel.cpp b/engines/lastexpress/entities/mmeboutarel.cpp
index 323e686..888adeb 100644
--- a/engines/lastexpress/entities/mmeboutarel.cpp
+++ b/engines/lastexpress/entities/mmeboutarel.cpp
@@ -400,7 +400,7 @@ IMPLEMENT_FUNCTION(13, MmeBoutarel, function13)
 
 	case kActionNone:
 		if (!getSoundQueue()->isBuffered(kEntityMmeBoutarel) && params->param6 != kTimeInvalid) {
-			UPDATE_PARAM_PROC_TIME(params->param1, !getEntities()->isDistanceBetweenEntities(kEntityMmeBoutarel, kEntityPlayer, 2000), params->param6, 0)
+			if (Entity::updateParameterTime((TimeValue)params->param1, !getEntities()->isDistanceBetweenEntities(kEntityMmeBoutarel, kEntityPlayer, 2000), params->param6, 0)) {
 				getObjects()->update(kObjectCompartmentD, kEntityPlayer, kObjectLocation1, kCursorNormal, kCursorNormal);
 				getObjects()->update(kObject51, kEntityPlayer, kObjectLocation1, kCursorNormal, kCursorNormal);
 
@@ -412,16 +412,16 @@ IMPLEMENT_FUNCTION(13, MmeBoutarel, function13)
 				setCallback(1);
 				setup_playSound("MME1037");
 				break;
-			UPDATE_PARAM_PROC_END
+			}
 		}
 
 label_callback_1:
 		if (getProgress().field_24 && params->param7 != kTimeInvalid) {
-			UPDATE_PARAM_PROC_TIME(kTime1093500, (!params->param5 || !getEntities()->isPlayerInCar(kCarRedSleeping)), params->param7, 0)
+			if (Entity::updateParameterTime(kTime1093500, (!params->param5 || !getEntities()->isPlayerInCar(kCarRedSleeping)), params->param7, 0)) {
 				setCallback(2);
 				setup_function11();
 				break;
-			UPDATE_PARAM_PROC_END
+			}
 		}
 
 		TIME_CHECK(kTime1094400, params->param8, setup_function14);
diff --git a/engines/lastexpress/entities/pascale.cpp b/engines/lastexpress/entities/pascale.cpp
index e74cf34..6e9f992 100644
--- a/engines/lastexpress/entities/pascale.cpp
+++ b/engines/lastexpress/entities/pascale.cpp
@@ -1115,13 +1115,13 @@ IMPLEMENT_FUNCTION(33, Pascale, function33)
 
 	case kActionNone:
 		if (params->param4) {
-			UPDATE_PARAM_PROC(params->param5, getState()->time, 4500)
+			if (Entity::updateParameter(params->param5, getState()->time, 4500)) {
 				getObjects()->update(kObjectCompartmentG, kEntityPascale, kObjectLocation1, kCursorNormal, kCursorNormal);
 
 				setCallback(1);
 				setup_playSound("Wat5010");
 				break;
-			UPDATE_PARAM_PROC_END
+			}
 		}
 
 label_callback1:
diff --git a/engines/lastexpress/entities/rebecca.cpp b/engines/lastexpress/entities/rebecca.cpp
index 96deaaf..c0c22fa 100644
--- a/engines/lastexpress/entities/rebecca.cpp
+++ b/engines/lastexpress/entities/rebecca.cpp
@@ -498,14 +498,14 @@ IMPLEMENT_FUNCTION_I(20, Rebecca, function20, TimeValue)
 		if (!params->param2) {
 			params->param6 = 0;
 		} else {
-			UPDATE_PARAM_PROC(params->param6, getState()->timeTicks, 75)
+			if (Entity::updateParameter(params->param6, getState()->timeTicks, 75)) {
 				params->param2 = 0;
 				params->param3 = 1;
 				getObjects()->update(kObjectCompartmentE, kEntityRebecca, kObjectLocation1, kCursorNormal, kCursorNormal);
 				getObjects()->update(kObject52, kEntityRebecca, kObjectLocation1, kCursorNormal, kCursorNormal);
 
 				params->param6 = 0;
-			UPDATE_PARAM_PROC_END
+			}
 		}
 
 		if (getProgress().chapter == kChapter1 && !ENTITY_PARAM(0, 3)) {
diff --git a/engines/lastexpress/entities/servers0.cpp b/engines/lastexpress/entities/servers0.cpp
index 56fc0e6..73e0d34 100644
--- a/engines/lastexpress/entities/servers0.cpp
+++ b/engines/lastexpress/entities/servers0.cpp
@@ -312,17 +312,17 @@ IMPLEMENT_FUNCTION(20, Servers0, chapter1Handler)
 
 	case kActionNone:
 		if (params->param2) {
-			UPDATE_PARAM_PROC(params->param3, getState()->time, 2700);
+			if (Entity::updateParameter(params->param3, getState()->time, 2700)) {
 				ENTITY_PARAM(0, 4) = 1;
 				params->param2 = 0;
-			UPDATE_PARAM_PROC_END
+			}
 		}
 
 		if (params->param1) {
-			UPDATE_PARAM_PROC(params->param4, getState()->time, 4500)
+			if (Entity::updateParameter(params->param4, getState()->time, 4500)) {
 				ENTITY_PARAM(0, 5) = 1;
 				params->param1 = 0;
-			UPDATE_PARAM_PROC_END
+			}
 		}
 
 		if (!getEntities()->isInKitchen(kEntityServers0) && !getEntities()->isSomebodyInsideRestaurantOrSalon())
@@ -733,10 +733,10 @@ IMPLEMENT_FUNCTION(32, Servers0, chapter4Handler)
 		break;
 
 	case kActionNone:
-		UPDATE_PARAM_PROC(params->param2, getState()->time, 3600)
+		if (Entity::updateParameter(params->param2, getState()->time, 3600)) {
 			ENTITY_PARAM(1, 8) = 1;
 			params->param1 = 0;
-		UPDATE_PARAM_PROC_END
+		}
 
 		if (!getEntities()->isInKitchen(kEntityServers1) || !getEntities()->isSomebodyInsideRestaurantOrSalon())
 			break;
diff --git a/engines/lastexpress/entities/servers1.cpp b/engines/lastexpress/entities/servers1.cpp
index 24bf678..a8f4c02 100644
--- a/engines/lastexpress/entities/servers1.cpp
+++ b/engines/lastexpress/entities/servers1.cpp
@@ -563,10 +563,10 @@ IMPLEMENT_FUNCTION(26, Servers1, chapter4Handler)
 
 	case kActionNone:
 		if (params->param2) {
-			UPDATE_PARAM_PROC(params->param2, getState()->time, 900)
+			if (Entity::updateParameter(params->param2, getState()->time, 900)) {
 				ENTITY_PARAM(1, 5) = 1;
 				params->param1 = 0;
-			UPDATE_PARAM_PROC_END
+			}
 		}
 
 		if (!getEntities()->isInKitchen(kEntityServers1) || !getEntities()->isSomebodyInsideRestaurantOrSalon())
diff --git a/engines/lastexpress/entities/tatiana.cpp b/engines/lastexpress/entities/tatiana.cpp
index 9c2c582..992d38e 100644
--- a/engines/lastexpress/entities/tatiana.cpp
+++ b/engines/lastexpress/entities/tatiana.cpp
@@ -374,10 +374,10 @@ IMPLEMENT_FUNCTION(18, Tatiana, function18)
 			}
 
 			if (!params->param1) {
-				UPDATE_PARAM_PROC(params->param3, getState()->time, 4500)
+				if (Entity::updateParameter(params->param3, getState()->time, 4500)) {
 					getEntities()->drawSequenceRight(kEntityTatiana, "806DS");
 					params->param1 = 1;
-				UPDATE_PARAM_PROC_END
+				}
 			}
 		}
 
@@ -424,20 +424,20 @@ IMPLEMENT_FUNCTION(19, Tatiana, chapter1Handler)
 		if (getSoundQueue()->isBuffered(kEntityTatiana) || !params->param4 || params->param3 == 2 || getSoundQueue()->isBuffered("TAT1066"))
 			goto label_tatiana_chapter1_2;
 
-		UPDATE_PARAM_PROC(params->param5, getState()->timeTicks, 450)
+		if (Entity::updateParameter(params->param5, getState()->timeTicks, 450)) {
 			getSound()->playSound(kEntityTatiana, params->param3 ? "TAT1069B" : "TAT1069A");
 			getProgress().field_64 = 1;
 			params->param3++;
 			params->param5 = 0;
-		UPDATE_PARAM_PROC_END
+		}
 
 		if (getEntities()->isPlayerPosition(kCarRestaurant, 71)) {
-			UPDATE_PARAM_PROC(params->param6, getState()->timeTicks, 75)
+			if (Entity::updateParameter(params->param6, getState()->timeTicks, 75)) {
 				getSound()->playSound(kEntityTatiana, params->param3 ? "TAT1069B" : "TAT1069A");
 				getProgress().field_64 = 1;
 				params->param3++;
 				params->param6 = 0;
-			UPDATE_PARAM_PROC_END
+			}
 		}
 
 label_tatiana_chapter1_2:
@@ -615,7 +615,7 @@ IMPLEMENT_FUNCTION(22, Tatiana, function22)
 		if (params->param1 == kTimeInvalid || getState()->time <= kTime1179000)
 			goto label_update;
 
-		UPDATE_PARAM_PROC_TIME(kTime1233000, ((!getEvent(kEventTatianaAskMatchSpeakRussian) && !getEvent(kEventTatianaAskMatch)) || getEntities()->isInGreenCarEntrance(kEntityPlayer)), params->param1, 0)
+		if (Entity::updateParameterTime(kTime1233000, ((!getEvent(kEventTatianaAskMatchSpeakRussian) && !getEvent(kEventTatianaAskMatch)) || getEntities()->isInGreenCarEntrance(kEntityPlayer)), params->param1, 0)) {
 label_update:
 			if (!getEvent(kEventTatianaAskMatchSpeakRussian)
 			 && !getEvent(kEventTatianaAskMatch)
@@ -624,7 +624,7 @@ label_update:
 				getObjects()->update(kObject25, kEntityTatiana, kObjectLocation1, kCursorNormal, kCursorForward);
 				getObjects()->update(kObjectTrainTimeTable, kEntityTatiana, kObjectLocation1, kCursorNormal, kCursorForward);
 			}
-		UPDATE_PARAM_PROC_END
+		}
 
 		params->param1 = kTimeInvalid;
 
@@ -1284,13 +1284,13 @@ IMPLEMENT_FUNCTION(37, Tatiana, function37)
 				params->param3 = (uint)getState()->time + 900;
 
 			if (params->param4 != kTimeInvalid && params->param3 < getState()->time) {
-				UPDATE_PARAM_PROC_TIME(kTime2227500, !getEntities()->isPlayerInCar(kCarRedSleeping), params->param4, 450)
+				if (Entity::updateParameterTime(kTime2227500, !getEntities()->isPlayerInCar(kCarRedSleeping), params->param4, 450)) {
 					getProgress().field_5C = 1;
 					if (getEntities()->isInsideCompartment(kEntityAnna, kCarRedSleeping, kPosition_4070)) {
 						setup_function38();
 						break;
 					}
-				UPDATE_PARAM_PROC_END
+				}
 			}
 		}
 
diff --git a/engines/lastexpress/entities/vesna.cpp b/engines/lastexpress/entities/vesna.cpp
index 6889be4..f54f0f3 100644
--- a/engines/lastexpress/entities/vesna.cpp
+++ b/engines/lastexpress/entities/vesna.cpp
@@ -1082,10 +1082,10 @@ IMPLEMENT_FUNCTION(30, Vesna, function30)
 
 	case kActionNone:
 		if (!params->param1) {
-			UPDATE_PARAM_PROC(params->param3, getState()->timeTicks, 120)
+			if (Entity::updateParameter(params->param3, getState()->timeTicks, 120)) {
 				getSound()->playSound(kEntityVesna, "Ves50001", kFlagDefault);
 				params->param1 = 1;
-			UPDATE_PARAM_PROC_END
+			}
 		}
 
 		if (!Entity::updateParameter(params->param4, getState()->timeTicks, 180))


Commit: 82ad017a8e8614ca4c4141c4d1a8fd2a9c45010d
    https://github.com/scummvm/scummvm/commit/82ad017a8e8614ca4c4141c4d1a8fd2a9c45010d
Author: Julien (julien at powerinbox.com)
Date: 2012-07-26T21:14:58-07:00

Commit Message:
LASTEXPRESS: Replace UPDATE_PARAM_GOTO macro

Changed paths:
    engines/lastexpress/entities/anna.cpp
    engines/lastexpress/entities/august.cpp
    engines/lastexpress/entities/entity_intern.h
    engines/lastexpress/entities/tatiana.cpp
    engines/lastexpress/entities/train.cpp
    engines/lastexpress/entities/vassili.cpp



diff --git a/engines/lastexpress/entities/anna.cpp b/engines/lastexpress/entities/anna.cpp
index ab7163a..0f32679 100644
--- a/engines/lastexpress/entities/anna.cpp
+++ b/engines/lastexpress/entities/anna.cpp
@@ -3277,7 +3277,8 @@ IMPLEMENT_FUNCTION(67, Anna, chapter4Handler)
 
 	case kActionNone:
 		if (getEntities()->isPlayerPosition(kCarRedSleeping, 46)) {
-			UPDATE_PARAM_GOTO(params->param4, getState()->timeTicks, 30, label_next);
+			if (!Entity::updateParameter(params->param4, getState()->timeTicks, 30))
+				goto label_next;
 
 			getScenes()->loadSceneFromPosition(kCarRedSleeping, 8);
 		}
diff --git a/engines/lastexpress/entities/august.cpp b/engines/lastexpress/entities/august.cpp
index 5ae8d11..e863fe1 100644
--- a/engines/lastexpress/entities/august.cpp
+++ b/engines/lastexpress/entities/august.cpp
@@ -523,7 +523,8 @@ IMPLEMENT_FUNCTION_I(21, August, function21, TimeValue)
 		}
 
 		if (params->param2) {
-			UPDATE_PARAM_GOTO(params->param8, getState()->timeTicks, 75, label_continue);
+			if (!Entity::updateParameter(params->param8, getState()->timeTicks, 75))
+				goto label_continue;
 
 			params->param2 = 0;
 			params->param3 = 1;
diff --git a/engines/lastexpress/entities/entity_intern.h b/engines/lastexpress/entities/entity_intern.h
index c4fc36a..4a7aabf 100644
--- a/engines/lastexpress/entities/entity_intern.h
+++ b/engines/lastexpress/entities/entity_intern.h
@@ -358,19 +358,6 @@ void class::setup_##name() { \
 	} \
 }
 
-//////////////////////////////////////////////////////////////////////////
-// Param update
-//////////////////////////////////////////////////////////////////////////
-
-// Todo: replace with UPDATE_PARAM_PROC as appropriate
-#define UPDATE_PARAM_GOTO(parameter, type, value, label) { \
-	if (!parameter) \
-		parameter = (uint)(type + value); \
-	if (parameter >= type) \
-		goto label; \
-	parameter = kTimeInvalid; \
-}
-
 } // End of namespace LastExpress
 
 #endif // LASTEXPRESS_ENTITY_INTERN_H
diff --git a/engines/lastexpress/entities/tatiana.cpp b/engines/lastexpress/entities/tatiana.cpp
index 992d38e..b7c26bd 100644
--- a/engines/lastexpress/entities/tatiana.cpp
+++ b/engines/lastexpress/entities/tatiana.cpp
@@ -1955,7 +1955,8 @@ IMPLEMENT_FUNCTION(48, Tatiana, function48)
 		if (!params->param1 || getSoundQueue()->isBuffered(kEntityTatiana))
 			goto label_end;
 
-		UPDATE_PARAM_GOTO(params->param2, getState()->timeTicks, 5 * (3 * rnd(5) + 30), label_end);
+		if (!Entity::updateParameter(params->param2, getState()->timeTicks, 5 * (3 * rnd(5) + 30)))
+			goto label_end;
 
 		getSound()->playSound(kEntityTatiana, "LIB012", kFlagDefault);
 		params->param2 = 0;
diff --git a/engines/lastexpress/entities/train.cpp b/engines/lastexpress/entities/train.cpp
index 0830dff..e3f530e 100644
--- a/engines/lastexpress/entities/train.cpp
+++ b/engines/lastexpress/entities/train.cpp
@@ -267,18 +267,20 @@ IMPLEMENT_FUNCTION(8, Train, process)
 		if ((getEntities()->isPlayerInCar(kCarGreenSleeping) || getEntities()->isPlayerInCar(kCarRedSleeping))
 		  && params->param4 && !params->param5) {
 
-		  params->param4 -= 1;
+			params->param4 -= 1;
 
-		  if (!params->param4 && getProgress().jacket == kJacketGreen) {
+			if (!params->param4 && getProgress().jacket == kJacketGreen) {
 
-			  getAction()->playAnimation(isNight() ? kEventCathSmokeNight : kEventCathSmokeDay);
-			  params->param5 = 1;
-			  getScenes()->processScene();
-		  }
+				getAction()->playAnimation(isNight() ? kEventCathSmokeNight : kEventCathSmokeDay);
+				params->param5 = 1;
+				getScenes()->processScene();
+			}
 		}
 
 		if (params->param6) {
-			UPDATE_PARAM_GOTO(params1->param7, getState()->time, 900, label_process);
+			if (!Entity::updateParameter(params1->param7, getState()->time, 900))
+				goto label_process;
+
 			getScenes()->loadSceneFromPosition(kCarRestaurant, 58);
 		}
 
diff --git a/engines/lastexpress/entities/vassili.cpp b/engines/lastexpress/entities/vassili.cpp
index 6504df7..5344e70 100644
--- a/engines/lastexpress/entities/vassili.cpp
+++ b/engines/lastexpress/entities/vassili.cpp
@@ -144,7 +144,8 @@ IMPLEMENT_FUNCTION(6, Vassili, function6)
 
 	case kActionNone:
 		if (getEntities()->isInsideCompartment(kEntityPlayer, kCarRedSleeping, kPosition_8200)) {
-			UPDATE_PARAM_GOTO(params->param3, getState()->timeTicks, params->param1, label_function7);
+			if (!Entity::updateParameter(params->param3, getState()->timeTicks, params->param1))
+				goto label_function7;
 
 			setCallback(1);
 			setup_draw("303B");


Commit: e985f7374fd20efc4574bc8320967deef7489d5a
    https://github.com/scummvm/scummvm/commit/e985f7374fd20efc4574bc8320967deef7489d5a
Author: Julien (julien at powerinbox.com)
Date: 2012-07-26T21:14:59-07:00

Commit Message:
LASTEXPRESS: Move Entity function declaration macros to entity.h

Changed paths:
    engines/lastexpress/entities/entity.h
    engines/lastexpress/entities/entity_intern.h



diff --git a/engines/lastexpress/entities/entity.h b/engines/lastexpress/entities/entity.h
index 73114a1..76abab6 100644
--- a/engines/lastexpress/entities/entity.h
+++ b/engines/lastexpress/entities/entity.h
@@ -41,9 +41,38 @@ class Sequence;
 class SequenceFrame;
 struct SavePoint;
 
+//////////////////////////////////////////////////////////////////////////
+// Declaration
+//////////////////////////////////////////////////////////////////////////
+#define DECLARE_FUNCTION(name) \
+	void setup_##name(); \
+	void name(const SavePoint &savepoint);
+
+#define DECLARE_FUNCTION_1(name, param1) \
+	void setup_##name(param1); \
+	void name(const SavePoint &savepoint);
+
+#define DECLARE_FUNCTION_2(name, param1, param2) \
+	void setup_##name(param1, param2); \
+	void name(const SavePoint &savepoint);
+
+#define DECLARE_FUNCTION_3(name, param1, param2, param3) \
+	void setup_##name(param1, param2, param3); \
+	void name(const SavePoint &savepoint);
+
+#define DECLARE_FUNCTION_4(name, param1, param2, param3, param4) \
+	void setup_##name(param1, param2, param3, param4); \
+	void name(const SavePoint &savepoint);
+
+#define DECLARE_FUNCTION_NOSETUP(name) \
+	void name(const SavePoint &savepoint);
+
+#define DECLARE_NULL_FUNCTION() \
+	void setup_nullfunction();
 
 //////////////////////////////////////////////////////////////////////////
 // Callbacks
+//////////////////////////////////////////////////////////////////////////
 #define ENTITY_CALLBACK(class, name, pointer) \
 	Common::Functor1Mem<const SavePoint&, void, class>(pointer, &class::name)
 
@@ -63,7 +92,7 @@ struct SavePoint;
 	((EntityData::EntityParametersIIII*)_data->getParameters(8, index))->param##id
 
 
-
+//////////////////////////////////////////////////////////////////////////
 class EntityData : Common::Serializable {
 public:
 
diff --git a/engines/lastexpress/entities/entity_intern.h b/engines/lastexpress/entities/entity_intern.h
index 4a7aabf..e62eeb0 100644
--- a/engines/lastexpress/entities/entity_intern.h
+++ b/engines/lastexpress/entities/entity_intern.h
@@ -26,36 +26,6 @@
 namespace LastExpress {
 
 //////////////////////////////////////////////////////////////////////////
-// Declaration
-//////////////////////////////////////////////////////////////////////////
-
-#define DECLARE_FUNCTION(name) \
-	void setup_##name(); \
-	void name(const SavePoint &savepoint);
-
-#define DECLARE_FUNCTION_1(name, param1) \
-	void setup_##name(param1); \
-	void name(const SavePoint &savepoint);
-
-#define DECLARE_FUNCTION_2(name, param1, param2) \
-	void setup_##name(param1, param2); \
-	void name(const SavePoint &savepoint);
-
-#define DECLARE_FUNCTION_3(name, param1, param2, param3) \
-	void setup_##name(param1, param2, param3); \
-	void name(const SavePoint &savepoint);
-
-#define DECLARE_FUNCTION_4(name, param1, param2, param3, param4) \
-	void setup_##name(param1, param2, param3, param4); \
-	void name(const SavePoint &savepoint);
-
-#define DECLARE_FUNCTION_NOSETUP(name) \
-	void name(const SavePoint &savepoint);
-
-#define DECLARE_NULL_FUNCTION() \
-	void setup_nullfunction();
-
-//////////////////////////////////////////////////////////////////////////
 // Setup
 //////////////////////////////////////////////////////////////////////////
 


Commit: 8545991739848d878e61ff058e8fa1326261e634
    https://github.com/scummvm/scummvm/commit/8545991739848d878e61ff058e8fa1326261e634
Author: Julien (julien at powerinbox.com)
Date: 2012-07-26T21:15:00-07:00

Commit Message:
LASTEXPRESS: Remove several TIME_CHECK* macros

Changed paths:
    engines/lastexpress/entities/abbot.cpp
    engines/lastexpress/entities/alexei.cpp
    engines/lastexpress/entities/alouan.cpp
    engines/lastexpress/entities/anna.cpp
    engines/lastexpress/entities/august.cpp
    engines/lastexpress/entities/boutarel.cpp
    engines/lastexpress/entities/cooks.cpp
    engines/lastexpress/entities/coudert.cpp
    engines/lastexpress/entities/entity.cpp
    engines/lastexpress/entities/entity.h
    engines/lastexpress/entities/entity_intern.h
    engines/lastexpress/entities/francois.cpp
    engines/lastexpress/entities/gendarmes.cpp
    engines/lastexpress/entities/hadija.cpp
    engines/lastexpress/entities/ivo.cpp
    engines/lastexpress/entities/kahina.cpp
    engines/lastexpress/entities/kronos.cpp
    engines/lastexpress/entities/mahmud.cpp
    engines/lastexpress/entities/max.cpp
    engines/lastexpress/entities/mertens.cpp
    engines/lastexpress/entities/milos.cpp
    engines/lastexpress/entities/mmeboutarel.cpp
    engines/lastexpress/entities/rebecca.cpp
    engines/lastexpress/entities/salko.cpp
    engines/lastexpress/entities/sophie.cpp
    engines/lastexpress/entities/tatiana.cpp
    engines/lastexpress/entities/vassili.cpp
    engines/lastexpress/entities/verges.cpp
    engines/lastexpress/entities/vesna.cpp
    engines/lastexpress/entities/yasmin.cpp



diff --git a/engines/lastexpress/entities/abbot.cpp b/engines/lastexpress/entities/abbot.cpp
index 7916f88..e0fe429 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 b31a995..115c890 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 7549aaf..2f086de 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 0f32679..f876803 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 e863fe1..0412da6 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 2a8c660..3c13cb1 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 62a1e0f..5e8a2df 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 4458632..b604277 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 04ae649..48856a7 100644
--- a/engines/lastexpress/entities/entity.cpp
+++ b/engines/lastexpress/entities/entity.cpp
@@ -637,6 +637,57 @@ bool Entity::updateParameterCheck(uint &parameter, uint timeType, uint delta) {
 	return true;
 }
 
+bool Entity::timeCheck(TimeValue timeValue, uint &parameter, Common::Functor0<void> *function) {
+	if (getState()->time > timeValue && !parameter) {
+		parameter = 1;
+		(*function)();
+
+		return true;
+	}
+
+	return false;
+}
+
+bool Entity::timeCheckCallback(TimeValue timeValue, uint &parameter, 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 &parameter, 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 &parameter, 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 &parameter, 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 76abab6..6e55e21 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 &parameter, uint timeType, uint delta);
 	bool updateParameterTime(TimeValue timeValue, bool check, uint &parameter, uint delta);
 
+	bool timeCheck(TimeValue timeValue, uint &parameter, Common::Functor0<void> *function);
+	bool timeCheckCallback(TimeValue timeValue, uint &parameter, byte callback, Common::Functor0<void> *function);
+	bool timeCheckCallbackInventory(TimeValue timeValue, uint &parameter, byte callback, Common::Functor0<void> *function);
+	bool timeCheckCar(TimeValue timeValue, uint &parameter, byte callback, Common::Functor0<void> *function);
 	void timeCheckSavepoint(TimeValue timeValue, uint &parameter, EntityIndex entity1, EntityIndex entity2, ActionIndex action);
 	void timeCheckObject(TimeValue timeValue, uint &parameter, ObjectIndex index, ObjectLocation location);
 	bool timeCheckCallbackAction(TimeValue timeValue, uint &parameter);
 	bool timeCheckPlaySoundUpdatePosition(TimeValue timeValue, uint &parameter, byte callback, const char* sound, EntityPosition position);
+
 };
 
 
diff --git a/engines/lastexpress/entities/entity_intern.h b/engines/lastexpress/entities/entity_intern.h
index e62eeb0..1d6c462 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 e4d401d..89fdcaf 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 22697b3..a912fa4 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 62badc4..e9abcd8 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 cb0fb92..c53f468 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 08f845f..7860836 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 5dd790c..26ce3ca 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 1e7df5c..af86ef8 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 5c43346..abd2aae 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 9d9225f..b6ea86c 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 5c5d481..519a613 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 888adeb..950644c 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 c0c22fa..5ad8a1b 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 b799564..e8b4b42 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 10c4147..1700900 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 b7c26bd..432def6 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 5344e70..4695f88 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 f459b6f..dfeae21 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 f54f0f3..f29bce8 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 f2b4d2e..acacbb5 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;


Commit: 552e8d45b265f29d16a02d7a5b01803d1143ef94
    https://github.com/scummvm/scummvm/commit/552e8d45b265f29d16a02d7a5b01803d1143ef94
Author: Julien (julien at powerinbox.com)
Date: 2012-07-26T21:15:00-07:00

Commit Message:
LASTEXPRESS: Switch some warnings to debug console output

Changed paths:
    engines/lastexpress/data/animation.cpp
    engines/lastexpress/game/action.cpp



diff --git a/engines/lastexpress/data/animation.cpp b/engines/lastexpress/data/animation.cpp
index 1296852..ce42acb 100644
--- a/engines/lastexpress/data/animation.cpp
+++ b/engines/lastexpress/data/animation.cpp
@@ -248,7 +248,7 @@ void Animation::processChunkAudio(Common::SeekableReadStream *in, const Chunk &c
 		// Read Snd header
 		uint32 header1 = in->readUint32LE();
 		uint16 header2 = in->readUint16LE();
-		warning("Start ADPCM: %d, %d", header1, header2);
+		debugC(4, kLastExpressDebugSound, "Start ADPCM: %d, %d", header1, header2);
 		size -= 6;
 	}
 
diff --git a/engines/lastexpress/game/action.cpp b/engines/lastexpress/game/action.cpp
index 0ce75f1..1e5bc0f 100644
--- a/engines/lastexpress/game/action.cpp
+++ b/engines/lastexpress/game/action.cpp
@@ -1739,14 +1739,14 @@ CursorStyle Action::getCursor(const SceneHotspot &hotspot) const {
 			return kCursorBackward;
 
 	case SceneHotspot::kActionKnockOnDoor:
-		warning("================================= DOOR %03d =================================", object);
+		debugC(2, kLastExpressDebugScenes, "================================= DOOR %03d =================================", object);
 		if (object >= kObjectMax)
 			return kCursorNormal;
 		else
 			return (CursorStyle)getObjects()->get(object).cursor;
 
 	case SceneHotspot::kAction12:
-		warning("================================= OBJECT %03d =================================", object);
+		debugC(2, kLastExpressDebugScenes, "================================= OBJECT %03d =================================", object);
 		if (object >= kObjectMax)
 			return kCursorNormal;
 
@@ -1756,7 +1756,7 @@ CursorStyle Action::getCursor(const SceneHotspot &hotspot) const {
 			return kCursorNormal;
 
 	case SceneHotspot::kActionPickItem:
-		warning("================================= ITEM %03d =================================", object);
+		debugC(2, kLastExpressDebugScenes, "================================= ITEM %03d =================================", object);
 		if (object >= kObjectCompartmentA)
 			return kCursorNormal;
 
@@ -1767,7 +1767,7 @@ CursorStyle Action::getCursor(const SceneHotspot &hotspot) const {
 			return kCursorNormal;
 
 	case SceneHotspot::kActionDropItem:
-		warning("================================= ITEM %03d =================================", object);
+		debugC(2, kLastExpressDebugScenes, "================================= ITEM %03d =================================", object);
 		if (object >= kObjectCompartmentA)
 			return kCursorNormal;
 
@@ -1884,7 +1884,7 @@ LABEL_KEY:
 	// Handle compartment action
 	case SceneHotspot::kActionCompartment:
 	case SceneHotspot::kActionExitCompartment:
-		warning("================================= DOOR %03d =================================", object);
+		debugC(2, kLastExpressDebugScenes, "================================= DOOR %03d =================================", object);
 		if (object >= kObjectMax)
 			return kCursorNormal;
 


Commit: 7974b62b716343ff979447957b140f8e2b79f03c
    https://github.com/scummvm/scummvm/commit/7974b62b716343ff979447957b140f8e2b79f03c
Author: Julien (julien at powerinbox.com)
Date: 2012-07-26T21:15:01-07:00

Commit Message:
LASTEXPRESS: Reduce nesting in Entities::processEntity()

Changed paths:
    engines/lastexpress/game/entities.cpp



diff --git a/engines/lastexpress/game/entities.cpp b/engines/lastexpress/game/entities.cpp
index 4cdefcd..29cc7d8 100644
--- a/engines/lastexpress/game/entities.cpp
+++ b/engines/lastexpress/game/entities.cpp
@@ -751,43 +751,41 @@ label_nosequence:
 
 	if (data->frame->getInfo()->field_30 > (data->field_49B + 1) || (data->direction == kDirectionLeft && data->sequence->count() == 1)) {
 		++data->field_49B;
-	} else {
-		if (data->frame->getInfo()->field_30 > data->field_49B && !data->frame->getInfo()->keepPreviousFrame) {
-			++data->field_49B;
-		} else {
-			if (data->frame->getInfo()->keepPreviousFrame == 1)
-				keepPreviousFrame = true;
+	} else if (data->frame->getInfo()->field_30 <= data->field_49B || data->frame->getInfo()->keepPreviousFrame) {
+		if (data->frame->getInfo()->keepPreviousFrame == 1)
+			keepPreviousFrame = true;
 
-			// Increment current frame
-			++data->currentFrame;
+		// Increment current frame
+		++data->currentFrame;
 
-			if (data->currentFrame > (int16)(data->sequence->count() - 1) || (data->field_4A9 && checkSequenceFromPosition(entityIndex))) {
-
-				if (data->direction == kDirectionLeft) {
-					data->currentFrame = 0;
-				} else {
-					keepPreviousFrame = true;
-					drawNextSequence(entityIndex);
+		if (data->currentFrame > (int16)(data->sequence->count() - 1) || (data->field_4A9 && checkSequenceFromPosition(entityIndex))) {
 
-					if (getFlags()->flag_entities_0 || data->doProcessEntity)
-						return;
+			if (data->direction == kDirectionLeft) {
+				data->currentFrame = 0;
+			} else {
+				keepPreviousFrame = true;
+				drawNextSequence(entityIndex);
 
-					if (!data->sequence2) {
-						updateEntityPosition(entityIndex);
-						data->doProcessEntity = false;
-						return;
-					}
+				if (getFlags()->flag_entities_0 || data->doProcessEntity)
+					return;
 
-					copySequenceData(entityIndex);
+				if (!data->sequence2) {
+					updateEntityPosition(entityIndex);
+					data->doProcessEntity = false;
+					return;
 				}
 
+				copySequenceData(entityIndex);
 			}
 
-			processFrame(entityIndex, keepPreviousFrame, false);
-
-			if (getFlags()->flag_entities_0 || data->doProcessEntity)
-				return;
 		}
+
+		processFrame(entityIndex, keepPreviousFrame, false);
+
+		if (getFlags()->flag_entities_0 || data->doProcessEntity)
+			return;
+	} else {
+		++data->field_49B;
 	}
 
 	incrementDirectionCounter(data);


Commit: 7450ae23fb3c7afcaa33a35390e4c2c03238a024
    https://github.com/scummvm/scummvm/commit/7450ae23fb3c7afcaa33a35390e4c2c03238a024
Author: Julien (julien at powerinbox.com)
Date: 2012-07-26T21:15:01-07:00

Commit Message:
LASTEXPRESS: Move RESET_ENTITY_STATE macro to entity.h

Changed paths:
    engines/lastexpress/entities/entity.h
    engines/lastexpress/entities/entity_intern.h



diff --git a/engines/lastexpress/entities/entity.h b/engines/lastexpress/entities/entity.h
index 6e55e21..785e355 100644
--- a/engines/lastexpress/entities/entity.h
+++ b/engines/lastexpress/entities/entity.h
@@ -94,6 +94,14 @@ struct SavePoint;
 #define ENTITY_PARAM(index, id) \
 	((EntityData::EntityParametersIIII*)_data->getParameters(8, index))->param##id
 
+//////////////////////////////////////////////////////////////////////////
+// Misc
+//////////////////////////////////////////////////////////////////////////
+#define RESET_ENTITY_STATE(entity, class, function) \
+	getEntities()->resetState(entity); \
+	((class *)getEntities()->get(entity))->function();
+
+
 
 //////////////////////////////////////////////////////////////////////////
 class EntityData : Common::Serializable {
diff --git a/engines/lastexpress/entities/entity_intern.h b/engines/lastexpress/entities/entity_intern.h
index 1d6c462..306dbf8 100644
--- a/engines/lastexpress/entities/entity_intern.h
+++ b/engines/lastexpress/entities/entity_intern.h
@@ -260,13 +260,6 @@ void class::setup_##name() { \
 
 
 //////////////////////////////////////////////////////////////////////////
-// Misc
-//////////////////////////////////////////////////////////////////////////
-#define RESET_ENTITY_STATE(entity, class, function) \
-	getEntities()->resetState(entity); \
-	((class *)getEntities()->get(entity))->function();
-
-//////////////////////////////////////////////////////////////////////////
 // Time check macros
 //////////////////////////////////////////////////////////////////////////
 #define TIME_CHECK_CALLBACK_1(timeValue, parameter, callback, function, param1) \


Commit: 37770212c0be36de982e16448fb62aa370a70f6a
    https://github.com/scummvm/scummvm/commit/37770212c0be36de982e16448fb62aa370a70f6a
Author: Julien (julien at powerinbox.com)
Date: 2012-07-26T21:15:02-07:00

Commit Message:
LASTEXPRESS: Remove TIME_CHECK_CALLBACK_2 macro

Changed paths:
    engines/lastexpress/entities/chapters.cpp
    engines/lastexpress/entities/chapters.h
    engines/lastexpress/entities/entity_intern.h
    engines/lastexpress/entities/rebecca.cpp



diff --git a/engines/lastexpress/entities/chapters.cpp b/engines/lastexpress/entities/chapters.cpp
index c563117..ac9387b 100644
--- a/engines/lastexpress/entities/chapters.cpp
+++ b/engines/lastexpress/entities/chapters.cpp
@@ -403,11 +403,18 @@ IMPLEMENT_FUNCTION(8, Chapters, chapter1Handler)
 
 label_processStations:
 		// Process stations
-		TIME_CHECK_CALLBACK_2(kTime1039500, params->param7, 1, setup_savegame, kSavegameTypeTime, kTimeNone);
+		if (getState()->time > kTime1039500 && !params->param7) {
+			params->param7 = 1;
+			setCallback(1);
+			setup_savegame(kSavegameTypeTime, kTimeNone);
+
+			break;
+		}
 
 label_enter_epernay:
 		// Entering Epernay station
-		TIME_CHECK_CALLBACK_2(kTimeEnterEpernay, params->param8, 1, setup_enterStation, "Epernay", kCityEpernay);
+		if (timeCheckEnterStation(kTimeEnterEpernay, params->param8, 1, "Epernay", kCityEpernay))
+			break;
 
 label_exit_epernay:
 		// Exiting Epernay station
@@ -437,7 +444,8 @@ label_enter_chalons:
 			goto label_exit_strasbourg;
 
 		// Entering Chalons station
-		TIME_CHECK_CALLBACK_2(kTimeEnterChalons, CURRENT_PARAM(1, 3), 5, setup_enterStation, "Chalons", kCityChalons);
+		if (timeCheckEnterStation(kTimeEnterChalons, CURRENT_PARAM(1, 3), 5, "Chalons", kCityChalons))
+			break;
 
 label_exit_chalons:
 		// Exiting Chalons station
@@ -445,7 +453,8 @@ label_exit_chalons:
 
 label_enter_barleduc:
 		// Entering Bar-Le-Duc station
-		TIME_CHECK_CALLBACK_2(kTimeCityBarLeDuc, CURRENT_PARAM(1, 5), 7, setup_enterStation, "BarLeDuc", kCityBarleduc);
+		if (timeCheckEnterStation(kTimeCityBarLeDuc, CURRENT_PARAM(1, 5), 7, "BarLeDuc", kCityBarleduc))
+			break;
 
 label_exit_barleduc:
 		// Exiting Bar-Le-Duc station
@@ -458,7 +467,8 @@ label_enter_nancy:
 		}
 
 		// Entering Nancy station
-		TIME_CHECK_CALLBACK_2(kTimeCityNancy, CURRENT_PARAM(1, 8), 9, setup_enterStation, "Nancy", kCityNancy);
+		if (timeCheckEnterStation(kTimeCityNancy, CURRENT_PARAM(1, 8), 9, "Nancy", kCityNancy))
+			break;
 
 label_exit_nancy:
 		// Exiting Nancy station
@@ -466,7 +476,8 @@ label_exit_nancy:
 
 label_enter_luneville:
 		// Entering Luneville station
-		TIME_CHECK_CALLBACK_2(kTimeCityLuneville, CURRENT_PARAM(2, 2), 11, setup_enterStation, "Luneville", kCityLuneville);
+		if (timeCheckEnterStation(kTimeCityLuneville, CURRENT_PARAM(2, 2), 11, "Luneville", kCityLuneville))
+			break;
 
 label_exit_luneville:
 		// Exiting Luneville station
@@ -474,7 +485,8 @@ label_exit_luneville:
 
 label_enter_avricourt:
 		// Entering Avricourt station
-		TIME_CHECK_CALLBACK_2(kTimeCityAvricourt, CURRENT_PARAM(2, 4), 13, setup_enterStation, "Avricourt", kCityAvricourt);
+		if (timeCheckEnterStation(kTimeCityAvricourt, CURRENT_PARAM(2, 4), 13, "Avricourt", kCityAvricourt))
+			break;
 
 label_exit_avricourt:
 		// Exiting Avricourt station
@@ -482,14 +494,21 @@ label_exit_avricourt:
 
 label_enter_deutschavricourt:
 		// Entering Deutsch-Avricourt station
-		TIME_CHECK_CALLBACK_2(kTimeCityDeutschAvricourt, CURRENT_PARAM(2, 6), 15, setup_enterStation, "DeutschA", kCityDeutschAvricourt);
+		if (timeCheckEnterStation(kTimeCityDeutschAvricourt, CURRENT_PARAM(2, 6), 15, "DeutschA", kCityDeutschAvricourt))
+			break;
 
 label_exit_deutschavricourt:
 		// Exiting Avricourt station
 		TIME_CHECK_CALLBACK_1(kTimeExitDeutschAvricourt, CURRENT_PARAM(2, 7), 16, setup_exitStation, "DeutschA");
 
 label_enter_strasbourg:
-		TIME_CHECK_CALLBACK_2(kTimeCityStrasbourg, CURRENT_PARAM(2, 8), 17, setup_savegame, kSavegameTypeTime, kTimeNone);
+		if (getState()->time > kTimeCityStrasbourg && !CURRENT_PARAM(2, 8)) {
+			CURRENT_PARAM(2, 8) = 1;
+			setCallback(17);
+			setup_savegame(kSavegameTypeTime, kTimeNone);
+
+			break;
+		}
 
 label_exit_strasbourg:
 		// Exiting Strasbourg station
@@ -497,7 +516,8 @@ label_exit_strasbourg:
 
 label_enter_badenoos:
 		// Entering Baden Oos station
-		TIME_CHECK_CALLBACK_2(kTimeCityBadenOos, CURRENT_PARAM(3, 2), 20, setup_enterStation, "BadenOos", kCityBadenOos);
+		if (timeCheckEnterStation(kTimeCityBadenOos, CURRENT_PARAM(3, 2), 20, "BadenOos", kCityBadenOos))
+			break;
 
 label_exit_badenoos:
 		// Exiting Baden Oos station
@@ -922,25 +942,29 @@ IMPLEMENT_FUNCTION(15, Chapters, chapter3Handler)
 			params->param5 = 0;
 		}
 
-		TIME_CHECK_CALLBACK_2(kTimeEnterSalzbourg, params->param6, 1, setup_enterStation, "Salzburg", kCitySalzbourg);
+		if (timeCheckEnterStation(kTimeEnterSalzbourg, params->param6, 1, "Salzburg", kCitySalzbourg))
+			break;
 
 label_callback_1:
 		TIME_CHECK_CALLBACK_1(kTimeExitSalzbourg, params->param7, 2, setup_exitStation, "Salzburg");
 
 label_callback_2:
-		TIME_CHECK_CALLBACK_2(kTimeEnterAttnangPuchheim, params->param8, 3, setup_enterStation, "Attnang", kCityAttnangPuchheim);
+		if (timeCheckEnterStation(kTimeEnterAttnangPuchheim, params->param8, 3, "Attnang", kCityAttnangPuchheim))
+			break;
 
 label_callback_3:
 		TIME_CHECK_CALLBACK_1(kTimeExitAttnangPuchheim, CURRENT_PARAM(1, 1), 4, setup_exitStation, "Attnang");
 
 label_callback_4:
-		TIME_CHECK_CALLBACK_2(kTimeEnterWels, CURRENT_PARAM(1, 2), 5, setup_enterStation, "Wels", kCityWels);
+		if (timeCheckEnterStation(kTimeEnterWels, CURRENT_PARAM(1, 2), 5, "Wels", kCityWels))
+			break;
 
 label_callback_5:
 		TIME_CHECK_CALLBACK_1(kTimeEnterWels, CURRENT_PARAM(1, 3), 6, setup_exitStation, "Wels");
 
 label_callback_6:
-		TIME_CHECK_CALLBACK_2(kTimeEnterLinz, CURRENT_PARAM(1, 4), 7, setup_enterStation, "Linz", kCityLinz);
+		if (timeCheckEnterStation(kTimeEnterLinz, CURRENT_PARAM(1, 4), 7, "Linz", kCityLinz))
+			break;
 
 label_callback_7:
 		TIME_CHECK_CALLBACK_1(kTimeCityLinz, CURRENT_PARAM(1, 5), 8, setup_exitStation, "Linz");
@@ -951,7 +975,7 @@ label_callback_8:
 			getState()->timeDelta = 5;
 		}
 
-		TIME_CHECK_CALLBACK_2(kTimeCityVienna, CURRENT_PARAM(1, 7), 9, setup_enterStation, "Vienna", kCityVienna);
+		timeCheckEnterStation(kTimeCityVienna, CURRENT_PARAM(1, 7), 9, "Vienna", kCityVienna);
 		break;
 
 	case kActionEndSound:
@@ -1221,7 +1245,8 @@ IMPLEMENT_FUNCTION(19, Chapters, chapter4Handler)
 			params->param7 = 0;
 		}
 
-		TIME_CHECK_CALLBACK_2(kTimeEnterPoszony, params->param8, 1, setup_enterStation, "Pozsony", kCityPoszony);
+		if (timeCheckEnterStation(kTimeEnterPoszony, params->param8, 1, "Pozsony", kCityPoszony))
+			break;
 
 label_exitPozsony:
 		TIME_CHECK_CALLBACK_1(kTimeExitPoszony, CURRENT_PARAM(1, 1), 2, setup_exitStation, "Pozsony");
@@ -1237,7 +1262,8 @@ label_enterGalanta:
 		if (params->param1)
 			goto label_callback_4;
 
-		TIME_CHECK_CALLBACK_2(kTimeEnterGalanta, CURRENT_PARAM(1, 3), 3, setup_enterStation, "Galanta", kCityGalanta);
+		if (timeCheckEnterStation(kTimeEnterGalanta, CURRENT_PARAM(1, 3), 3, "Galanta", kCityGalanta))
+			break;
 
 label_exitGalanta:
 		TIME_CHECK_CALLBACK_1(kTimeExitGalanta, CURRENT_PARAM(1, 4), 4, setup_exitStation, "Galanta");
@@ -1817,4 +1843,16 @@ void Chapters::playSteam() {
 	ENTITY_PARAM(0, 2) = 0;
 }
 
+bool Chapters::timeCheckEnterStation(TimeValue timeValue, uint &parameter, byte callback, const char *sequence, CityIndex cityIndex) {
+	if (getState()->time > timeValue && !parameter) {
+		parameter = 1;
+		setCallback(callback);
+		setup_enterStation(sequence, cityIndex);
+
+		return true;
+	}
+
+	return false;
+}
+
 } // End of namespace LastExpress
diff --git a/engines/lastexpress/entities/chapters.h b/engines/lastexpress/entities/chapters.h
index 62b8af9..51e6444 100644
--- a/engines/lastexpress/entities/chapters.h
+++ b/engines/lastexpress/entities/chapters.h
@@ -154,6 +154,7 @@ public:
 	DECLARE_FUNCTION(chapter5Handler)
 
 private:
+	bool timeCheckEnterStation(TimeValue timeValue, uint &parameter, byte callback, const char *sequence, CityIndex cityIndex);
 	void enterExitStation(const SavePoint &savepoint, bool isEnteringStation);
 	void enterExitHelper(bool isEnteringStation);
 	void playSteam();
diff --git a/engines/lastexpress/entities/entity_intern.h b/engines/lastexpress/entities/entity_intern.h
index 306dbf8..9818a20 100644
--- a/engines/lastexpress/entities/entity_intern.h
+++ b/engines/lastexpress/entities/entity_intern.h
@@ -270,14 +270,6 @@ void class::setup_##name() { \
 		break; \
 	}
 
-#define TIME_CHECK_CALLBACK_2(timeValue, parameter, callback, function, param1, param2) \
-	if (getState()->time > timeValue && !parameter) { \
-		parameter = 1; \
-		setCallback(callback); \
-		function(param1, param2); \
-		break; \
-	}
-
 #define TIME_CHECK_CALLBACK_3(timeValue, parameter, callback, function, param1, param2, param3) \
 	if (getState()->time > timeValue && !parameter) { \
 		parameter = 1; \
diff --git a/engines/lastexpress/entities/rebecca.cpp b/engines/lastexpress/entities/rebecca.cpp
index 5ad8a1b..0dc201b 100644
--- a/engines/lastexpress/entities/rebecca.cpp
+++ b/engines/lastexpress/entities/rebecca.cpp
@@ -774,7 +774,13 @@ IMPLEMENT_FUNCTION(23, Rebecca, function23)
 		break;
 
 	case kActionNone:
-		TIME_CHECK_CALLBACK_2(kTime1111500, params->param2, 3, setup_enterExitCompartment, "623De", kObjectCompartmentE);
+		if (getState()->time > kTime1111500 && !params->param2) {
+			params->param2 = 1;
+			setCallback(3);
+			setup_enterExitCompartment("623De", kObjectCompartmentE);
+
+			break;
+		}
 		break;
 
 	case kActionDefault:


Commit: b6b98483c5117ee3cee0a52607e5f5f4acb7def7
    https://github.com/scummvm/scummvm/commit/b6b98483c5117ee3cee0a52607e5f5f4acb7def7
Author: Julien (julien at powerinbox.com)
Date: 2012-07-26T21:15:02-07:00

Commit Message:
LASTEXPRESS: Remove TIME_CHECK_CALLBACK_3 macro

Changed paths:
    engines/lastexpress/entities/entity_intern.h
    engines/lastexpress/entities/francois.cpp
    engines/lastexpress/entities/francois.h
    engines/lastexpress/entities/rebecca.cpp
    engines/lastexpress/entities/verges.cpp



diff --git a/engines/lastexpress/entities/entity_intern.h b/engines/lastexpress/entities/entity_intern.h
index 9818a20..f12f34a 100644
--- a/engines/lastexpress/entities/entity_intern.h
+++ b/engines/lastexpress/entities/entity_intern.h
@@ -270,14 +270,6 @@ void class::setup_##name() { \
 		break; \
 	}
 
-#define TIME_CHECK_CALLBACK_3(timeValue, parameter, callback, function, param1, param2, param3) \
-	if (getState()->time > timeValue && !parameter) { \
-		parameter = 1; \
-		setCallback(callback); \
-		function(param1, param2, param3); \
-		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 89fdcaf..c39eb119 100644
--- a/engines/lastexpress/entities/francois.cpp
+++ b/engines/lastexpress/entities/francois.cpp
@@ -1007,10 +1007,11 @@ label_callback_5:
 		}
 
 label_callback_6:
-		TIME_CHECK_CALLBACK_3(kTime1782000, params->param6, 7, setup_function14, kObjectCompartmentC, kPosition_6470, "c");
+		if (timeCheckCallbackCompartment(kTime1782000, params->param6, 7, kObjectCompartmentC, kPosition_6470, "c"))
+			break;
 
 label_callback_7:
-		TIME_CHECK_CALLBACK_3(kTime1813500, params->param7, 8, setup_function14, kObjectCompartmentF, kPosition_4070, "f");
+		timeCheckCallbackCompartment(kTime1813500, params->param7, 8, kObjectCompartmentF, kPosition_4070, "f");
 		break;
 
 	case kActionCallback:
@@ -1136,13 +1137,15 @@ label_callback_11:
 				}
 
 label_callback_12:
-				TIME_CHECK_CALLBACK_3(kTime2040300, CURRENT_PARAM(1, 5), 13, setup_function14, kObjectCompartmentE, kPosition_4840, "e");
+				if (timeCheckCallbackCompartment(kTime2040300, CURRENT_PARAM(1, 5), 13, kObjectCompartmentE, kPosition_4840, "e"))
+					break;
 
 label_callback_13:
-				TIME_CHECK_CALLBACK_3(kTime2040300, CURRENT_PARAM(1, 6), 14, setup_function14, kObjectCompartmentF, kPosition_4070, "f");
+				if (timeCheckCallbackCompartment(kTime2040300, CURRENT_PARAM(1, 6), 14, kObjectCompartmentF, kPosition_4070, "f"))
+					break;
 
 label_callback_14:
-				TIME_CHECK_CALLBACK_3(kTime2040300, CURRENT_PARAM(1, 7), 15, setup_function14, kObjectCompartmentB, kPosition_7500, "b");
+				timeCheckCallbackCompartment(kTime2040300, CURRENT_PARAM(1, 7), 15, kObjectCompartmentB, kPosition_7500, "b");
 			}
 		}
 		break;
@@ -1298,4 +1301,21 @@ IMPLEMENT_FUNCTION_END
 //////////////////////////////////////////////////////////////////////////
 IMPLEMENT_NULL_FUNCTION(31, Francois)
 
+
+//////////////////////////////////////////////////////////////////////////
+// Helper functions
+//////////////////////////////////////////////////////////////////////////
+bool Francois::timeCheckCallbackCompartment(TimeValue timeValue, uint &parameter, byte callback, ObjectIndex compartment, EntityPosition position, const char* sequenceSuffix) {
+	if (getState()->time > timeValue && !parameter) {
+		parameter = 1;
+		setCallback(callback);
+		setup_function14(compartment, position, sequenceSuffix);
+
+		return true;
+	}
+
+	return false;
+}
+
+
 } // End of namespace LastExpress
diff --git a/engines/lastexpress/entities/francois.h b/engines/lastexpress/entities/francois.h
index 19eca6f..09715db 100644
--- a/engines/lastexpress/entities/francois.h
+++ b/engines/lastexpress/entities/francois.h
@@ -160,6 +160,9 @@ public:
 	DECLARE_FUNCTION(function30)
 
 	DECLARE_NULL_FUNCTION()
+
+private:
+	bool timeCheckCallbackCompartment(TimeValue timeValue, uint &parameter, byte callback, ObjectIndex compartment, EntityPosition position, const char* sequenceSuffix);
 };
 
 } // End of namespace LastExpress
diff --git a/engines/lastexpress/entities/rebecca.cpp b/engines/lastexpress/entities/rebecca.cpp
index 0dc201b..79d13a9 100644
--- a/engines/lastexpress/entities/rebecca.cpp
+++ b/engines/lastexpress/entities/rebecca.cpp
@@ -972,7 +972,12 @@ IMPLEMENT_FUNCTION(26, Rebecca, function26)
 		break;
 
 	case kActionNone:
-		TIME_CHECK_CALLBACK_3(kTime1224000, params->param2, 1, setup_updatePosition, "118H", kCarRestaurant, 52);
+		if (getState()->time > kTime1224000 && !params->param2) {
+			params->param2 = 1;
+			setCallback(1);
+			setup_updatePosition("118H", kCarRestaurant, 52);
+			break;
+		}
 
 		if (params->param1) {
 			if (!Entity::updateParameter(params->param3, getState()->timeTicks, 90))
diff --git a/engines/lastexpress/entities/verges.cpp b/engines/lastexpress/entities/verges.cpp
index dfeae21..e652687 100644
--- a/engines/lastexpress/entities/verges.cpp
+++ b/engines/lastexpress/entities/verges.cpp
@@ -1280,7 +1280,12 @@ IMPLEMENT_FUNCTION(32, Verges, function32)
 		break;
 
 	case kActionNone:
-		TIME_CHECK_CALLBACK_3(kTime2263500, params->param1, 5, setup_function10, kCarRedSleeping, kPosition_9460, "TRA3006");
+		if (getState()->time > kTime2263500 && !params->param1) {
+			params->param1 = 1;
+			setCallback(5);
+			setup_function10(kCarRedSleeping, kPosition_9460, "TRA3006");
+			break;
+		}
 		break;
 
 	case kActionDefault:


Commit: 938961e23737e5ff19aee61e1ec6dd6e19ca0529
    https://github.com/scummvm/scummvm/commit/938961e23737e5ff19aee61e1ec6dd6e19ca0529
Author: Julien (julien at powerinbox.com)
Date: 2012-07-26T21:15:03-07:00

Commit Message:
LASTEXPRESS: Remove TIME_CHECK_CALLBACK_1 macro

Changed paths:
    engines/lastexpress/entities/alouan.cpp
    engines/lastexpress/entities/august.cpp
    engines/lastexpress/entities/boutarel.cpp
    engines/lastexpress/entities/chapters.cpp
    engines/lastexpress/entities/chapters.h
    engines/lastexpress/entities/entity.cpp
    engines/lastexpress/entities/entity.h
    engines/lastexpress/entities/entity_intern.h
    engines/lastexpress/entities/francois.cpp
    engines/lastexpress/entities/francois.h
    engines/lastexpress/entities/mertens.cpp
    engines/lastexpress/entities/rebecca.cpp
    engines/lastexpress/entities/verges.cpp
    engines/lastexpress/entities/yasmin.cpp



diff --git a/engines/lastexpress/entities/alouan.cpp b/engines/lastexpress/entities/alouan.cpp
index 2f086de..e834e1f 100644
--- a/engines/lastexpress/entities/alouan.cpp
+++ b/engines/lastexpress/entities/alouan.cpp
@@ -292,7 +292,8 @@ label_callback1:
 		}
 
 label_callback2:
-		TIME_CHECK_CALLBACK_1(kTime2052000, params->param3, 3, setup_playSound, "Har1005");
+		if (Entity::timeCheckCallback(kTime2052000, params->param3, 3, "Har1005", WRAP_SETUP_FUNCTION_S(Alouan, setup_playSound)))
+			break;
 
 label_callback3:
 		if (Entity::timeCheckCallback(kTime2133000, params->param4, 4, WRAP_SETUP_FUNCTION(Alouan, setup_compartment6to8)))
diff --git a/engines/lastexpress/entities/august.cpp b/engines/lastexpress/entities/august.cpp
index 0412da6..67d810f 100644
--- a/engines/lastexpress/entities/august.cpp
+++ b/engines/lastexpress/entities/august.cpp
@@ -1906,7 +1906,7 @@ IMPLEMENT_FUNCTION(37, August, function37)
 		break;
 
 	case kActionNone:
-		TIME_CHECK_CALLBACK_1(kTime1791000, params->param2, 5, setup_function20, true);
+		Entity::timeCheckCallback(kTime1791000, params->param2, 5, true, WRAP_SETUP_FUNCTION_B(August, setup_function20));
 		break;
 
 	case kActionDefault:
diff --git a/engines/lastexpress/entities/boutarel.cpp b/engines/lastexpress/entities/boutarel.cpp
index 3c13cb1..219ddf9 100644
--- a/engines/lastexpress/entities/boutarel.cpp
+++ b/engines/lastexpress/entities/boutarel.cpp
@@ -653,7 +653,7 @@ IMPLEMENT_FUNCTION(20, Boutarel, function20)
 			}
 		}
 
-		TIME_CHECK_CALLBACK_1(kTime1138500, params->param4, 4, setup_function14, false);
+		Entity::timeCheckCallback(kTime1138500, params->param4, 4, false, WRAP_SETUP_FUNCTION_B(Boutarel, setup_function14));
 		break;
 
 	case kActionDefault:
@@ -678,7 +678,7 @@ IMPLEMENT_FUNCTION(20, Boutarel, function20)
 			break;
 
 		case 3:
-			TIME_CHECK_CALLBACK_1(kTime1138500, params->param4, 4, setup_function14, false);
+			Entity::timeCheckCallback(kTime1138500, params->param4, 4, false, WRAP_SETUP_FUNCTION_B(Boutarel, setup_function14));
 			break;
 
 		case 4:
@@ -836,7 +836,7 @@ IMPLEMENT_FUNCTION(24, Boutarel, chapter2Handler)
 		break;
 
 	case kActionNone:
-		TIME_CHECK_CALLBACK_1(kTime1759500, params->param2, 1, setup_function14, false);
+		Entity::timeCheckCallback(kTime1759500, params->param2, 1, false, WRAP_SETUP_FUNCTION_B(Boutarel, setup_function14));
 		break;
 
 	case kActionDefault:
@@ -961,7 +961,7 @@ IMPLEMENT_FUNCTION(29, Boutarel, function29)
 			}
 		}
 
-		TIME_CHECK_CALLBACK_1(kTime2002500, params->param4, 1, setup_function14, true);
+		Entity::timeCheckCallback(kTime2002500, params->param4, 1, true, WRAP_SETUP_FUNCTION_B(Boutarel, setup_function14));
 		break;
 
 	case kActionDefault:
@@ -974,7 +974,7 @@ IMPLEMENT_FUNCTION(29, Boutarel, function29)
 			break;
 
 		case 1:
-			TIME_CHECK_CALLBACK_1(kTime2002500, params->param4, 1, setup_function14, true);
+			Entity::timeCheckCallback(kTime2002500, params->param4, 1, true, WRAP_SETUP_FUNCTION_B(Boutarel, setup_function14));
 			break;
 
 		case 2:
@@ -1065,7 +1065,7 @@ IMPLEMENT_FUNCTION(33, Boutarel, function33)
 
 	case kActionNone:
 		if (params->param1)
-			TIME_CHECK_CALLBACK_1(kTime2389500, params->param2, 3, setup_function14, false);
+			Entity::timeCheckCallback(kTime2389500, params->param2, 3, false, WRAP_SETUP_FUNCTION_B(Boutarel, setup_function14));
 		break;
 
 	case kActionDefault:
diff --git a/engines/lastexpress/entities/chapters.cpp b/engines/lastexpress/entities/chapters.cpp
index ac9387b..a2f3a3d 100644
--- a/engines/lastexpress/entities/chapters.cpp
+++ b/engines/lastexpress/entities/chapters.cpp
@@ -449,7 +449,8 @@ label_enter_chalons:
 
 label_exit_chalons:
 		// Exiting Chalons station
-		TIME_CHECK_CALLBACK_1(kTimeExitChalons, CURRENT_PARAM(1, 4), 6, setup_exitStation, "Chalons");
+		if (timeCheckExitStation(kTimeExitChalons, CURRENT_PARAM(1, 4), 6, "Chalons"))
+			break;
 
 label_enter_barleduc:
 		// Entering Bar-Le-Duc station
@@ -458,7 +459,8 @@ label_enter_barleduc:
 
 label_exit_barleduc:
 		// Exiting Bar-Le-Duc station
-		TIME_CHECK_CALLBACK_1(kTimeExitBarLeDuc, CURRENT_PARAM(1, 6), 8, setup_exitStation, "BarLeDuc");
+		if (timeCheckExitStation(kTimeExitBarLeDuc, CURRENT_PARAM(1, 6), 8, "BarLeDuc"))
+			break;
 
 label_enter_nancy:
 		if (getState()->time > kTime1260000 && !CURRENT_PARAM(1, 7)) {
@@ -472,7 +474,8 @@ label_enter_nancy:
 
 label_exit_nancy:
 		// Exiting Nancy station
-		TIME_CHECK_CALLBACK_1(kTimeExitNancy, CURRENT_PARAM(2, 1), 10, setup_exitStation, "Nancy");
+		if (timeCheckExitStation(kTimeExitNancy, CURRENT_PARAM(2, 1), 10, "Nancy"))
+			break;
 
 label_enter_luneville:
 		// Entering Luneville station
@@ -481,7 +484,8 @@ label_enter_luneville:
 
 label_exit_luneville:
 		// Exiting Luneville station
-		TIME_CHECK_CALLBACK_1(kTimeExitLuneville, CURRENT_PARAM(2, 3), 12, setup_exitStation, "Luneville");
+		if (timeCheckExitStation(kTimeExitLuneville, CURRENT_PARAM(2, 3), 12, "Luneville"))
+			break;
 
 label_enter_avricourt:
 		// Entering Avricourt station
@@ -490,7 +494,8 @@ label_enter_avricourt:
 
 label_exit_avricourt:
 		// Exiting Avricourt station
-		TIME_CHECK_CALLBACK_1(kTimeExitAvricourt, CURRENT_PARAM(2, 5), 14, setup_exitStation, "Avricourt");
+		if (timeCheckExitStation(kTimeExitAvricourt, CURRENT_PARAM(2, 5), 14, "Avricourt"))
+			break;
 
 label_enter_deutschavricourt:
 		// Entering Deutsch-Avricourt station
@@ -499,7 +504,8 @@ label_enter_deutschavricourt:
 
 label_exit_deutschavricourt:
 		// Exiting Avricourt station
-		TIME_CHECK_CALLBACK_1(kTimeExitDeutschAvricourt, CURRENT_PARAM(2, 7), 16, setup_exitStation, "DeutschA");
+		if (timeCheckExitStation(kTimeExitDeutschAvricourt, CURRENT_PARAM(2, 7), 16, "DeutschA"))
+			break;
 
 label_enter_strasbourg:
 		if (getState()->time > kTimeCityStrasbourg && !CURRENT_PARAM(2, 8)) {
@@ -512,7 +518,8 @@ label_enter_strasbourg:
 
 label_exit_strasbourg:
 		// Exiting Strasbourg station
-		TIME_CHECK_CALLBACK_1(kTimeExitStrasbourg, CURRENT_PARAM(3, 1), 19, setup_exitStation, "Strasbou");
+		if (timeCheckExitStation(kTimeExitStrasbourg, CURRENT_PARAM(3, 1), 19, "Strasbou"))
+			break;
 
 label_enter_badenoos:
 		// Entering Baden Oos station
@@ -521,7 +528,8 @@ label_enter_badenoos:
 
 label_exit_badenoos:
 		// Exiting Baden Oos station
-		TIME_CHECK_CALLBACK_1(kTimeExitBadenOos, CURRENT_PARAM(3, 3), 21, setup_exitStation, "BadenOos");
+		if (timeCheckExitStation(kTimeExitBadenOos, CURRENT_PARAM(3, 3), 21, "BadenOos"))
+			break;
 
 label_chapter1_next:
 		if (getState()->time > kTimeChapter1End3 && ! CURRENT_PARAM(3, 4)) {
@@ -946,28 +954,32 @@ IMPLEMENT_FUNCTION(15, Chapters, chapter3Handler)
 			break;
 
 label_callback_1:
-		TIME_CHECK_CALLBACK_1(kTimeExitSalzbourg, params->param7, 2, setup_exitStation, "Salzburg");
+		if (timeCheckExitStation(kTimeExitSalzbourg, params->param7, 2, "Salzburg"))
+			break;
 
 label_callback_2:
 		if (timeCheckEnterStation(kTimeEnterAttnangPuchheim, params->param8, 3, "Attnang", kCityAttnangPuchheim))
 			break;
 
 label_callback_3:
-		TIME_CHECK_CALLBACK_1(kTimeExitAttnangPuchheim, CURRENT_PARAM(1, 1), 4, setup_exitStation, "Attnang");
+		if (timeCheckExitStation(kTimeExitAttnangPuchheim, CURRENT_PARAM(1, 1), 4, "Attnang"))
+			break;
 
 label_callback_4:
 		if (timeCheckEnterStation(kTimeEnterWels, CURRENT_PARAM(1, 2), 5, "Wels", kCityWels))
 			break;
 
 label_callback_5:
-		TIME_CHECK_CALLBACK_1(kTimeEnterWels, CURRENT_PARAM(1, 3), 6, setup_exitStation, "Wels");
+		if (timeCheckExitStation(kTimeEnterWels, CURRENT_PARAM(1, 3), 6, "Wels"))
+			break;
 
 label_callback_6:
 		if (timeCheckEnterStation(kTimeEnterLinz, CURRENT_PARAM(1, 4), 7, "Linz", kCityLinz))
 			break;
 
 label_callback_7:
-		TIME_CHECK_CALLBACK_1(kTimeCityLinz, CURRENT_PARAM(1, 5), 8, setup_exitStation, "Linz");
+		if (timeCheckExitStation(kTimeCityLinz, CURRENT_PARAM(1, 5), 8, "Linz"))
+			break;
 
 label_callback_8:
 		if (getState()->time > kTime2187000 && !CURRENT_PARAM(1, 6)) {
@@ -1249,7 +1261,8 @@ IMPLEMENT_FUNCTION(19, Chapters, chapter4Handler)
 			break;
 
 label_exitPozsony:
-		TIME_CHECK_CALLBACK_1(kTimeExitPoszony, CURRENT_PARAM(1, 1), 2, setup_exitStation, "Pozsony");
+		if (timeCheckExitStation(kTimeExitPoszony, CURRENT_PARAM(1, 1), 2, "Pozsony"))
+			break;
 
 label_enterGalanta:
 		if (getObjects()->get(kObjectCompartment1).location2 == kObjectLocation1) {
@@ -1266,7 +1279,8 @@ label_enterGalanta:
 			break;
 
 label_exitGalanta:
-		TIME_CHECK_CALLBACK_1(kTimeExitGalanta, CURRENT_PARAM(1, 4), 4, setup_exitStation, "Galanta");
+		if (timeCheckExitStation(kTimeExitGalanta, CURRENT_PARAM(1, 4), 4, "Galanta"))
+			break;
 
 label_callback_4:
 		if (getState()->time > kTime2470500 && !CURRENT_PARAM(1, 5)) {
@@ -1855,4 +1869,16 @@ bool Chapters::timeCheckEnterStation(TimeValue timeValue, uint &parameter, byte
 	return false;
 }
 
+bool Chapters::timeCheckExitStation(TimeValue timeValue, uint &parameter, byte callback, const char *sequence) {
+	if (getState()->time > timeValue && !parameter) {
+		parameter = 1;
+		setCallback(callback);
+		setup_exitStation(sequence);
+
+		return true;
+	}
+
+	return false;
+}
+
 } // End of namespace LastExpress
diff --git a/engines/lastexpress/entities/chapters.h b/engines/lastexpress/entities/chapters.h
index 51e6444..a9a5352 100644
--- a/engines/lastexpress/entities/chapters.h
+++ b/engines/lastexpress/entities/chapters.h
@@ -155,6 +155,7 @@ public:
 
 private:
 	bool timeCheckEnterStation(TimeValue timeValue, uint &parameter, byte callback, const char *sequence, CityIndex cityIndex);
+	bool timeCheckExitStation(TimeValue timeValue, uint &parameter, byte callback, const char *sequence);
 	void enterExitStation(const SavePoint &savepoint, bool isEnteringStation);
 	void enterExitHelper(bool isEnteringStation);
 	void playSteam();
diff --git a/engines/lastexpress/entities/entity.cpp b/engines/lastexpress/entities/entity.cpp
index 48856a7..9160b6d 100644
--- a/engines/lastexpress/entities/entity.cpp
+++ b/engines/lastexpress/entities/entity.cpp
@@ -660,6 +660,30 @@ bool Entity::timeCheckCallback(TimeValue timeValue, uint &parameter, byte callba
 	return false;
 }
 
+bool Entity::timeCheckCallback(TimeValue timeValue, uint &parameter, byte callback, const char *str, Common::Functor1<const char *, void> *function) {
+	if (getState()->time > timeValue && !parameter) {
+		parameter = 1;
+		setCallback(callback);
+		(*function)(str);
+
+		return true;
+	}
+
+	return false;
+}
+
+bool Entity::timeCheckCallback(TimeValue timeValue, uint &parameter, byte callback, bool check, Common::Functor1<bool, void> *function) {
+	if (getState()->time > timeValue && !parameter) {
+		parameter = 1;
+		setCallback(callback);
+		(*function)(check);
+
+		return true;
+	}
+
+	return false;
+}
+
 bool Entity::timeCheckCallbackInventory(TimeValue timeValue, uint &parameter, byte callback, Common::Functor0<void> *function) {
 	if (getState()->time > timeValue && !parameter) {
 		parameter = 1;
diff --git a/engines/lastexpress/entities/entity.h b/engines/lastexpress/entities/entity.h
index 785e355..3141559 100644
--- a/engines/lastexpress/entities/entity.h
+++ b/engines/lastexpress/entities/entity.h
@@ -85,6 +85,12 @@ struct SavePoint;
 #define WRAP_SETUP_FUNCTION(className, method) \
 	new Common::Functor0Mem<void, className>(this, &className::method)
 
+#define WRAP_SETUP_FUNCTION_S(className, method) \
+	new Common::Functor1Mem<const char *, void, className>(this, &className::method)
+
+#define WRAP_SETUP_FUNCTION_B(className, method) \
+	new Common::Functor1Mem<bool, void, className>(this, &className::method)
+
 //////////////////////////////////////////////////////////////////////////
 // Parameters macros
 //////////////////////////////////////////////////////////////////////////
@@ -916,6 +922,8 @@ protected:
 
 	bool timeCheck(TimeValue timeValue, uint &parameter, Common::Functor0<void> *function);
 	bool timeCheckCallback(TimeValue timeValue, uint &parameter, byte callback, Common::Functor0<void> *function);
+	bool timeCheckCallback(TimeValue timeValue, uint &parameter, byte callback, const char *str, Common::Functor1<const char *, void> *function);
+	bool timeCheckCallback(TimeValue timeValue, uint &parameter, byte callback, bool check, Common::Functor1<bool, void> *function);
 	bool timeCheckCallbackInventory(TimeValue timeValue, uint &parameter, byte callback, Common::Functor0<void> *function);
 	bool timeCheckCar(TimeValue timeValue, uint &parameter, byte callback, Common::Functor0<void> *function);
 	void timeCheckSavepoint(TimeValue timeValue, uint &parameter, EntityIndex entity1, EntityIndex entity2, ActionIndex action);
diff --git a/engines/lastexpress/entities/entity_intern.h b/engines/lastexpress/entities/entity_intern.h
index f12f34a..01e997f 100644
--- a/engines/lastexpress/entities/entity_intern.h
+++ b/engines/lastexpress/entities/entity_intern.h
@@ -258,18 +258,6 @@ void class::setup_##name() { \
 	EXPOSE_PARAMS(EntityData::EntityParametersIISS) \
 	debugC(6, kLastExpressDebugLogic, "Entity: " #class "::" #name "(%d, %d, %s, %s) - action: %s", params->param1, params->param2, (char *)&params->seq1, (char *)&params->seq2, ACTION_NAME(savepoint.action));
 
-
-//////////////////////////////////////////////////////////////////////////
-// Time check macros
-//////////////////////////////////////////////////////////////////////////
-#define TIME_CHECK_CALLBACK_1(timeValue, parameter, callback, function, param1) \
-	if (getState()->time > timeValue && !parameter) { \
-		parameter = 1; \
-		setCallback(callback); \
-		function(param1); \
-		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 c39eb119..d2bbc98 100644
--- a/engines/lastexpress/entities/francois.cpp
+++ b/engines/lastexpress/entities/francois.cpp
@@ -866,7 +866,7 @@ IMPLEMENT_FUNCTION(18, Francois, chapter1Handler)
 		break;
 
 	case kActionNone:
-		TIME_CHECK_CALLBACK_1(kTimeParisEpernay, params->param1, 1, setup_function11, kTime1093500);
+		timeCheckCallback(kTimeParisEpernay, params->param1, 1, kTime1093500);
 		break;
 
 	case kActionCallback:
@@ -978,7 +978,8 @@ IMPLEMENT_FUNCTION(23, Francois, function23)
 		}
 
 label_callback_1:
-		TIME_CHECK_CALLBACK_1(kTime1764000, params->param1, 2, setup_playSound, "Fra2011");
+		if (Entity::timeCheckCallback(kTime1764000, params->param1, 2, "Fra2011", WRAP_SETUP_FUNCTION_S(Francois, setup_playSound)))
+			break;
 
 label_callback_2:
 		if (Entity::timeCheckCallback(kTime1800000, params->param2, 3, WRAP_SETUP_FUNCTION(Francois, setup_function13)))
@@ -986,10 +987,12 @@ label_callback_2:
 
 label_callback_3:
 		if (!getInventory()->hasItem(kItemWhistle) && getInventory()->get(kItemWhistle)->location != kObjectLocation3) {
-			TIME_CHECK_CALLBACK_1(kTime1768500, params->param3, 4, setup_function11, kTime1773000);
+			if (timeCheckCallback(kTime1768500, params->param3, 4, kTime1773000))
+				break;
 
 label_callback_4:
-			TIME_CHECK_CALLBACK_1(kTime1827000, params->param4, 5, setup_function11, kTime1831500);
+			if (timeCheckCallback(kTime1827000, params->param4, 5, kTime1831500))
+				break;
 		}
 
 label_callback_5:
@@ -1116,10 +1119,12 @@ label_callback_8:
 
 label_callback_9:
 			if (!getInventory()->hasItem(kItemWhistle) && getInventory()->get(kItemWhistle)->location != kObjectLocation3) {
-				TIME_CHECK_CALLBACK_1(kTime2011500, CURRENT_PARAM(1, 2), 10, setup_function11, kTime2016000);
+				if (timeCheckCallback(kTime2011500, CURRENT_PARAM(1, 2), 10, kTime2016000))
+					break;
 
 label_callback_10:
-				TIME_CHECK_CALLBACK_1(kTime2115000, CURRENT_PARAM(1, 3), 11, setup_function11, kTime2119500);
+				if (timeCheckCallback(kTime2115000, CURRENT_PARAM(1, 3), 11, kTime2119500))
+					break;
 			}
 
 label_callback_11:
@@ -1317,5 +1322,17 @@ bool Francois::timeCheckCallbackCompartment(TimeValue timeValue, uint &parameter
 	return false;
 }
 
+bool Francois::timeCheckCallback(TimeValue timeValue, uint &parameter, byte callback, TimeValue timeValue2) {
+	if (getState()->time > timeValue && !parameter) {
+		parameter = 1;
+		setCallback(callback);
+		setup_function11(timeValue2);
+
+		return true;
+	}
+
+	return false;
+}
+
 
 } // End of namespace LastExpress
diff --git a/engines/lastexpress/entities/francois.h b/engines/lastexpress/entities/francois.h
index 09715db..5a4ff4b 100644
--- a/engines/lastexpress/entities/francois.h
+++ b/engines/lastexpress/entities/francois.h
@@ -163,6 +163,7 @@ public:
 
 private:
 	bool timeCheckCallbackCompartment(TimeValue timeValue, uint &parameter, byte callback, ObjectIndex compartment, EntityPosition position, const char* sequenceSuffix);
+	bool timeCheckCallback(TimeValue timeValue, uint &parameter, byte callback, TimeValue timeValue2);
 };
 
 } // End of namespace LastExpress
diff --git a/engines/lastexpress/entities/mertens.cpp b/engines/lastexpress/entities/mertens.cpp
index b6ea86c..97dd293 100644
--- a/engines/lastexpress/entities/mertens.cpp
+++ b/engines/lastexpress/entities/mertens.cpp
@@ -3532,14 +3532,16 @@ label_callback_5:
 		}
 
 label_callback_6:
-		TIME_CHECK_CALLBACK_1(kTime1971000, params->param1, 7, setup_function28, "CON3012");
+		if (Entity::timeCheckCallback(kTime1971000, params->param1, 7, "CON3012", WRAP_SETUP_FUNCTION_S(Mertens, setup_function28)))
+			break;
 
 label_callback_7:
 		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");
+		if (Entity::timeCheckCallback(kTime2124000, params->param3, 9, "CON2010", WRAP_SETUP_FUNCTION_S(Mertens, setup_function28)))
+			break;
 
 label_callback_9:
 		if (Entity::timeCheckCallback(kTime2146500, params->param4, 10, WRAP_SETUP_FUNCTION(Mertens, setup_function32)))
diff --git a/engines/lastexpress/entities/rebecca.cpp b/engines/lastexpress/entities/rebecca.cpp
index 79d13a9..5bcb6ae 100644
--- a/engines/lastexpress/entities/rebecca.cpp
+++ b/engines/lastexpress/entities/rebecca.cpp
@@ -683,7 +683,8 @@ IMPLEMENT_FUNCTION(22, Rebecca, chapter1Handler)
 		break;
 
 	case kActionNone:
-		TIME_CHECK_CALLBACK_1(kTime1084500, params->param3, 1, setup_playSound, "REB1015");
+		if (Entity::timeCheckCallback(kTime1084500, params->param3, 1, "REB1015", WRAP_SETUP_FUNCTION_S(Rebecca, setup_playSound)))
+			break;
 
 		if (params->param4 == kTimeInvalid)
 			goto label_callback_4;
diff --git a/engines/lastexpress/entities/verges.cpp b/engines/lastexpress/entities/verges.cpp
index e652687..867f122 100644
--- a/engines/lastexpress/entities/verges.cpp
+++ b/engines/lastexpress/entities/verges.cpp
@@ -907,7 +907,8 @@ label_callback3:
 		if (params->param6)
 			goto label_callback12;
 
-		TIME_CHECK_CALLBACK_1(kTimeChapter1, params->param7, 4, setup_function9, "TRA1001");
+		if (Entity::timeCheckCallback(kTimeChapter1, params->param7, 4, "TRA1001", WRAP_SETUP_FUNCTION_S(Verges, setup_function9)))
+			break;
 
 label_callback4:
 		if (Entity::timeCheckCallback(kTime1089000, params->param8, 5, WRAP_SETUP_FUNCTION(Verges, setup_function12)))
@@ -922,16 +923,20 @@ label_callback4:
 		}
 
 label_callback8:
-		TIME_CHECK_CALLBACK_1(kTime1107000, CURRENT_PARAM(1, 1), 9, setup_function9, "TRA1001A");
+		if (Entity::timeCheckCallback(kTime1107000, CURRENT_PARAM(1, 1), 9, "TRA1001A", WRAP_SETUP_FUNCTION_S(Verges, setup_function9)))
+			break;
 
 label_callback9:
-		TIME_CHECK_CALLBACK_1(kTime1134000, CURRENT_PARAM(1, 2), 10, setup_function9, "TRA1002");
+		if (Entity::timeCheckCallback(kTime1134000, CURRENT_PARAM(1, 2), 10, "TRA1002", WRAP_SETUP_FUNCTION_S(Verges, setup_function9)))
+			break;
 
 label_callback10:
-		TIME_CHECK_CALLBACK_1(kTime1165500, CURRENT_PARAM(1, 3), 11, setup_function9, "TRA1003");
+		if (Entity::timeCheckCallback(kTime1165500, CURRENT_PARAM(1, 3), 11, "TRA1003", WRAP_SETUP_FUNCTION_S(Verges, setup_function9)))
+			break;
 
 label_callback11:
-		TIME_CHECK_CALLBACK_1(kTime1225800, CURRENT_PARAM(1, 4), 12, setup_function9, "TRA1004");
+		if (Entity::timeCheckCallback(kTime1225800, CURRENT_PARAM(1, 4), 12, "TRA1004", WRAP_SETUP_FUNCTION_S(Verges, setup_function9)))
+			break;
 
 label_callback12:
 		if (ENTITY_PARAM(0, 5) && !params->param2) {
@@ -1083,7 +1088,8 @@ IMPLEMENT_FUNCTION(28, Verges, chapter2Handler)
 		}
 
 label_callback_1:
-		TIME_CHECK_CALLBACK_1(kTime1818900, params->param1, 2, setup_function9, "Tra2177");
+		if (Entity::timeCheckCallback(kTime1818900, params->param1, 2, "Tra2177", WRAP_SETUP_FUNCTION_S(Verges, setup_function9)))
+			break;
 
 label_callback_2:
 		if (params->param2 == kTimeInvalid || !getState()->time)
@@ -1445,23 +1451,28 @@ label_callback_2:
 		}
 
 label_callback_3:
-		TIME_CHECK_CALLBACK_1(kTime1971000, params->param1, 4, setup_function9, "Tra3001");
+		if (Entity::timeCheckCallback(kTime1971000, params->param1, 4, "Tra3001", WRAP_SETUP_FUNCTION_S(Verges, setup_function9)))
+			break;
 
 label_callback_4:
-		TIME_CHECK_CALLBACK_1(kTime1998000, params->param2, 5, setup_function9, "Tra3010a");
+		if (Entity::timeCheckCallback(kTime1998000, params->param2, 5, "Tra3010a", WRAP_SETUP_FUNCTION_S(Verges, setup_function9)))
+			break;
 
 label_callback_5:
 		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");
+		if (Entity::timeCheckCallback(kTime2070000, params->param4, 7, "Tra3002", WRAP_SETUP_FUNCTION_S(Verges, setup_function9)))
+			break;
 
 label_callback_7:
-		TIME_CHECK_CALLBACK_1(kTime2142000, params->param5, 8, setup_function9, "Tra3003");
+		if (Entity::timeCheckCallback(kTime2142000, params->param5, 8, "Tra3003", WRAP_SETUP_FUNCTION_S(Verges, setup_function9)))
+			break;
 
 label_callback_8:
-		TIME_CHECK_CALLBACK_1(kTime2173500, params->param6, 9, setup_function30, "Tra3012");
+		if (Entity::timeCheckCallback(kTime2173500, params->param6, 9, "Tra3012", WRAP_SETUP_FUNCTION_S(Verges, setup_function30)))
+			break;
 
 label_callback_9:
 		Entity::timeCheckCallback(kTime2218500, params->param7, 10, WRAP_SETUP_FUNCTION(Verges, setup_function32));
@@ -1611,27 +1622,32 @@ label_callback_1:
 			}
 
 label_callback_2:
-			TIME_CHECK_CALLBACK_1(kTime2349000, params->param1, 3, setup_function9, "Tra1001");
+			if (Entity::timeCheckCallback(kTime2349000, params->param1, 3, "Tra1001", WRAP_SETUP_FUNCTION_S(Verges, setup_function9)))
+				break;
 
 label_callback_3:
-			TIME_CHECK_CALLBACK_1(kTime2378700, params->param2, 4, setup_function9, "Tra4001");
+			if (Entity::timeCheckCallback(kTime2378700, params->param2, 4, "Tra4001", WRAP_SETUP_FUNCTION_S(Verges, setup_function9)))
+				break;
 
 label_callback_4:
-			TIME_CHECK_CALLBACK_1(kTime2403000, params->param3, 5, setup_function9, "Tra1001A");
+			if (Entity::timeCheckCallback(kTime2403000, params->param3, 5, "Tra1001A", WRAP_SETUP_FUNCTION_S(Verges, setup_function9)))
+				break;
 
 label_callback_5:
-			TIME_CHECK_CALLBACK_1(kTime2414700, params->param4, 6, setup_function9, "Tra4002");
+			if (Entity::timeCheckCallback(kTime2414700, params->param4, 6, "Tra4002", WRAP_SETUP_FUNCTION_S(Verges, setup_function9)))
+				break;
 
 label_callback_6:
-			TIME_CHECK_CALLBACK_1(kTime2484000, params->param5, 7, setup_function9, "Tra4003");
+			if (Entity::timeCheckCallback(kTime2484000, params->param5, 7, "Tra4003", WRAP_SETUP_FUNCTION_S(Verges, setup_function9)))
+				break;
 
 label_callback_7:
-			TIME_CHECK_CALLBACK_1(kTime2511000, params->param6, 8, setup_function9, "Tra4004");
+			if (Entity::timeCheckCallback(kTime2511000, params->param6, 8, "Tra4004", WRAP_SETUP_FUNCTION_S(Verges, setup_function9)))
+				break;
 		}
 
 label_callback_8:
-		TIME_CHECK_CALLBACK_1(kTime2538000, params->param7, 9, setup_function9, "Tra4005");
-
+		Entity::timeCheckCallback(kTime2538000, params->param7, 9, "Tra4005", WRAP_SETUP_FUNCTION_S(Verges, setup_function9));
 		break;
 
 	case kActionOpenDoor:
diff --git a/engines/lastexpress/entities/yasmin.cpp b/engines/lastexpress/entities/yasmin.cpp
index acacbb5..1d280f5 100644
--- a/engines/lastexpress/entities/yasmin.cpp
+++ b/engines/lastexpress/entities/yasmin.cpp
@@ -211,9 +211,11 @@ IMPLEMENT_FUNCTION(9, Yasmin, chapter1Handler)
 		if (Entity::timeCheckPlaySoundUpdatePosition(kTime1162800, params->param3, 4, "Har1102", kPosition_4070))
 			break;
 
-		TIME_CHECK_CALLBACK_1(kTime1165500, params->param4, 5, setup_playSound, "Har1104");
+		if (Entity::timeCheckCallback(kTime1165500, params->param4, 5, "Har1104", WRAP_SETUP_FUNCTION_S(Yasmin, setup_playSound)))
+			break;
 
-		TIME_CHECK_CALLBACK_1(kTime1174500, params->param5, 6, setup_playSound, "Har1106");
+		if (Entity::timeCheckCallback(kTime1174500, params->param5, 6, "Har1106", WRAP_SETUP_FUNCTION_S(Yasmin, setup_playSound)))
+			break;
 
 		Entity::timeCheckCallback(kTime1183500, params->param6, 7, WRAP_SETUP_FUNCTION(Yasmin, setup_function6));
 		break;
@@ -240,11 +242,13 @@ IMPLEMENT_FUNCTION(9, Yasmin, chapter1Handler)
 			// Fallback to case 4
 
 		case 4:
-			TIME_CHECK_CALLBACK_1(kTime1165500, params->param4, 5, setup_playSound, "Har1104");
+			if (Entity::timeCheckCallback(kTime1165500, params->param4, 5, "Har1104", WRAP_SETUP_FUNCTION_S(Yasmin, setup_playSound)))
+				break;
 			// Fallback to case 5
 
 		case 5:
-			TIME_CHECK_CALLBACK_1(kTime1174500, params->param5, 6, setup_playSound, "Har1106");
+			if (Entity::timeCheckCallback(kTime1174500, params->param5, 6, "Har1106", WRAP_SETUP_FUNCTION_S(Yasmin, setup_playSound)))
+				break;
 			// Fallback to case 6
 
 		case 6:


Commit: 813c2bb96587966cc49d34daef3bb5b5930427f1
    https://github.com/scummvm/scummvm/commit/813c2bb96587966cc49d34daef3bb5b5930427f1
Author: Julien (julien at powerinbox.com)
Date: 2012-07-26T21:15:04-07:00

Commit Message:
LASTEXPRESS: Merge the remaining macros in entity_intern.h into entity.h

Changed paths:
    engines/lastexpress/entities/abbot.h
    engines/lastexpress/entities/alexei.h
    engines/lastexpress/entities/alouan.h
    engines/lastexpress/entities/anna.h
    engines/lastexpress/entities/august.h
    engines/lastexpress/entities/boutarel.h
    engines/lastexpress/entities/chapters.h
    engines/lastexpress/entities/cooks.h
    engines/lastexpress/entities/coudert.h
    engines/lastexpress/entities/entity.cpp
    engines/lastexpress/entities/entity.h
    engines/lastexpress/entities/entity39.h
    engines/lastexpress/entities/entity_intern.h
    engines/lastexpress/entities/francois.h
    engines/lastexpress/entities/gendarmes.h
    engines/lastexpress/entities/hadija.h
    engines/lastexpress/entities/ivo.h
    engines/lastexpress/entities/kahina.h
    engines/lastexpress/entities/kronos.h
    engines/lastexpress/entities/mahmud.h
    engines/lastexpress/entities/max.h
    engines/lastexpress/entities/mertens.h
    engines/lastexpress/entities/milos.h
    engines/lastexpress/entities/mmeboutarel.h
    engines/lastexpress/entities/pascale.h
    engines/lastexpress/entities/rebecca.h
    engines/lastexpress/entities/salko.h
    engines/lastexpress/entities/servers0.h
    engines/lastexpress/entities/servers1.h
    engines/lastexpress/entities/sophie.h
    engines/lastexpress/entities/tables.h
    engines/lastexpress/entities/tatiana.h
    engines/lastexpress/entities/train.h
    engines/lastexpress/entities/vassili.h
    engines/lastexpress/entities/verges.h
    engines/lastexpress/entities/vesna.h
    engines/lastexpress/entities/yasmin.h



diff --git a/engines/lastexpress/entities/abbot.h b/engines/lastexpress/entities/abbot.h
index 462f5a4..ce52bb6 100644
--- a/engines/lastexpress/entities/abbot.h
+++ b/engines/lastexpress/entities/abbot.h
@@ -24,7 +24,6 @@
 #define LASTEXPRESS_ABBOT_H
 
 #include "lastexpress/entities/entity.h"
-#include "lastexpress/entities/entity_intern.h"
 
 namespace LastExpress {
 
diff --git a/engines/lastexpress/entities/alexei.h b/engines/lastexpress/entities/alexei.h
index 262826a..9792385 100644
--- a/engines/lastexpress/entities/alexei.h
+++ b/engines/lastexpress/entities/alexei.h
@@ -24,7 +24,6 @@
 #define LASTEXPRESS_ALEXEI_H
 
 #include "lastexpress/entities/entity.h"
-#include "lastexpress/entities/entity_intern.h"
 
 namespace LastExpress {
 
diff --git a/engines/lastexpress/entities/alouan.h b/engines/lastexpress/entities/alouan.h
index c6a6bed..91254a4 100644
--- a/engines/lastexpress/entities/alouan.h
+++ b/engines/lastexpress/entities/alouan.h
@@ -24,7 +24,6 @@
 #define LASTEXPRESS_ALOUAN_H
 
 #include "lastexpress/entities/entity.h"
-#include "lastexpress/entities/entity_intern.h"
 
 namespace LastExpress {
 
diff --git a/engines/lastexpress/entities/anna.h b/engines/lastexpress/entities/anna.h
index 72c6db4..205ff9d 100644
--- a/engines/lastexpress/entities/anna.h
+++ b/engines/lastexpress/entities/anna.h
@@ -24,7 +24,6 @@
 #define LASTEXPRESS_ANNA_H
 
 #include "lastexpress/entities/entity.h"
-#include "lastexpress/entities/entity_intern.h"
 
 namespace LastExpress {
 
diff --git a/engines/lastexpress/entities/august.h b/engines/lastexpress/entities/august.h
index 2cbb31b..6063219 100644
--- a/engines/lastexpress/entities/august.h
+++ b/engines/lastexpress/entities/august.h
@@ -24,7 +24,6 @@
 #define LASTEXPRESS_AUGUST_H
 
 #include "lastexpress/entities/entity.h"
-#include "lastexpress/entities/entity_intern.h"
 
 namespace LastExpress {
 
diff --git a/engines/lastexpress/entities/boutarel.h b/engines/lastexpress/entities/boutarel.h
index 5eb2646..04838f6 100644
--- a/engines/lastexpress/entities/boutarel.h
+++ b/engines/lastexpress/entities/boutarel.h
@@ -24,7 +24,6 @@
 #define LASTEXPRESS_BOUTAREL_H
 
 #include "lastexpress/entities/entity.h"
-#include "lastexpress/entities/entity_intern.h"
 
 namespace LastExpress {
 
diff --git a/engines/lastexpress/entities/chapters.h b/engines/lastexpress/entities/chapters.h
index a9a5352..ddb3de3 100644
--- a/engines/lastexpress/entities/chapters.h
+++ b/engines/lastexpress/entities/chapters.h
@@ -24,7 +24,6 @@
 #define LASTEXPRESS_CHAPTERS_H
 
 #include "lastexpress/entities/entity.h"
-#include "lastexpress/entities/entity_intern.h"
 
 namespace LastExpress {
 
diff --git a/engines/lastexpress/entities/cooks.h b/engines/lastexpress/entities/cooks.h
index 3ab7d35..f01d0b2 100644
--- a/engines/lastexpress/entities/cooks.h
+++ b/engines/lastexpress/entities/cooks.h
@@ -24,7 +24,6 @@
 #define LASTEXPRESS_COOKS_H
 
 #include "lastexpress/entities/entity.h"
-#include "lastexpress/entities/entity_intern.h"
 
 namespace LastExpress {
 
diff --git a/engines/lastexpress/entities/coudert.h b/engines/lastexpress/entities/coudert.h
index 45d13ce..8303c80 100644
--- a/engines/lastexpress/entities/coudert.h
+++ b/engines/lastexpress/entities/coudert.h
@@ -24,8 +24,6 @@
 #define LASTEXPRESS_COUDERT_H
 
 #include "lastexpress/entities/entity.h"
-#include "lastexpress/entities/entity_intern.h"
-
 namespace LastExpress {
 
 class LastExpressEngine;
diff --git a/engines/lastexpress/entities/entity.cpp b/engines/lastexpress/entities/entity.cpp
index 9160b6d..a9ceaa1 100644
--- a/engines/lastexpress/entities/entity.cpp
+++ b/engines/lastexpress/entities/entity.cpp
@@ -22,8 +22,6 @@
 
 #include "lastexpress/entities/entity.h"
 
-#include "lastexpress/entities/entity_intern.h"
-
 #include "lastexpress/data/sequence.h"
 
 #include "lastexpress/game/action.h"
diff --git a/engines/lastexpress/entities/entity.h b/engines/lastexpress/entities/entity.h
index 3141559..634e400 100644
--- a/engines/lastexpress/entities/entity.h
+++ b/engines/lastexpress/entities/entity.h
@@ -107,6 +107,238 @@ struct SavePoint;
 	getEntities()->resetState(entity); \
 	((class *)getEntities()->get(entity))->function();
 
+//////////////////////////////////////////////////////////////////////////
+// Setup
+//////////////////////////////////////////////////////////////////////////
+
+#define IMPLEMENT_SETUP(class, callback_class, name, index) \
+void class::setup_##name() { \
+	BEGIN_SETUP(callback_class, name, index, EntityData::EntityParametersIIII) \
+	debugC(6, kLastExpressDebugLogic, "Entity: " #class "::setup_" #name "()"); \
+	END_SETUP() \
+}
+
+#define BEGIN_SETUP(class, name, index, type) \
+	_engine->getGameLogic()->getGameState()->getGameSavePoints()->setCallback(_entityIndex, _callbacks[index]); \
+	_data->setCurrentCallback(index); \
+	_data->resetCurrentParameters<type>();
+
+#define END_SETUP() \
+	_engine->getGameLogic()->getGameState()->getGameSavePoints()->call(_entityIndex, _entityIndex, kActionDefault);
+
+
+//////////////////////////////////////////////////////////////////////////
+// Implementation
+//////////////////////////////////////////////////////////////////////////
+
+// Expose parameters and check validity
+#define EXPOSE_PARAMS(type) \
+	type *params = (type *)_data->getCurrentParameters(); \
+	if (!params) \
+		error("[EXPOSE_PARAMS] Trying to call an entity function with invalid parameters"); \
+
+
+// function signature without setup (we keep the index for consistency but never use it)
+#define IMPLEMENT_FUNCTION_NOSETUP(index, class, name) \
+	void class::name(const SavePoint &savepoint) { \
+		debugC(6, kLastExpressDebugLogic, "Entity: " #class "::" #name "(index=" #index ")");
+
+// simple setup with no parameters
+#define IMPLEMENT_FUNCTION(index, class, name) \
+	IMPLEMENT_SETUP(class, class, name, index) \
+	void class::name(const SavePoint &savepoint) { \
+		EXPOSE_PARAMS(EntityData::EntityParametersIIII) \
+		debugC(6, kLastExpressDebugLogic, "Entity: " #class "::" #name "() - action: %s", ACTION_NAME(savepoint.action));
+
+#define IMPLEMENT_FUNCTION_END }
+
+// nullfunction call
+#define IMPLEMENT_NULL_FUNCTION(index, class) \
+	IMPLEMENT_SETUP(class, Entity, nullfunction, index)
+
+// setup with one uint parameter
+#define IMPLEMENT_FUNCTION_I(index, class, name, paramType) \
+	void class::setup_##name(paramType param1) { \
+	BEGIN_SETUP(class, name, index, EntityData::EntityParametersIIII) \
+	EntityData::EntityParametersIIII *params = (EntityData::EntityParametersIIII*)_data->getCurrentParameters(); \
+	params->param1 = (unsigned int)param1; \
+	END_SETUP() \
+	} \
+	void class::name(const SavePoint &savepoint) { \
+	EXPOSE_PARAMS(EntityData::EntityParametersIIII) \
+	debugC(6, kLastExpressDebugLogic, "Entity: " #class "::" #name "(%d) - action: %s", params->param1, ACTION_NAME(savepoint.action));
+
+// setup with two uint parameters
+#define IMPLEMENT_FUNCTION_II(index, class, name, paramType1, paramType2) \
+	void class::setup_##name(paramType1 param1, paramType2 param2) { \
+		BEGIN_SETUP(class, name, index, EntityData::EntityParametersIIII) \
+		EntityData::EntityParametersIIII *params = (EntityData::EntityParametersIIII*)_data->getCurrentParameters(); \
+		params->param1 = param1; \
+		params->param2 = param2; \
+		END_SETUP() \
+	} \
+	void class::name(const SavePoint &savepoint) { \
+	EXPOSE_PARAMS(EntityData::EntityParametersIIII) \
+	debugC(6, kLastExpressDebugLogic, "Entity: " #class "::" #name "(%d, %d) - action: %s", params->param1, params->param2, ACTION_NAME(savepoint.action));
+
+// setup with three uint parameters
+#define IMPLEMENT_FUNCTION_III(index, class, name, paramType1, paramType2, paramType3) \
+	void class::setup_##name(paramType1 param1, paramType2 param2, paramType3 param3) { \
+		BEGIN_SETUP(class, name, index, EntityData::EntityParametersIIII) \
+		EntityData::EntityParametersIIII *params = (EntityData::EntityParametersIIII*)_data->getCurrentParameters(); \
+		params->param1 = param1; \
+		params->param2 = param2; \
+		params->param3 = param3; \
+		END_SETUP() \
+	} \
+	void class::name(const SavePoint &savepoint) { \
+	EXPOSE_PARAMS(EntityData::EntityParametersIIII) \
+	debugC(6, kLastExpressDebugLogic, "Entity: " #class "::" #name "(%d, %d, %d) - action: %s", params->param1, params->param2, params->param3, ACTION_NAME(savepoint.action));
+
+// setup with one char *parameter
+#define IMPLEMENT_FUNCTION_S(index, class, name) \
+	void class::setup_##name(const char *seq1) { \
+		BEGIN_SETUP(class, name, index, EntityData::EntityParametersSIIS) \
+		EntityData::EntityParametersSIIS *params = (EntityData::EntityParametersSIIS*)_data->getCurrentParameters(); \
+		strncpy((char *)&params->seq1, seq1, 12); \
+		END_SETUP() \
+	} \
+	void class::name(const SavePoint &savepoint) { \
+	EXPOSE_PARAMS(EntityData::EntityParametersSIIS) \
+	debugC(6, kLastExpressDebugLogic, "Entity: " #class "::" #name "(%s) - action: %s", (char *)&params->seq1, ACTION_NAME(savepoint.action));
+
+// setup with one char *parameter and one uint
+#define IMPLEMENT_FUNCTION_SI(index, class, name, paramType2) \
+	void class::setup_##name(const char *seq1, paramType2 param4) { \
+		BEGIN_SETUP(class, name, index, EntityData::EntityParametersSIIS) \
+		EntityData::EntityParametersSIIS *params = (EntityData::EntityParametersSIIS*)_data->getCurrentParameters(); \
+		strncpy((char *)&params->seq1, seq1, 12); \
+		params->param4 = param4; \
+		END_SETUP() \
+	} \
+	void class::name(const SavePoint &savepoint) { \
+	EXPOSE_PARAMS(EntityData::EntityParametersSIIS) \
+	debugC(6, kLastExpressDebugLogic, "Entity: " #class "::" #name "(%s, %d) - action: %s", (char *)&params->seq1, params->param4, ACTION_NAME(savepoint.action));
+
+// setup with one char *parameter and two uints
+#define IMPLEMENT_FUNCTION_SII(index, class, name, paramType2, paramType3) \
+	void class::setup_##name(const char *seq1, paramType2 param4, paramType3 param5) { \
+		BEGIN_SETUP(class, name, index, EntityData::EntityParametersSIIS) \
+		EntityData::EntityParametersSIIS *params = (EntityData::EntityParametersSIIS*)_data->getCurrentParameters(); \
+		strncpy((char *)&params->seq1, seq1, 12); \
+		params->param4 = param4; \
+		params->param5 = param5; \
+		END_SETUP() \
+	} \
+	void class::name(const SavePoint &savepoint) { \
+	EXPOSE_PARAMS(EntityData::EntityParametersSIIS) \
+	debugC(6, kLastExpressDebugLogic, "Entity: " #class "::" #name "(%s, %d, %d) - action: %s", (char *)&params->seq1, params->param4, params->param5, ACTION_NAME(savepoint.action));
+
+// setup with one char *parameter and three uints
+#define IMPLEMENT_FUNCTION_SIII(index, class, name, paramType2, paramType3, paramType4) \
+	void class::setup_##name(const char *seq, paramType2 param4, paramType3 param5, paramType4 param6) { \
+		BEGIN_SETUP(class, name, index, EntityData::EntityParametersSIII) \
+		EntityData::EntityParametersSIII *params = (EntityData::EntityParametersSIII*)_data->getCurrentParameters(); \
+		strncpy((char *)&params->seq, seq, 12); \
+		params->param4 = param4; \
+		params->param5 = param5; \
+		params->param6 = param6; \
+		END_SETUP() \
+	} \
+	void class::name(const SavePoint &savepoint) { \
+	EXPOSE_PARAMS(EntityData::EntityParametersSIII) \
+	debugC(6, kLastExpressDebugLogic, "Entity: " #class "::" #name "(%s, %d, %d, %d) - action: %s", (char *)&params->seq, params->param4, params->param5, params->param6, ACTION_NAME(savepoint.action));
+
+#define IMPLEMENT_FUNCTION_SIIS(index, class, name, paramType2, paramType3) \
+	void class::setup_##name(const char *seq1, paramType2 param4, paramType3 param5, const char *seq2) { \
+		BEGIN_SETUP(class, name, index, EntityData::EntityParametersSIIS) \
+		EntityData::EntityParametersSIIS *params = (EntityData::EntityParametersSIIS*)_data->getCurrentParameters(); \
+		strncpy((char *)&params->seq1, seq1, 12); \
+		params->param4 = param4; \
+		params->param5 = param5; \
+		strncpy((char *)&params->seq2, seq2, 12); \
+		END_SETUP() \
+	} \
+	void class::name(const SavePoint &savepoint) { \
+	EXPOSE_PARAMS(EntityData::EntityParametersSIIS) \
+	debugC(6, kLastExpressDebugLogic, "Entity: " #class "::" #name "(%s, %d, %d, %s) - action: %s", (char *)&params->seq1, params->param4, params->param5, (char *)&params->seq2, ACTION_NAME(savepoint.action));
+
+#define IMPLEMENT_FUNCTION_SS(index, class, name) \
+	void class::setup_##name(const char *seq1, const char *seq2) { \
+		BEGIN_SETUP(class, name, index, EntityData::EntityParametersSSII) \
+		EntityData::EntityParametersSSII *params = (EntityData::EntityParametersSSII*)_data->getCurrentParameters(); \
+		strncpy((char *)&params->seq1, seq1, 12); \
+		strncpy((char *)&params->seq2, seq2, 12); \
+		END_SETUP() \
+	} \
+	void class::name(const SavePoint &savepoint) { \
+	EXPOSE_PARAMS(EntityData::EntityParametersSSII) \
+	debugC(6, kLastExpressDebugLogic, "Entity: " #class "::" #name "(%s, %s) - action: %s", (char *)&params->seq1, (char *)&params->seq2, ACTION_NAME(savepoint.action));
+
+#define IMPLEMENT_FUNCTION_SSI(index, class, name, paramType3) \
+	void class::setup_##name(const char *seq1, const char *seq2, paramType3 param7) { \
+		BEGIN_SETUP(class, name, index, EntityData::EntityParametersSSII) \
+		EntityData::EntityParametersSSII *params = (EntityData::EntityParametersSSII*)_data->getCurrentParameters(); \
+		strncpy((char *)&params->seq1, seq1, 12); \
+		strncpy((char *)&params->seq2, seq2, 12); \
+		params->param7 = param7; \
+		END_SETUP() \
+	} \
+	void class::name(const SavePoint &savepoint) { \
+	EXPOSE_PARAMS(EntityData::EntityParametersSSII) \
+	debugC(6, kLastExpressDebugLogic, "Entity: " #class "::" #name "(%s, %s, %d) - action: %s", (char *)&params->seq1, (char *)&params->seq2, params->param7, ACTION_NAME(savepoint.action));
+
+#define IMPLEMENT_FUNCTION_IS(index, class, name, paramType) \
+	void class::setup_##name(paramType param1, const char *seq) { \
+		BEGIN_SETUP(class, name, index, EntityData::EntityParametersISII) \
+		EntityData::EntityParametersISII *params = (EntityData::EntityParametersISII*)_data->getCurrentParameters(); \
+		params->param1 = (unsigned int)param1; \
+		strncpy((char *)&params->seq, seq, 12); \
+		END_SETUP() \
+	} \
+	void class::name(const SavePoint &savepoint) { \
+	EXPOSE_PARAMS(EntityData::EntityParametersISII) \
+	debugC(6, kLastExpressDebugLogic, "Entity: " #class "::" #name "(%d, %s) - action: %s", params->param1, (char *)&params->seq, ACTION_NAME(savepoint.action));
+
+#define IMPLEMENT_FUNCTION_ISS(index, class, name, paramType) \
+	void class::setup_##name(paramType param1, const char *seq1, const char *seq2) { \
+		BEGIN_SETUP(class, name, index, EntityData::EntityParametersISSI) \
+		EntityData::EntityParametersISSI *params = (EntityData::EntityParametersISSI*)_data->getCurrentParameters(); \
+		params->param1 = param1; \
+		strncpy((char *)&params->seq1, seq1, 12); \
+		strncpy((char *)&params->seq2, seq2, 12); \
+		END_SETUP() \
+	} \
+	void class::name(const SavePoint &savepoint) { \
+	EXPOSE_PARAMS(EntityData::EntityParametersISSI) \
+	debugC(6, kLastExpressDebugLogic, "Entity: " #class "::" #name "(%d, %s, %s) - action: %s", params->param1, (char *)&params->seq1, (char *)&params->seq2, ACTION_NAME(savepoint.action));
+
+#define IMPLEMENT_FUNCTION_IIS(index, class, name, paramType1, paramType2) \
+	void class::setup_##name(paramType1 param1, paramType2 param2, const char *seq) { \
+		BEGIN_SETUP(class, name, index, EntityData::EntityParametersIISI) \
+		EntityData::EntityParametersIISI *params = (EntityData::EntityParametersIISI*)_data->getCurrentParameters(); \
+		params->param1 = param1; \
+		params->param2 = param2; \
+		strncpy((char *)&params->seq, seq, 12); \
+		END_SETUP() \
+	} \
+	void class::name(const SavePoint &savepoint) { \
+	EXPOSE_PARAMS(EntityData::EntityParametersIISI) \
+	debugC(6, kLastExpressDebugLogic, "Entity: " #class "::" #name "(%d, %d, %s) - action: %s", params->param1, params->param2, (char *)&params->seq, ACTION_NAME(savepoint.action));
+
+#define IMPLEMENT_FUNCTION_IISS(index, class, name, paramType1, paramType2) \
+	void class::setup_##name(paramType1 param1, paramType2 param2, const char *seq1, const char *seq2) { \
+		BEGIN_SETUP(class, name, index, EntityData::EntityParametersIISS) \
+		EntityData::EntityParametersIISS *params = (EntityData::EntityParametersIISS*)_data->getCurrentParameters(); \
+		params->param1 = param1; \
+		params->param2 = param2; \
+		strncpy((char *)&params->seq1, seq1, 12); \
+		strncpy((char *)&params->seq2, seq2, 12); \
+		END_SETUP() \
+	} \
+	void class::name(const SavePoint &savepoint) { \
+	EXPOSE_PARAMS(EntityData::EntityParametersIISS) \
+	debugC(6, kLastExpressDebugLogic, "Entity: " #class "::" #name "(%d, %d, %s, %s) - action: %s", params->param1, params->param2, (char *)&params->seq1, (char *)&params->seq2, ACTION_NAME(savepoint.action));
 
 
 //////////////////////////////////////////////////////////////////////////
diff --git a/engines/lastexpress/entities/entity39.h b/engines/lastexpress/entities/entity39.h
index 148bca5..54b6540 100644
--- a/engines/lastexpress/entities/entity39.h
+++ b/engines/lastexpress/entities/entity39.h
@@ -24,7 +24,6 @@
 #define LASTEXPRESS_ENTITY39_H
 
 #include "lastexpress/entities/entity.h"
-#include "lastexpress/entities/entity_intern.h"
 
 namespace LastExpress {
 
diff --git a/engines/lastexpress/entities/entity_intern.h b/engines/lastexpress/entities/entity_intern.h
index 01e997f..fd80367 100644
--- a/engines/lastexpress/entities/entity_intern.h
+++ b/engines/lastexpress/entities/entity_intern.h
@@ -25,238 +25,6 @@
 
 namespace LastExpress {
 
-//////////////////////////////////////////////////////////////////////////
-// Setup
-//////////////////////////////////////////////////////////////////////////
-
-#define IMPLEMENT_SETUP(class, callback_class, name, index) \
-void class::setup_##name() { \
-	BEGIN_SETUP(callback_class, name, index, EntityData::EntityParametersIIII) \
-	debugC(6, kLastExpressDebugLogic, "Entity: " #class "::setup_" #name "()"); \
-	END_SETUP() \
-}
-
-#define BEGIN_SETUP(class, name, index, type) \
-	_engine->getGameLogic()->getGameState()->getGameSavePoints()->setCallback(_entityIndex, _callbacks[index]); \
-	_data->setCurrentCallback(index); \
-	_data->resetCurrentParameters<type>();
-
-#define END_SETUP() \
-	_engine->getGameLogic()->getGameState()->getGameSavePoints()->call(_entityIndex, _entityIndex, kActionDefault);
-
-
-//////////////////////////////////////////////////////////////////////////
-// Implementation
-//////////////////////////////////////////////////////////////////////////
-
-// Expose parameters and check validity
-#define EXPOSE_PARAMS(type) \
-	type *params = (type *)_data->getCurrentParameters(); \
-	if (!params) \
-		error("[EXPOSE_PARAMS] Trying to call an entity function with invalid parameters"); \
-
-
-// function signature without setup (we keep the index for consistency but never use it)
-#define IMPLEMENT_FUNCTION_NOSETUP(index, class, name) \
-	void class::name(const SavePoint &savepoint) { \
-		debugC(6, kLastExpressDebugLogic, "Entity: " #class "::" #name "(index=" #index ")");
-
-// simple setup with no parameters
-#define IMPLEMENT_FUNCTION(index, class, name) \
-	IMPLEMENT_SETUP(class, class, name, index) \
-	void class::name(const SavePoint &savepoint) { \
-		EXPOSE_PARAMS(EntityData::EntityParametersIIII) \
-		debugC(6, kLastExpressDebugLogic, "Entity: " #class "::" #name "() - action: %s", ACTION_NAME(savepoint.action));
-
-#define IMPLEMENT_FUNCTION_END }
-
-// nullfunction call
-#define IMPLEMENT_NULL_FUNCTION(index, class) \
-	IMPLEMENT_SETUP(class, Entity, nullfunction, index)
-
-// setup with one uint parameter
-#define IMPLEMENT_FUNCTION_I(index, class, name, paramType) \
-	void class::setup_##name(paramType param1) { \
-	BEGIN_SETUP(class, name, index, EntityData::EntityParametersIIII) \
-	EntityData::EntityParametersIIII *params = (EntityData::EntityParametersIIII*)_data->getCurrentParameters(); \
-	params->param1 = (unsigned int)param1; \
-	END_SETUP() \
-	} \
-	void class::name(const SavePoint &savepoint) { \
-	EXPOSE_PARAMS(EntityData::EntityParametersIIII) \
-	debugC(6, kLastExpressDebugLogic, "Entity: " #class "::" #name "(%d) - action: %s", params->param1, ACTION_NAME(savepoint.action));
-
-// setup with two uint parameters
-#define IMPLEMENT_FUNCTION_II(index, class, name, paramType1, paramType2) \
-	void class::setup_##name(paramType1 param1, paramType2 param2) { \
-		BEGIN_SETUP(class, name, index, EntityData::EntityParametersIIII) \
-		EntityData::EntityParametersIIII *params = (EntityData::EntityParametersIIII*)_data->getCurrentParameters(); \
-		params->param1 = param1; \
-		params->param2 = param2; \
-		END_SETUP() \
-	} \
-	void class::name(const SavePoint &savepoint) { \
-	EXPOSE_PARAMS(EntityData::EntityParametersIIII) \
-	debugC(6, kLastExpressDebugLogic, "Entity: " #class "::" #name "(%d, %d) - action: %s", params->param1, params->param2, ACTION_NAME(savepoint.action));
-
-// setup with three uint parameters
-#define IMPLEMENT_FUNCTION_III(index, class, name, paramType1, paramType2, paramType3) \
-	void class::setup_##name(paramType1 param1, paramType2 param2, paramType3 param3) { \
-		BEGIN_SETUP(class, name, index, EntityData::EntityParametersIIII) \
-		EntityData::EntityParametersIIII *params = (EntityData::EntityParametersIIII*)_data->getCurrentParameters(); \
-		params->param1 = param1; \
-		params->param2 = param2; \
-		params->param3 = param3; \
-		END_SETUP() \
-	} \
-	void class::name(const SavePoint &savepoint) { \
-	EXPOSE_PARAMS(EntityData::EntityParametersIIII) \
-	debugC(6, kLastExpressDebugLogic, "Entity: " #class "::" #name "(%d, %d, %d) - action: %s", params->param1, params->param2, params->param3, ACTION_NAME(savepoint.action));
-
-// setup with one char *parameter
-#define IMPLEMENT_FUNCTION_S(index, class, name) \
-	void class::setup_##name(const char *seq1) { \
-		BEGIN_SETUP(class, name, index, EntityData::EntityParametersSIIS) \
-		EntityData::EntityParametersSIIS *params = (EntityData::EntityParametersSIIS*)_data->getCurrentParameters(); \
-		strncpy((char *)&params->seq1, seq1, 12); \
-		END_SETUP() \
-	} \
-	void class::name(const SavePoint &savepoint) { \
-	EXPOSE_PARAMS(EntityData::EntityParametersSIIS) \
-	debugC(6, kLastExpressDebugLogic, "Entity: " #class "::" #name "(%s) - action: %s", (char *)&params->seq1, ACTION_NAME(savepoint.action));
-
-// setup with one char *parameter and one uint
-#define IMPLEMENT_FUNCTION_SI(index, class, name, paramType2) \
-	void class::setup_##name(const char *seq1, paramType2 param4) { \
-		BEGIN_SETUP(class, name, index, EntityData::EntityParametersSIIS) \
-		EntityData::EntityParametersSIIS *params = (EntityData::EntityParametersSIIS*)_data->getCurrentParameters(); \
-		strncpy((char *)&params->seq1, seq1, 12); \
-		params->param4 = param4; \
-		END_SETUP() \
-	} \
-	void class::name(const SavePoint &savepoint) { \
-	EXPOSE_PARAMS(EntityData::EntityParametersSIIS) \
-	debugC(6, kLastExpressDebugLogic, "Entity: " #class "::" #name "(%s, %d) - action: %s", (char *)&params->seq1, params->param4, ACTION_NAME(savepoint.action));
-
-// setup with one char *parameter and two uints
-#define IMPLEMENT_FUNCTION_SII(index, class, name, paramType2, paramType3) \
-	void class::setup_##name(const char *seq1, paramType2 param4, paramType3 param5) { \
-		BEGIN_SETUP(class, name, index, EntityData::EntityParametersSIIS) \
-		EntityData::EntityParametersSIIS *params = (EntityData::EntityParametersSIIS*)_data->getCurrentParameters(); \
-		strncpy((char *)&params->seq1, seq1, 12); \
-		params->param4 = param4; \
-		params->param5 = param5; \
-		END_SETUP() \
-	} \
-	void class::name(const SavePoint &savepoint) { \
-	EXPOSE_PARAMS(EntityData::EntityParametersSIIS) \
-	debugC(6, kLastExpressDebugLogic, "Entity: " #class "::" #name "(%s, %d, %d) - action: %s", (char *)&params->seq1, params->param4, params->param5, ACTION_NAME(savepoint.action));
-
-// setup with one char *parameter and three uints
-#define IMPLEMENT_FUNCTION_SIII(index, class, name, paramType2, paramType3, paramType4) \
-	void class::setup_##name(const char *seq, paramType2 param4, paramType3 param5, paramType4 param6) { \
-		BEGIN_SETUP(class, name, index, EntityData::EntityParametersSIII) \
-		EntityData::EntityParametersSIII *params = (EntityData::EntityParametersSIII*)_data->getCurrentParameters(); \
-		strncpy((char *)&params->seq, seq, 12); \
-		params->param4 = param4; \
-		params->param5 = param5; \
-		params->param6 = param6; \
-		END_SETUP() \
-	} \
-	void class::name(const SavePoint &savepoint) { \
-	EXPOSE_PARAMS(EntityData::EntityParametersSIII) \
-	debugC(6, kLastExpressDebugLogic, "Entity: " #class "::" #name "(%s, %d, %d, %d) - action: %s", (char *)&params->seq, params->param4, params->param5, params->param6, ACTION_NAME(savepoint.action));
-
-#define IMPLEMENT_FUNCTION_SIIS(index, class, name, paramType2, paramType3) \
-	void class::setup_##name(const char *seq1, paramType2 param4, paramType3 param5, const char *seq2) { \
-		BEGIN_SETUP(class, name, index, EntityData::EntityParametersSIIS) \
-		EntityData::EntityParametersSIIS *params = (EntityData::EntityParametersSIIS*)_data->getCurrentParameters(); \
-		strncpy((char *)&params->seq1, seq1, 12); \
-		params->param4 = param4; \
-		params->param5 = param5; \
-		strncpy((char *)&params->seq2, seq2, 12); \
-		END_SETUP() \
-	} \
-	void class::name(const SavePoint &savepoint) { \
-	EXPOSE_PARAMS(EntityData::EntityParametersSIIS) \
-	debugC(6, kLastExpressDebugLogic, "Entity: " #class "::" #name "(%s, %d, %d, %s) - action: %s", (char *)&params->seq1, params->param4, params->param5, (char *)&params->seq2, ACTION_NAME(savepoint.action));
-
-#define IMPLEMENT_FUNCTION_SS(index, class, name) \
-	void class::setup_##name(const char *seq1, const char *seq2) { \
-		BEGIN_SETUP(class, name, index, EntityData::EntityParametersSSII) \
-		EntityData::EntityParametersSSII *params = (EntityData::EntityParametersSSII*)_data->getCurrentParameters(); \
-		strncpy((char *)&params->seq1, seq1, 12); \
-		strncpy((char *)&params->seq2, seq2, 12); \
-		END_SETUP() \
-	} \
-	void class::name(const SavePoint &savepoint) { \
-	EXPOSE_PARAMS(EntityData::EntityParametersSSII) \
-	debugC(6, kLastExpressDebugLogic, "Entity: " #class "::" #name "(%s, %s) - action: %s", (char *)&params->seq1, (char *)&params->seq2, ACTION_NAME(savepoint.action));
-
-#define IMPLEMENT_FUNCTION_SSI(index, class, name, paramType3) \
-	void class::setup_##name(const char *seq1, const char *seq2, paramType3 param7) { \
-		BEGIN_SETUP(class, name, index, EntityData::EntityParametersSSII) \
-		EntityData::EntityParametersSSII *params = (EntityData::EntityParametersSSII*)_data->getCurrentParameters(); \
-		strncpy((char *)&params->seq1, seq1, 12); \
-		strncpy((char *)&params->seq2, seq2, 12); \
-		params->param7 = param7; \
-		END_SETUP() \
-	} \
-	void class::name(const SavePoint &savepoint) { \
-	EXPOSE_PARAMS(EntityData::EntityParametersSSII) \
-	debugC(6, kLastExpressDebugLogic, "Entity: " #class "::" #name "(%s, %s, %d) - action: %s", (char *)&params->seq1, (char *)&params->seq2, params->param7, ACTION_NAME(savepoint.action));
-
-#define IMPLEMENT_FUNCTION_IS(index, class, name, paramType) \
-	void class::setup_##name(paramType param1, const char *seq) { \
-		BEGIN_SETUP(class, name, index, EntityData::EntityParametersISII) \
-		EntityData::EntityParametersISII *params = (EntityData::EntityParametersISII*)_data->getCurrentParameters(); \
-		params->param1 = (unsigned int)param1; \
-		strncpy((char *)&params->seq, seq, 12); \
-		END_SETUP() \
-	} \
-	void class::name(const SavePoint &savepoint) { \
-	EXPOSE_PARAMS(EntityData::EntityParametersISII) \
-	debugC(6, kLastExpressDebugLogic, "Entity: " #class "::" #name "(%d, %s) - action: %s", params->param1, (char *)&params->seq, ACTION_NAME(savepoint.action));
-
-#define IMPLEMENT_FUNCTION_ISS(index, class, name, paramType) \
-	void class::setup_##name(paramType param1, const char *seq1, const char *seq2) { \
-		BEGIN_SETUP(class, name, index, EntityData::EntityParametersISSI) \
-		EntityData::EntityParametersISSI *params = (EntityData::EntityParametersISSI*)_data->getCurrentParameters(); \
-		params->param1 = param1; \
-		strncpy((char *)&params->seq1, seq1, 12); \
-		strncpy((char *)&params->seq2, seq2, 12); \
-		END_SETUP() \
-	} \
-	void class::name(const SavePoint &savepoint) { \
-	EXPOSE_PARAMS(EntityData::EntityParametersISSI) \
-	debugC(6, kLastExpressDebugLogic, "Entity: " #class "::" #name "(%d, %s, %s) - action: %s", params->param1, (char *)&params->seq1, (char *)&params->seq2, ACTION_NAME(savepoint.action));
-
-#define IMPLEMENT_FUNCTION_IIS(index, class, name, paramType1, paramType2) \
-	void class::setup_##name(paramType1 param1, paramType2 param2, const char *seq) { \
-		BEGIN_SETUP(class, name, index, EntityData::EntityParametersIISI) \
-		EntityData::EntityParametersIISI *params = (EntityData::EntityParametersIISI*)_data->getCurrentParameters(); \
-		params->param1 = param1; \
-		params->param2 = param2; \
-		strncpy((char *)&params->seq, seq, 12); \
-		END_SETUP() \
-	} \
-	void class::name(const SavePoint &savepoint) { \
-	EXPOSE_PARAMS(EntityData::EntityParametersIISI) \
-	debugC(6, kLastExpressDebugLogic, "Entity: " #class "::" #name "(%d, %d, %s) - action: %s", params->param1, params->param2, (char *)&params->seq, ACTION_NAME(savepoint.action));
-
-#define IMPLEMENT_FUNCTION_IISS(index, class, name, paramType1, paramType2) \
-	void class::setup_##name(paramType1 param1, paramType2 param2, const char *seq1, const char *seq2) { \
-		BEGIN_SETUP(class, name, index, EntityData::EntityParametersIISS) \
-		EntityData::EntityParametersIISS *params = (EntityData::EntityParametersIISS*)_data->getCurrentParameters(); \
-		params->param1 = param1; \
-		params->param2 = param2; \
-		strncpy((char *)&params->seq1, seq1, 12); \
-		strncpy((char *)&params->seq2, seq2, 12); \
-		END_SETUP() \
-	} \
-	void class::name(const SavePoint &savepoint) { \
-	EXPOSE_PARAMS(EntityData::EntityParametersIISS) \
-	debugC(6, kLastExpressDebugLogic, "Entity: " #class "::" #name "(%d, %d, %s, %s) - action: %s", params->param1, params->param2, (char *)&params->seq1, (char *)&params->seq2, ACTION_NAME(savepoint.action));
 
 } // End of namespace LastExpress
 
diff --git a/engines/lastexpress/entities/francois.h b/engines/lastexpress/entities/francois.h
index 5a4ff4b..51270fa 100644
--- a/engines/lastexpress/entities/francois.h
+++ b/engines/lastexpress/entities/francois.h
@@ -24,7 +24,6 @@
 #define LASTEXPRESS_FRANCOIS_H
 
 #include "lastexpress/entities/entity.h"
-#include "lastexpress/entities/entity_intern.h"
 
 namespace LastExpress {
 
diff --git a/engines/lastexpress/entities/gendarmes.h b/engines/lastexpress/entities/gendarmes.h
index d999cfc..a761643 100644
--- a/engines/lastexpress/entities/gendarmes.h
+++ b/engines/lastexpress/entities/gendarmes.h
@@ -24,7 +24,6 @@
 #define LASTEXPRESS_GENDARMES_H
 
 #include "lastexpress/entities/entity.h"
-#include "lastexpress/entities/entity_intern.h"
 
 #include "lastexpress/sound/sound.h"
 
diff --git a/engines/lastexpress/entities/hadija.h b/engines/lastexpress/entities/hadija.h
index d249595..545f21e 100644
--- a/engines/lastexpress/entities/hadija.h
+++ b/engines/lastexpress/entities/hadija.h
@@ -24,7 +24,6 @@
 #define LASTEXPRESS_HADIJA_H
 
 #include "lastexpress/entities/entity.h"
-#include "lastexpress/entities/entity_intern.h"
 
 namespace LastExpress {
 
diff --git a/engines/lastexpress/entities/ivo.h b/engines/lastexpress/entities/ivo.h
index cd5cb7b..7581433 100644
--- a/engines/lastexpress/entities/ivo.h
+++ b/engines/lastexpress/entities/ivo.h
@@ -24,7 +24,6 @@
 #define LASTEXPRESS_IVO_H
 
 #include "lastexpress/entities/entity.h"
-#include "lastexpress/entities/entity_intern.h"
 
 namespace LastExpress {
 
diff --git a/engines/lastexpress/entities/kahina.h b/engines/lastexpress/entities/kahina.h
index b25053e..7479cf7 100644
--- a/engines/lastexpress/entities/kahina.h
+++ b/engines/lastexpress/entities/kahina.h
@@ -24,7 +24,6 @@
 #define LASTEXPRESS_KAHINA_H
 
 #include "lastexpress/entities/entity.h"
-#include "lastexpress/entities/entity_intern.h"
 
 namespace LastExpress {
 
diff --git a/engines/lastexpress/entities/kronos.h b/engines/lastexpress/entities/kronos.h
index 4c61b98..a7693fc 100644
--- a/engines/lastexpress/entities/kronos.h
+++ b/engines/lastexpress/entities/kronos.h
@@ -24,7 +24,6 @@
 #define LASTEXPRESS_KRONOS_H
 
 #include "lastexpress/entities/entity.h"
-#include "lastexpress/entities/entity_intern.h"
 
 namespace LastExpress {
 
diff --git a/engines/lastexpress/entities/mahmud.h b/engines/lastexpress/entities/mahmud.h
index 5feb95c..685100f 100644
--- a/engines/lastexpress/entities/mahmud.h
+++ b/engines/lastexpress/entities/mahmud.h
@@ -24,7 +24,6 @@
 #define LASTEXPRESS_MAHMUD_H
 
 #include "lastexpress/entities/entity.h"
-#include "lastexpress/entities/entity_intern.h"
 
 namespace LastExpress {
 
diff --git a/engines/lastexpress/entities/max.h b/engines/lastexpress/entities/max.h
index 17b5847..acd8235 100644
--- a/engines/lastexpress/entities/max.h
+++ b/engines/lastexpress/entities/max.h
@@ -24,7 +24,6 @@
 #define LASTEXPRESS_MAX_H
 
 #include "lastexpress/entities/entity.h"
-#include "lastexpress/entities/entity_intern.h"
 
 namespace LastExpress {
 
diff --git a/engines/lastexpress/entities/mertens.h b/engines/lastexpress/entities/mertens.h
index 55c2a76..4cc58fd 100644
--- a/engines/lastexpress/entities/mertens.h
+++ b/engines/lastexpress/entities/mertens.h
@@ -24,7 +24,6 @@
 #define LASTEXPRESS_MERTENS_H
 
 #include "lastexpress/entities/entity.h"
-#include "lastexpress/entities/entity_intern.h"
 
 namespace LastExpress {
 
diff --git a/engines/lastexpress/entities/milos.h b/engines/lastexpress/entities/milos.h
index d58d717..e8f95dc 100644
--- a/engines/lastexpress/entities/milos.h
+++ b/engines/lastexpress/entities/milos.h
@@ -24,7 +24,6 @@
 #define LASTEXPRESS_MILOS_H
 
 #include "lastexpress/entities/entity.h"
-#include "lastexpress/entities/entity_intern.h"
 
 namespace LastExpress {
 
diff --git a/engines/lastexpress/entities/mmeboutarel.h b/engines/lastexpress/entities/mmeboutarel.h
index 772451b..0f6e634 100644
--- a/engines/lastexpress/entities/mmeboutarel.h
+++ b/engines/lastexpress/entities/mmeboutarel.h
@@ -24,7 +24,6 @@
 #define LASTEXPRESS_MMEBOUTAREL_H
 
 #include "lastexpress/entities/entity.h"
-#include "lastexpress/entities/entity_intern.h"
 
 namespace LastExpress {
 
diff --git a/engines/lastexpress/entities/pascale.h b/engines/lastexpress/entities/pascale.h
index 333ebca..eaf0f3b 100644
--- a/engines/lastexpress/entities/pascale.h
+++ b/engines/lastexpress/entities/pascale.h
@@ -24,7 +24,6 @@
 #define LASTEXPRESS_PASCALE_H
 
 #include "lastexpress/entities/entity.h"
-#include "lastexpress/entities/entity_intern.h"
 
 namespace LastExpress {
 
diff --git a/engines/lastexpress/entities/rebecca.h b/engines/lastexpress/entities/rebecca.h
index e91ee30..885632f 100644
--- a/engines/lastexpress/entities/rebecca.h
+++ b/engines/lastexpress/entities/rebecca.h
@@ -24,7 +24,6 @@
 #define LASTEXPRESS_REBECCA_H
 
 #include "lastexpress/entities/entity.h"
-#include "lastexpress/entities/entity_intern.h"
 
 namespace LastExpress {
 
diff --git a/engines/lastexpress/entities/salko.h b/engines/lastexpress/entities/salko.h
index 6308211..6ca73e3 100644
--- a/engines/lastexpress/entities/salko.h
+++ b/engines/lastexpress/entities/salko.h
@@ -24,7 +24,6 @@
 #define LASTEXPRESS_SALKO_H
 
 #include "lastexpress/entities/entity.h"
-#include "lastexpress/entities/entity_intern.h"
 
 namespace LastExpress {
 
diff --git a/engines/lastexpress/entities/servers0.h b/engines/lastexpress/entities/servers0.h
index 2e9165a..4c35637 100644
--- a/engines/lastexpress/entities/servers0.h
+++ b/engines/lastexpress/entities/servers0.h
@@ -24,7 +24,6 @@
 #define LASTEXPRESS_SERVERS0_H
 
 #include "lastexpress/entities/entity.h"
-#include "lastexpress/entities/entity_intern.h"
 
 namespace LastExpress {
 
diff --git a/engines/lastexpress/entities/servers1.h b/engines/lastexpress/entities/servers1.h
index 13b3069..c8f667e 100644
--- a/engines/lastexpress/entities/servers1.h
+++ b/engines/lastexpress/entities/servers1.h
@@ -24,7 +24,6 @@
 #define LASTEXPRESS_SERVERS1_H
 
 #include "lastexpress/entities/entity.h"
-#include "lastexpress/entities/entity_intern.h"
 
 namespace LastExpress {
 
diff --git a/engines/lastexpress/entities/sophie.h b/engines/lastexpress/entities/sophie.h
index 47cfa80..188788b 100644
--- a/engines/lastexpress/entities/sophie.h
+++ b/engines/lastexpress/entities/sophie.h
@@ -24,7 +24,6 @@
 #define LASTEXPRESS_SOPHIE_H
 
 #include "lastexpress/entities/entity.h"
-#include "lastexpress/entities/entity_intern.h"
 
 namespace LastExpress {
 
diff --git a/engines/lastexpress/entities/tables.h b/engines/lastexpress/entities/tables.h
index 7fcfc04..c213aac 100644
--- a/engines/lastexpress/entities/tables.h
+++ b/engines/lastexpress/entities/tables.h
@@ -24,7 +24,6 @@
 #define LASTEXPRESS_TABLES_H
 
 #include "lastexpress/entities/entity.h"
-#include "lastexpress/entities/entity_intern.h"
 
 namespace LastExpress {
 
diff --git a/engines/lastexpress/entities/tatiana.h b/engines/lastexpress/entities/tatiana.h
index c457d49..8ec69db 100644
--- a/engines/lastexpress/entities/tatiana.h
+++ b/engines/lastexpress/entities/tatiana.h
@@ -24,7 +24,6 @@
 #define LASTEXPRESS_TATIANA_H
 
 #include "lastexpress/entities/entity.h"
-#include "lastexpress/entities/entity_intern.h"
 
 namespace LastExpress {
 
diff --git a/engines/lastexpress/entities/train.h b/engines/lastexpress/entities/train.h
index ea9e1d7..4b8bc10 100644
--- a/engines/lastexpress/entities/train.h
+++ b/engines/lastexpress/entities/train.h
@@ -24,7 +24,6 @@
 #define LASTEXPRESS_TRAIN_H
 
 #include "lastexpress/entities/entity.h"
-#include "lastexpress/entities/entity_intern.h"
 
 namespace LastExpress {
 
diff --git a/engines/lastexpress/entities/vassili.h b/engines/lastexpress/entities/vassili.h
index 843a065..d006770 100644
--- a/engines/lastexpress/entities/vassili.h
+++ b/engines/lastexpress/entities/vassili.h
@@ -24,7 +24,6 @@
 #define LASTEXPRESS_VASSILI_H
 
 #include "lastexpress/entities/entity.h"
-#include "lastexpress/entities/entity_intern.h"
 
 namespace LastExpress {
 
diff --git a/engines/lastexpress/entities/verges.h b/engines/lastexpress/entities/verges.h
index 17a3c8a..8238104 100644
--- a/engines/lastexpress/entities/verges.h
+++ b/engines/lastexpress/entities/verges.h
@@ -24,7 +24,6 @@
 #define LASTEXPRESS_VERGES_H
 
 #include "lastexpress/entities/entity.h"
-#include "lastexpress/entities/entity_intern.h"
 
 namespace LastExpress {
 
diff --git a/engines/lastexpress/entities/vesna.h b/engines/lastexpress/entities/vesna.h
index a096640..025d458 100644
--- a/engines/lastexpress/entities/vesna.h
+++ b/engines/lastexpress/entities/vesna.h
@@ -24,7 +24,6 @@
 #define LASTEXPRESS_VESNA_H
 
 #include "lastexpress/entities/entity.h"
-#include "lastexpress/entities/entity_intern.h"
 
 namespace LastExpress {
 
diff --git a/engines/lastexpress/entities/yasmin.h b/engines/lastexpress/entities/yasmin.h
index e943a8b..b1413f5 100644
--- a/engines/lastexpress/entities/yasmin.h
+++ b/engines/lastexpress/entities/yasmin.h
@@ -24,7 +24,6 @@
 #define LASTEXPRESS_YASMIN_H
 
 #include "lastexpress/entities/entity.h"
-#include "lastexpress/entities/entity_intern.h"
 
 namespace LastExpress {
 


Commit: 2d6f7992351c9737f71964ad64c307fa6d1543cf
    https://github.com/scummvm/scummvm/commit/2d6f7992351c9737f71964ad64c307fa6d1543cf
Author: Julien (julien at powerinbox.com)
Date: 2012-07-26T21:15:04-07:00

Commit Message:
LASTEXPRESS: Cleanup unused arguments from BEGIN_SETUP macro

Changed paths:
    engines/lastexpress/entities/entity.h



diff --git a/engines/lastexpress/entities/entity.h b/engines/lastexpress/entities/entity.h
index 634e400..6a32fb6 100644
--- a/engines/lastexpress/entities/entity.h
+++ b/engines/lastexpress/entities/entity.h
@@ -111,14 +111,14 @@ struct SavePoint;
 // Setup
 //////////////////////////////////////////////////////////////////////////
 
-#define IMPLEMENT_SETUP(class, callback_class, name, index) \
+#define IMPLEMENT_SETUP(class, name, index) \
 void class::setup_##name() { \
-	BEGIN_SETUP(callback_class, name, index, EntityData::EntityParametersIIII) \
+	BEGIN_SETUP(index, EntityData::EntityParametersIIII) \
 	debugC(6, kLastExpressDebugLogic, "Entity: " #class "::setup_" #name "()"); \
 	END_SETUP() \
 }
 
-#define BEGIN_SETUP(class, name, index, type) \
+#define BEGIN_SETUP(index, type) \
 	_engine->getGameLogic()->getGameState()->getGameSavePoints()->setCallback(_entityIndex, _callbacks[index]); \
 	_data->setCurrentCallback(index); \
 	_data->resetCurrentParameters<type>();
@@ -145,7 +145,7 @@ void class::setup_##name() { \
 
 // simple setup with no parameters
 #define IMPLEMENT_FUNCTION(index, class, name) \
-	IMPLEMENT_SETUP(class, class, name, index) \
+	IMPLEMENT_SETUP(class, name, index) \
 	void class::name(const SavePoint &savepoint) { \
 		EXPOSE_PARAMS(EntityData::EntityParametersIIII) \
 		debugC(6, kLastExpressDebugLogic, "Entity: " #class "::" #name "() - action: %s", ACTION_NAME(savepoint.action));
@@ -154,12 +154,12 @@ void class::setup_##name() { \
 
 // nullfunction call
 #define IMPLEMENT_NULL_FUNCTION(index, class) \
-	IMPLEMENT_SETUP(class, Entity, nullfunction, index)
+	IMPLEMENT_SETUP(class, nullfunction, index)
 
 // setup with one uint parameter
 #define IMPLEMENT_FUNCTION_I(index, class, name, paramType) \
 	void class::setup_##name(paramType param1) { \
-	BEGIN_SETUP(class, name, index, EntityData::EntityParametersIIII) \
+	BEGIN_SETUP(index, EntityData::EntityParametersIIII) \
 	EntityData::EntityParametersIIII *params = (EntityData::EntityParametersIIII*)_data->getCurrentParameters(); \
 	params->param1 = (unsigned int)param1; \
 	END_SETUP() \
@@ -171,7 +171,7 @@ void class::setup_##name() { \
 // setup with two uint parameters
 #define IMPLEMENT_FUNCTION_II(index, class, name, paramType1, paramType2) \
 	void class::setup_##name(paramType1 param1, paramType2 param2) { \
-		BEGIN_SETUP(class, name, index, EntityData::EntityParametersIIII) \
+		BEGIN_SETUP(index, EntityData::EntityParametersIIII) \
 		EntityData::EntityParametersIIII *params = (EntityData::EntityParametersIIII*)_data->getCurrentParameters(); \
 		params->param1 = param1; \
 		params->param2 = param2; \
@@ -184,7 +184,7 @@ void class::setup_##name() { \
 // setup with three uint parameters
 #define IMPLEMENT_FUNCTION_III(index, class, name, paramType1, paramType2, paramType3) \
 	void class::setup_##name(paramType1 param1, paramType2 param2, paramType3 param3) { \
-		BEGIN_SETUP(class, name, index, EntityData::EntityParametersIIII) \
+		BEGIN_SETUP(index, EntityData::EntityParametersIIII) \
 		EntityData::EntityParametersIIII *params = (EntityData::EntityParametersIIII*)_data->getCurrentParameters(); \
 		params->param1 = param1; \
 		params->param2 = param2; \
@@ -198,7 +198,7 @@ void class::setup_##name() { \
 // setup with one char *parameter
 #define IMPLEMENT_FUNCTION_S(index, class, name) \
 	void class::setup_##name(const char *seq1) { \
-		BEGIN_SETUP(class, name, index, EntityData::EntityParametersSIIS) \
+		BEGIN_SETUP(index, EntityData::EntityParametersSIIS) \
 		EntityData::EntityParametersSIIS *params = (EntityData::EntityParametersSIIS*)_data->getCurrentParameters(); \
 		strncpy((char *)&params->seq1, seq1, 12); \
 		END_SETUP() \
@@ -210,7 +210,7 @@ void class::setup_##name() { \
 // setup with one char *parameter and one uint
 #define IMPLEMENT_FUNCTION_SI(index, class, name, paramType2) \
 	void class::setup_##name(const char *seq1, paramType2 param4) { \
-		BEGIN_SETUP(class, name, index, EntityData::EntityParametersSIIS) \
+		BEGIN_SETUP(index, EntityData::EntityParametersSIIS) \
 		EntityData::EntityParametersSIIS *params = (EntityData::EntityParametersSIIS*)_data->getCurrentParameters(); \
 		strncpy((char *)&params->seq1, seq1, 12); \
 		params->param4 = param4; \
@@ -223,7 +223,7 @@ void class::setup_##name() { \
 // setup with one char *parameter and two uints
 #define IMPLEMENT_FUNCTION_SII(index, class, name, paramType2, paramType3) \
 	void class::setup_##name(const char *seq1, paramType2 param4, paramType3 param5) { \
-		BEGIN_SETUP(class, name, index, EntityData::EntityParametersSIIS) \
+		BEGIN_SETUP(index, EntityData::EntityParametersSIIS) \
 		EntityData::EntityParametersSIIS *params = (EntityData::EntityParametersSIIS*)_data->getCurrentParameters(); \
 		strncpy((char *)&params->seq1, seq1, 12); \
 		params->param4 = param4; \
@@ -237,7 +237,7 @@ void class::setup_##name() { \
 // setup with one char *parameter and three uints
 #define IMPLEMENT_FUNCTION_SIII(index, class, name, paramType2, paramType3, paramType4) \
 	void class::setup_##name(const char *seq, paramType2 param4, paramType3 param5, paramType4 param6) { \
-		BEGIN_SETUP(class, name, index, EntityData::EntityParametersSIII) \
+		BEGIN_SETUP(index, EntityData::EntityParametersSIII) \
 		EntityData::EntityParametersSIII *params = (EntityData::EntityParametersSIII*)_data->getCurrentParameters(); \
 		strncpy((char *)&params->seq, seq, 12); \
 		params->param4 = param4; \
@@ -251,7 +251,7 @@ void class::setup_##name() { \
 
 #define IMPLEMENT_FUNCTION_SIIS(index, class, name, paramType2, paramType3) \
 	void class::setup_##name(const char *seq1, paramType2 param4, paramType3 param5, const char *seq2) { \
-		BEGIN_SETUP(class, name, index, EntityData::EntityParametersSIIS) \
+		BEGIN_SETUP(index, EntityData::EntityParametersSIIS) \
 		EntityData::EntityParametersSIIS *params = (EntityData::EntityParametersSIIS*)_data->getCurrentParameters(); \
 		strncpy((char *)&params->seq1, seq1, 12); \
 		params->param4 = param4; \
@@ -265,7 +265,7 @@ void class::setup_##name() { \
 
 #define IMPLEMENT_FUNCTION_SS(index, class, name) \
 	void class::setup_##name(const char *seq1, const char *seq2) { \
-		BEGIN_SETUP(class, name, index, EntityData::EntityParametersSSII) \
+		BEGIN_SETUP(index, EntityData::EntityParametersSSII) \
 		EntityData::EntityParametersSSII *params = (EntityData::EntityParametersSSII*)_data->getCurrentParameters(); \
 		strncpy((char *)&params->seq1, seq1, 12); \
 		strncpy((char *)&params->seq2, seq2, 12); \
@@ -277,7 +277,7 @@ void class::setup_##name() { \
 
 #define IMPLEMENT_FUNCTION_SSI(index, class, name, paramType3) \
 	void class::setup_##name(const char *seq1, const char *seq2, paramType3 param7) { \
-		BEGIN_SETUP(class, name, index, EntityData::EntityParametersSSII) \
+		BEGIN_SETUP(index, EntityData::EntityParametersSSII) \
 		EntityData::EntityParametersSSII *params = (EntityData::EntityParametersSSII*)_data->getCurrentParameters(); \
 		strncpy((char *)&params->seq1, seq1, 12); \
 		strncpy((char *)&params->seq2, seq2, 12); \
@@ -290,7 +290,7 @@ void class::setup_##name() { \
 
 #define IMPLEMENT_FUNCTION_IS(index, class, name, paramType) \
 	void class::setup_##name(paramType param1, const char *seq) { \
-		BEGIN_SETUP(class, name, index, EntityData::EntityParametersISII) \
+		BEGIN_SETUP(index, EntityData::EntityParametersISII) \
 		EntityData::EntityParametersISII *params = (EntityData::EntityParametersISII*)_data->getCurrentParameters(); \
 		params->param1 = (unsigned int)param1; \
 		strncpy((char *)&params->seq, seq, 12); \
@@ -302,7 +302,7 @@ void class::setup_##name() { \
 
 #define IMPLEMENT_FUNCTION_ISS(index, class, name, paramType) \
 	void class::setup_##name(paramType param1, const char *seq1, const char *seq2) { \
-		BEGIN_SETUP(class, name, index, EntityData::EntityParametersISSI) \
+		BEGIN_SETUP(index, EntityData::EntityParametersISSI) \
 		EntityData::EntityParametersISSI *params = (EntityData::EntityParametersISSI*)_data->getCurrentParameters(); \
 		params->param1 = param1; \
 		strncpy((char *)&params->seq1, seq1, 12); \
@@ -315,7 +315,7 @@ void class::setup_##name() { \
 
 #define IMPLEMENT_FUNCTION_IIS(index, class, name, paramType1, paramType2) \
 	void class::setup_##name(paramType1 param1, paramType2 param2, const char *seq) { \
-		BEGIN_SETUP(class, name, index, EntityData::EntityParametersIISI) \
+		BEGIN_SETUP(index, EntityData::EntityParametersIISI) \
 		EntityData::EntityParametersIISI *params = (EntityData::EntityParametersIISI*)_data->getCurrentParameters(); \
 		params->param1 = param1; \
 		params->param2 = param2; \
@@ -328,7 +328,7 @@ void class::setup_##name() { \
 
 #define IMPLEMENT_FUNCTION_IISS(index, class, name, paramType1, paramType2) \
 	void class::setup_##name(paramType1 param1, paramType2 param2, const char *seq1, const char *seq2) { \
-		BEGIN_SETUP(class, name, index, EntityData::EntityParametersIISS) \
+		BEGIN_SETUP(index, EntityData::EntityParametersIISS) \
 		EntityData::EntityParametersIISS *params = (EntityData::EntityParametersIISS*)_data->getCurrentParameters(); \
 		params->param1 = param1; \
 		params->param2 = param2; \


Commit: b4b4a7d127194cf29fdfcf5ee7b41b875d26b37e
    https://github.com/scummvm/scummvm/commit/b4b4a7d127194cf29fdfcf5ee7b41b875d26b37e
Author: Julien (julien at powerinbox.com)
Date: 2012-07-26T21:15:05-07:00

Commit Message:
LASTEXPRESS: Replace setup macros by functions

Changed paths:
    engines/lastexpress/entities/entity.cpp
    engines/lastexpress/entities/entity.h



diff --git a/engines/lastexpress/entities/entity.cpp b/engines/lastexpress/entities/entity.cpp
index a9ceaa1..8595978 100644
--- a/engines/lastexpress/entities/entity.cpp
+++ b/engines/lastexpress/entities/entity.cpp
@@ -596,6 +596,46 @@ void Entity::callbackAction() {
 }
 
 //////////////////////////////////////////////////////////////////////////
+// Setup functions
+//////////////////////////////////////////////////////////////////////////
+void Entity::setup(const char *name, uint index) {
+	debugC(6, kLastExpressDebugLogic, "Entity: %s()", name);
+
+	_engine->getGameLogic()->getGameState()->getGameSavePoints()->setCallback(_entityIndex, _callbacks[index]);
+	_data->setCurrentCallback(index);
+	_data->resetCurrentParameters<EntityData::EntityParametersIIII>();
+
+	_engine->getGameLogic()->getGameState()->getGameSavePoints()->call(_entityIndex, _entityIndex, kActionDefault);
+}
+
+void Entity::setupS(const char *name, uint index, const char *seq1) {
+	debugC(6, kLastExpressDebugLogic, "Entity: %s(%s)", name, seq1);
+
+	_engine->getGameLogic()->getGameState()->getGameSavePoints()->setCallback(_entityIndex, _callbacks[index]);
+	_data->setCurrentCallback(index);
+	_data->resetCurrentParameters<EntityData::EntityParametersSIIS>();
+
+	EntityData::EntityParametersSIIS *params = (EntityData::EntityParametersSIIS*)_data->getCurrentParameters();
+	strncpy((char *)&params->seq1, seq1, 12);
+
+	_engine->getGameLogic()->getGameState()->getGameSavePoints()->call(_entityIndex, _entityIndex, kActionDefault);
+}
+
+void Entity::setupSS(const char *name, uint index, const char *seq1, const char *seq2) {
+	debugC(6, kLastExpressDebugLogic, "Entity: %s(%s, %s)", name, seq1, seq2);
+
+	_engine->getGameLogic()->getGameState()->getGameSavePoints()->setCallback(_entityIndex, _callbacks[index]);
+	_data->setCurrentCallback(index);
+	_data->resetCurrentParameters<EntityData::EntityParametersSSII>();
+
+	EntityData::EntityParametersSSII *params = (EntityData::EntityParametersSSII*)_data->getCurrentParameters();
+	strncpy((char *)&params->seq1, seq1, 12);
+	strncpy((char *)&params->seq2, seq2, 12);
+
+	_engine->getGameLogic()->getGameState()->getGameSavePoints()->call(_entityIndex, _entityIndex, kActionDefault);
+}
+
+//////////////////////////////////////////////////////////////////////////
 // Helper functions
 //////////////////////////////////////////////////////////////////////////
 
diff --git a/engines/lastexpress/entities/entity.h b/engines/lastexpress/entities/entity.h
index 6a32fb6..18039e9 100644
--- a/engines/lastexpress/entities/entity.h
+++ b/engines/lastexpress/entities/entity.h
@@ -108,26 +108,6 @@ struct SavePoint;
 	((class *)getEntities()->get(entity))->function();
 
 //////////////////////////////////////////////////////////////////////////
-// Setup
-//////////////////////////////////////////////////////////////////////////
-
-#define IMPLEMENT_SETUP(class, name, index) \
-void class::setup_##name() { \
-	BEGIN_SETUP(index, EntityData::EntityParametersIIII) \
-	debugC(6, kLastExpressDebugLogic, "Entity: " #class "::setup_" #name "()"); \
-	END_SETUP() \
-}
-
-#define BEGIN_SETUP(index, type) \
-	_engine->getGameLogic()->getGameState()->getGameSavePoints()->setCallback(_entityIndex, _callbacks[index]); \
-	_data->setCurrentCallback(index); \
-	_data->resetCurrentParameters<type>();
-
-#define END_SETUP() \
-	_engine->getGameLogic()->getGameState()->getGameSavePoints()->call(_entityIndex, _entityIndex, kActionDefault);
-
-
-//////////////////////////////////////////////////////////////////////////
 // Implementation
 //////////////////////////////////////////////////////////////////////////
 
@@ -137,7 +117,6 @@ void class::setup_##name() { \
 	if (!params) \
 		error("[EXPOSE_PARAMS] Trying to call an entity function with invalid parameters"); \
 
-
 // function signature without setup (we keep the index for consistency but never use it)
 #define IMPLEMENT_FUNCTION_NOSETUP(index, class, name) \
 	void class::name(const SavePoint &savepoint) { \
@@ -145,7 +124,9 @@ void class::setup_##name() { \
 
 // simple setup with no parameters
 #define IMPLEMENT_FUNCTION(index, class, name) \
-	IMPLEMENT_SETUP(class, name, index) \
+	void class::setup_##name() { \
+		Entity::setup(#class "::setup_" #name, index); \
+	} \
 	void class::name(const SavePoint &savepoint) { \
 		EXPOSE_PARAMS(EntityData::EntityParametersIIII) \
 		debugC(6, kLastExpressDebugLogic, "Entity: " #class "::" #name "() - action: %s", ACTION_NAME(savepoint.action));
@@ -154,191 +135,128 @@ void class::setup_##name() { \
 
 // nullfunction call
 #define IMPLEMENT_NULL_FUNCTION(index, class) \
-	IMPLEMENT_SETUP(class, nullfunction, index)
+	void class::setup_nullfunction() { \
+		Entity::setup(#class "::setup_nullfunction", index); \
+	}
 
 // setup with one uint parameter
 #define IMPLEMENT_FUNCTION_I(index, class, name, paramType) \
 	void class::setup_##name(paramType param1) { \
-	BEGIN_SETUP(index, EntityData::EntityParametersIIII) \
-	EntityData::EntityParametersIIII *params = (EntityData::EntityParametersIIII*)_data->getCurrentParameters(); \
-	params->param1 = (unsigned int)param1; \
-	END_SETUP() \
+		Entity::setupI<paramType>(#class "::setup_" #name, index, param1); \
 	} \
 	void class::name(const SavePoint &savepoint) { \
-	EXPOSE_PARAMS(EntityData::EntityParametersIIII) \
-	debugC(6, kLastExpressDebugLogic, "Entity: " #class "::" #name "(%d) - action: %s", params->param1, ACTION_NAME(savepoint.action));
+		EXPOSE_PARAMS(EntityData::EntityParametersIIII) \
+		debugC(6, kLastExpressDebugLogic, "Entity: " #class "::" #name "(%d) - action: %s", params->param1, ACTION_NAME(savepoint.action));
 
 // setup with two uint parameters
 #define IMPLEMENT_FUNCTION_II(index, class, name, paramType1, paramType2) \
 	void class::setup_##name(paramType1 param1, paramType2 param2) { \
-		BEGIN_SETUP(index, EntityData::EntityParametersIIII) \
-		EntityData::EntityParametersIIII *params = (EntityData::EntityParametersIIII*)_data->getCurrentParameters(); \
-		params->param1 = param1; \
-		params->param2 = param2; \
-		END_SETUP() \
+		Entity::setupII<paramType1, paramType2>(#class "::setup_" #name, index, param1, param2); \
 	} \
 	void class::name(const SavePoint &savepoint) { \
-	EXPOSE_PARAMS(EntityData::EntityParametersIIII) \
-	debugC(6, kLastExpressDebugLogic, "Entity: " #class "::" #name "(%d, %d) - action: %s", params->param1, params->param2, ACTION_NAME(savepoint.action));
+		EXPOSE_PARAMS(EntityData::EntityParametersIIII) \
+		debugC(6, kLastExpressDebugLogic, "Entity: " #class "::" #name "(%d, %d) - action: %s", params->param1, params->param2, ACTION_NAME(savepoint.action));
 
 // setup with three uint parameters
 #define IMPLEMENT_FUNCTION_III(index, class, name, paramType1, paramType2, paramType3) \
 	void class::setup_##name(paramType1 param1, paramType2 param2, paramType3 param3) { \
-		BEGIN_SETUP(index, EntityData::EntityParametersIIII) \
-		EntityData::EntityParametersIIII *params = (EntityData::EntityParametersIIII*)_data->getCurrentParameters(); \
-		params->param1 = param1; \
-		params->param2 = param2; \
-		params->param3 = param3; \
-		END_SETUP() \
+		Entity::setupIII<paramType1, paramType2, paramType3>(#class "::setup_" #name, index, param1, param2, param3); \
 	} \
 	void class::name(const SavePoint &savepoint) { \
-	EXPOSE_PARAMS(EntityData::EntityParametersIIII) \
-	debugC(6, kLastExpressDebugLogic, "Entity: " #class "::" #name "(%d, %d, %d) - action: %s", params->param1, params->param2, params->param3, ACTION_NAME(savepoint.action));
+		EXPOSE_PARAMS(EntityData::EntityParametersIIII) \
+		debugC(6, kLastExpressDebugLogic, "Entity: " #class "::" #name "(%d, %d, %d) - action: %s", params->param1, params->param2, params->param3, ACTION_NAME(savepoint.action));
 
 // setup with one char *parameter
 #define IMPLEMENT_FUNCTION_S(index, class, name) \
 	void class::setup_##name(const char *seq1) { \
-		BEGIN_SETUP(index, EntityData::EntityParametersSIIS) \
-		EntityData::EntityParametersSIIS *params = (EntityData::EntityParametersSIIS*)_data->getCurrentParameters(); \
-		strncpy((char *)&params->seq1, seq1, 12); \
-		END_SETUP() \
+		Entity::setupS(#class "::setup_" #name, index, seq1); \
 	} \
 	void class::name(const SavePoint &savepoint) { \
-	EXPOSE_PARAMS(EntityData::EntityParametersSIIS) \
-	debugC(6, kLastExpressDebugLogic, "Entity: " #class "::" #name "(%s) - action: %s", (char *)&params->seq1, ACTION_NAME(savepoint.action));
+		EXPOSE_PARAMS(EntityData::EntityParametersSIIS) \
+		debugC(6, kLastExpressDebugLogic, "Entity: " #class "::" #name "(%s) - action: %s", (char *)&params->seq1, ACTION_NAME(savepoint.action));
 
 // setup with one char *parameter and one uint
 #define IMPLEMENT_FUNCTION_SI(index, class, name, paramType2) \
 	void class::setup_##name(const char *seq1, paramType2 param4) { \
-		BEGIN_SETUP(index, EntityData::EntityParametersSIIS) \
-		EntityData::EntityParametersSIIS *params = (EntityData::EntityParametersSIIS*)_data->getCurrentParameters(); \
-		strncpy((char *)&params->seq1, seq1, 12); \
-		params->param4 = param4; \
-		END_SETUP() \
+		Entity::setupSI<paramType2>(#class "::setup_" #name, index, seq1, param4); \
 	} \
 	void class::name(const SavePoint &savepoint) { \
-	EXPOSE_PARAMS(EntityData::EntityParametersSIIS) \
-	debugC(6, kLastExpressDebugLogic, "Entity: " #class "::" #name "(%s, %d) - action: %s", (char *)&params->seq1, params->param4, ACTION_NAME(savepoint.action));
+		EXPOSE_PARAMS(EntityData::EntityParametersSIIS) \
+		debugC(6, kLastExpressDebugLogic, "Entity: " #class "::" #name "(%s, %d) - action: %s", (char *)&params->seq1, params->param4, ACTION_NAME(savepoint.action));
 
 // setup with one char *parameter and two uints
 #define IMPLEMENT_FUNCTION_SII(index, class, name, paramType2, paramType3) \
 	void class::setup_##name(const char *seq1, paramType2 param4, paramType3 param5) { \
-		BEGIN_SETUP(index, EntityData::EntityParametersSIIS) \
-		EntityData::EntityParametersSIIS *params = (EntityData::EntityParametersSIIS*)_data->getCurrentParameters(); \
-		strncpy((char *)&params->seq1, seq1, 12); \
-		params->param4 = param4; \
-		params->param5 = param5; \
-		END_SETUP() \
+		Entity::setupSII<paramType2, paramType3>(#class "::setup_" #name, index, seq1, param4, param5); \
 	} \
 	void class::name(const SavePoint &savepoint) { \
-	EXPOSE_PARAMS(EntityData::EntityParametersSIIS) \
-	debugC(6, kLastExpressDebugLogic, "Entity: " #class "::" #name "(%s, %d, %d) - action: %s", (char *)&params->seq1, params->param4, params->param5, ACTION_NAME(savepoint.action));
+		EXPOSE_PARAMS(EntityData::EntityParametersSIIS) \
+		debugC(6, kLastExpressDebugLogic, "Entity: " #class "::" #name "(%s, %d, %d) - action: %s", (char *)&params->seq1, params->param4, params->param5, ACTION_NAME(savepoint.action));
 
 // setup with one char *parameter and three uints
 #define IMPLEMENT_FUNCTION_SIII(index, class, name, paramType2, paramType3, paramType4) \
 	void class::setup_##name(const char *seq, paramType2 param4, paramType3 param5, paramType4 param6) { \
-		BEGIN_SETUP(index, EntityData::EntityParametersSIII) \
-		EntityData::EntityParametersSIII *params = (EntityData::EntityParametersSIII*)_data->getCurrentParameters(); \
-		strncpy((char *)&params->seq, seq, 12); \
-		params->param4 = param4; \
-		params->param5 = param5; \
-		params->param6 = param6; \
-		END_SETUP() \
+		Entity::setupSIII<paramType2, paramType3, paramType4>(#class "::setup_" #name, index, seq, param4, param5, param6); \
 	} \
 	void class::name(const SavePoint &savepoint) { \
-	EXPOSE_PARAMS(EntityData::EntityParametersSIII) \
-	debugC(6, kLastExpressDebugLogic, "Entity: " #class "::" #name "(%s, %d, %d, %d) - action: %s", (char *)&params->seq, params->param4, params->param5, params->param6, ACTION_NAME(savepoint.action));
+		EXPOSE_PARAMS(EntityData::EntityParametersSIII) \
+		debugC(6, kLastExpressDebugLogic, "Entity: " #class "::" #name "(%s, %d, %d, %d) - action: %s", (char *)&params->seq, params->param4, params->param5, params->param6, ACTION_NAME(savepoint.action));
 
 #define IMPLEMENT_FUNCTION_SIIS(index, class, name, paramType2, paramType3) \
 	void class::setup_##name(const char *seq1, paramType2 param4, paramType3 param5, const char *seq2) { \
-		BEGIN_SETUP(index, EntityData::EntityParametersSIIS) \
-		EntityData::EntityParametersSIIS *params = (EntityData::EntityParametersSIIS*)_data->getCurrentParameters(); \
-		strncpy((char *)&params->seq1, seq1, 12); \
-		params->param4 = param4; \
-		params->param5 = param5; \
-		strncpy((char *)&params->seq2, seq2, 12); \
-		END_SETUP() \
+		Entity::setupSIIS<paramType2, paramType3>(#class "::setup_" #name, index, seq1, param4, param5, seq2); \
 	} \
 	void class::name(const SavePoint &savepoint) { \
-	EXPOSE_PARAMS(EntityData::EntityParametersSIIS) \
-	debugC(6, kLastExpressDebugLogic, "Entity: " #class "::" #name "(%s, %d, %d, %s) - action: %s", (char *)&params->seq1, params->param4, params->param5, (char *)&params->seq2, ACTION_NAME(savepoint.action));
+		EXPOSE_PARAMS(EntityData::EntityParametersSIIS) \
+		debugC(6, kLastExpressDebugLogic, "Entity: " #class "::" #name "(%s, %d, %d, %s) - action: %s", (char *)&params->seq1, params->param4, params->param5, (char *)&params->seq2, ACTION_NAME(savepoint.action));
 
 #define IMPLEMENT_FUNCTION_SS(index, class, name) \
 	void class::setup_##name(const char *seq1, const char *seq2) { \
-		BEGIN_SETUP(index, EntityData::EntityParametersSSII) \
-		EntityData::EntityParametersSSII *params = (EntityData::EntityParametersSSII*)_data->getCurrentParameters(); \
-		strncpy((char *)&params->seq1, seq1, 12); \
-		strncpy((char *)&params->seq2, seq2, 12); \
-		END_SETUP() \
+		Entity::setupSS(#class "::setup_" #name, index, seq1, seq2); \
 	} \
 	void class::name(const SavePoint &savepoint) { \
-	EXPOSE_PARAMS(EntityData::EntityParametersSSII) \
-	debugC(6, kLastExpressDebugLogic, "Entity: " #class "::" #name "(%s, %s) - action: %s", (char *)&params->seq1, (char *)&params->seq2, ACTION_NAME(savepoint.action));
+		EXPOSE_PARAMS(EntityData::EntityParametersSSII) \
+		debugC(6, kLastExpressDebugLogic, "Entity: " #class "::" #name "(%s, %s) - action: %s", (char *)&params->seq1, (char *)&params->seq2, ACTION_NAME(savepoint.action));
 
 #define IMPLEMENT_FUNCTION_SSI(index, class, name, paramType3) \
 	void class::setup_##name(const char *seq1, const char *seq2, paramType3 param7) { \
-		BEGIN_SETUP(index, EntityData::EntityParametersSSII) \
-		EntityData::EntityParametersSSII *params = (EntityData::EntityParametersSSII*)_data->getCurrentParameters(); \
-		strncpy((char *)&params->seq1, seq1, 12); \
-		strncpy((char *)&params->seq2, seq2, 12); \
-		params->param7 = param7; \
-		END_SETUP() \
+		Entity::setupSSI<paramType3>(#class "::setup_" #name, index, seq1, seq2, param7); \
 	} \
 	void class::name(const SavePoint &savepoint) { \
-	EXPOSE_PARAMS(EntityData::EntityParametersSSII) \
-	debugC(6, kLastExpressDebugLogic, "Entity: " #class "::" #name "(%s, %s, %d) - action: %s", (char *)&params->seq1, (char *)&params->seq2, params->param7, ACTION_NAME(savepoint.action));
+		EXPOSE_PARAMS(EntityData::EntityParametersSSII) \
+		debugC(6, kLastExpressDebugLogic, "Entity: " #class "::" #name "(%s, %s, %d) - action: %s", (char *)&params->seq1, (char *)&params->seq2, params->param7, ACTION_NAME(savepoint.action));
 
 #define IMPLEMENT_FUNCTION_IS(index, class, name, paramType) \
 	void class::setup_##name(paramType param1, const char *seq) { \
-		BEGIN_SETUP(index, EntityData::EntityParametersISII) \
-		EntityData::EntityParametersISII *params = (EntityData::EntityParametersISII*)_data->getCurrentParameters(); \
-		params->param1 = (unsigned int)param1; \
-		strncpy((char *)&params->seq, seq, 12); \
-		END_SETUP() \
+		Entity::setupIS<paramType>(#class "::setup_" #name, index, param1, seq); \
 	} \
 	void class::name(const SavePoint &savepoint) { \
-	EXPOSE_PARAMS(EntityData::EntityParametersISII) \
-	debugC(6, kLastExpressDebugLogic, "Entity: " #class "::" #name "(%d, %s) - action: %s", params->param1, (char *)&params->seq, ACTION_NAME(savepoint.action));
+		EXPOSE_PARAMS(EntityData::EntityParametersISII) \
+		debugC(6, kLastExpressDebugLogic, "Entity: " #class "::" #name "(%d, %s) - action: %s", params->param1, (char *)&params->seq, ACTION_NAME(savepoint.action));
 
 #define IMPLEMENT_FUNCTION_ISS(index, class, name, paramType) \
 	void class::setup_##name(paramType param1, const char *seq1, const char *seq2) { \
-		BEGIN_SETUP(index, EntityData::EntityParametersISSI) \
-		EntityData::EntityParametersISSI *params = (EntityData::EntityParametersISSI*)_data->getCurrentParameters(); \
-		params->param1 = param1; \
-		strncpy((char *)&params->seq1, seq1, 12); \
-		strncpy((char *)&params->seq2, seq2, 12); \
-		END_SETUP() \
+		Entity::setupISS<paramType>(#class "::setup_" #name, index, param1, seq1, seq2); \
 	} \
 	void class::name(const SavePoint &savepoint) { \
-	EXPOSE_PARAMS(EntityData::EntityParametersISSI) \
-	debugC(6, kLastExpressDebugLogic, "Entity: " #class "::" #name "(%d, %s, %s) - action: %s", params->param1, (char *)&params->seq1, (char *)&params->seq2, ACTION_NAME(savepoint.action));
+		EXPOSE_PARAMS(EntityData::EntityParametersISSI) \
+		debugC(6, kLastExpressDebugLogic, "Entity: " #class "::" #name "(%d, %s, %s) - action: %s", params->param1, (char *)&params->seq1, (char *)&params->seq2, ACTION_NAME(savepoint.action));
 
 #define IMPLEMENT_FUNCTION_IIS(index, class, name, paramType1, paramType2) \
 	void class::setup_##name(paramType1 param1, paramType2 param2, const char *seq) { \
-		BEGIN_SETUP(index, EntityData::EntityParametersIISI) \
-		EntityData::EntityParametersIISI *params = (EntityData::EntityParametersIISI*)_data->getCurrentParameters(); \
-		params->param1 = param1; \
-		params->param2 = param2; \
-		strncpy((char *)&params->seq, seq, 12); \
-		END_SETUP() \
+		Entity::setupIIS<paramType1, paramType2>(#class "::setup_" #name, index, param1, param2, seq); \
 	} \
 	void class::name(const SavePoint &savepoint) { \
-	EXPOSE_PARAMS(EntityData::EntityParametersIISI) \
-	debugC(6, kLastExpressDebugLogic, "Entity: " #class "::" #name "(%d, %d, %s) - action: %s", params->param1, params->param2, (char *)&params->seq, ACTION_NAME(savepoint.action));
+		EXPOSE_PARAMS(EntityData::EntityParametersIISI) \
+		debugC(6, kLastExpressDebugLogic, "Entity: " #class "::" #name "(%d, %d, %s) - action: %s", params->param1, params->param2, (char *)&params->seq, ACTION_NAME(savepoint.action));
 
 #define IMPLEMENT_FUNCTION_IISS(index, class, name, paramType1, paramType2) \
 	void class::setup_##name(paramType1 param1, paramType2 param2, const char *seq1, const char *seq2) { \
-		BEGIN_SETUP(index, EntityData::EntityParametersIISS) \
-		EntityData::EntityParametersIISS *params = (EntityData::EntityParametersIISS*)_data->getCurrentParameters(); \
-		params->param1 = param1; \
-		params->param2 = param2; \
-		strncpy((char *)&params->seq1, seq1, 12); \
-		strncpy((char *)&params->seq2, seq2, 12); \
-		END_SETUP() \
+		Entity::setupIISS<paramType1, paramType2>(#class "::setup_" #name, index, param1, param2, seq1, seq2); \
 	} \
 	void class::name(const SavePoint &savepoint) { \
-	EXPOSE_PARAMS(EntityData::EntityParametersIISS) \
-	debugC(6, kLastExpressDebugLogic, "Entity: " #class "::" #name "(%d, %d, %s, %s) - action: %s", params->param1, params->param2, (char *)&params->seq1, (char *)&params->seq2, ACTION_NAME(savepoint.action));
+		EXPOSE_PARAMS(EntityData::EntityParametersIISS) \
+		debugC(6, kLastExpressDebugLogic, "Entity: " #class "::" #name "(%d, %d, %s, %s) - action: %s", params->param1, params->param2, (char *)&params->seq1, (char *)&params->seq2, ACTION_NAME(savepoint.action));
 
 
 //////////////////////////////////////////////////////////////////////////
@@ -1145,6 +1063,203 @@ protected:
 	void callbackAction();
 
 	//////////////////////////////////////////////////////////////////////////
+	// Setup functions
+	//////////////////////////////////////////////////////////////////////////
+	void setup(const char *name, uint index);
+	void setupS(const char *name, uint index, const char *seq1);
+	void setupSS(const char *name, uint index, const char *seq1, const char *seq2);
+
+	template<typename T>
+	void setupI(const char *name, uint index, T param1) {
+		debugC(6, kLastExpressDebugLogic, "Entity: %s(%d)", name, param1);
+
+		_engine->getGameLogic()->getGameState()->getGameSavePoints()->setCallback(_entityIndex, _callbacks[index]);
+		_data->setCurrentCallback(index);
+		_data->resetCurrentParameters<EntityData::EntityParametersIIII>();
+
+		EntityData::EntityParametersIIII *params = (EntityData::EntityParametersIIII*)_data->getCurrentParameters();
+		params->param1 = (unsigned int)param1;
+
+		_engine->getGameLogic()->getGameState()->getGameSavePoints()->call(_entityIndex, _entityIndex, kActionDefault);
+	}
+
+	template<typename T1, typename T2>
+	void setupII(const char *name, uint index, T1 param1, T2 param2) {
+		debugC(6, kLastExpressDebugLogic, "Entity: %s(%d, %d)", name, param1, param2);
+
+		_engine->getGameLogic()->getGameState()->getGameSavePoints()->setCallback(_entityIndex, _callbacks[index]);
+		_data->setCurrentCallback(index);
+		_data->resetCurrentParameters<EntityData::EntityParametersIIII>();
+
+		EntityData::EntityParametersIIII *params = (EntityData::EntityParametersIIII*)_data->getCurrentParameters();
+		params->param1 = param1;
+		params->param2 = param2;
+
+		_engine->getGameLogic()->getGameState()->getGameSavePoints()->call(_entityIndex, _entityIndex, kActionDefault);
+	}
+
+	template<typename T1, typename T2, typename T3>
+	void setupIII(const char *name, uint index, T1 param1, T2 param2, T3 param3) {
+		debugC(6, kLastExpressDebugLogic, "Entity: %s(%d, %d, %d)", name, param1, param2, param3);
+
+		_engine->getGameLogic()->getGameState()->getGameSavePoints()->setCallback(_entityIndex, _callbacks[index]);
+		_data->setCurrentCallback(index);
+		_data->resetCurrentParameters<EntityData::EntityParametersIIII>();
+
+		EntityData::EntityParametersIIII *params = (EntityData::EntityParametersIIII*)_data->getCurrentParameters();
+		params->param1 = param1;
+		params->param2 = param2;
+		params->param3 = param3;
+
+		_engine->getGameLogic()->getGameState()->getGameSavePoints()->call(_entityIndex, _entityIndex, kActionDefault);
+	}
+
+	template<typename T>
+	void setupSI(const char *name, uint index, const char *seq1, T param4) {
+		debugC(6, kLastExpressDebugLogic, "Entity: %s(%s, %d)", name, seq1, param4);
+
+		_engine->getGameLogic()->getGameState()->getGameSavePoints()->setCallback(_entityIndex, _callbacks[index]);
+		_data->setCurrentCallback(index);
+		_data->resetCurrentParameters<EntityData::EntityParametersSIIS>();
+
+		EntityData::EntityParametersSIIS *params = (EntityData::EntityParametersSIIS*)_data->getCurrentParameters();
+		strncpy((char *)&params->seq1, seq1, 12);
+		params->param4 = param4;
+
+		_engine->getGameLogic()->getGameState()->getGameSavePoints()->call(_entityIndex, _entityIndex, kActionDefault);
+	}
+
+	template<typename T1, typename T2>
+	void setupSII(const char *name, uint index, const char *seq1, T1 param4, T2 param5) {
+		debugC(6, kLastExpressDebugLogic, "Entity: %s(%s, %d, %d)", name, seq1, param4, param5);
+
+		_engine->getGameLogic()->getGameState()->getGameSavePoints()->setCallback(_entityIndex, _callbacks[index]);
+		_data->setCurrentCallback(index);
+		_data->resetCurrentParameters<EntityData::EntityParametersSIIS>();
+
+		EntityData::EntityParametersSIIS *params = (EntityData::EntityParametersSIIS*)_data->getCurrentParameters();
+		strncpy((char *)&params->seq1, seq1, 12);
+		params->param4 = param4;
+		params->param5 = param5;
+
+		_engine->getGameLogic()->getGameState()->getGameSavePoints()->call(_entityIndex, _entityIndex, kActionDefault);
+	}
+
+	template<typename T1, typename T2, typename T3>
+	void setupSIII(const char *name, uint index, const char *seq, T1 param4, T2 param5, T3 param6) {
+		debugC(6, kLastExpressDebugLogic, "Entity: %s(%s, %d, %d, %d)", name, seq, param4, param5, param6);
+
+		_engine->getGameLogic()->getGameState()->getGameSavePoints()->setCallback(_entityIndex, _callbacks[index]);
+		_data->setCurrentCallback(index);
+		_data->resetCurrentParameters<EntityData::EntityParametersSIII>();
+
+		EntityData::EntityParametersSIII *params = (EntityData::EntityParametersSIII*)_data->getCurrentParameters();
+		strncpy((char *)&params->seq, seq, 12);
+		params->param4 = param4;
+		params->param5 = param5;
+		params->param6 = param6;
+
+		_engine->getGameLogic()->getGameState()->getGameSavePoints()->call(_entityIndex, _entityIndex, kActionDefault);
+	}
+
+	template<typename T1, typename T2>
+	void setupSIIS(const char *name, uint index, const char *seq1, T1 param4, T2 param5, const char *seq2) {
+		debugC(6, kLastExpressDebugLogic, "Entity: %s(%s, %d, %d, %s)", name, seq1, param4, param5, seq2);
+
+		_engine->getGameLogic()->getGameState()->getGameSavePoints()->setCallback(_entityIndex, _callbacks[index]);
+		_data->setCurrentCallback(index);
+		_data->resetCurrentParameters<EntityData::EntityParametersSIIS>();
+
+		EntityData::EntityParametersSIIS *params = (EntityData::EntityParametersSIIS*)_data->getCurrentParameters();
+		strncpy((char *)&params->seq1, seq1, 12);
+		params->param4 = param4;
+		params->param5 = param5;
+		strncpy((char *)&params->seq2, seq2, 12);
+
+		_engine->getGameLogic()->getGameState()->getGameSavePoints()->call(_entityIndex, _entityIndex, kActionDefault);
+	}
+
+	template<typename T>
+	void setupSSI(const char *name, uint index, const char *seq1, const char *seq2, T param7) {
+		debugC(6, kLastExpressDebugLogic, "Entity: %s(%s, %s, %d)", name, seq1, seq2, param7);
+
+		_engine->getGameLogic()->getGameState()->getGameSavePoints()->setCallback(_entityIndex, _callbacks[index]);
+		_data->setCurrentCallback(index);
+		_data->resetCurrentParameters<EntityData::EntityParametersSSII>();
+
+		EntityData::EntityParametersSSII *params = (EntityData::EntityParametersSSII*)_data->getCurrentParameters();
+		strncpy((char *)&params->seq1, seq1, 12);
+		strncpy((char *)&params->seq2, seq2, 12);
+		params->param7 = param7;
+
+		_engine->getGameLogic()->getGameState()->getGameSavePoints()->call(_entityIndex, _entityIndex, kActionDefault);
+	}
+
+	template<typename T>
+	void setupIS(const char *name, uint index, T param1, const char *seq) {
+		debugC(6, kLastExpressDebugLogic, "Entity: %s(%d, %s)", name, param1, seq);
+
+		_engine->getGameLogic()->getGameState()->getGameSavePoints()->setCallback(_entityIndex, _callbacks[index]);
+		_data->setCurrentCallback(index);
+		_data->resetCurrentParameters<EntityData::EntityParametersISII>();
+
+		EntityData::EntityParametersISII *params = (EntityData::EntityParametersISII*)_data->getCurrentParameters();
+		params->param1 = (unsigned int)param1;
+		strncpy((char *)&params->seq, seq, 12);
+
+		_engine->getGameLogic()->getGameState()->getGameSavePoints()->call(_entityIndex, _entityIndex, kActionDefault);
+	}
+
+	template<typename T>
+	void setupISS(const char *name, uint index, T param1, const char *seq1, const char *seq2) {
+		debugC(6, kLastExpressDebugLogic, "Entity: %s(%d, %s, %s)", name, param1, seq1, seq2);
+
+		_engine->getGameLogic()->getGameState()->getGameSavePoints()->setCallback(_entityIndex, _callbacks[index]);
+		_data->setCurrentCallback(index);
+		_data->resetCurrentParameters<EntityData::EntityParametersISSI>();
+
+		EntityData::EntityParametersISSI *params = (EntityData::EntityParametersISSI*)_data->getCurrentParameters();
+		params->param1 = param1;
+		strncpy((char *)&params->seq1, seq1, 12);
+		strncpy((char *)&params->seq2, seq2, 12);
+
+		_engine->getGameLogic()->getGameState()->getGameSavePoints()->call(_entityIndex, _entityIndex, kActionDefault);
+	}
+
+	template<typename T1, typename T2>
+	void setupIIS(const char *name, uint index, T1 param1, T2 param2, const char *seq) {
+		debugC(6, kLastExpressDebugLogic, "Entity: %s(%d, %d, %s)", name, param1, param2, seq);
+
+		_engine->getGameLogic()->getGameState()->getGameSavePoints()->setCallback(_entityIndex, _callbacks[index]);
+		_data->setCurrentCallback(index);
+		_data->resetCurrentParameters<EntityData::EntityParametersIISI>();
+
+		EntityData::EntityParametersIISI *params = (EntityData::EntityParametersIISI*)_data->getCurrentParameters();
+		params->param1 = param1;
+		params->param2 = param2;
+		strncpy((char *)&params->seq, seq, 12);
+
+		_engine->getGameLogic()->getGameState()->getGameSavePoints()->call(_entityIndex, _entityIndex, kActionDefault);
+	}
+
+	template<typename T1, typename T2>
+	void setupIISS(const char *name, uint index, T1 param1, T2 param2, const char *seq1, const char *seq2) {
+		debugC(6, kLastExpressDebugLogic, "Entity: %s(%d, %d, %s, %s)", name, param1, param2, seq1, seq2);
+
+		_engine->getGameLogic()->getGameState()->getGameSavePoints()->setCallback(_entityIndex, _callbacks[index]);
+		_data->setCurrentCallback(index);
+		_data->resetCurrentParameters<EntityData::EntityParametersIISS>();
+
+		EntityData::EntityParametersIISS *params = (EntityData::EntityParametersIISS*)_data->getCurrentParameters();
+		params->param1 = param1;
+		params->param2 = param2;
+		strncpy((char *)&params->seq1, seq1, 12);
+		strncpy((char *)&params->seq2, seq2, 12);
+
+		_engine->getGameLogic()->getGameState()->getGameSavePoints()->call(_entityIndex, _entityIndex, kActionDefault);
+	}
+
+	//////////////////////////////////////////////////////////////////////////
 	// Helper functions
 	//////////////////////////////////////////////////////////////////////////
 


Commit: 3d6807b35905a951688508d3b696ee48c1453c4d
    https://github.com/scummvm/scummvm/commit/3d6807b35905a951688508d3b696ee48c1453c4d
Author: Julien (julien at powerinbox.com)
Date: 2012-07-26T21:15:05-07:00

Commit Message:
LASTEXPRESS: Implement Logic::resetState()

Changed paths:
    engines/lastexpress/game/logic.cpp
    engines/lastexpress/game/scenes.cpp
    engines/lastexpress/game/scenes.h



diff --git a/engines/lastexpress/game/logic.cpp b/engines/lastexpress/game/logic.cpp
index 5f22047..c8e4c22 100644
--- a/engines/lastexpress/game/logic.cpp
+++ b/engines/lastexpress/game/logic.cpp
@@ -408,9 +408,12 @@ void Logic::eventTick(const Common::Event &) {
  * Resets the game state.
  */
 void Logic::resetState() {
-	getState()->scene = kSceneDefault;
+	getScenes()->setCoordinates(Common::Rect(80, 0, 559, 479));
 
-	warning("[Logic::resetState] Not implemented! You need to restart the engine until this is implemented.");
+	SAFE_DELETE(_entities);
+	SAFE_DELETE(_state);
+	_entities = new Entities(_engine);
+	_state    = new State(_engine);
 }
 
 /**
diff --git a/engines/lastexpress/game/scenes.cpp b/engines/lastexpress/game/scenes.cpp
index 254b0fd..447e871 100644
--- a/engines/lastexpress/game/scenes.cpp
+++ b/engines/lastexpress/game/scenes.cpp
@@ -739,24 +739,31 @@ void SceneManager::resetQueue() {
 	_queue.clear();
 }
 
-void SceneManager::setCoordinates(SequenceFrame *frame) {
+void SceneManager::setCoordinates(Common::Rect rect) {
+	_flagCoordinates = true;
 
-	if (!frame || frame->getInfo()->subType == 3)
-		return;
+	if (_coords.right > rect.right)
+		_coords.right = rect.right;
 
-	_flagCoordinates = true;
+	if (_coords.bottom > rect.bottom)
+		_coords.bottom = rect.bottom;
 
-	if (_coords.right > (int)frame->getInfo()->xPos1)
-		_coords.right = (int16)frame->getInfo()->xPos1;
+	if (_coords.left < rect.left)
+		_coords.left = rect.left;
 
-	if (_coords.bottom > (int)frame->getInfo()->yPos1)
-		_coords.bottom = (int16)frame->getInfo()->yPos1;
+	if (_coords.top < rect.top)
+		_coords.top = rect.top;
+}
+
+void SceneManager::setCoordinates(SequenceFrame *frame) {
 
-	if (_coords.left < (int)frame->getInfo()->xPos2)
-		_coords.left = (int16)frame->getInfo()->xPos2;
+	if (!frame || frame->getInfo()->subType == 3)
+		return;
 
-	if (_coords.top < (int)frame->getInfo()->yPos2)
-		_coords.top = (int16)frame->getInfo()->yPos2;
+	setCoordinates(Common::Rect((int16)frame->getInfo()->xPos1,
+								(int16)frame->getInfo()->yPos1,
+								(int16)frame->getInfo()->xPos2,
+								(int16)frame->getInfo()->yPos2));
 }
 
 void SceneManager::resetCoordinates() {
diff --git a/engines/lastexpress/game/scenes.h b/engines/lastexpress/game/scenes.h
index 172dde2..a866c65 100644
--- a/engines/lastexpress/game/scenes.h
+++ b/engines/lastexpress/game/scenes.h
@@ -79,6 +79,7 @@ public:
 	void removeAndRedraw(SequenceFrame **frame, bool doRedraw);
 	void resetQueue();
 	void setCoordinates(SequenceFrame *frame);
+	void setCoordinates(Common::Rect rect);
 
 	// Helpers
 	SceneIndex getSceneIndexFromPosition(CarIndex car, Position position, int param3 = -1);






More information about the Scummvm-git-logs mailing list