pr_obj_reference
pr_obj_reference
- The player object consists of four relative pointers, with them being
respectively for the Cells,
Sprites, Scripts and Palettes sections. Also has padding.
- Every other object follows the default object structure, being three
relative pointers to respectively,
the Cells, Sprites and Scripts sections. Ultimately they only don't have the
palettes section. Also has
padding.
- The Cells section consists of multiple relative pointers as well, each one
pointing to an individual
cell. Also has padding.
- Just like the Cells section, the Sprites section consists of multiple
relative pointers, each one
pointing to an individual sprite. Also has padding.
- Each sprite begins with a short 16-bytes long header that translated to the
following:
Offset 0x0: Mode (ushort)
Offset 0x2: clut (ushort)
Offset 0x4: Bit Depth (ushort)
Offset 0x6: Width (ushort)
Offset 0x8: Height (ushort)
Offset 0xA: tw (ushort)
Offset 0xC: th (ushort)
Offset 0xE: hash (ushort)
- Then if mode is 0, the sprite will be uncompressed, so each byte (or half
for 4 bpp) corresponds to
a pixel, with their value being the index of the color they should use from
the provided palette.
when a literal:
8 bits: pixel 1
8 bits: pixel 2
when a token
9 bits: token offset
7 bits: token length
- For the Scripts section, things get slightly more complex, refer to the
scripts documentation for
proper info on that.
- For the Palettes section, there will be also multiple relative pointers,
each one pointing to an
individual palette, which all also have the same header as sprites, but
currently only the mode, clut and
bit depth field seems to be used, with mode always being "3", clut always
being "0x20", and the bit depth
telling the game in which order to read the palette and how many colors.
- After that, there will be 256 Big-Endian RGBA (with half alpha) colors.
- For embedded palettes, if a sprite is in 4 bpp, there will only be 16
colors.