From da2f919e8f98e9e9bc481a16a1f207d211f506c8 Mon Sep 17 00:00:00 2001 From: Paul Chote Date: Thu, 1 Apr 2010 00:40:52 +1300 Subject: [PATCH] Saves enough data for a functional multiplayer map. Waypoint and Actor definitions will want refactoring at some point. --- MapConverter/IniMap.cs | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/MapConverter/IniMap.cs b/MapConverter/IniMap.cs index 883218ae8b..83a2189cff 100644 --- a/MapConverter/IniMap.cs +++ b/MapConverter/IniMap.cs @@ -30,13 +30,23 @@ namespace MapConverter { public class MapData { + // General info public int MapFormat; public string Title; - public string Theater; + public string Description; + public string Author; + public int Players; + + // 'Simple' map data + public string Tileset; public int2 Size; public int[] Bounds; + + // 'Complex' map data public string TileData; public string ResourceData; + public string[] Waypoints; + public string[] Actors; } public class IniMap @@ -82,7 +92,10 @@ namespace MapConverter var data = new MapData(); data.MapFormat = 1; data.Title = Title; - data.Theater = Theater; + data.Players = SpawnPoints.Count(); + data.Author = "Westwood Studios"; + data.Description = ""; + data.Tileset = Theater; data.Bounds = new int[] {XOffset, YOffset, Width, Height}; data.Size = new int2(MapSize,MapSize); @@ -126,6 +139,14 @@ namespace MapConverter writer.Flush(); data.ResourceData = Convert.ToBase64String(resources.ToArray()); + // Spawn points + int s = 0; + data.Waypoints = SpawnPoints.Select(t => "spawn{0}={1}|{2}".F(s++,t.X,t.Y)).ToArray(); + + // Actors + s = 0; + data.Actors = Actors.Select(t=>"actor{0}={1}|{2}|{3}".F(s++,t.Name,t.Location.X,t.Location.Y)).ToArray(); + Dictionary Nodes = new Dictionary(); Nodes.Add("MAP",FieldSaver.Save(data)); Nodes.WriteToFile(filename);