Replace your DMap.cs with this:
Code:
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
namespace CoSX
{
public class DMaps
{
public static int DMapsLoaded = 0;
/*DMAP LIST*/ public static ArrayList MapsNeeded = new ArrayList() { 1019, 700, 1020, 1021, 1025, 1026, 1027, 1028, 5000, 1037, 1039, 1040, 1041, 1060, 1061, 1062, 1064, 1082, 1098, 1099, 1101, 1102, 1103, 1104, 1105, 1106, 1107, 1108, 1109, 1201, 1202, 1203, 1204, 1205, 1206, 1207, 1208, 1209, 1210, 1211, 1212, 1213, 1214, 1215, 1216, 1505, 1506, 1507, 1508, 1509, 1550, 1551, 2021, 2022, 2023, 2024, 1730, 1731, 1732, 1733, 1734, 1735, 1736, 1737, 1738, 700, 1070, 1075, 1076, 1077, 1078, 1079, 1090, 1091, 1080, 1081, 1050, 1042, 1043, 1044, 1045, 1046, 1047, 1048, 1049, 1006, 1007, 1008, 1009, 1010, 1011, 1012, 1013, 1014, 1015, 1016, 1017, 6001, 6000, 1018, 1005, 1038, 1000, 1001, 1002, 1036, 1037, 1039, 1011, 1015, 1020, 1028, 1785 };
public static Hashtable H_DMaps = new Hashtable();
public static bool Loaded = false;
public static void Load()
{
if (Directory.Exists(Program.ConquerPath))
{
int Maps = 0;
uint Time = Native.timeGetTime();
Program.WriteLine("Starting to load DMaps.");
FileStream FS = new FileStream(Program.ConquerPath + @"ini\GameMap.dat", FileMode.Open);
BinaryReader BR = new BinaryReader(FS);
uint MapCount = BR.ReadUInt32();
for (uint i = 0; i < MapCount; i++)
{
ushort MapID = (ushort)BR.ReadUInt32();
string Path = Encoding.ASCII.GetString(BR.ReadBytes(BR.ReadInt32()));
if (MapsNeeded.Contains((int)MapID))
{
DMap D = new DMap(MapID, Path);
H_DMaps.Add(MapID, D);
Maps += 1;
}
BR.ReadInt32();
}
BR.Close();
FS.Close();
Loaded = true;
DMapsLoaded = Maps;
Program.WriteLine("Total DMaps: " + DMapsLoaded);
Program.WriteLine("DMaps loaded successfully in " + (Native.timeGetTime() - Time) + " milliseconds.");
}
else
Program.WriteLine("The specified Conquer Online folder doesn't exist. DMaps couldn't be loaded.");
}
}
public struct DMapCell
{
private Boolean _noAccess;
public Boolean High;
public DMapCell(Boolean noAccess)
{
_noAccess = noAccess;
High = false;
}
public Boolean NoAccess
{
get
{
return _noAccess;
}
internal set
{
_noAccess = value;
}
}
}
public class DMap
{
private Int32 Width;
private Int32 Height;
private DMapCell[,] Cells;
public DMap(ushort MapID, string Path)
{
Program.WriteLine("Loading " + MapID.ToString() + " : " + Program.ConquerPath + Path + "");
if (File.Exists(Program.ConquerPath + Path))
{
FileStream FS = new FileStream(Program.ConquerPath + Path, FileMode.Open);
BinaryReader BR = new BinaryReader(FS);
BR.ReadBytes(268);
Width = BR.ReadInt32();
Height = BR.ReadInt32();
Cells = new DMapCell[Width, Height];
byte[] cell_data = BR.ReadBytes(((6 * Width) + 4) * Height);
int offset = 0;
for (int y = 0; y < Width; y++)
{
for (int x = 0; x < Height; x++)
{
Boolean noAccess = BitConverter.ToBoolean(cell_data, offset) != false;
if (MapID == 1002)
{
if (x >= 606 && x <= 641)
if (y >= 674 && y <= 680)
noAccess = false;
if (x >= 148 && x <= 194)
if (y >= 541 && y <= 546)
noAccess = false;
}
Cells[x, y] = new DMapCell(noAccess);
if (MapID == 1038)
{
if (x <= 119)
Cells[x, y].High = true;
if (x >= 120 && x <= 216 && y <= 210)
Cells[x, y].High = true;
}
offset += 6;
}
offset += 4;
}
BR.Close();
FS.Close();
}
}
public DMapCell GetCell(ushort X, ushort Y)
{
return Cells[X, Y];
}
}
}






