private void WriteRoomBitmaps(BinaryWriter writer, int roomVersion) { if (roomVersion >= 5) { AGSGraphics.WriteLZ77Image(writer, Background.MainBackground, Background.BytesPerPixel); } else { AGSGraphics.WriteAllegroImage(writer, Background.MainBackground); } AGSGraphics.WriteAllegroImage(writer, Background.RegionsMask); AGSGraphics.WriteAllegroImage(writer, Background.WalkableAreasMask); AGSGraphics.WriteAllegroImage(writer, Background.WalkbehindAreasMask); AGSGraphics.WriteAllegroImage(writer, Background.HotspotsMask); }
public void WriteBlock(BinaryWriter writer, int roomVersion) { writer.Write((byte)Frames.Count); writer.Write((byte)AnimationSpeed); if (roomVersion >= 20) // ??? { Debug.Assert(PaletteShareFlags.Length == Frames.Count); writer.Write((byte[])PaletteShareFlags); } for (int i = 1; i < Frames.Count; ++i) { AGSGraphics.WriteLZ77Image(writer, Frames[i], BytesPerPixel); } }
private void ReadRoomBitmaps(BinaryReader reader, int roomVersion) { if (roomVersion >= 5) // ??? { Background.Frames.Add(AGSGraphics.ReadLZ77Image(reader, Background.BytesPerPixel)); } else { Background.Frames.Add(AGSGraphics.ReadAllegroImage(reader)); } Background.RegionsMask = AGSGraphics.ReadAllegroImage(reader); Background.WalkableAreasMask = AGSGraphics.ReadAllegroImage(reader); Background.WalkbehindAreasMask = AGSGraphics.ReadAllegroImage(reader); Background.HotspotsMask = AGSGraphics.ReadAllegroImage(reader); }
//NOTE(adm244): make sure that this block is read AFTER the main block, // since main block stores BytesPerPixel value and it is required here // to read the image data correctly public void ReadBlock(BinaryReader reader, int roomVersion) { byte framesCount = reader.ReadByte(); AnimationSpeed = reader.ReadByte(); if (roomVersion >= 20) { PaletteShareFlags = reader.ReadBytes(framesCount); } for (int i = 1; i < framesCount; ++i) { Frames.Add(AGSGraphics.ReadLZ77Image(reader, BytesPerPixel)); } Debug.Assert(Frames.Count >= framesCount); }