public GMOptions(BinaryReader binaryReader) : base(binaryReader) { CheckHeader("OPTN"); FullScreen = ReadBool(binaryReader); InterpolatePixels = ReadBool(binaryReader); NoBorder = ReadBool(binaryReader); ShowCursor = ReadBool(binaryReader); Scale = binaryReader.ReadInt32(); Sizeable = ReadBool(binaryReader); StayOnTop = ReadBool(binaryReader); WindowColor = new GMColor(binaryReader.ReadUInt32()); ChangeResolution = ReadBool(binaryReader); ColorDepth = binaryReader.ReadInt32(); Resolution = binaryReader.ReadInt32(); Frequency = binaryReader.ReadInt32(); NoBorder = ReadBool(binaryReader); VSync = ReadBool(binaryReader); ScreenKey = ReadBool(binaryReader); HelpKey = ReadBool(binaryReader); QuitKey = ReadBool(binaryReader); SaveKey = ReadBool(binaryReader); ScreenshotKey = ReadBool(binaryReader); CloseSec = ReadBool(binaryReader); Priority = binaryReader.ReadInt32(); Freeze = ReadBool(binaryReader); ShowProgress = ReadBool(binaryReader); var tpeBackImageAddr = binaryReader.ReadUInt32(); if (tpeBackImageAddr == 0) { tpeBackImage = null; } var tpeFrontImageAddr = binaryReader.ReadUInt32(); if (tpeFrontImageAddr == 0) { tpeFrontImage = null; } var tpeLoadImageAddr = binaryReader.ReadUInt32(); if (tpeLoadImageAddr == 0) { tpeLoadImage = null; } LoadTransparent = ReadBool(binaryReader); LoadAlpha = binaryReader.ReadInt32(); ScaleProgress = ReadBool(binaryReader); DisplayErrors = ReadBool(binaryReader); WriteErrors = ReadBool(binaryReader); AbortErrors = ReadBool(binaryReader); VariableErrors = ReadBool(binaryReader); ConstantCount = binaryReader.ReadInt32(); Constants = new List <GMGMLConstant>(); for (int c = 0; c < ConstantCount; c++) { var constant = new GMGMLConstant(binaryReader); Constants.Add(constant); } FixChunkAddr(binaryReader); }
public GMSprite(BinaryReader binaryReader, GMWAD w) { Name = new GMString(binaryReader); Width = binaryReader.ReadInt32(); Height = binaryReader.ReadInt32(); BBoxLeft = binaryReader.ReadInt32(); BBoxRight = binaryReader.ReadInt32(); BBoxBottom = binaryReader.ReadInt32(); BBoxTop = binaryReader.ReadInt32(); Transparent = ReadBool(binaryReader); Smooth = ReadBool(binaryReader); Preload = ReadBool(binaryReader); int mode = binaryReader.ReadInt32(); BBoxMode = (MaskShape)mode; ColCheck = ReadBool(binaryReader); XOrigin = binaryReader.ReadInt32(); YOrigin = binaryReader.ReadInt32(); ImageCount = binaryReader.ReadInt32(); if (ImageCount != 0) { ImageTextures = new List <GMTPAGEntry>(ImageCount); for (int img = 0; img < ImageCount; img++) { uint addr = binaryReader.ReadUInt32(); if (addr != 0) { long prev_addr = binaryReader.BaseStream.Position; binaryReader.BaseStream.Position = addr; var item = new GMTPAGEntry(binaryReader, w); binaryReader.BaseStream.Position = prev_addr; ImageTextures.Add(item); } else { ImageTextures.Add(null); } } } else { ImageTextures = null; } MasksCount = binaryReader.ReadInt32(); if (MasksCount != 0) { MaskData = new List <byte[]>(MasksCount); for (int msk = 0; msk < MasksCount; msk++) { int size = CalculateMaskSize(Width, Height); byte[] data = binaryReader.ReadBytes(size); MaskData.Add(data); } } else { MaskData = null; } // this is happening in Karoshi... if (ImageCount != MasksCount) { Output.Print($"Sprite {Name}'s ImageCount and MaskCount do not match. {ImageCount} | {MasksCount}"); } }