aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulien2012-07-22 21:41:28 -0400
committerJulien2012-07-27 00:14:55 -0400
commit2e20e1d1e259dc6d9de8a90fa8417245f5a481b4 (patch)
tree0774c699bf7f5e7bc49b86cbc4fc32a081b7ffa9
parentc589e69ec9f29e59fc4358e5045fcc613f9ab6a8 (diff)
downloadscummvm-rg350-2e20e1d1e259dc6d9de8a90fa8417245f5a481b4.tar.gz
scummvm-rg350-2e20e1d1e259dc6d9de8a90fa8417245f5a481b4.tar.bz2
scummvm-rg350-2e20e1d1e259dc6d9de8a90fa8417245f5a481b4.zip
LASTEXPRESS: Replace TIME_CHECK_PLAYSOUND_UPDATEPOSITION macro
-rw-r--r--engines/lastexpress/entities/entity.cpp13
-rw-r--r--engines/lastexpress/entities/entity.h2
-rw-r--r--engines/lastexpress/entities/entity_intern.h9
-rw-r--r--engines/lastexpress/entities/hadija.cpp3
-rw-r--r--engines/lastexpress/entities/yasmin.cpp6
5 files changed, 21 insertions, 12 deletions
diff --git a/engines/lastexpress/entities/entity.cpp b/engines/lastexpress/entities/entity.cpp
index 9cb6825f79..43f039df43 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 fb5c958464..3370659c6e 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 cb4f7b941b..15a0a37c2f 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 8d757d54fd..4e72ce56f1 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 ebf90744f5..6fb1936303 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: