SMAC MP Format ============== Research Notes (2005-04-19) Overall Structure ----------------- Bytes 1 - 10 ASCIIZ "TERRANMAP" Bytes 11 - 15 ??? 1A 05 00 00 00 Bytes 16 - 19 INT32 Width Bytes 20 - 23 INT32 Height Bytes 24 - 43 ??? ??? Byte 44 ??? 01 = flat map Bytes 45 - 47 ??? ??? Bytes 48 - 51 INT32 LabelCount Bytes 52 - 2611 STRUCT array(1..64) of Label Bytes 2612 - 2651 ??? ??? Bytes 2652 - 2731 ASCIIZ Filename Bytes 2732 - 2739 ??? ??? Bytes 2740 - ???? STRUCT array(1..(Height), 1..(Width / 2))* of MapData Bytes ???? - EOF ??? Landmass ID map? *i.e., MapData(Y, X); X and Y translate into game coordinates as follows: /\ /\ /. X=1 X=2 X=3 ... X=63 X=64 /0,\/2,\/... + ---- ---- ---- ---- ---- ---- \ 0/\ 0/\... Y=1 | 0,0 2,0 4,0 ... 124,0 126,0 \/1,\/3,\. Y=2 | 1,1 3,1 5,1 ... 125,1 127,1 /\ 1/\ 1/. Y=3 | 0,2 2,2 4,2 ... 124,2 126,2 /0,\/2,\/... Y=4 | 1,3 3,3 5,3 ... 125,3 127,3 \ 2/\ 2/\... ... | ... ... ... ... ... ... \/1,\/3,\. Y=127| 0,126 2,126 4,126 ... 124,126 126,126 /\ 3/\ 3/. Y=128| 1,127 3,127 5,127 ... 125,127 127,127 /..\/..\/... Label Struct ------------ Bytes 1 - 4 INT32 X Bytes 5 - 8 INT32 Y Bytes 9 - 40 ASCIIZ Label text MapData Struct -------------- Byte 1 BITS Flags: 00001000 Moist 00010000 Rainy 00100000 Ocean 01000000 Ocean Shelf 01100000 Just above sea level 10000000 One level above sea level 10100000 Two levels above sea level 11000000 Three levels above sea level 11100000 Four levels above sea level Byte 2 BYTE Altitude (0x3C = 10m; lower values are depth) Bytes 3 - 4 ??? ??? Byte 5 BYTE 0x00 Byte 6 BITS Flags: 01000000 Rolling 10000000 Rocky Byte 7 ??? ??? Byte 8 BYTE Tile owner (should be 0xFF) Bytes 9 - 12 BITS Flags: 00 00 00 01 Borehole 00 00 00 10 Pod? 00 00 00 80 Sensor 00 00 04 00 Airbase 00 00 10 00 Landmark? 00 00 20 00 Forest 00 00 40 00 Condenser 00 00 80 00 Mirror 00 01 00 00 River source/Aquifer 00 04 00 20 Nutrients 00 04 01 20 Energy 00 04 02 20 Minerals 00 08 00 00 Bunker 00 20 00 00 Monolith 00 80 00 00 Farm/Kelp 00 80 08 00 Farm, Enricher 04 00 00 00 Road 0C 00 00 00 Tube 10 00 00 00 Mine 20 00 00 00 Fungus 40 00 00 00 Solar/Tidal 80 00 00 00 River? Bytes 13 - 14 BITS Flags: 00 01 Mesa 00 04 Geothermal Shallows 00 10 Cluster Borehole 00 20 Nexus 01 00 Crater 04 00 Jungle 08 00 Uranium 40 00 Desert 80 00 Fresh water (sea); ??? (land) Byte 15 BYTE 0x40 Byte 16 BYTE Art ref? Bytes 17 - 44 BITS array(1..7) of INT32 = (Flags2 AND 7F FF FF FF)