diff options
| author | Julien | 2012-07-23 16:02:41 -0400 | 
|---|---|---|
| committer | Julien | 2012-07-27 00:15:01 -0400 | 
| commit | 7974b62b716343ff979447957b140f8e2b79f03c (patch) | |
| tree | 3f1212d3802e48c91739a2f579cba30dc2486217 | |
| parent | 552e8d45b265f29d16a02d7a5b01803d1143ef94 (diff) | |
| download | scummvm-rg350-7974b62b716343ff979447957b140f8e2b79f03c.tar.gz scummvm-rg350-7974b62b716343ff979447957b140f8e2b79f03c.tar.bz2 scummvm-rg350-7974b62b716343ff979447957b140f8e2b79f03c.zip  | |
LASTEXPRESS: Reduce nesting in Entities::processEntity()
| -rw-r--r-- | engines/lastexpress/game/entities.cpp | 52 | 
1 files changed, 25 insertions, 27 deletions
diff --git a/engines/lastexpress/game/entities.cpp b/engines/lastexpress/game/entities.cpp index 4cdefcd334..29cc7d889c 100644 --- a/engines/lastexpress/game/entities.cpp +++ b/engines/lastexpress/game/entities.cpp @@ -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) -				keepPreviousFrame = true; +	} 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; +		// 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); +		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) +			return; +	} else { +		++data->field_49B;  	}  	incrementDirectionCounter(data);  | 
