Skip to content

Commit

Permalink
PRINCE: makePath() fix
Browse files Browse the repository at this point in the history
  • Loading branch information
lukaslw committed Jul 25, 2014
1 parent 2a1b354 commit e6a6753
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions engines/prince/prince.cpp
Expand Up @@ -2275,7 +2275,7 @@ void PrinceEngine::moveRunHero(int heroId, int x, int y, int dir, bool runHeroFl
if (dir) {
hero->_destDirection = dir;
}
if (x && y) {
if (x || y) {
hero->freeOldMove();
hero->_coords = makePath(x, y);
if (hero->_coords != nullptr) {
Expand Down Expand Up @@ -2912,7 +2912,7 @@ void PrinceEngine::dialogLeftMouseButton(byte *string, int dialogSelected) {
}

void PrinceEngine::talkHero(int slot) {
// heroSlot = textSlot
// heroSlot = textSlot (slot 0 or 1)
Text &text = _textSlots[slot];
int lines = calcText((const char *)_interpreter->getString());
int time = lines * 30;
Expand All @@ -2930,7 +2930,7 @@ void PrinceEngine::talkHero(int slot) {
text._x = _secondHero->_middleX;
text._y = _secondHero->_middleY - _secondHero->_scaledFrameYSize;
}
text._time = time; // changed by SETSPECVOICE?
text._time = time;
text._str = (const char *)_interpreter->getString();
_interpreter->increaseString();
}
Expand Down Expand Up @@ -3040,6 +3040,7 @@ int PrinceEngine::getPixelAddr(byte *pathBitmap, int x, int y) {
return (mask & value);
}

// TODO - check when both (start point and dest) are wrong
void PrinceEngine::findPoint(int x1, int y1, int x2, int y2) {
_fpResult.x1 = x1;
_fpResult.y1 = y1;
Expand Down Expand Up @@ -4312,7 +4313,7 @@ byte *PrinceEngine::makePath(int destX, int destY) {
int x2 = destX / 2;
int y2 = destY / 2;

if ((x1 != x2) && (y1 != y2)) {
if ((x1 != x2) || (y1 != y2)) {
findPoint(x1, y1, x2, y2);
if (x1 != _fpResult.x1 || y1 != _fpResult.y1) {
x1 = _fpResult.x1;
Expand Down

0 comments on commit e6a6753

Please sign in to comment.