SHERLOCK: Update CAnim loading for Rose Tattoo

This commit is contained in:
Paul Gilbert 2015-05-16 22:48:24 -04:00
parent 7aa804b5cc
commit 46e27b6293
3 changed files with 30 additions and 11 deletions

View file

@ -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();

View file

@ -256,17 +256,22 @@ public:
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 {

View file

@ -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;
}