Skip to content

Commit

Permalink
ACCESS: Some initial pathfinding bugfixes
Browse files Browse the repository at this point in the history
  • Loading branch information
dreammaster committed Aug 18, 2014
1 parent 17315a4 commit 080a030
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
6 changes: 4 additions & 2 deletions engines/access/player.cpp
Expand Up @@ -565,14 +565,16 @@ void Player::walkDownRight() {
void Player::checkMove() {
if (_playerMove) {
if (_xFlag == 0 && _yFlag == 0) {
// Figure out whether a greater horizontal movement than vertical
// movement will be required, or vice versa
int xp = (_playerOffset.x / 2) + _rawPlayer.x - _moveTo.x;
if (xp < 0)
xp = -xp;
int yp = _rawPlayer.y - _moveTo.y;
if (yp < 0)
yp = -yp;

if (xp < yp)
if (xp > yp)
_xFlag = 1;
else
_yFlag = 1;
Expand Down Expand Up @@ -600,7 +602,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
4 changes: 2 additions & 2 deletions engines/access/player.h
Expand Up @@ -86,9 +86,9 @@ class Player: public ImageEntry, Manager {
Common::Point _walkOffDR[PLAYER_DATA_COUNT];
Common::Point _walkOffUL[PLAYER_DATA_COUNT];
Common::Point _walkOffDL[PLAYER_DATA_COUNT];
int _rawTempL;
byte _rawTempL;
int _rawXTemp;
int _rawYTempL;
byte _rawYTempL;
int _rawYTemp;
Common::Point _playerOffset;
int _playerXLow;
Expand Down
4 changes: 1 addition & 3 deletions engines/access/room.cpp
Expand Up @@ -653,7 +653,7 @@ bool Room::codeWalls() {
if ((player._rawXTemp >= screen._orgX1) &&
(player._rawXTemp <= screen._orgX2)) {
int y = screen._orgY2;
if (y == screen._orgY1)
if (y != screen._orgY1)
y = calcUD(player._rawXTemp);

jf._wallCode |= (player._rawYTemp - y) < 0 ? 4 : 8;
Expand Down Expand Up @@ -691,8 +691,6 @@ bool Room::checkCode(int v1, int v2) {
Player &p = *_vm->_player;

if (!v1) {
p._collideFlag = true;
return true;
} if (!v2 || (v1 == v2)) {
} else if (v1 & 1) {
if (v2 & 2) {
Expand Down

0 comments on commit 080a030

Please sign in to comment.