Mike, could you please investigate this bug?
It starts in the CMonster::FindOptimalPath2, call to CMonster::OpenMove() which requests a position 2 tiles away from the player. This is already problematic, because that in turn calls CCharacter:
oesSquareContainObstacle() which only takes two arguments, X and Y of the tile to check. If you scroll to the bottom of the method you'll see this code:
const int nFirstO = nGetO((int)wCol - (int)this->wX, (int)wRow - (int)this->wY);
if (room.CanMovePlatform(this->wX, this->wY, nFirstO))
break;
This code breaks because if the distance to the target tile is greater than one nGetO() will often return gibberish (like orientation=9 which does not correspond to any orientation).
I don't have the deep knowledge of how both CMonster::FindOptimalPath2() and CDbRoom::CanMovePlatform() work so for me it would be a lot of experimentation and analysis and I don't really have time for such a commitment now
.
I think it would be cool if we could fix this for 5.1, but if worse comes to worst we could probably dirty patch it by not calling CDbRoom::CanMovePlatform() if distance between Character position and the target tile is greater than 1. That's probably going to break behavior but will prevent crashes (I tested this by changing the if to:
if (nDist(wCol, wRow, this->wX, this->wY) == 1 && room.CanMovePlatform(this->wX, this->wY, nFirstO))
____________________________
My website |
Facebook |
Twitter