From 51437ba5e6e418d7e79cf341606bc6c1c50fd50b Mon Sep 17 00:00:00 2001 From: md5 Date: Thu, 3 Mar 2011 19:34:11 +0200 Subject: 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 --- engines/sci/engine/kpathing.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'engines/sci/engine') 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); -- cgit v1.2.3