public void Read() { try { BinaryReader file = new BinaryReader(File.Open(@"data/" + path + ".zmx", FileMode.Open)); for (int i = 0; i < ledge.Length; i++) { ledge[i].totalNodes = file.ReadInt32(); for (int n = 0; n < ledge[i].totalNodes; n++) { ledge[i].SetNode(n, new Vector2( file.ReadSingle(), file.ReadSingle())); } ledge[i].flags = file.ReadInt32(); } for (int l = 0; l < 3; l++) { for (int i = 0; i < 64; i++) { int t = file.ReadInt32(); if (t == -1) { mapSeg[l, i] = null; } else { mapSeg[l, i] = new MapSegment(); mapSeg[l, i].SetDefIdx(t); mapSeg[l, i].SetLoc(new Vector2( file.ReadSingle(), file.ReadSingle())); } } } for (int x = 0; x < 20; x++) { for (int y = 0; y < 20; y++) { col[x, y] = file.ReadInt32(); } } for (int i = 0; i < script.Length; i++) { script[i] = file.ReadString(); } file.Close(); } catch { return; } }
public int AddSeg(int l, int idx) { for (int i = 0; i < 64; i++) { if (mapSeg[l, i] == null) { mapSeg[l, i] = new MapSegment(); mapSeg[l, i].SetDefIdx(idx); return(i); } } return(-1); }
public int AddSeg(int l, int idx) { for (int i = 0; i < 64; i++) { if (mapSeg[l, i] == null) { mapSeg[l, i] = new MapSegment(); mapSeg[l, i].SetDefIdx(idx); return i; } } return -1; }
public void SwapSegs(int l, int i, int n) { MapSegment tSeg = new MapSegment(); if (mapSeg[l, i] != null && mapSeg[l, n] != null) { tSeg.SetDefIdx(mapSeg[l, i].GetDefIdx()); tSeg.SetLoc(mapSeg[l, i].GetLoc()); tSeg.SetDefIdx(mapSeg[l, i].GetDefIdx()); tSeg.SetLoc(mapSeg[l, i].GetLoc()); mapSeg[l, i].SetDefIdx(mapSeg[l, n].GetDefIdx()); mapSeg[l, i].SetLoc(mapSeg[l, n].GetLoc()); mapSeg[l, n].SetDefIdx(tSeg.GetDefIdx()); mapSeg[l, n].SetLoc(tSeg.GetLoc()); } }
public void Read() { try { BinaryReader file = new BinaryReader(File.Open(@"data/" + path + ".zmx", FileMode.Open)); for (int i = 0; i < ledge.Length; i++) { ledge[i].totalNodes = file.ReadInt32(); for (int n = 0; n < ledge[i].totalNodes; n++) { ledge[i].SetNode(n, new Vector2( file.ReadSingle(), file.ReadSingle())); } ledge[i].flags = file.ReadInt32(); } for (int l = 0; l < 3; l++) { for (int i = 0; i < 64; i++) { int t = file.ReadInt32(); if (t == -1) mapSeg[l, i] = null; else { mapSeg[l, i] = new MapSegment(); mapSeg[l, i].SetDefIdx(t); mapSeg[l, i].SetLoc(new Vector2( file.ReadSingle(), file.ReadSingle())); } } } for (int x = 0; x < 20; x++) { for (int y = 0; y < 20; y++) { col[x, y] = file.ReadInt32(); } } for (int i = 0; i < script.Length; i++) script[i] = file.ReadString(); file.Close(); } catch { return; } }