aboutsummaryrefslogtreecommitdiff
path: root/engines/gob/cmpfile.cpp
diff options
context:
space:
mode:
authorSven Hesse2012-06-28 22:54:05 +0200
committerSven Hesse2012-07-30 01:44:42 +0200
commit4fc3a88c5f0b053323aeaeac658dafb8e4606662 (patch)
tree0889eb2314c738f713ea2075d06a162bfed70797 /engines/gob/cmpfile.cpp
parent83896dea3edc3bcfb1e414b61644c7ca266e1cce (diff)
downloadscummvm-rg350-4fc3a88c5f0b053323aeaeac658dafb8e4606662.tar.gz
scummvm-rg350-4fc3a88c5f0b053323aeaeac658dafb8e4606662.tar.bz2
scummvm-rg350-4fc3a88c5f0b053323aeaeac658dafb8e4606662.zip
GOB: Add support for different methods of handling Endianness
The Once Upon A Time games handle endianness different in ANI, DEC and RXY files than Geisha does. We need to support both approaches.
Diffstat (limited to 'engines/gob/cmpfile.cpp')
-rw-r--r--engines/gob/cmpfile.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/engines/gob/cmpfile.cpp b/engines/gob/cmpfile.cpp
index 7b21c4c835..1cd1375879 100644
--- a/engines/gob/cmpfile.cpp
+++ b/engines/gob/cmpfile.cpp
@@ -21,6 +21,7 @@
*/
#include "common/stream.h"
+#include "common/substream.h"
#include "common/str.h"
#include "gob/gob.h"
@@ -143,7 +144,13 @@ void CMPFile::loadCMP(Common::SeekableReadStream &cmp) {
}
void CMPFile::loadRXY(Common::SeekableReadStream &rxy) {
- _coordinates = new RXYFile(rxy);
+ bool bigEndian = (_vm->getEndiannessMethod() == kEndiannessMethodBE) ||
+ ((_vm->getEndiannessMethod() == kEndiannessMethodSystem) &&
+ (_vm->getEndianness() == kEndiannessBE));
+
+ Common::SeekableSubReadStreamEndian sub(&rxy, 0, rxy.size(), bigEndian, DisposeAfterUse::NO);
+
+ _coordinates = new RXYFile(sub);
for (uint i = 0; i < _coordinates->size(); i++) {
const RXYFile::Coordinates &c = (*_coordinates)[i];