.DMAP File Structure

01/22/2009 02:36 BoboDundo#1
I'm looking for the .DMAP file structure. Based on existing source code I have been able to determine the following:

Skip the first 268 bytes (anyone know what this is).

Next 4 bytes contain the length of X.
Next 4 bytes contain the length of Y.

public struct DMAP {
public uint32 MapX;
public uint32 MapY;
}

Once you have that, you can use a loop to grab the X,Y information as follow (Taken from CO Reloaded Source):

Binary.ReadBytes(268);

MapX = Binary.ReadUInt32();
MapY = Binary.ReadUInt32();

DMapInfo = new DMAPPiece[MapX, MapY];
byte[] Buffer2 = new byte[MapY * MapX];
for (int y = 0; y < MapY; y++)
{
for (int x = 0; x < MapX; x++)
{
Buffer2[y + x] = Binary.ReadByte();
Binary.ReadBytes(5);
}
Binary.ReadInt32();
}
Binary.Close();

The are a couple of pieces that need explaining and more information. During the loop for the x, it reads a total of 6 bytes.

1) The first read does a single byte. What is this for. Does it mean that a character can be on this location (accessable)?

2) The next five bytes. It is just skipping over it, but exactly are these five bytes for (the ID of the tile/DDS/etc)?

3) Once it has finished the x loop, it reads 4 more bytes (Binary.ReadInt32) in the Y loop. What is this for?

4) What I'm trying to do is build a simple client that recreates the map on the screen of my program. I need to know which .DDS (i'm assuming this is the file I will end up reading) to load for the X,Y coordinate.

Any help is appreciated. Thank you.
01/22/2009 03:41 unknownone#2
I can give you answers to all that, but had a few to drink now. I'll post tomorrow. PM me your MSN addy if you want.