diff options
author | Littleboy | 2012-07-15 22:36:29 -0400 |
---|---|---|
committer | Littleboy | 2012-07-16 23:51:28 -0400 |
commit | 3d1b7b2d962ac37d8fb706ac8b884d3e560f97b5 (patch) | |
tree | bac7d8c1e2a927649f2fab8af0839a3d91bcdf86 | |
parent | e517c1199a0a187d865fbf22ce964a7dad069eb9 (diff) | |
download | scummvm-rg350-3d1b7b2d962ac37d8fb706ac8b884d3e560f97b5.tar.gz scummvm-rg350-3d1b7b2d962ac37d8fb706ac8b884d3e560f97b5.tar.bz2 scummvm-rg350-3d1b7b2d962ac37d8fb706ac8b884d3e560f97b5.zip |
LASTEXPRESS: Merge the two savegameBloodJacket functions into the base Entity class
-rw-r--r-- | engines/lastexpress/entities/coudert.cpp | 30 | ||||
-rw-r--r-- | engines/lastexpress/entities/coudert.h | 1 | ||||
-rw-r--r-- | engines/lastexpress/entities/entity.cpp | 22 | ||||
-rw-r--r-- | engines/lastexpress/entities/entity.h | 7 | ||||
-rw-r--r-- | engines/lastexpress/entities/entity39.h | 2 | ||||
-rw-r--r-- | engines/lastexpress/entities/mertens.cpp | 28 | ||||
-rw-r--r-- | engines/lastexpress/entities/mertens.h | 3 |
7 files changed, 53 insertions, 40 deletions
diff --git a/engines/lastexpress/entities/coudert.cpp b/engines/lastexpress/entities/coudert.cpp index 66733acc16..eea9dda718 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: - savegameBloodJacket(); + Entity::savegameBloodJacket(WRAP_SAVE_FUNCTION(Coudert, setup_savegame)); break; case kActionExitCompartment: @@ -142,7 +142,7 @@ IMPLEMENT_FUNCTION_SI(3, Coudert, enterExitCompartment, ObjectIndex) break; case kActionNone: - savegameBloodJacket(); + Entity::savegameBloodJacket(WRAP_SAVE_FUNCTION(Coudert, setup_savegame)); return; case kActionCallback: @@ -168,7 +168,7 @@ IMPLEMENT_FUNCTION(4, Coudert, callbackActionOnDirection) break; } - savegameBloodJacket(); + Entity::savegameBloodJacket(WRAP_SAVE_FUNCTION(Coudert, setup_savegame)); break; case kActionExitCompartment: @@ -191,7 +191,7 @@ IMPLEMENT_FUNCTION_SIII(5, Coudert, enterExitCompartment2, ObjectIndex, EntityPo break; case kActionNone: - savegameBloodJacket(); + Entity::savegameBloodJacket(WRAP_SAVE_FUNCTION(Coudert, setup_savegame)); return; case kActionCallback: @@ -212,7 +212,7 @@ IMPLEMENT_FUNCTION_S(6, Coudert, playSound) break; case kActionNone: - savegameBloodJacket(); + Entity::savegameBloodJacket(WRAP_SAVE_FUNCTION(Coudert, setup_savegame)); break; case kActionEndSound: @@ -241,7 +241,7 @@ IMPLEMENT_FUNCTION_NOSETUP(7, Coudert, playSound16) break; case kActionNone: - savegameBloodJacket(); + Entity::savegameBloodJacket(WRAP_SAVE_FUNCTION(Coudert, setup_savegame)); break; case kActionEndSound: @@ -354,7 +354,7 @@ IMPLEMENT_FUNCTION_I(10, Coudert, updateFromTime, uint32) break; case kActionNone: - savegameBloodJacket(); + Entity::savegameBloodJacket(WRAP_SAVE_FUNCTION(Coudert, setup_savegame)); UPDATE_PARAM(params->param2, getState()->time, params->param1); @@ -377,7 +377,7 @@ IMPLEMENT_FUNCTION_I(11, Coudert, updateFromTicks, uint32) break; case kActionNone: - savegameBloodJacket(); + Entity::savegameBloodJacket(WRAP_SAVE_FUNCTION(Coudert, setup_savegame)); UPDATE_PARAM(params->param2, getState()->timeTicks, params->param1); @@ -451,7 +451,7 @@ IMPLEMENT_FUNCTION_II(13, Coudert, function13, bool, EntityIndex) break; case kActionNone: - savegameBloodJacket(); + Entity::savegameBloodJacket(WRAP_SAVE_FUNCTION(Coudert, setup_savegame)); if (!params->param2 && !params->param3) { @@ -573,7 +573,7 @@ IMPLEMENT_FUNCTION_I(14, Coudert, function14, EntityIndex) break; case kActionNone: - savegameBloodJacket(); + Entity::savegameBloodJacket(WRAP_SAVE_FUNCTION(Coudert, setup_savegame)); break; case kActionDefault: @@ -4164,14 +4164,4 @@ void Coudert::visitCompartment(const SavePoint &savepoint, EntityPosition positi } } -void Coudert::savegameBloodJacket() { - if (getProgress().jacket == kJacketBlood - && getEntities()->isDistanceBetweenEntities(kEntityCoudert, kEntityPlayer, 1000) - && !getEntities()->isInsideCompartments(kEntityPlayer) - && !getEntities()->checkFields10(kEntityPlayer)) { - setCallback(1); - setup_savegame(kSavegameTypeEvent, kEventMertensBloodJacket); - } -} - } // End of namespace LastExpress diff --git a/engines/lastexpress/entities/coudert.h b/engines/lastexpress/entities/coudert.h index d06bb95ce9..45d13ce9bb 100644 --- a/engines/lastexpress/entities/coudert.h +++ b/engines/lastexpress/entities/coudert.h @@ -219,7 +219,6 @@ public: private: void visitCompartment(const SavePoint &savepoint, EntityPosition position, const char *seq1, ObjectIndex compartment, const char *seq2, const char *seq3, EntityPosition sittingPosition, ObjectIndex object, const char *seq4); - void savegameBloodJacket(); }; } // End of namespace LastExpress diff --git a/engines/lastexpress/entities/entity.cpp b/engines/lastexpress/entities/entity.cpp index 120c1f2d85..a412dc9b65 100644 --- a/engines/lastexpress/entities/entity.cpp +++ b/engines/lastexpress/entities/entity.cpp @@ -253,6 +253,28 @@ void Entity::savegame(const SavePoint &savepoint) { } } +void Entity::savegameBloodJacket(SaveFunction *savegame) { + if (getProgress().jacket == kJacketBlood + && getEntities()->isDistanceBetweenEntities(_entityIndex, kEntityPlayer, 1000) + && !getEntities()->isInsideCompartments(kEntityPlayer) + && !getEntities()->checkFields10(kEntityPlayer)) { + setCallback(1); + + switch (_entityIndex) { + default: + break; + + case kEntityCoudert: + (*savegame)(kSavegameTypeEvent, kEventCoudertBloodJacket); + break; + + case kEntityMertens: + (*savegame)(kSavegameTypeEvent, kEventCoudertBloodJacket); + break; + } + } +} + void Entity::playSound(const SavePoint &savepoint, bool resetItem, SoundFlag flag) { EXPOSE_PARAMS(EntityData::EntityParametersSIIS) diff --git a/engines/lastexpress/entities/entity.h b/engines/lastexpress/entities/entity.h index 4dca5424b1..01a19553ec 100644 --- a/engines/lastexpress/entities/entity.h +++ b/engines/lastexpress/entities/entity.h @@ -680,9 +680,11 @@ protected: 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 @@ -694,6 +696,11 @@ protected: void savegame(const SavePoint &savepoint); /** + * Saves the game before being found out with a blood covered jacket + */ + void savegameBloodJacket(SaveFunction *savegame); + + /** * Play sound * * @param savepoint The savepoint diff --git a/engines/lastexpress/entities/entity39.h b/engines/lastexpress/entities/entity39.h index 4335a9566e..148bca5c33 100644 --- a/engines/lastexpress/entities/entity39.h +++ b/engines/lastexpress/entities/entity39.h @@ -72,4 +72,4 @@ private: } // End of namespace LastExpress -#endif // LASTEXPRESS_##define##_H +#endif // LASTEXPRESS_ENTITY39_H diff --git a/engines/lastexpress/entities/mertens.cpp b/engines/lastexpress/entities/mertens.cpp index 5672fe4d49..dd69aea2a6 100644 --- a/engines/lastexpress/entities/mertens.cpp +++ b/engines/lastexpress/entities/mertens.cpp @@ -37,14 +37,6 @@ namespace LastExpress { -#define SAVEGAME_BLOOD_JACKET() \ - if (getProgress().jacket == kJacketBlood \ - && getEntities()->isDistanceBetweenEntities(kEntityMertens, kEntityPlayer, 1000) \ - && !getEntities()->isInsideCompartments(kEntityPlayer) \ - && !getEntities()->checkFields10(kEntityPlayer)) { \ - setCallback(1); \ - setup_savegame(kSavegameTypeEvent, kEventMertensBloodJacket); \ - } Mertens::Mertens(LastExpressEngine *engine) : Entity(engine, kEntityMertens) { ADD_CALLBACK_FUNCTION(Mertens, reset); @@ -115,7 +107,7 @@ IMPLEMENT_FUNCTION_S(2, Mertens, bloodJacket) break; case kActionNone: - SAVEGAME_BLOOD_JACKET(); + Entity::savegameBloodJacket(WRAP_SAVE_FUNCTION(Mertens, setup_savegame)); break; case kActionExitCompartment: @@ -142,7 +134,7 @@ IMPLEMENT_FUNCTION_SI(3, Mertens, enterExitCompartment, ObjectIndex) break; case kActionNone: - SAVEGAME_BLOOD_JACKET(); + Entity::savegameBloodJacket(WRAP_SAVE_FUNCTION(Mertens, setup_savegame)); return; case kActionCallback: @@ -163,7 +155,7 @@ IMPLEMENT_FUNCTION_SI(4, Mertens, enterExitCompartment2, ObjectIndex) break; case kActionNone: - SAVEGAME_BLOOD_JACKET(); + Entity::savegameBloodJacket(WRAP_SAVE_FUNCTION(Mertens, setup_savegame)); return; case kAction4: @@ -189,7 +181,7 @@ IMPLEMENT_FUNCTION_SIII(5, Mertens, enterExitCompartment3, ObjectIndex, EntityPo break; case kActionNone: - SAVEGAME_BLOOD_JACKET(); + Entity::savegameBloodJacket(WRAP_SAVE_FUNCTION(Mertens, setup_savegame)); break; case kActionExitCompartment: @@ -231,7 +223,7 @@ IMPLEMENT_FUNCTION(6, Mertens, callbackActionOnDirection) break; } - SAVEGAME_BLOOD_JACKET(); + Entity::savegameBloodJacket(WRAP_SAVE_FUNCTION(Mertens, setup_savegame)); break; case kActionExitCompartment: @@ -254,7 +246,7 @@ IMPLEMENT_FUNCTION_S(7, Mertens, playSound) break; case kActionNone: - SAVEGAME_BLOOD_JACKET(); + Entity::savegameBloodJacket(WRAP_SAVE_FUNCTION(Mertens, setup_savegame)); break; case kActionEndSound: @@ -281,7 +273,7 @@ IMPLEMENT_FUNCTION_S(8, Mertens, playSound16) break; case kActionNone: - SAVEGAME_BLOOD_JACKET(); + Entity::savegameBloodJacket(WRAP_SAVE_FUNCTION(Mertens, setup_savegame)); break; case kActionEndSound: @@ -480,7 +472,7 @@ IMPLEMENT_FUNCTION_I(11, Mertens, function11, uint32) break; case kActionNone: - SAVEGAME_BLOOD_JACKET(); + Entity::savegameBloodJacket(WRAP_SAVE_FUNCTION(Mertens, setup_savegame)); UPDATE_PARAM(params->param2, getState()->time, params->param1) @@ -548,7 +540,7 @@ IMPLEMENT_FUNCTION_II(13, Mertens, function13, bool, bool) break; case kActionNone: - SAVEGAME_BLOOD_JACKET(); + Entity::savegameBloodJacket(WRAP_SAVE_FUNCTION(Mertens, setup_savegame)); if (!params->param2 && !params->param3) { UPDATE_PARAM_PROC(params->param4, getState()->timeTicks, 75) @@ -670,7 +662,7 @@ IMPLEMENT_FUNCTION_I(14, Mertens, function14, EntityIndex) break; case kActionNone: - SAVEGAME_BLOOD_JACKET(); + Entity::savegameBloodJacket(WRAP_SAVE_FUNCTION(Mertens, setup_savegame)); break; case kActionDefault: diff --git a/engines/lastexpress/entities/mertens.h b/engines/lastexpress/entities/mertens.h index 31b7a97dcd..55c2a76140 100644 --- a/engines/lastexpress/entities/mertens.h +++ b/engines/lastexpress/entities/mertens.h @@ -210,6 +210,9 @@ public: DECLARE_FUNCTION(function53) DECLARE_NULL_FUNCTION() + +private: + void loadSceneFromPosition(); }; } // End of namespace LastExpress |