LASTEXPRESS: Reduce nesting in Entities::processEntity()

This commit is contained in:
Julien 2012-07-23 16:02:41 -04:00
parent 552e8d45b2
commit 7974b62b71

View File

@ -751,43 +751,41 @@ label_nosequence:
if (data->frame->getInfo()->field_30 > (data->field_49B + 1) || (data->direction == kDirectionLeft && data->sequence->count() == 1)) {
++data->field_49B;
} else {
if (data->frame->getInfo()->field_30 > data->field_49B && !data->frame->getInfo()->keepPreviousFrame) {
++data->field_49B;
} else {
if (data->frame->getInfo()->keepPreviousFrame == 1)
} else if (data->frame->getInfo()->field_30 <= data->field_49B || data->frame->getInfo()->keepPreviousFrame) {
if (data->frame->getInfo()->keepPreviousFrame == 1)
keepPreviousFrame = true;
// Increment current frame
++data->currentFrame;
if (data->currentFrame > (int16)(data->sequence->count() - 1) || (data->field_4A9 && checkSequenceFromPosition(entityIndex))) {
if (data->direction == kDirectionLeft) {
data->currentFrame = 0;
} else {
keepPreviousFrame = true;
drawNextSequence(entityIndex);
// Increment current frame
++data->currentFrame;
if (getFlags()->flag_entities_0 || data->doProcessEntity)
return;
if (data->currentFrame > (int16)(data->sequence->count() - 1) || (data->field_4A9 && checkSequenceFromPosition(entityIndex))) {
if (data->direction == kDirectionLeft) {
data->currentFrame = 0;
} else {
keepPreviousFrame = true;
drawNextSequence(entityIndex);
if (getFlags()->flag_entities_0 || data->doProcessEntity)
return;
if (!data->sequence2) {
updateEntityPosition(entityIndex);
data->doProcessEntity = false;
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)
return;
} else {
++data->field_49B;
}
incrementDirectionCounter(data);