Free Hero Mesh

Check-in [8179bf273f]
Login
This is a mirror of the main repository for Free Hero Mesh. New tickets and changes will not be accepted at this mirror.
Overview
Comment:Improve file format documentation
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 8179bf273f1f022037e6f8b02cd879d7d4c9bdec
User & Date: user on 2022-04-03 17:21:43
Other Links: manifest | tags
Context
2022-04-06
18:46
Implement "(DefaultImage <number> mod <number>)". check-in: 7b28d8159e user: user tags: trunk
2022-04-03
17:21
Improve file format documentation check-in: 8179bf273f user: user tags: trunk
2022-04-02
23:11
Add fileformat.doc check-in: 13c67423df user: user tags: trunk
Changes

Modified fileformat.doc from [c3548872c8] to [490957ffa7].

18
19
20
21
22
23
24

25
































































26
27
28
29
30
31
32

=== level/*.LVL ===

This lump containts the definition of a single level.

The lump name is the level ID number followed by ".LVL".


(TODO)


































































=== level/CLASS.DEF ===

Associates class names and user-defined message names with numbers, which
are used to refer to them in the other "*.LVL" lumps (all classes and
user-defined messages used must be listed here, but there may also be







>
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97

=== level/*.LVL ===

This lump containts the definition of a single level.

The lump name is the level ID number followed by ".LVL".

The header is six bytes:

* Level version number (small-endian 16-bits).

* Level code number (small-endian 16-bits).

* Width (one byte): The low 6-bits are one less than the playfield width.
(The high 2-bits are reserved for future use.)

* Height (one byte): The low 6-bits are one less than the playfield height.
(The high 2-bits are reserved for future use.)

The null-terminated title follows, and may include formatting codes.

After the title is the objects. Start with X=0 and Y=1 (the coordinates are
1-based). Each one starts by the flag byte:

* If it is 0xFF then there are no more objects.

* If it is 0xFE then start over from the beginning (X=0 and Y=1), but any
further objects will be in the bizarro world.

* The bit6, bit5, bit4 are used to determine the coordinates. If bit6 is
set then advance the X coordinate by 1. If bit5 is set then one byte with
the X coordinate follows. If bit4 is set then one byte with the Y
coordinate follows. (Bit4 and bit6 should not both be set.)

* If bit7 is set then it is MRU. In this case, the low 4-bits are the
run count. There are two MRUs; one of them is stored and retrieved if
any of bit6/bit5/bit4 are set, and the other is used if none of them are.
If the run count is nonzero, then that is the number of further objects
after the first one; each one advances the X coordinate by one (leaving
off for the next command at that object's location), and they always use
the MRU for the bit6/bit5/bit4 set instead of clear.

* If bit7 is clear then it is a single non-MRU object (which will be
stored in the appropriate MRU slot, as mentioned, and will also be
placed in the level playfield). In this case, bit3 is set if any of
the Misc1/Misc2/Misc3 are used or clear if they are all zero, and the
low 3-bits are the Dir variable of this object (0=east).

Objects within a cell should be ordered bottom to top, and otherwise
should be ordered starting from top left and going right.

A non-MRU object has the following data:

* Class number: Only the low 14-bits are used for the class number. If
the high bit is set, then it uses the lowest numbered default image for
this class, otherwise the image number is specified explicitly.

* Image number: One byte; not present if bit15 of the class number is
set. (Zero is the first image number.)

* If the bit3 of the flag byte is set, then the next byte specifies
the types of the Misc values. The high two bits specify how many Misc
values are used; if this is zero, then Misc2 and Misc3 are used but
Misc1 is not used. The low 2-bits are the type of Misc1, the next are
type of Misc2, and then type of Misc3. The types are: 0=number, 1=class,
2=message, 3=string.

* The Misc values follow (according to the Misc type byte); each
one that exists is a small-endian 16-bit number.

After the objects is zero or more level strings, each of which is
null-terminated, and may have formatting codes. The first level string
is numbered zero (for the purpose of referencing by Misc values).


=== level/CLASS.DEF ===

Associates class names and user-defined message names with numbers, which
are used to refer to them in the other "*.LVL" lumps (all classes and
user-defined messages used must be listed here, but there may also be
118
119
120
121
122
123
124


125






























126
127
128
129
130
131
132
amount is based on.


=== xclass/*.IMG ===

A picture; the part of the name before the dot is the picture name.



(TODO)
































=== xclass/*.WAV ===

A user-defined sound effect. The part of the lump name before the dot is
the name used to refer to it in a class definition file; the exclamation
mark is not included in the lump name.







>
>
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
amount is based on.


=== xclass/*.IMG ===

A picture; the part of the name before the dot is the picture name.

The beginning of this lump data specifies how many variants and their
formats and sizes, as follows:

* The first byte has the number of variants in the low nybble, and the
format of the first variant in the high nybble.

* Next is bytes for variants other than the first. The second variant
has the low nybble, the third variant has the high nybble, etc.

* Next is the sizes (one byte each) for each variant, in order. The
size can be any number from 1 to 255; the width and height of the
picture are both this number.

The format numbers are 0 to 7 for compressed format, where the number
indicates the order of the pixels (horizontally or vertically, up, down,
left, right). If the format number is 15 then it is uncompressed and
the pixels are stored in the usual order (starting from top left).

After that is the data for each picture variant.

A compressed picture is stored by the sequence of bytes as follows:

* 0 to 84 = Homogeneous run (2 or more pixels). Follow by one byte being
the pixel value. If the previous command is also a homogeneous run and
is the same colour, then the run count is 85 times one more than the first
byte, otherwise the run count is two plus the first byte.

* 85 to 169 = Heterogeneous run (1 to 85 pixels). Follow by that many
bytes being the pixel values (palette index).

* 170 to 254 = Copy-above run (1 to 85 pixels). Copies the specified
number of pixels from the previous scanline. (If this crosses multiple
scanlines, it continues copying it.)


=== xclass/*.WAV ===

A user-defined sound effect. The part of the lump name before the dot is
the name used to refer to it in a class definition file; the exclamation
mark is not included in the lump name.