View Single Post
Violet CLM Violet CLM's Avatar

JCF Éminence Grise

Joined: Mar 2001

Posts: 11,007

Violet CLM has disabled reputation

Aug 17, 2011, 06:37 PM
Violet CLM is offline
Reply With Quote
All right, I'm pretty sure I understand what's going on with the MASK section. It's the clipping mask (EMSK is the transparency mask), and each tile within it begins with a short giving that tile number. If the sixteenth bit is 0, then the following 128 bytes give the clipping mask for that tile, one bit per pixel, four bytes per row. If the sixteenth bit is 1, then instead that short is followed by another short giving the id of another (previously listed) tile whose mask this current tile shares. So 02 80 01 00 means that the third tile (02 00) has the same mask as the second tile (01 00).
However, not all the tiles actually have masks. At a guess, I'd say only the ones that are used somewhere in the level (or in layer 4?), but that could be wrong. In any case, if a tile doesn't have a mask it's just not listed in the file at all, which works fine because every tile specifies its id. Maskless tiles display fine in-game, but if you try to touch one, the game crashes.
__________________