Jump to content

Map format


Blade

Recommended Posts

Do not hold me to this, but from my old notes (that is seriously outdated, Dec 2010...), it should be;

 

I used "short" as the game handles pretty much everything as a byte, though that might have been a compiler optimization and I'm sure they coded it as a "int".

 

struct CoordStruct{

  short X;

  short Y;

};

 

struct MapPackStruct{

  CoordStruct Coord;

  TemplateType Template;

  short TemplateTileIndex;

};

 

Also, SS can load C&C95 maps when you set a internal integer "INIFormat to "0", its +0x28 from the static MapClass Map.

Link to comment
Share on other sites

Looking at an actual file, Myg's explanation looks closest to what I see, short containing x*y pos, byte identifying tileset, byte identifying tile.

 

struct MapPackStruct {

short CellNumber;

byte Template;

byte TemplateTileIndex;

};

 

This also explains why the files are different sizes, clear tiles aren't recorded.

Link to comment
Share on other sites

OK, so I was on the right track, just needed to change the "short"' to "byte". The game handles the first two bytes as a struct, and the basic common format for coords or position in C&C games is CoordStruct, weather the data be byte, short or int.

 

EDIT: All BIN's are formatted as if the map is 128x128. So 0xFF/255 means ignore/skip, while anything less that 128 means a valid cell coord and thus loads the data into the internal hardcoded map struct. So CoordStruct should be CellCoordStruct and the entry's represent the XY location of the cell in the internal 128x128 map structure.

 

Correct me if I am wrong as I'm new to the map formats of Pre-TS games...

Link to comment
Share on other sites

That sounds about right, but the Sole Survivor bin files don't appear to record the 0xFF, 0x00 pairs in the file itself, preferring the record the coords of the none clear tiles only unlike the TD ones that record an entry for all cells and rely on the position in the file to dictate what coord the entry pertains to.

Link to comment
Share on other sites

.bin for C&C95 is two bytes per cell, first byte is the template and the second byte is the tile of the template. For sole survivor you can use a hex editor and modify the maps. Try changing the first few bytes of the file and check what happens to the top north west of the map.

 

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...