diff options
author | Walter van Niftrik | 2011-03-04 21:51:55 +0100 |
---|---|---|
committer | Walter van Niftrik | 2011-03-04 21:55:39 +0100 |
commit | 23dcd3c7612205c822f81d7ebdc25b0076a18600 (patch) | |
tree | a00bc0a83bef7e438fb8c22e9350e7c48d89727e | |
parent | a913d360f27f300633a8da5997686343e95e56a3 (diff) | |
download | scummvm-rg350-23dcd3c7612205c822f81d7ebdc25b0076a18600.tar.gz scummvm-rg350-23dcd3c7612205c822f81d7ebdc25b0076a18600.tar.bz2 scummvm-rg350-23dcd3c7612205c822f81d7ebdc25b0076a18600.zip |
SCI: Remove SCI version check from READ/WRITE_SCI1ENDIAN_UINT16.
-rw-r--r-- | engines/sci/engine/kmisc.cpp | 8 | ||||
-rw-r--r-- | engines/sci/engine/kpathing.cpp | 8 | ||||
-rw-r--r-- | engines/sci/util.cpp | 8 | ||||
-rw-r--r-- | engines/sci/util.h | 9 |
4 files changed, 16 insertions, 17 deletions
diff --git a/engines/sci/engine/kmisc.cpp b/engines/sci/engine/kmisc.cpp index 5b0d93a249..73c92a9394 100644 --- a/engines/sci/engine/kmisc.cpp +++ b/engines/sci/engine/kmisc.cpp @@ -298,9 +298,9 @@ reg_t kMemory(EngineState *s, int argc, reg_t *argv) { error("Attempt to peek invalid memory at %04x:%04x", PRINT_REG(argv[1])); return s->r_acc; } - if (ref.isRaw) { - return make_reg(0, (int16)READ_SCI1ENDIAN_UINT16(ref.raw)); - } else { + if (ref.isRaw) + return make_reg(0, (int16)READ_SCIENDIAN_UINT16(ref.raw)); + else { if (ref.skipByte) error("Attempt to peek memory at odd offset %04X:%04X", PRINT_REG(argv[1])); return *(ref.reg); @@ -320,7 +320,7 @@ reg_t kMemory(EngineState *s, int argc, reg_t *argv) { error("Attempt to poke memory reference %04x:%04x to %04x:%04x", PRINT_REG(argv[2]), PRINT_REG(argv[1])); return s->r_acc; } - WRITE_SCI1ENDIAN_UINT16(ref.raw, argv[2].offset); // Amiga versions are BE + WRITE_SCIENDIAN_UINT16(ref.raw, argv[2].offset); // Amiga versions are BE } else { if (ref.skipByte) error("Attempt to poke memory at odd offset %04X:%04X", PRINT_REG(argv[1])); diff --git a/engines/sci/engine/kpathing.cpp b/engines/sci/engine/kpathing.cpp index c98d93c2d9..7786f9b093 100644 --- a/engines/sci/engine/kpathing.cpp +++ b/engines/sci/engine/kpathing.cpp @@ -265,8 +265,8 @@ static Common::Point readPoint(SegmentRef list_r, int offset) { Common::Point point; 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); + point.x = (int16)READ_SCIENDIAN_UINT16(list_r.raw + offset * POLY_POINT_SIZE); + point.y = (int16)READ_SCIENDIAN_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(); @@ -276,8 +276,8 @@ static Common::Point readPoint(SegmentRef list_r, int offset) { static void writePoint(SegmentRef ref, int offset, const Common::Point &point) { 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); + WRITE_SCIENDIAN_UINT16(ref.raw + offset * POLY_POINT_SIZE, point.x); + WRITE_SCIENDIAN_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); diff --git a/engines/sci/util.cpp b/engines/sci/util.cpp index 408fd9d818..f346adddeb 100644 --- a/engines/sci/util.cpp +++ b/engines/sci/util.cpp @@ -30,15 +30,15 @@ namespace Sci { -uint16 READ_SCI1ENDIAN_UINT16(const void *ptr) { - if (g_sci->isBE() && getSciVersion() >= SCI_VERSION_1_EGA_ONLY && getSciVersion() <= SCI_VERSION_1_LATE) +uint16 READ_SCIENDIAN_UINT16(const void *ptr) { + if (g_sci->isBE()) return READ_BE_UINT16(ptr); else return READ_LE_UINT16(ptr); } -void WRITE_SCI1ENDIAN_UINT16(void *ptr, uint16 val) { - if (g_sci->isBE() && getSciVersion() >= SCI_VERSION_1_EGA_ONLY && getSciVersion() <= SCI_VERSION_1_LATE) +void WRITE_SCIENDIAN_UINT16(void *ptr, uint16 val) { + if (g_sci->isBE()) WRITE_BE_UINT16(ptr, val); else WRITE_LE_UINT16(ptr, val); diff --git a/engines/sci/util.h b/engines/sci/util.h index d1f1c2ffa9..7a2abb1873 100644 --- a/engines/sci/util.h +++ b/engines/sci/util.h @@ -30,11 +30,10 @@ namespace Sci { -// Wrappers for reading/writing integer values for SCI1 Amiga. -// Amiga versions store big endian data in dynmem blocks, as -// the game resources are in LE, but the actual system is BE. -uint16 READ_SCI1ENDIAN_UINT16(const void *ptr); -void WRITE_SCI1ENDIAN_UINT16(void *ptr, uint16 val); +// Wrappers for reading/writing 16-bit values in the endianness +// of the original game platform. +uint16 READ_SCIENDIAN_UINT16(const void *ptr); +void WRITE_SCIENDIAN_UINT16(void *ptr, uint16 val); // Wrappers for reading integer values for SCI1.1+. // Mac versions have big endian data for some fields. |