From ce4c98d75715192823655f8e255b894c5bb92364 Mon Sep 17 00:00:00 2001 From: Littleboy Date: Thu, 8 Sep 2011 15:47:34 -0400 Subject: LASTEXPRESS: Small cleanup in Entities::processEntity() and Entities::processFrame() --- engines/lastexpress/game/entities.cpp | 65 +++++++++++++++++------------------ 1 file changed, 31 insertions(+), 34 deletions(-) (limited to 'engines') diff --git a/engines/lastexpress/game/entities.cpp b/engines/lastexpress/game/entities.cpp index f6bb2030f0..1b31339b7b 100644 --- a/engines/lastexpress/game/entities.cpp +++ b/engines/lastexpress/game/entities.cpp @@ -753,50 +753,48 @@ label_nosequence: if (!data->sequence) goto label_nosequence; - if (data->frame->getInfo()->field_30 > data->field_49B + 1 || (data->direction == kDirectionLeft && data->sequence->count() == 1)) { + if (data->frame->getInfo()->field_30 > (data->field_49B + 1) || (data->direction == kDirectionLeft && data->sequence->count() == 1)) { ++data->field_49B; - INCREMENT_DIRECTION_COUNTER(); - return; - } + } else { + if (data->frame->getInfo()->field_30 > data->field_49B && !data->frame->getInfo()->keepPreviousFrame) { + ++data->field_49B; + } else { + if (data->frame->getInfo()->keepPreviousFrame == 1) + keepPreviousFrame = true; - if (data->frame->getInfo()->field_30 > data->field_49B && !data->frame->getInfo()->keepPreviousFrame) { - ++data->field_49B; - INCREMENT_DIRECTION_COUNTER(); - return; - } + // Increment current frame + ++data->currentFrame; - if (data->frame->getInfo()->keepPreviousFrame == 1) - keepPreviousFrame = true; + if (data->currentFrame > (int16)(data->sequence->count() - 1) || (data->field_4A9 && checkSequenceFromPosition(entityIndex))) { - // Increment current frame - ++data->currentFrame; + if (data->direction == kDirectionLeft) { + data->currentFrame = 0; + } else { + keepPreviousFrame = true; + drawNextSequence(entityIndex); - if (data->currentFrame > (int16)(data->sequence->count() - 1) || (data->field_4A9 && checkSequenceFromPosition(entityIndex))) { + if (getFlags()->flag_entities_0 || data->doProcessEntity) + return; - if (data->direction == kDirectionLeft) { - data->currentFrame = 0; - } else { - keepPreviousFrame = true; - drawNextSequence(entityIndex); + if (!data->sequence2) { + updateEntityPosition(entityIndex); + data->doProcessEntity = false; + return; + } - if (getFlags()->flag_entities_0 || data->doProcessEntity) - return; + copySequenceData(entityIndex); + } - if (!data->sequence2) { - updateEntityPosition(entityIndex); - data->doProcessEntity = false; - return; } - copySequenceData(entityIndex); - } + processFrame(entityIndex, keepPreviousFrame, false); + if (getFlags()->flag_entities_0 || data->doProcessEntity) + return; + } } - processFrame(entityIndex, keepPreviousFrame, false); - - if (!getFlags()->flag_entities_0 && !data->doProcessEntity) - INCREMENT_DIRECTION_COUNTER(); + INCREMENT_DIRECTION_COUNTER(); } void Entities::computeCurrentFrame(EntityIndex entityIndex) const { @@ -1109,9 +1107,8 @@ void Entities::processFrame(EntityIndex entityIndex, bool keepPreviousFrame, boo // Get new frame info FrameInfo *info = data->sequence->getFrameInfo((uint16)data->currentFrame); - if (data->frame && data->frame->getInfo()->subType != kFrameType3) - if (!info->field_2E || keepPreviousFrame) - getScenes()->setCoordinates(data->frame); + if (data->frame && data->frame->getInfo()->subType != kFrameType3 && (!info->field_2E || keepPreviousFrame)) + getScenes()->setCoordinates(data->frame); // Update position if (info->entityPosition) { -- cgit v1.2.3