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 /engines/access/amazon/amazon_logic.cpp | |
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
Diffstat (limited to 'engines/access/amazon/amazon_logic.cpp')
-rw-r--r-- | engines/access/amazon/amazon_logic.cpp | 21 |
1 files changed, 11 insertions, 10 deletions
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; } |