aboutsummaryrefslogtreecommitdiff
path: root/engines/sci/engine
diff options
context:
space:
mode:
authormd52011-03-03 19:34:11 +0200
committermd52011-03-03 19:34:11 +0200
commit51437ba5e6e418d7e79cf341606bc6c1c50fd50b (patch)
tree8375cf8727b5af39dc844f3d176afa575b0576b1 /engines/sci/engine
parent1aed9a1f3401477d4d56e278fec63cd90fafd81d (diff)
downloadscummvm-rg350-51437ba5e6e418d7e79cf341606bc6c1c50fd50b.tar.gz
scummvm-rg350-51437ba5e6e418d7e79cf341606bc6c1c50fd50b.tar.bz2
scummvm-rg350-51437ba5e6e418d7e79cf341606bc6c1c50fd50b.zip
SCI: Fixed path finding in Amiga SCI1 games
Added wrapper functions to read/write from dynmem segments, as these are treated as BE in Amiga versions (as we treat them like raw data instead of reg_t's), whereas the rest are LE. Thanks to waltervn and wjp for their help on this
Diffstat (limited to 'engines/sci/engine')
-rw-r--r--engines/sci/engine/kpathing.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/engines/sci/engine/kpathing.cpp b/engines/sci/engine/kpathing.cpp
index cb70cf91e0..c98d93c2d9 100644
--- a/engines/sci/engine/kpathing.cpp
+++ b/engines/sci/engine/kpathing.cpp
@@ -264,9 +264,9 @@ struct PathfindingState {
static Common::Point readPoint(SegmentRef list_r, int offset) {
Common::Point point;
- if (list_r.isRaw) {
- point.x = (int16)READ_LE_UINT16(list_r.raw + offset * POLY_POINT_SIZE);
- point.y = (int16)READ_LE_UINT16(list_r.raw + offset * POLY_POINT_SIZE + 2);
+ if (list_r.isRaw) { // dynmem blocks are raw
+ point.x = (int16)READ_SCI1ENDIAN_UINT16(list_r.raw + offset * POLY_POINT_SIZE);
+ point.y = (int16)READ_SCI1ENDIAN_UINT16(list_r.raw + offset * POLY_POINT_SIZE + 2);
} else {
point.x = list_r.reg[offset * 2].toUint16();
point.y = list_r.reg[offset * 2 + 1].toUint16();
@@ -275,9 +275,9 @@ static Common::Point readPoint(SegmentRef list_r, int offset) {
}
static void writePoint(SegmentRef ref, int offset, const Common::Point &point) {
- if (ref.isRaw) {
- WRITE_LE_UINT16(ref.raw + offset * POLY_POINT_SIZE, point.x);
- WRITE_LE_UINT16(ref.raw + offset * POLY_POINT_SIZE + 2, point.y);
+ if (ref.isRaw) { // dynmem blocks are raw
+ WRITE_SCI1ENDIAN_UINT16(ref.raw + offset * POLY_POINT_SIZE, point.x);
+ WRITE_SCI1ENDIAN_UINT16(ref.raw + offset * POLY_POINT_SIZE + 2, point.y);
} else {
ref.reg[offset * 2] = make_reg(0, point.x);
ref.reg[offset * 2 + 1] = make_reg(0, point.y);