diff options
author | Paul Gilbert | 2014-12-04 22:40:09 -0500 |
---|---|---|
committer | Paul Gilbert | 2014-12-12 23:00:57 -0500 |
commit | 1f42800e0cd2b4ab08bba78edbe69f657dc89367 (patch) | |
tree | 899aae6bdc67fe0d2b83ff31bbc23f20a2bd15ed | |
parent | 84ba0df9b2ce15d6c1d32a6c61794a1accb3fc99 (diff) | |
download | scummvm-rg350-1f42800e0cd2b4ab08bba78edbe69f657dc89367.tar.gz scummvm-rg350-1f42800e0cd2b4ab08bba78edbe69f657dc89367.tar.bz2 scummvm-rg350-1f42800e0cd2b4ab08bba78edbe69f657dc89367.zip |
ACCESS: Further cleanup of river obstacles checks
-rw-r--r-- | engines/access/amazon/amazon_game.cpp | 3 | ||||
-rw-r--r-- | engines/access/amazon/amazon_logic.cpp | 21 | ||||
-rw-r--r-- | engines/access/amazon/amazon_resources.h | 2 |
3 files changed, 15 insertions, 11 deletions
diff --git a/engines/access/amazon/amazon_game.cpp b/engines/access/amazon/amazon_game.cpp index deb45ff4b1..79fca87b3f 100644 --- a/engines/access/amazon/amazon_game.cpp +++ b/engines/access/amazon/amazon_game.cpp @@ -627,6 +627,9 @@ void AmazonEngine::dead(int deathId) { _screen->forceFadeIn(); _sound->playSound(0); _screen->forceFadeOut(); + + if (shouldQuit()) + return; } freeCells(); diff --git a/engines/access/amazon/amazon_logic.cpp b/engines/access/amazon/amazon_logic.cpp index 428b85f969..a7ee432183 100644 --- a/engines/access/amazon/amazon_logic.cpp +++ b/engines/access/amazon/amazon_logic.cpp @@ -1635,8 +1635,9 @@ void River::moveCanoe2() { void River::updateObstacles() { RiverStruct *cur; for (cur = _topList; cur < RIVER_OBJECTS[_riverIndex][RIVER_END]; ++cur) { - int val = cur->_field1 + cur->_riverX - 1; + int val = cur->_riverX + cur->_width - 1; if (val < _screenVertX) + // Obstacle is not yet on-scren break; if (cur->_riverX < (_screenVertX + 319)) { @@ -1645,7 +1646,7 @@ void River::updateObstacles() { while (cur < RIVER_OBJECTS[_riverIndex][RIVER_END]) { ++cur; - val = cur->_field1 + cur->_riverX - 1; + val = cur->_riverX + cur->_width - 1; if (val < _screenVertX || (cur->_riverX >= (_screenVertX + 319))) break; @@ -1676,19 +1677,19 @@ bool River::checkRiverCollide() { _canoeVXPos = _screenVertX + 170; - for (RiverStruct *si = _topList; si <= _botList; ++si) { - if (si->_lane < _canoeLane) + for (RiverStruct *cur = _topList; cur <= _botList; ++cur) { + if (cur->_lane < _canoeLane) continue; - if ((si->_lane == _canoeLane) || (si->_lane == _canoeLane + 1)) { - if (si->_field1 + si->_riverX - 1 >= _canoeVXPos) { - if (_canoeVXPos + 124 >= si->_riverX) { - _vm->_sound->playSound(4); - return true; - } + if ((cur->_lane == _canoeLane) || (cur->_lane == _canoeLane + 1)) { + if ((cur->_riverX + cur->_width - 1) >= _canoeVXPos && + cur->_riverX < (_canoeVXPos + 124)) { + _vm->_sound->playSound(4); + return true; } } } + return false; } diff --git a/engines/access/amazon/amazon_resources.h b/engines/access/amazon/amazon_resources.h index b6b0dbbdce..777c579073 100644 --- a/engines/access/amazon/amazon_resources.h +++ b/engines/access/amazon/amazon_resources.h @@ -31,7 +31,7 @@ namespace Amazon { struct RiverStruct { int _id; - int _field1; + int _width; int _riverX; int _xp; int _lane; |