+==========================================================================================+ |Commander Keen 4-6 Tileinfo format: | +==========================================================================================+ This is the tile info segment formats for Keen 4-6, Keen Dreams and a number of other ID Software and Apogee games. The tileinfo segment is stored in the executable and controls how everything interacts with tiles. In theory it is actually TWO segments, the unmasked and masked tileinfo. Each tileinfo is made up of a number of planes of data, with one byte per tile. Note TED5 users, sprite 'icons' are also counted as tiles, and can, with hacking, be placed into levels like normal tiles. +------------------------------------------------------------------------------------------+ |Basic structure: | +------------------------------------------------------------------------------------------+ ------------------------------------------------------------------------------- FILE STRUCTURE: UNMASKED: ANIMATION PLANE UNMASKED: NEXT TILE PLANE MASKED: TOP PLANE MASKED: RIGHT PLANE MASKED: BOTTOM PLANE MASKED: LEFT PLANE MASKED: ANIMATION PLANE MASKED: PROPERTIES PLANE MASKED: NEXT TILE PLANE ------------------------------------------------------------------------------- Thus as you can see there are two main parts to the tileinfo, a 2-plane unmasked segment and a 7 plane masked segment. The total tileinfo size is thus: [2 * Unm] + [7 * Msk] For Keen 4 with 1296 and 2916 tiles respectively, we get 2592 + 20412 = 23004 bytes. Known tileinfo offsets are: Keen 4: $249C2 23004 Keen 5: $25B22 Keen 6: $25212 Keen Dreams: $1FC46 11322 +------------------------------------------------------------------------------------------+ |Planes ('Flags'): | +------------------------------------------------------------------------------------------+ Each plane is simply a collection of each tile's value, each value taking up one byte of space. Thus in Keen 1, unmasked tile 0's animation and next tile values are stored at 0 and 1296 in the segment. Each plane has specific values (Also known as flags) and notes about it. ANIMATION PLANE: How long in game ticks before a tile animates. 0 is no animation. Maximum value is 255 ticks. NEXT TILE PLANE: Which tile, RELATIVE TO THIS TILE the tile will animate to. For non-animating tiles, zero. (Same tile!) For tiles like switches that animate when 'pressed' this has a value, but no animation plane value. (I.e wait until pressed) This has values between +128 to -127 (A tile can animate to one less than it.) but should NOT animate to one not in the tileset! LEFT\RIGHT PLANE: Whether Keen can walk into the tile from left or right (Actually pushes Keen out of the tile in that direction if set.) Values either 0 or 1 for 'off' and 'on' TOP PLANE: Top slope, stand-on or fall through. Values mainly between $00-$11: 0 Fall through 1 Flat 2 Top -> Middle 3 Middle -> bottom 4 Top -> bottom 5 Middle -> top 6 Bottom -> middle 7 Bottom -> top 8 Unused 9 Deadly, can't land on in God mode SPECIAL VALUES: 17 Flat with pole 33 Keen 6 giant switch on 41 Keen 6 giant switch off 57 Keen 5 fuse BOTTOM PLANE: Bottom slope, hit-head or fall through. Values mainly between 0-11: 0 Jump through 1 Flat bottom 2 Bottom-> Middle 3 Middle -> top 4 Bottom -> top 5 Middle -> bottom 6 Top -> middle 7 Top -> bottom SPECIAL VALUES: 17 Pole going through 33 Keen 6 giant switch off PROPRTIES PLANE: What the tile *does* to Keen, kill, points, etc. Different for each game and can be complex. Values are 0-255, with 'front' tiles being +128 (That is a pole tile is 1, but a 'front' pole is 129) Thus no game property can be above 127. Value Property Games 0 Nothing All 1 Pole All 2 Door All (Also Miragia entrance in Keen 4) 3 Kills All 4 100 for 1UP Keen 4-6 5 Goplat switch off Keen 4, 5 6 Goplat switch on Keen 4, 5 7 Red gem holder Keen 4-6 8 Yellow gem holder Keen 4-6 9 Blue gem holder Keen 4-6 10 Green gem holder Keen 4-6 11 Enter water from top Keen 4 12 Enter water from right Keen 4 13 Enter water from bottom Keen 4 14 Enter water from left Keen 4 15 Bridge switch Keen 4, 5 16 Moon floor tile Keen 4 17 Sprite path arrow Keen 5,6, Biomenace 1-3, Dave 3-4 18 Bridge Keen 5, 6 19 Active zapper top Keen 6 20 Teleport entrance Keen 5, 6 21 100 All 22 200 All 23 500 All 24 1000 All 25 2000 All 26 5000 All 27 1UP All 28 Stunner , flowerpot Keen 4-6, dreams 29 Unused All 30 Inactive zapper Keen 6 31 Ampton switch Keen 5 32 Keycard door Keen 5 33 Left map elevator Keen 5 34 Right map elevator Keen 5