Skip to content

Commit

Permalink
LASTEXPRESS: Replace UPDATE_PARAM_GOTO macro
Browse files Browse the repository at this point in the history
  • Loading branch information
Templier committed Jul 27, 2012
1 parent 8de4cb6 commit 82ad017
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 24 deletions.
3 changes: 2 additions & 1 deletion engines/lastexpress/entities/anna.cpp
Expand Up @@ -3277,7 +3277,8 @@ IMPLEMENT_FUNCTION(67, Anna, chapter4Handler)

case kActionNone:
if (getEntities()->isPlayerPosition(kCarRedSleeping, 46)) {
UPDATE_PARAM_GOTO(params->param4, getState()->timeTicks, 30, label_next);
if (!Entity::updateParameter(params->param4, getState()->timeTicks, 30))
goto label_next;

getScenes()->loadSceneFromPosition(kCarRedSleeping, 8);
}
Expand Down
3 changes: 2 additions & 1 deletion engines/lastexpress/entities/august.cpp
Expand Up @@ -523,7 +523,8 @@ IMPLEMENT_FUNCTION_I(21, August, function21, TimeValue)
}

if (params->param2) {
UPDATE_PARAM_GOTO(params->param8, getState()->timeTicks, 75, label_continue);
if (!Entity::updateParameter(params->param8, getState()->timeTicks, 75))
goto label_continue;

params->param2 = 0;
params->param3 = 1;
Expand Down
13 changes: 0 additions & 13 deletions engines/lastexpress/entities/entity_intern.h
Expand Up @@ -358,19 +358,6 @@ void class::setup_##name() { \
} \
}

//////////////////////////////////////////////////////////////////////////
// Param update
//////////////////////////////////////////////////////////////////////////

// Todo: replace with UPDATE_PARAM_PROC as appropriate
#define UPDATE_PARAM_GOTO(parameter, type, value, label) { \
if (!parameter) \
parameter = (uint)(type + value); \
if (parameter >= type) \
goto label; \
parameter = kTimeInvalid; \
}

} // End of namespace LastExpress

#endif // LASTEXPRESS_ENTITY_INTERN_H
3 changes: 2 additions & 1 deletion engines/lastexpress/entities/tatiana.cpp
Expand Up @@ -1955,7 +1955,8 @@ IMPLEMENT_FUNCTION(48, Tatiana, function48)
if (!params->param1 || getSoundQueue()->isBuffered(kEntityTatiana))
goto label_end;

UPDATE_PARAM_GOTO(params->param2, getState()->timeTicks, 5 * (3 * rnd(5) + 30), label_end);
if (!Entity::updateParameter(params->param2, getState()->timeTicks, 5 * (3 * rnd(5) + 30)))
goto label_end;

getSound()->playSound(kEntityTatiana, "LIB012", kFlagDefault);
params->param2 = 0;
Expand Down
16 changes: 9 additions & 7 deletions engines/lastexpress/entities/train.cpp
Expand Up @@ -267,18 +267,20 @@ IMPLEMENT_FUNCTION(8, Train, process)
if ((getEntities()->isPlayerInCar(kCarGreenSleeping) || getEntities()->isPlayerInCar(kCarRedSleeping))
&& params->param4 && !params->param5) {

params->param4 -= 1;
params->param4 -= 1;

if (!params->param4 && getProgress().jacket == kJacketGreen) {
if (!params->param4 && getProgress().jacket == kJacketGreen) {

getAction()->playAnimation(isNight() ? kEventCathSmokeNight : kEventCathSmokeDay);
params->param5 = 1;
getScenes()->processScene();
}
getAction()->playAnimation(isNight() ? kEventCathSmokeNight : kEventCathSmokeDay);
params->param5 = 1;
getScenes()->processScene();
}
}

if (params->param6) {
UPDATE_PARAM_GOTO(params1->param7, getState()->time, 900, label_process);
if (!Entity::updateParameter(params1->param7, getState()->time, 900))
goto label_process;

getScenes()->loadSceneFromPosition(kCarRestaurant, 58);
}

Expand Down
3 changes: 2 additions & 1 deletion engines/lastexpress/entities/vassili.cpp
Expand Up @@ -144,7 +144,8 @@ IMPLEMENT_FUNCTION(6, Vassili, function6)

case kActionNone:
if (getEntities()->isInsideCompartment(kEntityPlayer, kCarRedSleeping, kPosition_8200)) {
UPDATE_PARAM_GOTO(params->param3, getState()->timeTicks, params->param1, label_function7);
if (!Entity::updateParameter(params->param3, getState()->timeTicks, params->param1))
goto label_function7;

setCallback(1);
setup_draw("303B");
Expand Down

0 comments on commit 82ad017

Please sign in to comment.