public void Read() { var file = new BinaryReader(File.Open(@"data/maps/" + Path + ".zmx", FileMode.Open)); for (var i = 0; i < Ledges.Length; i++) { Ledges[i] = new Ledge { TotalNodes = file.ReadInt32() }; for (var n = 0; n < Ledges[i].TotalNodes; n++) { Ledges[i].Nodes[n] = new Vector2(file.ReadSingle() * 2, file.ReadSingle() * 2); } Ledges[i].Flags = file.ReadInt32(); } for (var l = 0; l < 3; l++) { for (var i = 0; i < 64; i++) { var t = file.ReadInt32(); if (t == -1) { Segments[l, i] = null; } else { Segments[l, i] = new MapSegment { Index = t, Location = new Vector2(file.ReadSingle(), file.ReadSingle()) }; } } } for (var x = 0; x < XSize; x++) { for (var y = 0; y < YSize; y++) { Grid[x, y] = file.ReadInt32(); } } MapScript = new MapScript(this); for (var i = 0; i < MapScript.Lines.Length; i++) { var s = file.ReadString(); if (s.Length > 0) { MapScript.Lines[i] = new MapScriptLine(s); } else { MapScript.Lines[i] = null; } } file.Close(); Fog = false; if (MapScript.GotoTag("init")) { MapScript.IsReading = true; } }
public void Read() { var file = new BinaryReader(File.Open(@"data/maps/" + Path + ".zmx", FileMode.Open)); for (var i = 0; i < Ledges.Length; i++) { Ledges[i] = new Ledge { TotalNodes = file.ReadInt32() }; for (var n = 0; n < Ledges[i].TotalNodes; n++) { Ledges[i].Nodes[n] = new Vector2(file.ReadSingle() * 2, file.ReadSingle() * 2); } Ledges[i].Flags = file.ReadInt32(); } for (var l = 0; l < 3; l++) { for (var i = 0; i < 64; i++) { var t = file.ReadInt32(); if (t == -1) Segments[l, i] = null; else { Segments[l, i] = new MapSegment { Index = t, Location = new Vector2(file.ReadSingle(), file.ReadSingle()) }; } } } for (var x = 0; x < XSize; x++) { for (var y = 0; y < YSize; y++) { Grid[x, y] = file.ReadInt32(); } } MapScript = new MapScript(this); for (var i = 0; i < MapScript.Lines.Length; i++) { var s = file.ReadString(); if (s.Length > 0) MapScript.Lines[i] = new MapScriptLine(s); else MapScript.Lines[i] = null; } file.Close(); Fog = false; if (MapScript.GotoTag("init")) MapScript.IsReading = true; }