Skip to content

Commit

Permalink
ACCESS: Fix for collision detection
Browse files Browse the repository at this point in the history
  • Loading branch information
dreammaster committed Aug 21, 2014
1 parent c7d4958 commit 5870b18
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion engines/access/player.cpp
Expand Up @@ -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;

Expand Down
7 changes: 4 additions & 3 deletions engines/access/room.cpp
Expand Up @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -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;
}
}

Expand Down

0 comments on commit 5870b18

Please sign in to comment.