LYT FILES - 9 June 2011 ========= Layout File Format for the Live for Speed Racing Simulator. This document refers to the .LYT files created in the Autocross Editor. The OBJECT BLOCK is also used in the related InSim packets. TYPES : ======= 1) short : 16 bit signed integer 2) word : 16 bit unsigned 3) char : 8 bit signed integer 4) byte : 8 bit unsigned FILE DESCRIPTION : ================== num unit offset description --- ---- ------ ----------- HEADER BLOCK : 6 char 0 LFSLYT : do not read file if no match 1 byte 6 version : do not read file if > 0 1 byte 7 revision : do not read file if > 251 1 word 8 num added objects : number of OBJECT BLOCKS 1 byte 10 laps : number 1 byte 11 flags : 3 in new files - see NOTE4 ......OBJECT BLOCKS OBJECT BLOCK : 1 short 0 X : position (1 metre = 16) 1 short 2 Y : position (1 metre = 16) 1 char 4 Zchar : height (1m = 4) - see NOTE3 1 byte 5 Flags : 0 for objects - see NOTE1 1 byte 6 Index : object index - see NOTE5 1 byte 7 Heading : heading - see NOTE2 NOTE1 : ------- How to distinguish between physical objects and control objects, like start positions, checkpoints, finish line and marshall circles. if (Index >= 192) // either a circle or an unknown object { if (Index==255) // it's a marshall circle { if (Flags & 0x80) // highest bit set : restricted area { // Heading has its usual meaning // Flags byte contains the following data : // bits 0 to 1 : // 00 = no marshall // 01 = standing marshall // 10 = marshall pointing left // 11 = marshall pointing right // bits 2 to 6 : // radius in metres (1 to 31 - shifted left by 2 bits) } else // highest bit of flags is not set : route checker { // Heading is used not for heading, but the route index // bits 2 to 6 : // radius in metres (1 to 31 - shifted left by 2 bits) } } else { // unknown object - ignore } } else // could be an actual object or a control object { if (Flags & 0x80) // highest bit set : control object { // Heading has its usual meaning // Flags byte contains the following data : // bits 0 to 1 : // 00 = Start position (if width = 0) or finish line (if width > 0) // 01 = Checkpoint 1 // 10 = Checkpoint 2 // 11 = Checkpoint 3 // bits 2 to 6 : // half width in metres (1 to 31 - shifted left by 2 bits) } else // highest bit of flags is not set : autocross object { // Heading has its usual meaning // Flags byte contains the following data : // bits 0 to 2 : // Colour - only used for chalk (0-3) and tyres (0-5) } } NOTE2 : ------- Heading represents 360 degrees in 256 values. Heading = (heading_in_degrees + 180) * 256 / 360 128 : heading of zero 192 : heading of 90 degrees 0 : heading of 180 degrees 64 : heading of -90 degrees NOTE3 : ------- About Zchar, the approximate altitude : LFS does contact checks to place objects accurately on the ground. For output purposes : Zchar indicates the approximate altitude with a value from -80 (-20 metres) to 127 (31.75 metres). For input purposes : The ground check is performed with a test ray starting from 2 metres above Zchar. Using a value lower than 127 allows objects to be placed on the road below a bridge, for example. If you are creating objects from scratch and you are not sure of the approximate altitude, you can set Zchar to its maximum value (127). This will usually work unless there is a physical surface above the road where you are trying to place the object. NOTE4 : ------- If the file is saved in the most recent format, the two lowest bits of the flags byte must be set (total value 3). bit 0 : the file does not need correction for the Blackwood scaling bit 1 : the file does not need conversion for the new object indices Some very old layouts may not have bit 0 set. Layouts saved up to 0.5Z34 will not have bit 1 set. NOTE5 : ------- Object indices are now the same at all tracks. The first valid object index is 4 (AXO_CHALK_LINE). There are many gaps to allow for future objects. Valid object indices are all less than 192. AXO_NULL AXO_1 AXO_2 AXO_3 AXO_CHALK_LINE AXO_CHALK_LINE2 AXO_CHALK_AHEAD AXO_CHALK_AHEAD2 AXO_CHALK_LEFT AXO_CHALK_LEFT2 AXO_CHALK_LEFT3 AXO_CHALK_RIGHT AXO_CHALK_RIGHT2 AXO_CHALK_RIGHT3 AXO_14 AXO_15 AXO_16 AXO_17 AXO_18 AXO_19 AXO_CONE_RED AXO_CONE_RED2 AXO_CONE_RED3 AXO_CONE_BLUE AXO_CONE_BLUE2 AXO_CONE_GREEN AXO_CONE_GREEN2 AXO_CONE_ORANGE AXO_CONE_WHITE AXO_CONE_YELLOW AXO_CONE_YELLOW2 AXO_31 AXO_32 AXO_33 AXO_34 AXO_35 AXO_36 AXO_37 AXO_38 AXO_39 AXO_CONE_PTR_RED AXO_CONE_PTR_BLUE AXO_CONE_PTR_GREEN AXO_CONE_PTR_YELLOW AXO_44 AXO_45 AXO_46 AXO_47 AXO_TYRE_SINGLE AXO_TYRE_STACK2 AXO_TYRE_STACK3 AXO_TYRE_STACK4 AXO_TYRE_SINGLE_BIG AXO_TYRE_STACK2_BIG AXO_TYRE_STACK3_BIG AXO_TYRE_STACK4_BIG AXO_56 AXO_57 AXO_58 AXO_59 AXO_60 AXO_61 AXO_62 AXO_63 AXO_MARKER_CURVE_L AXO_MARKER_CURVE_R AXO_MARKER_L AXO_MARKER_R AXO_MARKER_HARD_L AXO_MARKER_HARD_R AXO_MARKER_L_R AXO_MARKER_R_L AXO_MARKER_S_L AXO_MARKER_S_R AXO_MARKER_S2_L AXO_MARKER_S2_R AXO_MARKER_U_L AXO_MARKER_U_R AXO_78 AXO_79 AXO_80 AXO_81 AXO_82 AXO_83 AXO_DIST25 AXO_DIST50 AXO_DIST75 AXO_DIST100 AXO_DIST125 AXO_DIST150 AXO_DIST200 AXO_DIST250 AXO_92 AXO_93 AXO_94 AXO_95 AXO_ARMCO1 AXO_ARMCO3 AXO_ARMCO5 AXO_99 AXO_100 AXO_101 AXO_102 AXO_103 AXO_BARRIER_LONG AXO_BARRIER_RED AXO_BARRIER_WHITE AXO_107 AXO_108 AXO_109 AXO_110 AXO_111 AXO_BANNER1 AXO_BANNER2 AXO_114 AXO_115 AXO_116 AXO_117 AXO_118 AXO_119 AXO_RAMP1 AXO_RAMP2 AXO_122 AXO_123 AXO_124 AXO_125 AXO_126 AXO_127 AXO_SPEED_HUMP_10M AXO_SPEED_HUMP_6M AXO_130 AXO_131 AXO_132 AXO_133 AXO_134 AXO_135 AXO_POST_GREEN AXO_POST_ORANGE AXO_POST_RED AXO_POST_WHITE AXO_140 AXO_141 AXO_142 AXO_143 AXO_BALE AXO_145 AXO_146 AXO_147 AXO_RAILING AXO_149 AXO_150 AXO_151 AXO_152 AXO_153 AXO_154 AXO_155 AXO_156 AXO_157 AXO_158 AXO_159 AXO_SIGN_KEEP_LEFT AXO_SIGN_KEEP_RIGHT AXO_162 AXO_163 AXO_164 AXO_165 AXO_166 AXO_167 AXO_SIGN_SPEED_80 AXO_SIGN_SPEED_50 AXO_170 AXO_171 AXO_172 AXO_173 AXO_174 AXO_175 AXO_176 AXO_177 AXO_178 AXO_179 AXO_180 AXO_181 AXO_182 AXO_183 AXO_184 AXO_185 AXO_186 AXO_187 AXO_188 AXO_189 AXO_190 AXO_191 www.lfs.net