diff options
author | Gregory Montoir | 2004-09-04 08:32:04 +0000 |
---|---|---|
committer | Gregory Montoir | 2004-09-04 08:32:04 +0000 |
commit | e6b2535ff97c511d4e31a52744239742bbee52e6 (patch) | |
tree | 7f5651ece389d468c5a8c742b0e4dba73f10cb13 /scumm | |
parent | 255736dfb70099b7cacea3f071453b5d48307f5f (diff) | |
download | scummvm-rg350-e6b2535ff97c511d4e31a52744239742bbee52e6.tar.gz scummvm-rg350-e6b2535ff97c511d4e31a52744239742bbee52e6.tar.bz2 scummvm-rg350-e6b2535ff97c511d4e31a52744239742bbee52e6.zip |
cleanup
svn-id: r14884
Diffstat (limited to 'scumm')
-rw-r--r-- | scumm/insane/insane_iact.cpp | 207 |
1 files changed, 76 insertions, 131 deletions
diff --git a/scumm/insane/insane_iact.cpp b/scumm/insane/insane_iact.cpp index 95437a644d..9e1da22bb3 100644 --- a/scumm/insane/insane_iact.cpp +++ b/scumm/insane/insane_iact.cpp @@ -184,6 +184,7 @@ void Insane::iactScene1(byte *renderBitmap, int32 codecparam, int32 setupsan12, } void Insane::proc62(void) { + debug(1, "Insane::proc62"); if (readArray(58) != 0) _enemy[EN_TORQUE].field_10 = 1; @@ -196,142 +197,83 @@ void Insane::proc62(void) { proc63(); - // FIXME: someone, please, untaint this mess - - int32 en, edi, ebp, edx, esi, eax, ebx, ecx; - - edx = eax = 0; - - for (eax = 0; eax < 9; eax++) - if (_enemy[eax].field_10 == 0) - edx++; - - edx -= 4; - - en = edx; - - ebp = 0; - edi = 0; - - _loop1: - edi++; - if (edi >= 14) - goto loc5; - - edx = _vm->_rnd.getRandomNumber(10); - - esi = edx; - - if (edx == 9) - esi = 6; - else if (edx > 9) - esi = 7; - - eax = esi; - ebx = 1; - - if (_enemy[eax].field_10 != ebp) - goto _loop1; - - if (ebp < _val215d) { - edx = _val215d; - eax = ebp; - if (ebx) - goto loc1; - } - - goto loc4; - - loc1: - if (esi == _val216d[eax + 1]) - ebx = ebp; - - eax++; - - if (eax < edx) { - if (ebx) - goto loc1; - } - - loc4: - if (ebx == 0) - goto loc15; - - edx = _val215d; - edx++; - _val216d[edx] = esi; - _val215d = edx; - if (edx < en) - goto loc15; - goto loc14; - - loc5: - ecx = ebp; - - loc6: - ebx = 1; - esi = ecx; - if (ebp < _val215d) - goto loc9; - goto loc11; - - loc7: - if (esi == _val216d[eax + 1]) - ebx = ebp; - - eax++; - - if (eax < edx) - goto loc10; - - goto loc11; - - loc9: - edx = _val215d; - eax = ebp; - - loc10: - if (ebx != 0) - goto loc7; - - loc11: - ecx++; - if (ecx >= 9) - goto loc12; - - if (ebx == 0) - goto loc6; - - loc12: - if (ebx == 0) { - _val215d = ebp; - edi = ebp; - goto _loop1; - } - - edx = _val215d; - edx++; - _val216d[edx] = esi; - _val215d = edx; + int32 count, i, j, en, en2; + bool notfound; + + en = 0; + for (i = 0; i < 9; i++) + if (_enemy[i].field_10 == 0) + ++en; + + en -= 4; + assert(en >= 0); + + count = 0; + while (1) { + count++; + if (count < 14) { + en2 = _vm->_rnd.getRandomNumber(10); + if (en2 == 9) + en2 = 6; + else if (en2 > 9) + en2 = 7; + + notfound = true; + + if (_enemy[en2].field_10 != 0) + continue; + + if (0 < _val215d) { + i = 0; + do { + if (en2 == _val216d[i + 1]) + notfound = false; + i++; + } while (i < _val215d && notfound); + } + if (!notfound) { + continue; + } + } else { + j = 0; + do { + notfound = true; + en2 = j; + if (0 < _val215d) { + i = 0; + do { + if (en2 == _val216d[i + 1]) + notfound = false; + i++; + } while (i < _val215d && notfound); + } + j++; + } while (j < 9 && !notfound); + if (!notfound) { + _val215d = 0; + count = 0; + continue; + } + } - if (edx < en) - goto loc15; + ++_val215d; + assert(_val215d < ARRAYSIZE(_val216d)); + _val216d[_val215d] = en2; - loc14: - proc64(ebp); + if (_val215d >= en) { + proc64(0); + } - loc15: - if (ebx == 0) - goto _loop1; + if (notfound) + break; + } - _currEnemy = esi; + _currEnemy = en2; } void Insane::proc63(void) { - int i; - if (_val215d > 0) { - for (i = 0; i < _val215d; i++) + for (int i = 0; i < _val215d; i++) if (_enemy[i].field_10 == 1) proc64(i); } @@ -341,10 +283,13 @@ void Insane::proc64(int32 enemy1) { if (enemy1 >= _val215d) return; - _val215d--; - - for (int en = enemy1; en < _val215d; en++) + int en = enemy1; + do { + ++en; + assert(en + 1 < ARRAYSIZE(_val216d)); _val216d[en] = _val216d[en + 1]; + } while (en < _val215d); + _val215d--; } void Insane::iactScene3(byte *renderBitmap, int32 codecparam, int32 setupsan12, |