public void Write(Writer writer) { writer.Write((byte)SpriteSheets.Count); for (int i = 0; i < SpriteSheets.Count; ++i) { writer.WriteRSDKString(SpriteSheets[i]); } writer.Write((byte)Animations.Count); for (int i = 0; i < Animations.Count; ++i) { Animations[i].Write(writer); } writer.Write((byte)CollisionBoxes.Count); for (int i = 0; i < CollisionBoxes.Count; ++i) { CollisionBoxes[i].Write(writer); } writer.Close(); }
public void Write(Writer writer) { writer.WriteRSDKString(Name); writer.Write(Value); }
internal void Write(Writer writer) { //Checks To Make Sure the Data Is Valid For Saving if (width > 255) { throw new Exception("Cannot save as Type v2. Width in tiles > 255"); } if (height > 255) { throw new Exception("Cannot save as Type v2. Height in tiles > 255"); } int num_of_objects = objects.Count; if (num_of_objects >= MaxObjectCount) { Console.WriteLine("Object Count > Max Objects!"); return; } // Write zone name writer.WriteRSDKString(Title); // Write the five "display" bytes writer.Write(ActiveLayer0); writer.Write(ActiveLayer1); writer.Write(ActiveLayer2); writer.Write(ActiveLayer3); writer.Write(Midpoint); // Write width and height writer.Write((byte)width); writer.Write((byte)height); // Write tile map for (int h = 0; h < height; h++) { for (int w = 0; w < width; w++) { writer.Write((byte)(MapLayout[h][w] >> 8)); writer.Write((byte)(MapLayout[h][w] & 0xff)); } } // Write number of object type names int num_of_objtype_names = objectTypeNames.Count; writer.Write((byte)(num_of_objtype_names)); // Write object type names // Ignore first object type "Type zero", it is not stored. for (int n = 0; n < num_of_objtype_names; n++) { writer.WriteRSDKString(objectTypeNames[n]); } // 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(); }
public void Write(Writer writer) { writer.WriteRSDKString(PlayerAnimLocation); writer.WriteRSDKString(PlayerScriptLocation); writer.WriteRSDKString(PlayerName); }
internal void Write(Writer writer) { writer.WriteRSDKString(Name); }
internal void Write(Writer writer) { //Checks To Make Sure the Data Is Valid For Saving if (this.width > 255) { throw new Exception("Cannot save as Type v1. Width in tiles > 255"); } if (this.height > 255) { throw new Exception("Cannot save as Type v1. Height in tiles > 255"); } int num_of_objects = objects.Count; if (num_of_objects > 65535) { throw new Exception("Cannot save as Type v1. Number of objects > 65535"); } for (int n = 0; n < num_of_objects; n++) { Object obj = objects[n]; int obj_type = obj.getType(); int obj_subtype = obj.getSubtype(); int obj_xPos = obj.getXPos(); int obj_yPos = obj.getYPos(); if (obj_type > 255) { throw new Exception("Cannot save as Type v1. Object type > 255"); } if (obj_subtype > 255) { throw new Exception("Cannot save as Type v1. Object subtype > 255"); } if (obj_xPos < -32768 || obj_xPos > 32767) { throw new Exception("Cannot save as Type v1. Object X Position can't fit in 16-bits"); } if (obj_yPos < -32768 || obj_yPos > 32767) { throw new Exception("Cannot save as Type v1. Object Y Position can't fit in 16-bits"); } } // Write zone name writer.WriteRSDKString(Title); // Write the five "display" bytes we kept writer.Write(displayBytes); // Write width and height writer.Write((byte)this.width); writer.Write((byte)this.height); // Write tile map for (int h = 0; h < this.height; h++) { for (int w = 0; w < this.width; w++) { writer.Write((byte)(MapLayout[h][w] >> 8)); writer.Write((byte)(MapLayout[h][w] & 0xff)); } } // Write number of object type names int num_of_objtype_names = this.objectTypeNames.Count; writer.Write((byte)(num_of_objtype_names)); // Write object type names // Ignore first object type "Type zero", it is not stored. for (int n = 0; n < num_of_objtype_names; n++) { writer.WriteRSDKString(objectTypeNames[n]); } // Write number of objects writer.Write((byte)(num_of_objects >> 8)); writer.Write((byte)(num_of_objects & 0xFF)); // Write object data for (int n = 0; n < num_of_objects; n++) { Object obj = objects[n]; int obj_type = obj.type; int obj_subtype = obj.subtype; int obj_xPos = obj.xPos; int obj_yPos = obj.yPos; writer.Write((byte)(obj_type)); writer.Write((byte)(obj_subtype)); writer.Write((byte)(obj_xPos >> 8)); writer.Write((byte)(obj_xPos & 0xFF)); writer.Write((byte)(obj_yPos >> 8)); writer.Write((byte)(obj_yPos & 0xFF)); } writer.Close(); }