public void Read() { var file = new BinaryReader(File.Open(@"data/" + 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(), file.ReadSingle()); } 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 < 20; x++) { for (var y = 0; y < 20; y++) { Grid[x, y] = file.ReadInt32(); } } for (var i = 0; i < Scripts.Length; i++) { Scripts[i] = file.ReadString(); } file.Close(); }
public Map() { for (int i = 0; i < Scripts.Length; i++) { Scripts[i] = ""; } segDef = new SegmentDefinitions[512]; mapSegment = new MapSegment[3, 64]; colisionGrid = new int[20, 20]; ledges = new Ledge[16]; for (int i = 0; i < 16; i++) { ledges[i] = new Ledge(); } ReadSegmentDefinitions(); }
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] = ""; } }
public void Read() { BinaryReader file = new BinaryReader(File.Open(@"Content/data/maps/" + path + ".dat", FileMode.Open)); // read ledge information first for (int i = 0; i < ledges.Length; i++) { ledges[i] = new Ledge(); ledges[i].TotalNodes = file.ReadInt32(); for (int n = 0; n < ledges[i].TotalNodes; n++) { ledges[i].Nodes[n] = new Vector2( file.ReadSingle(), file.ReadSingle()); } ledges[i].isHardLedge = file.ReadInt32(); } // read layer / segment information for (int l = 0; l < 3; l++) { for (int i = 0; i < 64; i++) { int t = file.ReadInt32(); if (t == -1) mapSegment[l, i] = null; else { mapSegment[l, i] = new MapSegment(); mapSegment[l, i].Index = t; mapSegment[l, i].location = new Vector2( file.ReadSingle(), file.ReadSingle()); } } } // read collision grid information for (int x = 0; x < 20; x++) { for (int y = 0; y < 20; y++) { colisionGrid[x, y] = file.ReadInt32(); } } // read script information for (int i = 0; i < Scripts.Length; i++) Scripts[i] = file.ReadString(); file.Close(); }
public void Read() { var file = new BinaryReader(File.Open(@"data/" + 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(), file.ReadSingle()); } 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 < 20; x++) { for (var y = 0; y < 20; y++) { Grid[x, y] = file.ReadInt32(); } } for (var i = 0; i < Scripts.Length; i++) Scripts[i] = file.ReadString(); file.Close(); }