Free Hero Mesh

Artifact [675214e6a2]
Login
This is a mirror of the main repository for Free Hero Mesh. New tickets and changes will not be accepted at this mirror.

Artifact 675214e6a2e14eea6721b98c0a06c6ed8252c094:

Wiki page [Picture file format] by zzo38 on 2018-08-18 06:12:00.
D 2018-08-18T06:12:00.027
L Picture\sfile\sformat
P c7434a2e2d6c8ba54f8ad2549600afc956c90df4
U zzo38
W 3193
This document describes the format of the <tt>.xclass</tt> files. This file is a [Hamster archive]; all numbers are small-endian (except lump sizes). The possible lumps are mentioned below.

Despite the page title, this file contains both pictures and sounds.

<h2>*.IMG</h2>
Replace the asterisk with the name of the picture (which is case-insensitive; this name is used in the [Class definition file|<tt>.class</tt> file] to identify the picture).

This lump has a header, as follows:
  *  The low nybble of the first byte of the header specifies how many picture variants there are (from 1 to 15).
  *  After that is a number of bytes equal to the number of picture variants; each one is a number from 1 to 255 indicating the picture size (the width and height are both equal to this number, so the pictures are always square).
  *  After that is a number of bytes equal to half of the number of picture variants, rounding down. The first picture uses the high nybble of the first byte of the header; other than that, in this section, they use one nybble, where the low nybbles come first. These specify the encoding format.

Encoding formats:
  *  0 = Compressed; order by y asc, x asc
  *  1 = Compressed; order by y asc, x desc
  *  2 = Compressed; order by y desc, x asc
  *  3 = Compressed; order by y desc, x desc
  *  4 = Compressed; order by x asc, y asc
  *  5 = Compressed; order by x desc, y asc
  *  6 = Compressed; order by x asc, y desc
  *  7 = Compressed; order by x desc, y desc
  *  15 = Uncompressed; order by y asc, x asc

After the header, each picture is encoded (with no terminators or separators), in order. If the uncompressed format is used, it is just a list of pixels (one byte per pixel; indexed colour). If the compressed formats are used, then it is the sequence of commands as follows:
  *  0-84: Homogeneous run. Follow by one byte (the pixel value), which is output 1-85 times. If another homogeneous run immediately follows and the same pixel value is specified, the ones after the first in the chain must multiply their length by 85 to determine how much to run.
  *  85-169: Heterogeneous run. Follow by 1-85 more bytes (pixel values) which are output.
  *  170-254: Copy-above run. Has no parameters; 1-85 pixels are copied from the previous row (or column, for formats 4-7); if there isn't anything to copy then a pixel value of zero (transparency) is assumed. If another copy-above run immediately follows, the ones after the first in the chain must multiply their length by 85 to determine how much to run.
  *  255: Invalid code. (Future versions of this program may define its meaning, but currently it is undefined.)

If there is more than one picture variant, it will automatically decide which one to load, based on the imageSize and altImage [.heromeshrc|resources]. Integer scaling may be used to make the pictures larger than specified in this file if a picture of the correct size cannot be found; it will not attempt to shrink pictures or to enlarge them by any factor other than an integer, though.

<h2>*.WAV</h2>
Replace the asterisk with the name of the sound. The data of this lump is a RIFF WAVE file.
Z dabada0e3088e42618d757872f15379f