aboutsummaryrefslogtreecommitdiff
path: root/engines/lastexpress/entities/entity.cpp
diff options
context:
space:
mode:
authorLittleboy2012-07-14 14:32:51 -0400
committerLittleboy2012-07-14 14:34:42 -0400
commit4cee0836c9d4dda646f1e76a3440ffb73499dbb5 (patch)
tree6f1853f3e1b554b8c6a9e85986c45483b3072361 /engines/lastexpress/entities/entity.cpp
parent13c00d40486201989463d337d5c09720f10a0aeb (diff)
downloadscummvm-rg350-4cee0836c9d4dda646f1e76a3440ffb73499dbb5.tar.gz
scummvm-rg350-4cee0836c9d4dda646f1e76a3440ffb73499dbb5.tar.bz2
scummvm-rg350-4cee0836c9d4dda646f1e76a3440ffb73499dbb5.zip
LASTEXPRESS: Replace CALLBACK_ACTION macro by member function
Diffstat (limited to 'engines/lastexpress/entities/entity.cpp')
-rw-r--r--engines/lastexpress/entities/entity.cpp39
1 files changed, 25 insertions, 14 deletions
diff --git a/engines/lastexpress/entities/entity.cpp b/engines/lastexpress/entities/entity.cpp
index dbce2246d0..7fdfd53d2f 100644
--- a/engines/lastexpress/entities/entity.cpp
+++ b/engines/lastexpress/entities/entity.cpp
@@ -242,12 +242,12 @@ void Entity::savegame(const SavePoint &savepoint) {
break;
case kActionNone:
- CALLBACK_ACTION();
+ callbackAction();
break;
case kActionDefault:
getSaveLoad()->saveGame((SavegameType)params->param1, _entityIndex, (EventIndex)params->param2);
- CALLBACK_ACTION();
+ callbackAction();
break;
}
}
@@ -260,7 +260,7 @@ void Entity::playSound(const SavePoint &savepoint, bool resetItem, SoundFlag fla
break;
case kActionEndSound:
- CALLBACK_ACTION();
+ callbackAction();
break;
case kActionDefault:
@@ -280,7 +280,7 @@ void Entity::draw(const SavePoint &savepoint, bool handleExcuseMe) {
break;
case kActionExitCompartment:
- CALLBACK_ACTION();
+ callbackAction();
break;
case kActionExcuseMeCath:
@@ -304,7 +304,7 @@ void Entity::draw2(const SavePoint &savepoint) {
break;
case kActionExitCompartment:
- CALLBACK_ACTION();
+ callbackAction();
break;
case kActionDefault:
@@ -323,7 +323,7 @@ void Entity::updateFromTicks(const SavePoint &savepoint) {
case kActionNone:
UPDATE_PARAM(params->param2, getState()->timeTicks, params->param1)
- CALLBACK_ACTION();
+ callbackAction();
break;
}
}
@@ -337,7 +337,7 @@ void Entity::updateFromTime(const SavePoint &savepoint) {
case kActionNone:
UPDATE_PARAM(params->param2, getState()->time, params->param1)
- CALLBACK_ACTION();
+ callbackAction();
break;
}
}
@@ -348,12 +348,12 @@ void Entity::callbackActionOnDirection(const SavePoint &savepoint) {
break;
case kActionExitCompartment:
- CALLBACK_ACTION();
+ callbackAction();
break;
case kActionDefault:
if (getData()->direction != kDirectionRight)
- CALLBACK_ACTION();
+ callbackAction();
break;
}
}
@@ -366,7 +366,7 @@ void Entity::callbackActionRestaurantOrSalon(const SavePoint &savepoint) {
case kActionNone:
case kActionDefault:
if (getEntities()->isSomebodyInsideRestaurantOrSalon())
- CALLBACK_ACTION();
+ callbackAction();
break;
}
}
@@ -391,7 +391,7 @@ void Entity::updateEntity(const SavePoint &savepoint, bool handleExcuseMe) {
case kActionNone:
case kActionDefault:
if (getEntities()->updateEntity(_entityIndex, (CarIndex)params->param1, (EntityPosition)params->param2))
- CALLBACK_ACTION();
+ callbackAction();
break;
}
}
@@ -406,7 +406,7 @@ void Entity::callSavepoint(const SavePoint &savepoint, bool handleExcuseMe) {
case kActionExitCompartment:
if (!CURRENT_PARAM(1, 1))
getSavePoints()->call(_entityIndex, (EntityIndex)params->param4, (ActionIndex)params->param5, (char *)&params->seq2);
- CALLBACK_ACTION();
+ callbackAction();
break;
case kActionExcuseMeCath:
@@ -444,7 +444,7 @@ void Entity::enterExitCompartment(const SavePoint &savepoint, EntityPosition pos
if (updateLocation)
getData()->location = kLocationInsideCompartment;
- CALLBACK_ACTION();
+ callbackAction();
break;
case kActionDefault:
@@ -473,7 +473,7 @@ void Entity::updatePosition(const SavePoint &savepoint, bool handleExcuseMe) {
case kActionExitCompartment:
getEntities()->updatePositionExit(_entityIndex, (CarIndex)params->param4, (Position)params->param5);
- CALLBACK_ACTION();
+ callbackAction();
break;
case kActionExcuseMeCath:
@@ -490,4 +490,15 @@ void Entity::updatePosition(const SavePoint &savepoint, bool handleExcuseMe) {
}
}
+void Entity::callbackAction() {
+ if (getData()->currentCall == 0)
+ error("[Entity::callbackAction] currentCall is already 0, cannot proceed");
+
+ getData()->currentCall--;
+
+ getSavePoints()->setCallback(_entityIndex, _callbacks[_data->getCurrentCallback()]);
+
+ getSavePoints()->call(_entityIndex, _entityIndex, kActionCallback);
+}
+
} // End of namespace LastExpress