diff options
author | Strangerke | 2014-11-25 07:28:35 +0100 |
---|---|---|
committer | Paul Gilbert | 2014-12-12 22:43:51 -0500 |
commit | 5674bed27bb43f0313e4d0a67ad94d4e41e8719c (patch) | |
tree | 858ecc0d4500c253ec1642da7f48d5e6a84100a6 /engines/access | |
parent | 9fa0fc845e2cc20f400790be57b607b4e656078e (diff) | |
download | scummvm-rg350-5674bed27bb43f0313e4d0a67ad94d4e41e8719c.tar.gz scummvm-rg350-5674bed27bb43f0313e4d0a67ad94d4e41e8719c.tar.bz2 scummvm-rg350-5674bed27bb43f0313e4d0a67ad94d4e41e8719c.zip |
ACCESS: Implement updateObstacles
Diffstat (limited to 'engines/access')
-rw-r--r-- | engines/access/amazon/amazon_scripts.cpp | 43 | ||||
-rw-r--r-- | engines/access/amazon/amazon_scripts.h | 2 |
2 files changed, 40 insertions, 5 deletions
diff --git a/engines/access/amazon/amazon_scripts.cpp b/engines/access/amazon/amazon_scripts.cpp index 2c16938ea8..b6d4987caa 100644 --- a/engines/access/amazon/amazon_scripts.cpp +++ b/engines/access/amazon/amazon_scripts.cpp @@ -1699,7 +1699,7 @@ void AmazonScripts::initRiver() { _game->_riverIndex = _game->_riverFlag; _game->_topList = RIVEROBJECTTBL[_game->_riverIndex]; - UPDATEOBSTACLES(); + updateObstacles(); riverSetPhysX(); _game->_canoeDir = 0; _game->_deathFlag = 0; @@ -1897,8 +1897,43 @@ void AmazonScripts::moveCanoe() { } } -void AmazonScripts::UPDATEOBSTACLES() { - warning("TODO: UPDATEOBSTACLES()"); +void AmazonScripts::updateObstacles() { + RiverStruct *cur = _game->_topList; + while (true) { + int val = cur[0]._field1 + cur[0]._field3 - 1; + if (val < _screenVertX) { + cur = _game->_topList; + cur--; + _game->_botList = cur; + return; + } + + if (cur[0]._field3 < _screenVertX + 319) { + _game->_topList = _game->_botList = cur; + break; + } + + if (cur > RIVEROBJECTTBL[_game->_riverIndex + 1]) { + cur = _game->_topList; + cur--; + _game->_botList = cur; + return; + } + } + + while (true) { + if (cur > RIVEROBJECTTBL[_game->_riverIndex + 1]) + return; + ++cur; + int val = cur[0]._field1 + cur[0]._field3 - 1; + if (val < _screenVertX) + return; + + if (cur[0]._field3 >= _screenVertX + 319) + return; + + _game->_botList = cur; + } } void AmazonScripts::riverSetPhysX() { @@ -1992,7 +2027,7 @@ void AmazonScripts::RIVER() { return; } - UPDATEOBSTACLES(); + updateObstacles(); riverSetPhysX(); RIVERCOLLIDE(); if (_game->_hitSafe != 0) diff --git a/engines/access/amazon/amazon_scripts.h b/engines/access/amazon/amazon_scripts.h index ef7ead60c9..0f71e89e48 100644 --- a/engines/access/amazon/amazon_scripts.h +++ b/engines/access/amazon/amazon_scripts.h @@ -101,7 +101,7 @@ protected: bool riverJumpTest(); void riverSound(); void moveCanoe(); - void UPDATEOBSTACLES(); + void updateObstacles(); void riverSetPhysX(); void RIVERCOLLIDE(); void plotRiver(); |