aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulien2012-07-22 20:27:23 -0400
committerJulien2012-07-27 00:14:54 -0400
commit5d4a8f1e15c9b90209cbd4572ef17552cc06d65c (patch)
treee874772727055387eda91ab7e6d7e334cd73d71d
parent2c4518d6154a0ae9772fe19a629f05c750ab19c8 (diff)
downloadscummvm-rg350-5d4a8f1e15c9b90209cbd4572ef17552cc06d65c.tar.gz
scummvm-rg350-5d4a8f1e15c9b90209cbd4572ef17552cc06d65c.tar.bz2
scummvm-rg350-5d4a8f1e15c9b90209cbd4572ef17552cc06d65c.zip
LASTEXPRESS: Remove use of function wrappers in shared entity functions
-rw-r--r--engines/lastexpress/entities/alouan.cpp8
-rw-r--r--engines/lastexpress/entities/coudert.cpp20
-rw-r--r--engines/lastexpress/entities/entity.cpp20
-rw-r--r--engines/lastexpress/entities/entity.h22
-rw-r--r--engines/lastexpress/entities/hadija.cpp8
-rw-r--r--engines/lastexpress/entities/mertens.cpp20
6 files changed, 46 insertions, 52 deletions
diff --git a/engines/lastexpress/entities/alouan.cpp b/engines/lastexpress/entities/alouan.cpp
index 8e56ae4c5b..589b712b16 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 77cddddf48..e79d4cdff7 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 1ad6d08035..4c661a4915 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 7ff574ddbe..77c3793890 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 2dd239d4c9..8d757d54fd 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 328c8e88d8..37e7bf5ca6 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: