Level (.lvl)
Note
It seems the structure is split in chunks marked by “CHNK”, somewhat similar to the IFF file format
It seems Chunks can only begin on addresses % 16 == 0, if the chunk wouldn’t start on one padding is inserted until it matches
Padding always seems to be the 0xcd byte, but that’s probably just a side effect of not writing data to it
Note
- id:
lvl
- file-extension:
lvl
- endian:
le
- imports:
../common/common
Sequence
[fib_chunk] fib_chunk
Type chunk
Sequence
'CHNK'
header[u4:chunk_type] type
[u2] header_version
[u2] data_version
[u4] size
[u4] data_offset
Instance data
[switch-on:type]
data_offset
chunk_type::fib | fib_data |
chunk_type::environment | environment_data |
chunk_type::object | object_data |
chunk_type::particle | particle_data |
Type fib_chunk
Sequence
'CHNK'
header[232, 3, 0, 0]
type[u2] header_version
[u2] data_version
[u4] size
[u4] data_offset
Instance data
[fib_data]
data_offset
Type fib_data
Sequence
[u4] version
[u4] revision
[u4] ofs_environment_chunk
[u4] ofs_object_chunk
[u4] ofs_particle_chunk
Instance environment_chunk
ofs_environment_chunk != 0
[chunk]
ofs_environment_chunk
Instance object_chunk
ofs_object_chunk != 0
[chunk]
ofs_object_chunk
Instance particle_chunk
ofs_particle_chunk != 0
[chunk]
ofs_particle_chunk
Type environment_data
Sequence
[u4] ofs_lighting
[u4] ofs_skydome
[u4] ofs_editor_settings
Instance lighting_info
[lighting_info]
ofs_lighting
Instance skydome_info
[skydome_info]
ofs_skydome
Instance editor_settings
_root.fib_chunk.data.version >= 37
[editor_settings]
ofs_editor_settings
Type lighting_info
Sequence
- if:
_root.fib_chunk.data.version >= 45
[f4] blend_time
[f4] ambient
repeat-expr:3
[f4] specular
repeat-expr:3
[f4] upper_hemi
repeat-expr:3
[common::vector3] position
- if:
_root.fib_chunk.data.version >= 39
[scene_draw_distances] min_draw_distances
- if:
_root.fib_chunk.data.version >= 39
[scene_draw_distances] max_draw_distances
- if:
_root.fib_chunk.data.version >= 40
[cull_data] cull_data
- if:
_root.fib_chunk.data.version >= 31 and _root.fib_chunk.data.version < 39
[f4] fog_near
- if:
_root.fib_chunk.data.version >= 31 and _root.fib_chunk.data.version < 39
[f4] fog_far
- if:
_root.fib_chunk.data.version >= 31
[f4] fog_color
repeat-expr:3
- if:
_root.fib_chunk.data.version >= 36
[f4] dir_light
repeat-expr:3
- if:
_root.fib_chunk.data.version < 42
[common::vector3] start_position
- if:
_root.fib_chunk.data.version >= 33 and _root.fib_chunk.data.version < 42
[common::quaternion] start_rotation
Type scene_draw_distances
Sequence
[f4] fog_near
[f4] fog_far
[f4] post_fog_solid
[f4] post_fog_fade
[f4] static_object_distance
[f4] dynamic_object_distance
Type cull_data
Sequence
[u4] num_cull_vals
[cull_val] cull_vals
repeat-expr:num_cull_vals
Type cull_val
Sequence
[u4] group_id
[f4] min
[f4] max
Type skydome_info
Sequence
[common::u4_str] filename
- if:
_root.fib_chunk.data.version >= 34
[common::u4_str] sky_layer_filename
- if:
_root.fib_chunk.data.version >= 34
[common::u4_str] ring_layer_0_filename
- if:
_root.fib_chunk.data.version >= 34
[common::u4_str] ring_layer_1_filename
- if:
_root.fib_chunk.data.version >= 34
[common::u4_str] ring_layer_2_filename
- if:
_root.fib_chunk.data.version >= 34
[common::u4_str] ring_layer_3_filename
Type editor_settings
Sequence
[u4] chunk_size
[u4] num_saved_colors
[color] saved_colors
repeat-expr:num_saved_colors
Type color
Sequence
[f4] r
[f4] g
[f4] b
Type object_data
Sequence
[u4] num_objects
[object_info] objects
repeat-expr:num_objects
Type object_info
Sequence
[common::object_id] object_id
[common::lot] lot
- if:
_root.fib_chunk.data.version >= 38
[u4:node_type] obj_type
- if:
_root.fib_chunk.data.version >= 32
[u4] glom_id
[common::vector3] position
[common::quaternion_wxyz] rotation
[f4] scale
[u4] config_size
- Size:
config_size * 2
- if:
_root.fib_chunk.data.version >= 7
[render_technique] render_technique
Type render_technique
Sequence
[u4] num_render_attrs
- if:
num_render_attrs > 0
[strz] name
Size:64
Encoding:ascii
[render_attr] render_attrs
repeat-expr:num_render_attrs
Type render_attr
Sequence
[strz] name
Size:64
Encoding:ascii
[u4] num_floats
[common::bool] is_color
[f4] floats
repeat-expr:4
Type particle_data
Sequence
[u4] num_particles
[particle] particles
repeat-expr:num_particles
Type particle
Sequence
- if:
_root.fib_chunk.data.version >= 43
[u2] priority
[common::vector3] position
[common::quaternion_wxyz] rotation
[common::u4_wstr] effect_names
- if:
_root.fib_chunk.data.version < 46
[0, 0]
null_terminator [common::u4_wstr] config_data
Enum chunk_type
- 1000:
fib
- 2000:
environment
- 2001:
object
- 2002:
particle
Enum node_type
- 0:
environment_obj
- 1:
building
- 2:
enemy
- 3:
npc
- 4:
rebuilder
- 5:
spawned
- 6:
cannon
- 7:
bouncer
- 8:
exhibit
- 9:
moving_platform
- 10:
springpad
- 11:
sound
- 12:
particle
- 13:
generic_placeholder
- 14:
error_marker
- 15:
player_start