diff options
author | Willem Jan Palenstijn | 2011-11-15 16:05:25 +0100 |
---|---|---|
committer | Willem Jan Palenstijn | 2011-11-15 16:07:34 +0100 |
commit | 36982fb8a439990d5a28762185fe178a1c788a50 (patch) | |
tree | a545133fc8d8dfc3a2dbac6ac6882c70802297bc | |
parent | 9c9b7e5a2c3016b5609cdfb4137108060eb95673 (diff) | |
download | scummvm-rg350-36982fb8a439990d5a28762185fe178a1c788a50.tar.gz scummvm-rg350-36982fb8a439990d5a28762185fe178a1c788a50.tar.bz2 scummvm-rg350-36982fb8a439990d5a28762185fe178a1c788a50.zip |
DREAMWEB: Clean up loops
-rw-r--r-- | engines/dreamweb/sprite.cpp | 27 |
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; } |