Cano Map Format 2 - ZaneDubya/MedievaLandsPublic GitHub Wiki
New map format 2
Map is stored as tiles. Tiles are read left to right, top to bottom.
Data types
- u8 = unsigned byte
- u16 = unsigned short
- u32 = unsigned int
- i7 = "7-bit integer", a number that ranges from 0-2 billion. Values between 0-127 fit in one byte. 128-16383 fit in 2 bytes. Values less than 2 million fit in 3 bytes. This data type optimizes files size when most of the values are less than 2 million, and is 1/4 the size of a 32bit integer when values are 0-127.
- sa = "Ascii-prefix", a string of ascii characters (8 bits per character, space character is 0x20), prefixed by a 7-bit integer length. It is not zero-terminated.
Map Data
Map Header:
- u16    Magic "0xD839"
- u16    Map Format "2"
Map Data:
- i7    Version "1"
- i7    Flags
- i7    Width in Tiles
- i7    Height in Tiles
Tile Data
Flags:
- i7      Flags 
          .000 0001 = Is walkable. If 0, players cannot enter tile by walk movement,
                      regardless of adjacent tile blocking.
          .000 0010 = Has blocking data. If 0, all cardinal directions are walkable as exits.
Blocking Data (if FlagBlockingData = 1):
- u8    Default blocking (can be overridden by map script)
        .... 0001 = North is default blocked
        .... 0010 = East is default blocked
        .... 0100 = South is default blocked
        .... 1000 = West is default blocked
Decoration (Deco) Data:
- i7    Deco count
        For each deco:
        i7   deco anchor
                  0 = north,
                  1 = east   (models rotate 90), 
                  2 = south  (models rotate 180), 
                  3 = west   (models rotate 270), 
                  4 = center
        i7   deco type
        .... deco data
Event Data:
7bit    Event count
        For each Event:
        7bit event type
        7bit event index (per map)
Event Types:
- 0x00 on arrive
- 0x01 on depart
- 0x10 on face n
- 0x11 on face e
- 0x12 on face s
- 0x13 on face w
- 0x20 on move n
- 0x21 on move e
- 0x22 on move s
- 0x23 on move w
- 0x30 on use item
- 0x31 on use spell/skill
- 0x40 set encounter