diff options
author | Strangerke | 2014-11-25 07:48:13 +0100 |
---|---|---|
committer | Paul Gilbert | 2014-12-12 22:44:04 -0500 |
commit | 6e2d63e4cd8240cc1b0dae2096cbef7bde993afe (patch) | |
tree | 1aa0da5897a4b0fb61bb10f4cad0758adb2dbb8e /engines | |
parent | 5674bed27bb43f0313e4d0a67ad94d4e41e8719c (diff) | |
download | scummvm-rg350-6e2d63e4cd8240cc1b0dae2096cbef7bde993afe.tar.gz scummvm-rg350-6e2d63e4cd8240cc1b0dae2096cbef7bde993afe.tar.bz2 scummvm-rg350-6e2d63e4cd8240cc1b0dae2096cbef7bde993afe.zip |
ACCESS: Implement checkRiverCollide()
Diffstat (limited to 'engines')
-rw-r--r-- | engines/access/amazon/amazon_scripts.cpp | 26 | ||||
-rw-r--r-- | engines/access/amazon/amazon_scripts.h | 2 |
2 files changed, 23 insertions, 5 deletions
diff --git a/engines/access/amazon/amazon_scripts.cpp b/engines/access/amazon/amazon_scripts.cpp index b6d4987caa..e83bc9f190 100644 --- a/engines/access/amazon/amazon_scripts.cpp +++ b/engines/access/amazon/amazon_scripts.cpp @@ -1945,8 +1945,26 @@ void AmazonScripts::riverSetPhysX() { } } -void AmazonScripts::RIVERCOLLIDE() { - warning("TODO: RIVERCOLLIDE()"); +bool AmazonScripts::checkRiverCollide() { + if (_game->_hitSafe) + return false; + + _game->_canoeVXPos = _screenVertX + 170; + + for (RiverStruct *si = _game->_topList; si <= _game->_botList; ++si) { + if (si[0]._lane < _game->_canoeLane) + continue; + + if ((si[0]._lane == _game->_canoeLane) || (si[0]._lane == _game->_canoeLane + 1)) { + if (si[0]._field1 + si[0]._field3 - 1 >= _game->_canoeVXPos) { + if (_game->_canoeVXPos + 124 >= si[0]._field3) { + _vm->_sound->playSound(4); + return true; + } + } + } + } + return false; } void AmazonScripts::plotRiver() { @@ -2029,11 +2047,11 @@ void AmazonScripts::RIVER() { updateObstacles(); riverSetPhysX(); - RIVERCOLLIDE(); + bool checkCollide = checkRiverCollide(); if (_game->_hitSafe != 0) _game->_hitSafe -= 2; - if (_game->_hitSafe < 0) { + if (checkCollide) { cmdDead(RIVERDEATH[0]); return; } diff --git a/engines/access/amazon/amazon_scripts.h b/engines/access/amazon/amazon_scripts.h index 0f71e89e48..1da10d8bdd 100644 --- a/engines/access/amazon/amazon_scripts.h +++ b/engines/access/amazon/amazon_scripts.h @@ -103,7 +103,7 @@ protected: void moveCanoe(); void updateObstacles(); void riverSetPhysX(); - void RIVERCOLLIDE(); + bool checkRiverCollide(); void plotRiver(); void scrollRiver1(); void setRiverPan(); |