Skip to content

Commit

Permalink
SHERLOCK: Update CAnim loading for Rose Tattoo
Browse files Browse the repository at this point in the history
  • Loading branch information
dreammaster committed May 17, 2015
1 parent f41b8ca commit bfb7877
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 11 deletions.
23 changes: 18 additions & 5 deletions engines/sherlock/objects.cpp
Expand Up @@ -1135,17 +1135,30 @@ const Common::Rect Object::getOldBounds() const {
/**
* Load the data for the animation
*/
void CAnim::load(Common::SeekableReadStream &s) {
void CAnim::load(Common::SeekableReadStream &s, bool isRoseTattoo) {
char buffer[12];
s.read(buffer, 12);
_name = Common::String(buffer);

s.read(_sequences, 30);
if (isRoseTattoo) {
Common::fill(&_sequences[0], &_sequences[30], 0);
_size = s.readUint32LE();
} else {
s.read(_sequences, 30);
}

_position.x = s.readSint16LE();
_position.y = s.readSint16LE();
_size = s.readUint32LE();
_type = (SpriteType)s.readUint16LE();
_flags = s.readByte();

if (isRoseTattoo) {
_flags = s.readByte();
_scaleVal = s.readSint16LE();
} else {
_size = s.readUint32LE();
_type = (SpriteType)s.readUint16LE();
_flags = s.readByte();
}

_goto.x = s.readSint16LE();
_goto.y = s.readSint16LE();
_gotoDir = s.readSint16LE();
Expand Down
11 changes: 8 additions & 3 deletions engines/sherlock/objects.h
Expand Up @@ -256,17 +256,22 @@ class Object {

struct CAnim {
Common::String _name; // Name
byte _sequences[MAX_FRAME]; // Animation sequences
Common::Point _position; // Position
int _size; // Size of uncompressed animation
SpriteType _type;
int _flags; // Tells if can be walked behind
Common::Point _goto; // coords holmes should walk to before starting canim
int _gotoDir;
Common::Point _teleportPos; // Location Holmes shoul teleport to after
int _teleportDir; // playing canim

void load(Common::SeekableReadStream &s);
// Scalpel specific
byte _sequences[MAX_FRAME]; // Animation sequences
SpriteType _type;

// Rose Tattoo specific
int _scaleVal; // How much the canim is scaled

void load(Common::SeekableReadStream &s, bool isRoseTattoo);
};

struct SceneImage {
Expand Down
7 changes: 4 additions & 3 deletions engines/sherlock/scene.cpp
Expand Up @@ -398,13 +398,14 @@ bool Scene::loadScene(const Common::String &filename) {
// Load in cAnim list
_cAnim.clear();
if (bgHeader._numcAnimations) {
int animSize = _vm->getGameID() == GType_SerratedScalpel ? 65 : 47;
Common::SeekableReadStream *canimStream = _lzwMode ?
Resources::decompressLZ(*rrmStream, 65 * bgHeader._numcAnimations) :
rrmStream->readStream(65 * bgHeader._numcAnimations);
res.decompress(*rrmStream, animSize * bgHeader._numcAnimations) :
rrmStream->readStream(animSize * bgHeader._numcAnimations);

_cAnim.resize(bgHeader._numcAnimations);
for (uint idx = 0; idx < _cAnim.size(); ++idx)
_cAnim[idx].load(*canimStream);
_cAnim[idx].load(*canimStream, _vm->getGameID() == GType_RoseTattoo);

delete canimStream;
}
Expand Down

0 comments on commit bfb7877

Please sign in to comment.