ScriptCast::ScriptCast(Common::ReadStreamEndian &stream, uint16 version) { if (version < 4) { error("Unhandled Script cast"); } else if (version == 4) { stream.readByte(); stream.readByte(); initialRect = Score::readRect(stream); boundingRect = Score::readRect(stream); id = stream.readUint32(); debugC(4, kDebugLoading, "CASt: Script id: %d", id); stream.readByte(); // There should be no more data assert(stream.eos()); } else if (version > 4) { stream.readByte(); stream.readByte(); initialRect = Score::readRect(stream); boundingRect = Score::readRect(stream); id = stream.readUint32(); debugC(4, kDebugLoading, "CASt: Script id: %d", id); // WIP need to complete this! } modified = 0; }
BitmapCast::BitmapCast(Common::ReadStreamEndian &stream, uint32 castTag, uint16 version) { if (version < 4) { flags = stream.readByte(); someFlaggyThing = stream.readUint16(); initialRect = Score::readRect(stream); boundingRect = Score::readRect(stream); regY = stream.readUint16(); regX = stream.readUint16(); unk1 = unk2 = 0; if (someFlaggyThing & 0x8000) { unk1 = stream.readUint16(); unk2 = stream.readUint16(); } } else if (version == 4) { stream.readByte(); stream.readByte(); flags = 0; someFlaggyThing = 0; unk1 = unk2 = 0; initialRect = Score::readRect(stream); boundingRect = Score::readRect(stream); regX = stream.readUint16(); regY = stream.readUint16(); bitsPerPixel = stream.readUint16(); if (bitsPerPixel == 0) bitsPerPixel = 1; int tail = 0; while (!stream.eos()) { stream.readByte(); tail++; } warning("BitmapCast: %d bytes left", tail); } else if (version == 5) { uint16 count = stream.readUint16(); for (uint16 cc = 0; cc < count; cc++) stream.readUint32(); uint32 stringLength = stream.readUint32(); for (uint32 s = 0; s < stringLength; s++) stream.readByte(); /*uint16 width =*/ stream.readUint16LE(); //maybe? initialRect = Score::readRect(stream); /*uint32 somethingElse =*/ stream.readUint32(); boundingRect = Score::readRect(stream); bitsPerPixel = stream.readUint16(); regX = 0; regY = 0; stream.readUint32(); } modified = 0; tag = castTag; }