aboutsummaryrefslogtreecommitdiff
path: root/engines/gob/rxyfile.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/rxyfile.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/rxyfile.cpp')
-rw-r--r--engines/gob/rxyfile.cpp19
1 files changed, 13 insertions, 6 deletions
diff --git a/engines/gob/rxyfile.cpp b/engines/gob/rxyfile.cpp
index 9702dc8c7f..2ff8c121cd 100644
--- a/engines/gob/rxyfile.cpp
+++ b/engines/gob/rxyfile.cpp
@@ -21,12 +21,19 @@
*/
#include "common/stream.h"
+#include "common/substream.h"
#include "gob/rxyfile.h"
namespace Gob {
RXYFile::RXYFile(Common::SeekableReadStream &rxy) : _width(0), _height(0) {
+ Common::SeekableSubReadStreamEndian sub(&rxy, 0, rxy.size(), false, DisposeAfterUse::NO);
+
+ load(sub);
+}
+
+RXYFile::RXYFile(Common::SeekableSubReadStreamEndian &rxy) : _width(0), _height(0) {
load(rxy);
}
@@ -64,22 +71,22 @@ const RXYFile::Coordinates &RXYFile::operator[](uint i) const {
return _coords[i];
}
-void RXYFile::load(Common::SeekableReadStream &rxy) {
+void RXYFile::load(Common::SeekableSubReadStreamEndian &rxy) {
if (rxy.size() < 2)
return;
rxy.seek(0);
- _realCount = rxy.readUint16LE();
+ _realCount = rxy.readUint16();
uint16 count = (rxy.size() - 2) / 8;
_coords.resize(count);
for (CoordArray::iterator c = _coords.begin(); c != _coords.end(); ++c) {
- c->left = rxy.readUint16LE();
- c->right = rxy.readUint16LE();
- c->top = rxy.readUint16LE();
- c->bottom = rxy.readUint16LE();
+ c->left = rxy.readUint16();
+ c->right = rxy.readUint16();
+ c->top = rxy.readUint16();
+ c->bottom = rxy.readUint16();
if (c->left != 0xFFFF) {
_width = MAX<uint16>(_width , c->right + 1);