void DECFile::load(Common::SeekableSubReadStreamEndian &dec, const Common::String &fileName) { dec.skip(2); // Unused int16 backdropCount = dec.readUint16(); int16 layerCount = dec.readUint16(); // Sanity checks if (backdropCount > 1) warning("DECFile::load(): More than one backdrop (%d) in file \"%s\"", backdropCount, fileName.c_str()); if (layerCount < 1) warning("DECFile::load(): Less than one layer (%d) in file \"%s\"", layerCount, fileName.c_str()); // Load the backdrop if (backdropCount > 0) { loadBackdrop(dec); // We only support one backdrop, skip the rest dec.skip((backdropCount - 1) * (13 + (_hasPadding ? 1 : 0))); } // Load the layers _layers.reserve(MAX(0, layerCount - 1)); for (int i = 0; i < layerCount - 1; i++) _layers.push_back(loadLayer(dec)); // Load the backdrop parts if (backdropCount > 0) loadParts(dec); }
void DECFile::loadParts(Common::SeekableSubReadStreamEndian &dec) { dec.skip(13); // Name if (_hasPadding) dec.skip(1); dec.skip(13); // File? if (_hasPadding) dec.skip(1); uint16 partCount = dec.readUint16(); _parts.resize(partCount); for (PartArray::iterator p = _parts.begin(); p != _parts.end(); ++p) loadPart(*p, dec); }
void Frame::readPaletteInfo(Common::SeekableSubReadStreamEndian &stream) { _palette->firstColor = stream.readByte(); _palette->lastColor = stream.readByte(); _palette->flags = stream.readByte(); _palette->speed = stream.readByte(); _palette->frameCount = stream.readUint16(); stream.skip(8); //unknown }
void DECFile::loadBackdrop(Common::SeekableSubReadStreamEndian &dec) { // Interestingly, DEC files reference "FOO.LBM" instead of "FOO.CMP" Common::String file = Util::setExtension(Util::readString(dec, 13), ""); if (_hasPadding) dec.skip(1); _backdrop = new CMPFile(_vm, file, _width, _height, _bpp); }
void DECFile::loadPart(Part &part, Common::SeekableSubReadStreamEndian &dec) { part.layer = dec.readByte() - 1; part.part = dec.readByte(); dec.skip(1); // Unknown part.x = dec.readUint16(); part.y = dec.readUint16(); part.transp = dec.readByte() != 0; }