mirror of
https://github.com/libretro/scummvm.git
synced 2025-01-03 07:59:38 +00:00
LASTEXPRESS: Merge the two savegameBloodJacket functions into the base Entity class
This commit is contained in:
parent
e517c1199a
commit
3d1b7b2d96
@ -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
|
||||
|
@ -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
|
||||
|
@ -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)
|
||||
|
||||
|
@ -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
|
||||
@ -693,6 +695,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
|
||||
*
|
||||
|
@ -72,4 +72,4 @@ private:
|
||||
|
||||
} // End of namespace LastExpress
|
||||
|
||||
#endif // LASTEXPRESS_##define##_H
|
||||
#endif // LASTEXPRESS_ENTITY39_H
|
||||
|
@ -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:
|
||||
|
@ -210,6 +210,9 @@ public:
|
||||
DECLARE_FUNCTION(function53)
|
||||
|
||||
DECLARE_NULL_FUNCTION()
|
||||
|
||||
private:
|
||||
void loadSceneFromPosition();
|
||||
};
|
||||
|
||||
} // End of namespace LastExpress
|
||||
|
Loading…
Reference in New Issue
Block a user