aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Kiewitz2015-06-11 21:30:32 +0200
committerMartin Kiewitz2015-06-11 21:30:32 +0200
commit7ff3336a65ec19283ef44919d21e7c4542d7cc3f (patch)
tree806f03e55542aa00f918a481260c8b05905848a9
parent515d5422a7574971140d7b93e2db5275b5afec2f (diff)
downloadscummvm-rg350-7ff3336a65ec19283ef44919d21e7c4542d7cc3f.tar.gz
scummvm-rg350-7ff3336a65ec19283ef44919d21e7c4542d7cc3f.tar.bz2
scummvm-rg350-7ff3336a65ec19283ef44919d21e7c4542d7cc3f.zip
SHERLOCK: 3DO: load walk.anim for player
-rw-r--r--engines/sherlock/animation.cpp2
-rw-r--r--engines/sherlock/image_file.cpp40
-rw-r--r--engines/sherlock/image_file.h9
-rw-r--r--engines/sherlock/people.cpp7
4 files changed, 30 insertions, 28 deletions
diff --git a/engines/sherlock/animation.cpp b/engines/sherlock/animation.cpp
index 45cb6664cb..73f3a9220f 100644
--- a/engines/sherlock/animation.cpp
+++ b/engines/sherlock/animation.cpp
@@ -169,7 +169,7 @@ bool Animation::play3DO(const Common::String &filename, bool intro, int minDelay
// Load initial image
Common::String graphicsName = "prologue/" + filename + ".3da";
- ImageFile3DO images(graphicsName, true);
+ ImageFile3DO images(graphicsName);
events.wait(minDelay);
diff --git a/engines/sherlock/image_file.cpp b/engines/sherlock/image_file.cpp
index 0d60be474d..54af3d8a18 100644
--- a/engines/sherlock/image_file.cpp
+++ b/engines/sherlock/image_file.cpp
@@ -34,6 +34,9 @@ void ImageFile::setVm(SherlockEngine *vm) {
_vm = vm;
}
+ImageFile::ImageFile() {
+}
+
ImageFile::ImageFile(const Common::String &name, bool skipPal, bool animImages) {
Common::SeekableReadStream *stream = _vm->_res->load(name);
@@ -240,28 +243,29 @@ void ImageFile3DO::setVm(SherlockEngine *vm) {
_vm = vm;
}
-ImageFile3DO::ImageFile3DO(const Common::String &name, bool animImages) {
+ImageFile3DO::ImageFile3DO(const Common::String &name) {
Common::File *dataStream = new Common::File();
if (!dataStream->open(name)) {
error("unable to open %s\n", name.c_str());
}
- load(*dataStream, animImages);
+ load(*dataStream, false); // this is never called for room data
delete dataStream;
}
-ImageFile3DO::ImageFile3DO(Common::SeekableReadStream &stream) {
+ImageFile3DO::ImageFile3DO(Common::SeekableReadStream &stream, bool roomData) {
load(stream, false);
}
ImageFile3DO::~ImageFile3DO() {
- for (uint idx = 0; idx < size(); ++idx)
- (*this)[idx]._frame.free();
+ // already done in ImageFile destructor
+ //for (uint idx = 0; idx < size(); ++idx)
+ // (*this)[idx]._frame.free();
}
-void ImageFile3DO::load(Common::SeekableReadStream &stream, bool animImages) {
+void ImageFile3DO::load(Common::SeekableReadStream &stream, bool roomData) {
uint32 headerId = stream.readUint32BE();
assert(!stream.eos());
@@ -280,7 +284,7 @@ void ImageFile3DO::load(Common::SeekableReadStream &stream, bool animImages) {
default:
// Sherlock animation file (.3da files)
- loadAnimationFile(stream, animImages);
+ loadAnimationFile(stream);
break;
}
}
@@ -294,7 +298,7 @@ inline uint16 ImageFile3DO::convertPixel(uint16 pixel3DO) {
return ((red << 11) | (green << 6) | (blue));
}
-void ImageFile3DO::loadAnimationFile(Common::SeekableReadStream &stream, bool animImages) {
+void ImageFile3DO::loadAnimationFile(Common::SeekableReadStream &stream) {
int streamSize = stream.size();
uint32 compressedSize = 0;
@@ -307,22 +311,14 @@ void ImageFile3DO::loadAnimationFile(Common::SeekableReadStream &stream, bool an
frame._height = stream.readByte() + 1; // 1 byte BE height
frame._paletteBase = 0;
- if (animImages) {
- // Animation cutscene image files use a 16-bit x offset
- frame._offset.x = stream.readUint16BE();
- frame._rleEncoded = true; // always compressed
- if (frame._width & 0x8000) {
- frame._width &= 0x7FFF;
- compressedSize += 0x10000;
- }
- frame._offset.y = stream.readByte();
- } else {
- // Standard image files have a separate byte for the RLE flag, and an 8-bit X offset
- //frame._rleEncoded = stream.readByte() == 1;
- //frame._offset.x = stream.readByte();
- //frame._offset.y = stream.readByte();
+ frame._rleEncoded = true; // always compressed
+ if (frame._width & 0x8000) {
+ frame._width &= 0x7FFF;
+ compressedSize += 0x10000;
}
+ frame._offset.x = stream.readUint16BE();
+ frame._offset.y = stream.readByte();
frame._size = 0;
//warning("getting frame %d from offset %d", this->size(), stream.pos());
diff --git a/engines/sherlock/image_file.h b/engines/sherlock/image_file.h
index 5b280c45a5..bf41a3bf98 100644
--- a/engines/sherlock/image_file.h
+++ b/engines/sherlock/image_file.h
@@ -87,6 +87,7 @@ private:
public:
byte _palette[256 * 3];
public:
+ ImageFile();
ImageFile(const Common::String &name, bool skipPal = false, bool animImages = false);
ImageFile(Common::SeekableReadStream &stream, bool skipPal = false);
~ImageFile();
@@ -97,7 +98,7 @@ struct ImageFile3DOPixelLookupTable {
uint16 pixelColor[256];
};
-class ImageFile3DO : public Common::Array<ImageFrame> {
+class ImageFile3DO : public ImageFile { // Common::Array<ImageFrame> {
private:
static SherlockEngine *_vm;
@@ -126,11 +127,11 @@ private:
/**
* Load animation graphics file
*/
- void loadAnimationFile(Common::SeekableReadStream &stream, bool animImages);
+ void loadAnimationFile(Common::SeekableReadStream &stream);
public:
- ImageFile3DO(const Common::String &name, bool animImages = false);
- ImageFile3DO(Common::SeekableReadStream &stream);
+ ImageFile3DO(const Common::String &name);
+ ImageFile3DO(Common::SeekableReadStream &stream, bool roomData = false);
~ImageFile3DO();
static void setVm(SherlockEngine *vm);
};
diff --git a/engines/sherlock/people.cpp b/engines/sherlock/people.cpp
index 143e53242e..18621badb2 100644
--- a/engines/sherlock/people.cpp
+++ b/engines/sherlock/people.cpp
@@ -198,7 +198,12 @@ bool People::loadWalk() {
if (_data[PLAYER]._walkLoaded) {
return false;
} else {
- _data[PLAYER]._images = new ImageFile("walk.vgs");
+ if (_vm->getPlatform() != Common::kPlatform3DO) {
+ _data[PLAYER]._images = new ImageFile("walk.vgs");
+ } else {
+ // Load walk.anim on 3DO, which is a cel animation file
+ _data[PLAYER]._images = new ImageFile3DO("walk.anim");
+ }
_data[PLAYER].setImageFrame();
_data[PLAYER]._walkLoaded = true;