diff options
author | uruk | 2014-02-19 19:10:25 +0100 |
---|---|---|
committer | uruk | 2014-02-19 19:10:25 +0100 |
commit | 2d5493b599b8ea5410a0ba481b6cd12c05debf52 (patch) | |
tree | e91f863ed63513c7c8e24df192da975e2a10a56d | |
parent | 5c841dab6dd03754e37b3c7a0849a865f850179b (diff) | |
download | scummvm-rg350-2d5493b599b8ea5410a0ba481b6cd12c05debf52.tar.gz scummvm-rg350-2d5493b599b8ea5410a0ba481b6cd12c05debf52.tar.bz2 scummvm-rg350-2d5493b599b8ea5410a0ba481b6cd12c05debf52.zip |
AVALANCHE: Implement ShootEmUp::bumpFolk() and ShootEmUp::turnAround().
-rw-r--r-- | engines/avalanche/shootemup.cpp | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/engines/avalanche/shootemup.cpp b/engines/avalanche/shootemup.cpp index fde6fc3ff5..5a490124a1 100644 --- a/engines/avalanche/shootemup.cpp +++ b/engines/avalanche/shootemup.cpp @@ -411,11 +411,31 @@ void ShootEmUp::collisionCheck() { } void ShootEmUp::turnAround(byte who, bool randomX) { - warning("STUB: ShootEmUp::turnAround()"); + if (randomX) { + int8 ix = (_vm->_rnd->getRandomNumber(4) + 1); + if (_running[who]._ix > 0) + _running[who]._ix = -(ix); + else + _running[who]._ix = ix; + } else + _running[who]._ix = -(_running[who]._ix); + + _running[who]._iy = -(_running[who]._iy); } void ShootEmUp::bumpFolk() { - warning("STUB: ShootEmUp::bumpFolk()"); + for (int i = 0; i < 4; i++) { + if (_running[i]._x != kFlag) { + for (int j = i + 1; j < 4; j++) { + bool overlaps = overlap(_running[i]._x, _running[i]._y, _running[i]._x + 17, _running[i]._y + 24, + _running[j]._x, _running[j]._y, _running[j]._x + 17, _running[j]._y + 24); + if ((_running[i]._x != kFlag) && overlaps) { + turnAround(i, false); // Opp. directions. + turnAround(j, false); + } + } + } + } } void ShootEmUp::peopleRunning() { |