aboutsummaryrefslogtreecommitdiff
path: root/engines/toltecs/segmap.cpp
diff options
context:
space:
mode:
authorJoost Peters2011-11-24 23:28:12 +0100
committerJoost Peters2011-11-24 23:28:12 +0100
commit8b9b7773978a7b21ac6acda8cf053b87ecc00705 (patch)
tree82fb17c23b8921e3ef68259f11c82e55a1286291 /engines/toltecs/segmap.cpp
parent56690162250f577f448c4edc2cc455c99234513a (diff)
downloadscummvm-rg350-8b9b7773978a7b21ac6acda8cf053b87ecc00705.tar.gz
scummvm-rg350-8b9b7773978a7b21ac6acda8cf053b87ecc00705.tar.bz2
scummvm-rg350-8b9b7773978a7b21ac6acda8cf053b87ecc00705.zip
TOLTECS: findPath() endian fixes.
Diffstat (limited to 'engines/toltecs/segmap.cpp')
-rw-r--r--engines/toltecs/segmap.cpp26
1 files changed, 13 insertions, 13 deletions
diff --git a/engines/toltecs/segmap.cpp b/engines/toltecs/segmap.cpp
index 75b0c633cd..10e5f56096 100644
--- a/engines/toltecs/segmap.cpp
+++ b/engines/toltecs/segmap.cpp
@@ -275,8 +275,6 @@ void plotProc(int x, int y, int color, void *data) {
void SegmentMap::findPath(int16 *pointsArray, int16 destX, int16 destY, int16 sourceX, int16 sourceY) {
- // TODO: Writes to pointsArray aren't endian-safe yet
-
int16 currentRectIndex, destRectIndex;
int16 pointsCount;
@@ -309,30 +307,32 @@ void SegmentMap::findPath(int16 *pointsArray, int16 destX, int16 destY, int16 so
currentRectIndex = _closedPathRects[--_closedPathRectsCount];
}
for (int16 i = 0; i < _pathNodesCount; i++) {
- pointsArray[pointsCount++] = _pathNodes[i].y;
- pointsArray[pointsCount++] = _pathNodes[i].x;
+ pointsArray[pointsCount++] = TO_LE_16(_pathNodes[i].y);
+ pointsArray[pointsCount++] = TO_LE_16(_pathNodes[i].x);
}
}
- pointsArray[pointsCount++] = destY;
- pointsArray[pointsCount++] = destX;
+ pointsArray[pointsCount++] = TO_LE_16(destY);
+ pointsArray[pointsCount++] = TO_LE_16(destX);
pointsArray[0] = 0;
- pointsArray[1] = _pathNodesCount + 1;
+ pointsArray[1] = TO_LE_16(_pathNodesCount + 1);
}
- debug(0, "SegmentMap::findPath() count = %d", pointsArray[1]);
+ debug(0, "SegmentMap::findPath() count = %d", FROM_LE_16(pointsArray[1]));
#if 0 // DEBUG: Draw the path we found
int sx = sourceX, sy = sourceY;
LineData ld;
ld.pitch = _vm->_sceneWidth;
ld.surf = _vm->_screen->_backScreen;
- for (int16 i = 0; i < pointsArray[1] * 2; i+=2) {
- debug(0, "x = %d; y = %d", pointsArray[3+i], pointsArray[2+i]);
- Graphics::drawLine(sx, sy, pointsArray[3+i], pointsArray[2+i], 0xFF, plotProc, &ld);
- sx = pointsArray[3+i];
- sy = pointsArray[2+i];
+ for (int16 i = 0; i < FROM_LE_16(pointsArray[1]) * 2; i+=2) {
+ const int x = FROM_LE_16(pointsArray[3+i]);
+ const int y = FROM_LE_16(pointsArray[2+1]);
+ debug(0, "x = %d; y = %d", x, y);
+ Graphics::drawLine(sx, sy, x, y, 0xFF, plotProc, &ld);
+ sx = x;
+ sy = y;
}
#endif