internal void WriteObjectsNames(Writer writer) { writer.Write((byte)Objects.Count); for (int i = 0; i < Objects.Count; ++i) { writer.WriteRSDKString(Objects[i].FilePath); } for (int i = 0; i < Objects.Count; i++) { writer.Write(Objects[i].SpriteSheetID); } }
public void Write(Writer writer) { writer.Write(Unknown); writer.Write(PlayerType); writer.Write((byte)Animations.Count); byte SheetCnt = (byte)SpriteSheets.Length; for (int i = 0; i < SpriteSheets.Length; ++i) { writer.WriteRSDKString(SpriteSheets[i]); } for (int i = 0; i < Animations.Count; ++i) { Animations[i].Write(writer); } writer.Close(); }
internal void Write(Writer writer) { //Checks To make sure that the file can be saved correctly int num_of_objects = objects.Count; if (num_of_objects > MaxObjectCount) { throw new Exception("Cannot save as Retro-Sonic map. Number of objects above 1100!"); } // Save zone name writer.WriteRSDKString(Title); // Write the Stage Init Data writer.Write(Music); writer.Write(Background); writer.Write((byte)(PlayerXpos >> 8)); writer.Write((byte)(PlayerXpos & 0xFF)); writer.Write((byte)(PlayerYPos >> 8)); writer.Write((byte)(PlayerYPos & 0xFF)); // Write number of objects writer.Write((byte)(num_of_objects >> 8)); writer.Write((byte)(num_of_objects & 0xFF)); objects = objects.OrderBy(o => o.id).ToList(); // Write object data for (int n = 0; n < num_of_objects; n++) { Object obj = objects[n]; obj.Write(writer); } writer.Close(); }
internal void Write(Writer writer) { //Checks To make sure that the file can be saved correctly if (width >= 256) { throw new Exception("Cannot save as Retro-Sonic map. Level width in tiles > 255."); } if (height >= 256) { throw new Exception("Cannot save as Retro-Sonic map. Level height in tiles > 255."); } int num_of_objects = objects.Count; if (num_of_objects > MaxObjectCount) { throw new Exception("Cannot save as Retro-Sonic map. Number of objects above 1100!"); } // Separate path components String dirname = Path.GetDirectoryName(writer.GetFilename()); String basename = "\\" + Path.GetFileNameWithoutExtension(writer.GetFilename()); String itmPath = dirname + basename + ".itm"; // Create item file Writer ITMwriter = new Writer(itmPath); // Save width and height writer.Write((byte)width); writer.Write((byte)height); // Save map data for (int y = 0; y < height; y++) { for (int x = 0; x < width; x++) { writer.Write((byte)MapLayout[y][x]); } } // Close map file writer.Close(); // Save zone name ITMwriter.WriteRSDKString(Title); // Write the Stage Init Data ITMwriter.Write(Music); ITMwriter.Write(Background); ITMwriter.Write((byte)(PlayerXpos >> 8)); ITMwriter.Write((byte)(PlayerXpos & 0xFF)); ITMwriter.Write((byte)(PlayerYPos >> 8)); ITMwriter.Write((byte)(PlayerYPos & 0xFF)); // Write number of objects ITMwriter.Write((byte)(num_of_objects >> 8)); ITMwriter.Write((byte)(num_of_objects & 0xFF)); // Write object data for (int n = 0; n < num_of_objects; n++) { Object obj = objects[n]; obj.Write(ITMwriter); } ITMwriter.Close(); }
internal void WriteObjectsSpriteSheets(Writer writer) { writer.Write((byte)ObjectSpritesheets.Count); foreach (string name in ObjectSpritesheets) writer.WriteRSDKString(name); }