private void ReadSegmentDefinitions() { var s = new StreamReader(@"Content/maps.zdx"); var currentTex = 0; var curDef = -1; var tRect = new Rectangle(); s.ReadLine(); while (!s.EndOfStream) { // ReSharper disable PossibleNullReferenceException var t = s.ReadLine(); string[] split; if (t.StartsWith("#")) { if (t.StartsWith("#src")) { split = t.Split(' '); if (split.Length > 1) { var n = Convert.ToInt32(split[1]); currentTex = n - 1; } } } else { curDef++; var name = t; t = s.ReadLine(); split = t.Split(' '); if (split.Length > 3) { tRect.X = Convert.ToInt32(split[0]); tRect.Y = Convert.ToInt32(split[1]); tRect.Width = Convert.ToInt32(split[2]) - tRect.X; tRect.Height = Convert.ToInt32(split[3]) - tRect.Y; } else { Console.WriteLine("read fail: " + name); } var tex = currentTex; t = s.ReadLine(); var flags = Convert.ToInt32(t); SegmentDefinitions[curDef] = new SegmentDefinition(name, tex, tRect, flags); } // ReSharper restore PossibleNullReferenceException } }
public Map() { Definitions = new SegmentDefinition[512]; Segments = new MapSegment[3, 64]; Grid = new int[20, 20]; Ledges = EnumerableHelper.Array<Ledge>(16); ReadDefinitions(); }
public Map() { Definitions = new SegmentDefinition[512]; Segments = new MapSegment[3, 64]; Grid = new int[20, 20]; Ledges = EnumerableHelper.Array <Ledge>(16); ReadDefinitions(); }
private void ReadDefinitions() { var reader = new StreamReader(@"Content/maps.zdx"); var currentTex = 0; var curDef = -1; var tRect = new Rectangle(); reader.ReadLine(); while (!reader.EndOfStream) { var line = reader.ReadLine(); string[] split; // ReSharper disable PossibleNullReferenceException if (line.StartsWith("#")) { if (line.StartsWith("#src")) { split = line.Split(' '); if (split.Length > 1) { currentTex = split[1].ToInt() - 1; } } } else { curDef++; var name = line; split = reader.ReadLine().Split(' '); if (split.Length > 3) { tRect.X = split[0].ToInt(); tRect.Y = split[1].ToInt(); tRect.Width = split[2].ToInt() - tRect.X; tRect.Height = split[3].ToInt() - tRect.Y; } else { Console.WriteLine("read fail: " + name); } var flags = Convert.ToInt32(reader.ReadLine()); Definitions[curDef] = new SegmentDefinition(name, currentTex, tRect, flags); } // ReSharper restore PossibleNullReferenceException } reader.Close(); }
public Map() { SegmentDefinitions = new SegmentDefinition[512]; Segments = new MapSegment[3, 64]; Grid = new int[20, 20]; Scripts = new String[128]; Path = "map"; Ledges = new Ledge[16]; for (var i = 0; i < 16; i++) Ledges[i] = new Ledge(); ReadSegmentDefinitions(); for (var i = 0; i < Scripts.Length; i++) Scripts[i] = ""; }
public Map() { SegmentDefinitions = new SegmentDefinition[512]; Segments = new MapSegment[3, 64]; Grid = new int[20, 20]; Scripts = new String[128]; Path = "map"; Ledges = new Ledge[16]; for (var i = 0; i < 16; i++) { Ledges[i] = new Ledge(); } ReadSegmentDefinitions(); for (var i = 0; i < Scripts.Length; i++) { Scripts[i] = ""; } }
private void ReadDefinitions() { var reader = new StreamReader(@"Content/maps.zdx"); var currentTex = 0; var curDef = -1; var tRect = new Rectangle(); reader.ReadLine(); while (!reader.EndOfStream) { var line = reader.ReadLine(); string[] split; // ReSharper disable PossibleNullReferenceException if (line.StartsWith("#")) { if (line.StartsWith("#src")) { split = line.Split(' '); if (split.Length > 1) currentTex = split[1].ToInt() - 1; } } else { curDef++; var name = line; split = reader.ReadLine().Split(' '); if (split.Length > 3) { tRect.X = split[0].ToInt(); tRect.Y = split[1].ToInt(); tRect.Width = split[2].ToInt() - tRect.X; tRect.Height = split[3].ToInt() - tRect.Y; } else Console.WriteLine("read fail: " + name); var flags = Convert.ToInt32(reader.ReadLine()); Definitions[curDef] = new SegmentDefinition(name, currentTex, tRect, flags); } // ReSharper restore PossibleNullReferenceException } reader.Close(); }
private void ReadSegmentDefinitions() { var s = new StreamReader(@"Content/maps.zdx"); var currentTex = 0; var curDef = -1; var tRect = new Rectangle(); s.ReadLine(); while (!s.EndOfStream) { // ReSharper disable PossibleNullReferenceException var t = s.ReadLine(); string[] split; if (t.StartsWith("#")) { if (t.StartsWith("#src")) { split = t.Split(' '); if (split.Length > 1) { var n = Convert.ToInt32(split[1]); currentTex = n - 1; } } } else { curDef++; var name = t; t = s.ReadLine(); split = t.Split(' '); if (split.Length > 3) { tRect.X = Convert.ToInt32(split[0]); tRect.Y = Convert.ToInt32(split[1]); tRect.Width = Convert.ToInt32(split[2]) - tRect.X; tRect.Height = Convert.ToInt32(split[3]) - tRect.Y; } else Console.WriteLine("read fail: " + name); var tex = currentTex; t = s.ReadLine(); var flags = Convert.ToInt32(t); SegmentDefinitions[curDef] = new SegmentDefinition(name, tex, tRect, flags); } // ReSharper restore PossibleNullReferenceException } }
/// <summary> /// /// </summary> private void ReadSegmentDefinitions() { StreamReader reader = new StreamReader(@"Content/maps.zdx"); string t = ""; int n; int currentTex = 0; int curDef = -1; Rectangle tRect = new Rectangle(); string[] split; t = reader.ReadLine(); while (!reader.EndOfStream) { t = reader.ReadLine(); if (t.StartsWith("#")) { if (t.StartsWith("#src")) { split = t.Split(' '); if (split.Length > 1) { n = Convert.ToInt32(split[1]); currentTex = n - 1; } } } else { // if it doesnt start with an ampersand curDef++; string name = t; t = reader.ReadLine(); split = t.Split(' '); if (split.Length > 3) { tRect.X = Convert.ToInt32(split[0]); tRect.Y = Convert.ToInt32(split[1]); tRect.Width = Convert.ToInt32(split[2]) - tRect.X; tRect.Height = Convert.ToInt32(split[3]) - tRect.Y; } else { Console.WriteLine("Read Fail: " + name); } int tex = currentTex; t = reader.ReadLine(); int flags = Convert.ToInt32(t); segmentDefs[curDef] = new SegmentDefinition(name, tex, tRect, flags); } } }