diff options
author | Paul Gilbert | 2014-08-20 20:02:17 -0400 |
---|---|---|
committer | Paul Gilbert | 2014-08-20 20:02:17 -0400 |
commit | 5870b18e175b8beee29654978d711d94ad92ddf5 (patch) | |
tree | 53e05d29cc9b995b15acabe1b704cf90187b6e62 | |
parent | c7d4958984f199e4f3a6677056c9904d7f235fbe (diff) | |
download | scummvm-rg350-5870b18e175b8beee29654978d711d94ad92ddf5.tar.gz scummvm-rg350-5870b18e175b8beee29654978d711d94ad92ddf5.tar.bz2 scummvm-rg350-5870b18e175b8beee29654978d711d94ad92ddf5.zip |
ACCESS: Fix for collision detection
-rw-r--r-- | engines/access/player.cpp | 2 | ||||
-rw-r--r-- | engines/access/room.cpp | 7 |
2 files changed, 5 insertions, 4 deletions
diff --git a/engines/access/player.cpp b/engines/access/player.cpp index 420404bf48..063aa76c56 100644 --- a/engines/access/player.cpp +++ b/engines/access/player.cpp @@ -624,7 +624,7 @@ void Player::checkMove() { } } } else if (_xFlag == 1) { - int xd = _rawPlayer.x - _moveTo.x; + int xd = (_playerOffset.x / 2) + _rawPlayer.x - _moveTo.x; if ((xd >= 0 && xd <= -_leftDelta) || (xd < 0 && -xd <= -_leftDelta)) { ++_xFlag; diff --git a/engines/access/room.cpp b/engines/access/room.cpp index e40c6b7096..e7008c5ab7 100644 --- a/engines/access/room.cpp +++ b/engines/access/room.cpp @@ -593,7 +593,7 @@ int Room::calcLR(int yp) { int rem = (yv % yd) << 1; yv /= yd; - if (rem >= yd) + if (rem >= yd || rem < 0) ++yv; return yv + screen._orgX1; @@ -607,7 +607,7 @@ int Room::calcUD(int xp) { int rem = (xv % xd) << 1; xv /= xd; - if (rem >= xd) + if (rem >= xd || rem < 0) ++xv; return xv + screen._orgY1; @@ -638,7 +638,8 @@ bool Room::codeWalls() { if ((player._rawYTemp >= screen._orgY1) && (player._rawYTemp <= screen._orgY2)) { jf._wallCode |= (calcLR(player._rawYTemp) - player._rawXTemp) < 0 ? 2 : 1; - jf._wallCode1 |= (calcLR(player._rawYTemp) - player._playerOffset.x) < 0 ? 2 : 1; + jf._wallCode1 |= (calcLR(player._rawYTemp) - + (player._rawXTemp + player._playerOffset.x)) < 0 ? 2 : 1; } } |