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:
  1. ../common/common

Sequence

  1. [fib_chunk] fib_chunk

Type chunk

Sequence

  1. 'CHNK' header

  2. [u4:chunk_type] type

  3. [u2] header_version

  4. [u2] data_version

  5. [u4] size

  6. [u4] data_offset

Instance data

[switch-on:type]

Position: data_offset
Type Cases
chunk_type::fib fib_data
chunk_type::environment environment_data
chunk_type::object object_data
chunk_type::particle particle_data

Type fib_chunk

Sequence

  1. 'CHNK' header

  2. [232, 3, 0, 0] type

  3. [u2] header_version

  4. [u2] data_version

  5. [u4] size

  6. [u4] data_offset

Instance data

[fib_data]

Position: data_offset

Type fib_data

Sequence

  1. [u4] version

  2. [u4] revision

  3. [u4] ofs_environment_chunk

  4. [u4] ofs_object_chunk

  5. [u4] ofs_particle_chunk

Instance environment_chunk

if: ofs_environment_chunk != 0

[chunk]

Position: ofs_environment_chunk

Instance object_chunk

if: ofs_object_chunk != 0

[chunk]

Position: ofs_object_chunk

Instance particle_chunk

if: ofs_particle_chunk != 0

[chunk]

Position: ofs_particle_chunk

Type environment_data

Sequence

  1. [u4] ofs_lighting

  2. [u4] ofs_skydome

  3. [u4] ofs_editor_settings

Instance lighting_info

[lighting_info]

Position: ofs_lighting

Instance skydome_info

[skydome_info]

Position: ofs_skydome

Instance editor_settings

if: _root.fib_chunk.data.version >= 37

[editor_settings]

Position: ofs_editor_settings

Type lighting_info

Sequence

  1. if: _root.fib_chunk.data.version >= 45

    [f4] blend_time

  2. [f4] ambient

    repeat-expr: 3
  3. [f4] specular

    repeat-expr: 3
  4. [f4] upper_hemi

    repeat-expr: 3
  5. [common::vector3] position

  6. if: _root.fib_chunk.data.version >= 39

    [scene_draw_distances] min_draw_distances

  7. if: _root.fib_chunk.data.version >= 39

    [scene_draw_distances] max_draw_distances

  8. if: _root.fib_chunk.data.version >= 40

    [cull_data] cull_data

  9. if: _root.fib_chunk.data.version >= 31 and _root.fib_chunk.data.version < 39

    [f4] fog_near

  10. if: _root.fib_chunk.data.version >= 31 and _root.fib_chunk.data.version < 39

    [f4] fog_far

  11. if: _root.fib_chunk.data.version >= 31

    [f4] fog_color

    repeat-expr: 3
  12. if: _root.fib_chunk.data.version >= 36

    [f4] dir_light

    repeat-expr: 3
  13. if: _root.fib_chunk.data.version < 42

    [common::vector3] start_position

  14. if: _root.fib_chunk.data.version >= 33 and _root.fib_chunk.data.version < 42

    [common::quaternion] start_rotation

Type scene_draw_distances

Sequence

  1. [f4] fog_near

  2. [f4] fog_far

  3. [f4] post_fog_solid

  4. [f4] post_fog_fade

  5. [f4] static_object_distance

  6. [f4] dynamic_object_distance

Type cull_data

Sequence

  1. [u4] num_cull_vals

  2. [cull_val] cull_vals

    repeat-expr: num_cull_vals

Type cull_val

Sequence

  1. [u4] group_id

  2. [f4] min

  3. [f4] max

Type skydome_info

Sequence

  1. [common::u4_str] filename

  2. if: _root.fib_chunk.data.version >= 34

    [common::u4_str] sky_layer_filename

  3. if: _root.fib_chunk.data.version >= 34

    [common::u4_str] ring_layer_0_filename

  4. if: _root.fib_chunk.data.version >= 34

    [common::u4_str] ring_layer_1_filename

  5. if: _root.fib_chunk.data.version >= 34

    [common::u4_str] ring_layer_2_filename

  6. if: _root.fib_chunk.data.version >= 34

    [common::u4_str] ring_layer_3_filename

Type editor_settings

Sequence

  1. [u4] chunk_size

  2. [u4] num_saved_colors

  3. [color] saved_colors

    repeat-expr: num_saved_colors

Type color

Sequence

  1. [f4] r

  2. [f4] g

  3. [f4] b

Type object_data

Sequence

  1. [u4] num_objects

  2. [object_info] objects

    repeat-expr: num_objects

Type object_info

Sequence

  1. [common::object_id] object_id

  2. [common::lot] lot

  3. if: _root.fib_chunk.data.version >= 38

    [u4:node_type] obj_type

  4. if: _root.fib_chunk.data.version >= 32

    [u4] glom_id

  5. [common::vector3] position

  6. [common::quaternion_wxyz] rotation

  7. [f4] scale

  8. [u4] config_size

  9. Size: config_size * 2
  10. if: _root.fib_chunk.data.version >= 7

    [render_technique] render_technique

Type render_technique

Sequence

  1. [u4] num_render_attrs

  2. if: num_render_attrs > 0

    [strz] name

    Size: 64
    Encoding: ascii
  3. [render_attr] render_attrs

    repeat-expr: num_render_attrs

Type render_attr

Sequence

  1. [strz] name

    Size: 64
    Encoding: ascii
  2. [u4] num_floats

  3. [common::bool] is_color

  4. [f4] floats

    repeat-expr: 4

Type particle_data

Sequence

  1. [u4] num_particles

  2. [particle] particles

    repeat-expr: num_particles

Type particle

Sequence

  1. if: _root.fib_chunk.data.version >= 43

    [u2] priority

  2. [common::vector3] position

  3. [common::quaternion_wxyz] rotation

  4. [common::u4_wstr] effect_names

  5. if: _root.fib_chunk.data.version < 46

    [0, 0] null_terminator

  6. [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

Old Format

[L:265] - ???
[std::string] - skybox
[std::string] - “(invalid)”
[std::string] - “(invalid)”
[std::string] - “(invalid)”
[std::string] - “(invalid)”
[std::string] - “(invalid)”
[L:4] - ???
[u32] - count
[float] - ???
[float] - ???
[float] - ???
[Chunk 2001 (Objects) Structure]