public override void Serialize(GMDataWriter writer) { base.Serialize(writer); List.Serialize(writer, (writer, i, count) => { // Align to 4 byte offsets if necessary if (writer.VersionInfo.AlignStringsTo4) { writer.Pad(4); } }); writer.Pad(128); }
private void WriteMaskData(GMDataWriter writer) { writer.Write(CollisionMasks.Count); int total = 0; foreach (var mask in CollisionMasks) { writer.Write(mask); total += mask.Length; } // Pad to 4 bytes if (total % 4 != 0) { total += 4 - (total % 4); } writer.Pad(4); int totalBits = ((Width + 7) / 8 * 8) * Height * CollisionMasks.Count; int totalBytes = ((totalBits + 31) / 32 * 32) / 8; if (total != totalBytes) { writer.Warnings.Add(new GMWarning("Unexpected sprite mask length!")); } }
public override void Serialize(GMDataWriter writer) { base.Serialize(writer); writer.Pad(4); writer.Write(1); List.Serialize(writer); }
public override void Serialize(GMDataWriter writer) { base.Serialize(writer); List.Serialize(writer, (writer, i, count) => { writer.Pad(4); }); }
public override void Serialize(GMDataWriter writer) { base.Serialize(writer); List.Serialize(writer, (writer, i, count) => { // Align each entry to 4 bytes writer.Pad(4); }); }
public override void Serialize(GMDataWriter writer) { base.Serialize(writer); List.Serialize(writer); foreach (GMTexturePage tpe in List) { tpe.TextureData.Serialize(writer); } writer.Pad(4); }
public override void Serialize(GMDataWriter writer) { base.Serialize(writer); List.Serialize(writer, (writer, i, count) => { // Align to 8 byte offsets if necessary if (writer.VersionInfo.AlignBackgroundsTo8) { writer.Pad(8); } }); }
public override void Serialize(GMDataWriter writer) { base.Serialize(writer); writer.Pad(4); writer.Write(1); writer.Write(AllTags.Count); foreach (GMString s in AllTags) { writer.WritePointerString(s); } AssetTagsList.Serialize(writer); }
public void Serialize(GMDataWriter writer) { writer.Pad(128); writer.WriteObjectPointer(this); writer.Write(Data); }
public void Serialize(GMDataWriter writer) { writer.WritePointerString(Name); writer.Write(Width); writer.Write(Height); writer.Write(MarginLeft); writer.Write(MarginRight); writer.Write(MarginBottom); writer.Write(MarginTop); writer.WriteWideBoolean(Transparent); writer.WriteWideBoolean(Smooth); writer.WriteWideBoolean(Preload); writer.Write(BBoxMode); writer.Write((int)SepMasks); writer.Write(OriginX); writer.Write(OriginY); if (SpecialOrGMS2) { // Special/GMS2 sprite type writer.Write(-1); if (writer.VersionInfo.IsNumberAtLeast(2, 3, 2)) { writer.Write(3); } else if (writer.VersionInfo.IsNumberAtLeast(2, 3)) { writer.Write(2); } else { writer.Write(1); } writer.Write((int)S_SpriteType); if (writer.VersionInfo.IsNumberAtLeast(2)) { writer.Write(GMS2_PlaybackSpeed); writer.Write((int)GMS2_PlaybackSpeedType); if (writer.VersionInfo.IsNumberAtLeast(2, 3)) { writer.WritePointer(GMS2_3_Sequence); if (writer.VersionInfo.IsNumberAtLeast(2, 3, 2)) { writer.WritePointer(GMS2_3_2_NineSlice); } } } switch (S_SpriteType) { case SpriteType.Normal: TextureItems.Serialize(writer); WriteMaskData(writer); break; case SpriteType.SWF: writer.Write(8); TextureItems.Serialize(writer); writer.Pad(4); writer.Write(S_Buffer); break; case SpriteType.Spine: writer.Pad(4); writer.Write(S_Buffer); break; } if (GMS2_3_Sequence != null) { writer.Pad(4); writer.WriteObjectPointer(GMS2_3_Sequence); GMS2_3_Sequence.Serialize(writer); } if (GMS2_3_2_NineSlice != null) { writer.Pad(4); writer.WriteObjectPointer(GMS2_3_2_NineSlice); GMS2_3_2_NineSlice.Serialize(writer); } } else { // Normal sprite type TextureItems.Serialize(writer); WriteMaskData(writer); } }
public void Serialize(GMDataWriter writer) { writer.WritePointerString(Name); writer.Write((uint)Type | 0x80000000u); writer.WritePointerString(GLSL_ES_Vertex); writer.WritePointerString(GLSL_ES_Fragment); writer.WritePointerString(GLSL_Vertex); writer.WritePointerString(GLSL_Fragment); writer.WritePointerString(HLSL9_Vertex); writer.WritePointerString(HLSL9_Fragment); writer.WritePointer(HLSL11_VertexBuffer); writer.WritePointer(HLSL11_PixelBuffer); writer.Write(VertexAttributes.Count); foreach (GMString s in VertexAttributes) { writer.WritePointerString(s); } writer.Write(Version); writer.WritePointer(PSSL_VertexBuffer); writer.Write((PSSL_VertexBuffer != null) ? PSSL_VertexBuffer.Buffer.Length : 0); writer.WritePointer(PSSL_PixelBuffer); writer.Write((PSSL_PixelBuffer != null) ? PSSL_PixelBuffer.Buffer.Length : 0); writer.WritePointer(CG_PSV_VertexBuffer); writer.Write((CG_PSV_VertexBuffer != null) ? CG_PSV_VertexBuffer.Buffer.Length : 0); writer.WritePointer(CG_PSV_PixelBuffer); writer.Write((CG_PSV_PixelBuffer != null) ? CG_PSV_PixelBuffer.Buffer.Length : 0); if (Version >= 2) { writer.WritePointer(CG_PS3_VertexBuffer); writer.Write((CG_PS3_VertexBuffer != null) ? CG_PS3_VertexBuffer.Buffer.Length : 0); writer.WritePointer(CG_PS3_PixelBuffer); writer.Write((CG_PS3_PixelBuffer != null) ? CG_PS3_PixelBuffer.Buffer.Length : 0); } if (HLSL11_VertexBuffer != null) { writer.Pad(8); writer.WriteObjectPointer(HLSL11_VertexBuffer); HLSL11_VertexBuffer.Serialize(writer); } if (HLSL11_PixelBuffer != null) { writer.Pad(8); writer.WriteObjectPointer(HLSL11_PixelBuffer); HLSL11_PixelBuffer.Serialize(writer); } if (PSSL_VertexBuffer != null) { writer.Pad(8); writer.WriteObjectPointer(PSSL_VertexBuffer); PSSL_VertexBuffer.Serialize(writer); } if (PSSL_PixelBuffer != null) { writer.Pad(8); writer.WriteObjectPointer(PSSL_PixelBuffer); PSSL_PixelBuffer.Serialize(writer); } if (CG_PSV_VertexBuffer != null) { writer.Pad(8); writer.WriteObjectPointer(CG_PSV_VertexBuffer); CG_PSV_VertexBuffer.Serialize(writer); } if (CG_PSV_PixelBuffer != null) { writer.Pad(8); writer.WriteObjectPointer(CG_PSV_PixelBuffer); CG_PSV_PixelBuffer.Serialize(writer); } if (Version >= 2) { if (CG_PS3_VertexBuffer != null) { writer.Pad(16); writer.WriteObjectPointer(CG_PS3_VertexBuffer); CG_PS3_VertexBuffer.Serialize(writer); } if (CG_PS3_PixelBuffer != null) { writer.Pad(8); writer.WriteObjectPointer(CG_PS3_PixelBuffer); CG_PS3_PixelBuffer.Serialize(writer); } } }