aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWillem Jan Palenstijn2011-11-15 16:05:25 +0100
committerWillem Jan Palenstijn2011-11-15 16:07:34 +0100
commit36982fb8a439990d5a28762185fe178a1c788a50 (patch)
treea545133fc8d8dfc3a2dbac6ac6882c70802297bc
parent9c9b7e5a2c3016b5609cdfb4137108060eb95673 (diff)
downloadscummvm-rg350-36982fb8a439990d5a28762185fe178a1c788a50.tar.gz
scummvm-rg350-36982fb8a439990d5a28762185fe178a1c788a50.tar.bz2
scummvm-rg350-36982fb8a439990d5a28762185fe178a1c788a50.zip
DREAMWEB: Clean up loops
-rw-r--r--engines/dreamweb/sprite.cpp27
1 files changed, 8 insertions, 19 deletions
diff --git a/engines/dreamweb/sprite.cpp b/engines/dreamweb/sprite.cpp
index 7ac3a8a7dc..6c8c8db86b 100644
--- a/engines/dreamweb/sprite.cpp
+++ b/engines/dreamweb/sprite.cpp
@@ -901,16 +901,12 @@ void DreamGenContext::splitintolines() {
Rain *DreamGenContext::splitintolines(uint8 x, uint8 y, Rain *rain) {
do {
// Look for line start
- do {
- if (getblockofpixel(x, y))
- break;
+ while (!getblockofpixel(x, y)) {
--x;
++y;
- if (x == 0)
- return rain;
- if (y >= data.byte(kMapysize))
+ if (x == 0 || y >= data.byte(kMapysize))
return rain;
- } while (true);
+ }
rain->x = x;
rain->y = y;
@@ -918,28 +914,21 @@ Rain *DreamGenContext::splitintolines(uint8 x, uint8 y, Rain *rain) {
uint8 length = 1;
// Look for line end
- do {
- if (! getblockofpixel(x, y))
- break;
+ while (getblockofpixel(x, y)) {
--x;
++y;
- if (x == 0)
- break;
- if (y >= data.byte(kMapysize))
+ if (x == 0 || y >= data.byte(kMapysize))
break;
++length;
- } while (true);
+ }
rain->size = length;
rain->w3_lo = engine->randomNumber();
rain->w3_hi = engine->randomNumber();
rain->b5 = (engine->randomNumber() & 3) + 4;
++rain;
- if (x == 0)
- return rain;
- if (y >= data.byte(kMapysize))
- return rain;
- } while (true);
+ } while (x > 0 && y < data.byte(kMapysize));
+
return rain;
}