|
The file is organised differently than the others, in the sense that there is no list of offsets in the beginning. No, it's just a grid of data.
|
The file contains 592x229 blocks, which seems to make them 32x32 blocks, to match the map.
The blocks are stored in a left-right, top-bottom order: the first block is the block in the top-left corner, the next block is the block right of the previous block, until you 'fall' of the right of the map. Then you start again at the left, right below the last row of blocks.
For each block, there are 8 bytes of data, each block containing two chunks (2 4-byte integers).
- The lower chunk (the first 4 bytes) contains some sort of identification for the "provinces" in the block,
but it's not the usual province id.
- The upper chunk (the last 4 bytes) contains the terra incognita boundaries. This data is used to 'antialias' (this term is not entirely correct, but it covers what I'd like to express) the TI regios.
But there's more. Each block is actually a list of 4 items, each occupying one byte in each chunk. This means that:
| Item 0 | ... is made up of ... | bytes 0 and 4 |
| Item 1 | bytes 1 and 5 |
| Item 2 | bytes 2 and 6 |
| Item 3 | bytes 3 and 7 |
|
|
|
|
This means that there are maximum 4 provinces possible per block, as you only have 4 byte-combinations. However, there are few blocks where all 4 are used (mostly in the part of the map covering Europe).
The lower chunk
As said before, the lower chunk data contains some sort of identification.
It's not the province id, but an index in the province list of a region
(as described in idgrid.tbl). If you look at the first screenshot,
you can clearly make out the regions you can also see in the idgrid.tbl file).
That's right: this file uses the regions defined in idgrid.tbl to encode it's data. A byte in the lower chunk represents an index in the region list, and so we get a province value.
Each region is 60x60 blocks (except for the rightmost and bottom regions) as represented in this file. This way you know what region you're in, just do some simple math:
# you have a block, its index represented by 'index'
x = index mod 592;
y = trunc( index / 592 );
region_index = trunc( x / 60 ) * 4 + trunc( y / 60 );
For example: a value of 2 in the top-left region gives us province 825 (Bering Straits).
The upper chunk
The upper chunk data provides a sort of anti-aliasing value for the TI values.
It's not clear how this data is build up, I'm still researching it.
|