Jump to content

Tile set file: Difference between revisions

(Created page with "Tile set files contain the GBA tiles (8x8 px, 4 bpp) used by tile maps. Boktai 1 only has a few of these files (11), while Boktai 2 and 3 only have one each. Tile set files contain multiple "parts", and each part can be loaded individually instead of having to load the entire file at once. Tile sets are loaded by engine call 0x11d4 by specifying the file ID and part ID(s). The requested parts are directly copied from the tile...")
 
 
Line 3: Line 3:
= File format =
= File format =


There are two versions of the tile set file format. Boktai 2 and 3 use a different version than Boktai 1. There's an extra field in the header, but the remainder of the file format is the same:
There are two versions of the tile set file format. Boktai 2 and 3 use a different version than Boktai 1: starting with Boktai 2, the <code>tileRefCount</code> field has been expanded from a 16-bit to a 32-bit integer.


<syntaxhighlight lang="c">
<syntaxhighlight lang="c">
// Boktai 1:
// Boktai 1:
struct TileSetFile_B1 {
struct TileSetFile_B1 {
   /* offset 0x00 */ u16 partCount; // Number of parts in this file
   /* offset 0x00 */ u16 partCount;   // Number of elements in the parts[] array
   /* offset 0x02 */ u16 unknown_0x02;
   /* offset 0x02 */ u16 tileRefCount; // Number of elements in the tileReferences[] array
   /* offset 0x04 */ u32 unknown_0x04;
   /* offset 0x04 */ u16 tileCount;    // Number of elements in the tiles[] array
  /* offset 0x06 */ u16 unknown_0x06;


   // Byte offset from start of this file to the parts array
   // Byte offset from start of this file to the parts array
Line 22: Line 23:


   TileSetPart parts[partCount];
   TileSetPart parts[partCount];
   u16 tileReferences[];
   u16 tileReferences[tileRefCount];
   GBA_Tile tileData[]; // 32 bytes per tile
   GBA_Tile tileData[tileCount]; // 32 bytes per tile
};
};


// Boktai 2 and 3:
// Boktai 2 and 3:
struct TileSetFile_B2 {
struct TileSetFile_B2 {
   /* offset 0x00 */ u16 partCount; // Number of parts in this file
   /* offset 0x00 */ u16 partCount;   // Number of elements in the parts[] array
   /* offset 0x02 */ u16 unknown_0x02;
   /* offset 0x02 */ u16 unknown_0x02;
   /* offset 0x04 */ u32 unknown_0x04;
   /* offset 0x04 */ u32 tileRefCount; // Number of elements in the tileReferences[] array
   /* offset 0x08 */ u32 unknown_0x08;
   /* offset 0x08 */ u32 tileCount;   // Number of elements in the tiles[] array


   /* offset 0x0c */ u32 offsetToPartList;
   /* offset 0x0c */ u32 offsetToPartList;
Line 38: Line 39:


   TileSetPart parts[partCount];
   TileSetPart parts[partCount];
   u16 tileReferences[];
   u16 tileReferences[tileRefCount];
   GBA_Tile tileData[]; // 32 bytes per tile
   GBA_Tile tileData[tileCount]; // 32 bytes per tile
};
};