private void Load_Triggers(ProjectReader reader) { int Version = reader.ReadInt32(); if (Version != 800) { throw new InvalidDataException("This library only supports .gmk GM8.0 files."); } int Count = reader.ReadInt32(); Triggers = new List <GMTrigger>(Count); for (int i = 0; i < Count; i++) { var dec_reader = reader.MakeReaderZlib(); if (dec_reader.ReadBoolean()) { Triggers.Add(new GMTrigger(dec_reader)); } else { Triggers.Add(null); } } TriggersLastChanged = reader.ReadDate(); }
public void Load(ProjectReader reader) { Version = reader.ReadInt32(); if (Version != 700) { throw new Exception("Invalid extension file version, got " + Version); } FileName = reader.ReadString(); OriginalName = reader.ReadString(); Kind = (GEDFileKind)reader.ReadInt32(); Initialization = reader.ReadString(); Finalization = reader.ReadString(); int cnt = reader.ReadInt32(); Functions = new List <GEDFunction>(cnt); for (int i = 0; i < cnt; i++) { var gedf = new GEDFunction(); gedf.Load(reader); Functions.Add(gedf); } cnt = reader.ReadInt32(); Constants = new List <GEDConstant>(cnt); for (int i = 0; i < cnt; i++) { GEDConstant cc = new GEDConstant(); cc.Load(reader); Constants.Add(cc); } }
public GMBackground(ProjectReader reader) { Name = reader.ReadString(); LastChanged = reader.ReadDate(); Version = reader.ReadInt32(); // version that we don't care about here. UseAsTileset = reader.ReadBoolean(); TileWidth = reader.ReadInt32(); TileHeight = reader.ReadInt32(); OffsetH = reader.ReadInt32(); OffsetV = reader.ReadInt32(); SepH = reader.ReadInt32(); SepV = reader.ReadInt32(); FrameVersion = reader.ReadInt32(); // frame version int Width, Height; Width = reader.ReadInt32(); Height = reader.ReadInt32(); Background = null; if (Width * Height != 0) { Background = reader.ReadBGRAImage(Width, Height); } reader.Dispose(); }
private void Load_Backgrounds(ProjectReader reader) { int Version = reader.ReadInt32(); if (Version != 800) { throw new InvalidDataException("This library only supports .gmk GM8.0 files."); } int Count = reader.ReadInt32(); Backgrounds = new List <GMBackground>(Count); for (int i = 0; i < Count; i++) { var dec_reader = reader.MakeReaderZlib(); if (dec_reader.ReadBoolean()) { Backgrounds.Add(new GMBackground(dec_reader)); } else { Backgrounds.Add(null); } } }
public GMEmbeddedExtension(ProjectReader reader) { int ver = reader.ReadInt32(); Name = reader.ReadString(); Folder = reader.ReadString(); int incl_count = reader.ReadInt32(); for (int i = 0; i < incl_count; i++) { } }
public void Load(ProjectReader reader) { int magic = reader.ReadInt32(); if (magic != GMProject.GMMagic) { throw new Exception("Invalid GEX magic, got " + magic); } Version = reader.ReadInt32(); if (Version != 701) { throw new Exception("Invalid GEX version, got " + Version); } Seed = reader.ReadInt32(); Lookup(Seed); // Decrypt GED/DAT var gedStream = new MemoryStream(); gedStream.WriteByte((byte)reader.ReadByte()); // first byte is never encrypted. while (true) { int bb = reader.ReadByte(); if (bb < 0) { break; } // non-additive mode. gedStream.WriteByte(GMKrypt[1][(byte)bb]); } gedStream.Seek(0, SeekOrigin.Begin); var gedReader = new ProjectReader(gedStream); Package = new GED(); Package.Load(gedReader); RawDATs = new List <byte[]>(Package.Files.Count); for (int i = 0; i < Package.Files.Count; i++) { //if (Package.Files[i].Kind != GEDFile.GEDFileKind.ActionLib) // ??????????????????????????? RawDATs.Add(gedReader.ReadCompressedStream()); } gedStream.Dispose(); gedReader.Dispose(); }
public GMTrigger(ProjectReader reader) { Version = reader.ReadInt32(); if (Version != 800) { throw new InvalidDataException("Wrong project version."); } Name = reader.ReadString(); Condition = reader.ReadString(); Event = (TriggerEvent)reader.ReadInt32(); ConstName = reader.ReadString(); }
public GMTimeline(ProjectReader reader) { Name = reader.ReadString(); LastChanged = reader.ReadDate(); Version = reader.ReadInt32(); int momentcount = reader.ReadInt32(); Moments = new List <TimelineMoment>(momentcount); for (int i = 0; i < momentcount; i++) { Moments.Add(new TimelineMoment(reader)); } reader.Dispose(); }
public GMEvent(ProjectReader reader) { Version = reader.ReadInt32(); // 400? if (Version != 400) { throw new InvalidDataException("Invalid GMEvent version number, got " + Version); } int Count = reader.ReadInt32(); Actions = new List <GMAction>(Count); for (int i = 0; i < Count; i++) { Actions.Add(new GMAction(reader)); } }
private void Load_ExtensionPackages(ProjectReader reader) { int Version = reader.ReadInt32(); if (Version != 700) { throw new InvalidDataException("Invalid extension package version."); } int Count = reader.ReadInt32(); ExtensionPackageNames = new List <string>(Count); for (int i = 0; i < Count; i++) { ExtensionPackageNames.Add(reader.ReadString()); } }
private void Load_LibCreationCode(ProjectReader reader) { int Version = reader.ReadInt32(); if (Version != 500) { throw new InvalidDataException("Invalid library creation code version."); } int Count = reader.ReadInt32(); LibraryCreationCode = new List <string>(Count); for (int i = 0; i < Count; i++) { LibraryCreationCode.Add(reader.ReadString()); } }
public GMFont(ProjectReader reader) { Name = reader.ReadString(); LastChanged = reader.ReadDate(); Version = reader.ReadInt32(); if (Version != 800) { throw new InvalidDataException("This library only supports .gmk GM8.0 files."); } FontName = reader.ReadString(); Size = reader.ReadInt32(); Bold = reader.ReadBoolean(); Italic = reader.ReadBoolean(); RangeMin = reader.ReadInt32(); RangeMax = reader.ReadInt32(); }
private void Load_RoomOrder(ProjectReader reader) { int Version = reader.ReadInt32(); if (Version != 700) { throw new InvalidDataException("Invalid room execution order version."); } int Count = reader.ReadInt32(); RoomExecutionOrder = new List <GMRoom>(Count); for (int i = 0; i < Count; i++) { int room_ind = reader.ReadInt32(); RoomExecutionOrder.Add(Rooms[room_ind]); } }
private void Load_Constants(ProjectReader reader) { int Version = reader.ReadInt32(); if (Version != 800) { throw new InvalidDataException("This library only supports .gmk GM8.0 files."); } int Count = reader.ReadInt32(); Constants = new List <GMConstant>(Count); for (int i = 0; i < Count; i++) { Constants.Add(new GMConstant(reader)); } ConstantsLastChanged = reader.ReadDate(); }
public GMObject(ProjectReader reader, GMProject proj) { Name = reader.ReadString(); LastChanged = reader.ReadDate(); Version = reader.ReadInt32(); if (Version != 430) { throw new InvalidDataException("Invalid Object version, got " + Version); } Sprite = null; int spr = reader.ReadInt32(); if (spr > -1) { Sprite = proj.Sprites[spr]; } Solid = reader.ReadBoolean(); Visible = reader.ReadBoolean(); Depth = reader.ReadInt32(); Persistent = reader.ReadBoolean(); Parent = null; _ParentInd = reader.ReadInt32(); Mask = null; int mask = reader.ReadInt32(); if (mask > -1) { Mask = proj.Sprites[mask]; } int ev_count = reader.ReadInt32(); Events = new List <List <GMEvent> >(ev_count + 1); for (int i = 0; i <= ev_count; i++) { var l = new List <GMEvent>(); bool done = false; while (!done) { int first = reader.ReadInt32(); if (first != -1) { var ev = new GMEvent(reader); ev.Key = first; l.Add(ev); } else { done = true; } } Events.Add(l); } reader.Dispose(); }
public GMSound(ProjectReader reader) { Name = reader.ReadString(); LastChanged = reader.ReadDate(); Version = reader.ReadInt32(); if (Version != 800) { throw new InvalidDataException("This library only supports .gmk GM8.0 files."); } Kind = (SoundKind)reader.ReadInt32(); FileType = reader.ReadString(); FileName = reader.ReadString(); Data = null; if (reader.ReadBoolean()) { int size = reader.ReadInt32(); Data = reader.ReadBytes(size); } int eff = reader.ReadInt32(); int efflen = (int)SoundEffects.__LENGTH; Effects = new bool[efflen]; for (int i = 0; i < efflen; i++) { Effects[i] = (eff & 1) != 0; eff >>= 1; } // to check for an effect you do: // if (Effects[(int)SoundEffects.CHORUS]) { } Volume = reader.ReadDouble(); Panning = reader.ReadDouble(); Preload = reader.ReadBoolean(); reader.Dispose(); }
public GMScript(ProjectReader reader) { Name = reader.ReadString(); LastChanged = reader.ReadDate(); Version = reader.ReadInt32(); if (Version != 800) { throw new InvalidDataException("This library only supports .gmk GM8.0 files."); } Code = reader.ReadString(); reader.Dispose(); }
public void Load(ProjectReader reader) { Version = reader.ReadInt32(); if (Version != 700) { throw new Exception("Invalid function version, got " + Version); } Name = reader.ReadString(); ExternalName = reader.ReadString(); Convention = (GEDFunctionConv)reader.ReadInt32(); Help = reader.ReadString(); Hidden = reader.ReadBoolean(); Argc = reader.ReadInt32(); ArgTypes = new List <GEDFunctionArgType>(17); for (int i = 0; i < 17; i++) { GEDFunctionArgType tt = (GEDFunctionArgType)reader.ReadInt32(); ArgTypes.Add(tt); } Return = (GEDFunctionArgType)reader.ReadInt32(); }
private void Load_GameInformation(ProjectReader reader) { int Version = reader.ReadInt32(); if (Version != 800) { throw new InvalidDataException("This library only supports .gmk GM8.0 files."); } var dec_reader = reader.MakeReaderZlib(); GameInformation = new GMGameInformation(dec_reader); GameInformation.Version = Version; }
public GMBackground(ProjectReader reader, bool _gmbck) { // Same as .gmspr... int magic = reader.ReadInt32(); if (magic != 1234321) { throw new InvalidDataException("Wrong GMBCK magic, got " + magic); } var dec_reader = reader.MakeReaderZlib(); Version = dec_reader.ReadInt32(); if (Version != 710) { throw new InvalidDataException("Unknown GMBCK version, got " + magic); } UseAsTileset = dec_reader.ReadBoolean(); TileWidth = dec_reader.ReadInt32(); TileHeight = dec_reader.ReadInt32(); OffsetH = dec_reader.ReadInt32(); OffsetV = dec_reader.ReadInt32(); SepH = dec_reader.ReadInt32(); SepV = dec_reader.ReadInt32(); FrameVersion = dec_reader.ReadInt32(); if (FrameVersion != 800) { throw new InvalidDataException("Unknown GMBCK image version, got " + magic); } int Width, Height; Width = dec_reader.ReadInt32(); Height = dec_reader.ReadInt32(); Background = null; if (Width * Height != 0) { Background = dec_reader.ReadBGRAImage(Width, Height); } dec_reader.Dispose(); }