Alien Trilogy BND: Difference between revisions
imported>LexSafonov No edit summary |
imported>LexSafonov No edit summary |
||
| (15 intermediate revisions by the same user not shown) | |||
| Line 213: | Line 213: | ||
=== | === Texture Mesh Section Specifications === | ||
The format of this section is poorly understood, due to the small number of experiments. However, having this description in hand, you can convert pickup / menu models. | The format of this section is poorly understood, due to the small number of experiments. However, having this description in hand, you can convert pickup / menu models. | ||
| Line 225: | Line 225: | ||
----------------------------------------------------------------------------- | ----------------------------------------------------------------------------- | ||
0x04 42 58 30 30 BX00 | |||
0x04 - section data size in bytes, BIG-ENDIAN | |||
0x04 - number of rectangles | |||
0x0... - rectangles in turn (see format below) | |||
- BX00 texture rectangle format | |||
size Comment | |||
-------------------------------------------------------------------------------- | |||
0x01 - X size (-1 pixel, i.e. 31 instead of 32, and so on) | |||
0x01 - Y size (-1 pixel) | |||
0x01 - unknown value | |||
0x01 - unknown value | |||
0x01 - X offset from the end (i.e. you need to subtract the width before using) | |||
0x01 - Y offset | |||
</pre> | </pre> | ||
</div> | </div> | ||
== T000(#1,2,3....) Texture Section == | |||
This section contains the texture. Textures are not compressed by the compression algorithm, unlike sprites, so they are easy enough to extract with third-party tools such as XWE, TiledGGD and others. In this section, the texture has dimension data. | |||
=== Texture Section Specifications === | |||
<div class="toccolours mw-collapsible" id="mw-customcollapsible-myDivision" style="width:800px; overflow:auto;"> | |||
<pre> | |||
// Alien Trilogy | |||
// Texture Section format(combine BND Format) | |||
Size Comment | |||
----------------------------------------------------------------------------- | |||
0x04 46 4F 52 4D FORM | |||
0x04 - file data size in bytes, BIG-ENDIAN | |||
0x04 50 53 58 54 PSXT (probably format identifier) | |||
- further (in no particular order?) sections INFO, TP00, CL00, BX00..... | |||
- section INFO | |||
Size Comment | |||
------------------------------------------------------------------------------- | |||
0x04 49 4E 46 4F INFO | |||
0x04 - section data size in bytes, BIG-ENDIAN | |||
0x02 - texture size X | |||
0x02 - texture size Y | |||
0x0C - unknown information, 12 bytes | |||
- section TP00 | |||
here WxH pixels. each pixel = 1 byte. shift to the palette of the current screen. can be found in PALS / WSELECT.PAL (768 bytes, 3 bytes for each color, multiplied by 4 for each component, for 8-bit color variations) | |||
</pre> | |||
</div> | |||
<br><br> | <br><br> | ||
[[Category:Game_Alien Trilogy | Game: Alien Trilogy]] | [[Category:Game_Alien Trilogy | Game: Alien Trilogy]] | ||
Latest revision as of 15:56, 24 May 2021
Back to index | Edit this page
BND
- Format Type : File container
- Extensions: bnd and b16 for 16-bit sprites
- Platforms: PC/PS1/Sega Saturn
- Endian Order : Little Endian/Big Endian
Format Description
A container file that can store sprites, textures, models, palette, texture mesh for models. Each file is divided into "sections" that have "names". The problem with this format is that one and the same file is used for different types of data, and different types of data are specified just by "sections" within the file itself. There are the following "section names":
- F000(#1,2,3....) F? - Frame, this section is used for sprites. Most sprites have compression, do not have information about frame sizes (hardcoded into the game engine in animation structures)
- T000(#1,2,3....) T? - Texture, in this section there are standard "descriptions" of images - size, color, no compression, resources can be ripped out with tools such as XWE, TiledGGD.
- M000(#1,2,3....) M? - Model, section contains models. Contains a list of vertices and quads. The peculiarity with quads is apparently due to the fact that the game was originally developed for the Sega Saturn console, which supports them in hardware better than polygon
- BX00(#1,2,3....) - Texture mesh, usually located next to the texture section and has the same numbering. Contains a "list" of quads for texturing.
- CX00(#1,2,3....) - urrently unencrypted section
- C000(#1,2,3....) - C? - Color, specific section, only available in b16 file variations. Contains a 16-bit palette.
Format Specifications
This is a generic "template" for a file. As mentioned above, the rest of the data is determined by the game by the "names / identifiers" of the sections within the file itself. As a rule - this section comes in 16-bit versions of images at the very end of the file, outside the limits of the file size. Consider this when you use these templates to develop your programs!
// Alien Trilogy // BND(B16) file format size comment ----------------------------------------------------------------------------- 0x04 46 4F 52 4D FORM 0x04 - file data size in bytes, BIG-ENDIAN 0x04 - number of sections in a file, text(string?) 0x04 - format \ section identifier(F000\T000\M000....) 0x0... - data, for each section have its own structure
F000(#1,2,3....) Sprite Section
This section contains sprites of enemies and weapons.
These files contain such sections:
Enemyes:
BURSTER.BND(B16) COLONIST.BND(B16)
DOG.BND(B16) DOGCEIL.BND(B16)
EGGS.BND(B16) FINGERS.BND(B16)
GUARD.BND(B16) HANDLER.BND(B16)
HUGGER.BND(B16) QUEEN.BND(B16)
SOLDIERSYNTH.BND(B16) WAR.BND(B16)
WARCEIL.BND(B16)
Wepons:
MM9.BND(B16) PULSE.BND(B16)
SHOTGUN.BND(B16)FLAME.BND(B16)
SMART.BND(B16)
Does not contain image size information. All sizing information is contained in the game engine in animation structures. Most of the sprites in the PC version of the game are compressed by the LZW algorithm, which works the other way around. Those. - the principle of "sliding window" is applied and subsequent pixels are built from the previous ones. The .B16 format uses in addition a section C000 with a 16-bit palette of 2 bytes per color.
Sprite Section Specifications
// Alien Trilogy // Sprite Section format(combine in Container Format) Size Comment ----------------------------------------------------------------------------- 0x04 46 4F 52 4D FORM 0x04 - File data size in bytes, BIG-ENDIAN 0x04 - Number of sections in a file, text(string?) 0x04 - Format \ section identifier F000...(Char "F" + 3 bytes section number) 0x04 - Section Lenth 0x0... - Sprite Data
Sprite decompression function
One section can contain several sprites, some of which may not be compressed. Take this into account when using the function.
void PicDecoder(uint8_t *p, uint8_t *u) {
int32_t i, offs, size;
i = 0;
while (1) {
while (1) {
i >>= 1;
if (!(i & 0xFF00)) {
i = 0xFF00 | *p;
p++;
}
if (i & 1) { break; }
*u = *p;
u++;
p++;
}
if (*p >= 96) {
offs = *p - 256;
size = 3;
p++;
} else {
size = (*p & 0xF0) >> 4;
offs = (*p & 0x0F) << 8;
p++;
offs |= *p;
p++;
if (!offs) { break; }
offs = -offs;
if (size == 5) {
size = *p + 9;
p++;
} else {
size = size + 4;
}
}
while (--size) {
*u = u[offs];
u++;
}
}
}
C000(#1,2,3....) Color Section
This section appears in B16 variants of the file. Contains a palette of colors. The format is 2 bytes per color. Apparently, this section is available only in the PC version of the game.As a rule - this section comes in 16-bit versions of images at the very end of the file, outside the limits of the file size. Consider this when you use these templates to develop your programs!
Color Section Specifications
Size Comment ----------------------------------------------------------------------------- 0x04 - C000(Char "C" + 3 bytes section number) 0x04 - Number of files allocated for the palette 0x0... - Color Data
M000(#1,2,3....) Models Section
This section contains models. Models have vertices and quads in their composition. The nuance with quads, apparently, is due to the fact that the game was originally developed for the Sega Saturn, where quads work better in hardware than polygons. Vertex coordinates have integer values! Many models have a textured mesh
These files contain such sections:
PICKMOD.BND - pickup models
OPTOBJ.BND - menu option models
OBJ3D.BND - other models
Model Section Specifications
// Alien Trilogy // Model Section format(combine in Container Format) Size Comment ----------------------------------------------------------------------------- 0x04 46 4F 52 4D FORM 0x04 - File data size in bytes, BIG-ENDIAN 0x04 - Number of sections in a file, text(string?) 0x04 - Format \ section identifier M000...(Char "M" + 3 bytes model number) 0x04 - Model data size in bytes, BIG-ENDIAN 0x04 4F 42 4A 31 OBJ1 0x08 00 00 00 00 00 00 00 00 Unknown value? 0x04 - The number of quads in the model. LITTLE-ENDIAN 0x04 - The number of vertices in the model? 0x14*N - Quads in turn (see format below) 0x08*N - Vertices in turn (see format below) - Quad format: Size Comment ------------------------------------------------------------------------------------------------------------------------- 0x04 - First point index. LITTLE-ENDIAN 0x04 - Second point index. LITTLE-ENDIAN 0x04 - Third point index. LITTLE-ENDIAN 0x04 - Fourth point index. Maybe -1 (0xFFFFFFFF), then this is a triangle and the third point must be duplicated. 0x02 - Quad texture index 0x02 - Some parameter. Maybe 11, then the texture should be flipped along Y (?). Maybe 128. no one knows why. - Vertices format: Size Comment ------------------------------------------------------------------------------------------------------------------------- 0x02 - X coordinate (signed, LITTLE-ENDIAN, short) 0x02 - Y coordinate (signed, LITTLE-ENDIAN, short) 0x02 - Z coordinate (signed, LITTLE-ENDIAN, short) 0x02 - Unknown value, always zero. Apparently serves to make the data multiples of 4
BX00(#1,2,3....) Texture Mesh Section
This section contains a texture mesh for models. This section has the same numbers as the texture sections. These files have the following section:
PICKGFX.BND - pickup models
PANELGFX.BND - Has a textured mesh for switches
PANEL3GF.BND - same as above
OPTGFX.BND - models from the game menu (Has a B16 option).
The most interesting thing about this section is that it is used not only for models, but also for simple textures, apparently to indicate the "required sizes" (in addition to the size of the image itself).
Texture Mesh Section Specifications
The format of this section is poorly understood, due to the small number of experiments. However, having this description in hand, you can convert pickup / menu models.
// Alien Trilogy // Texture Mesh Section format Size Comment ----------------------------------------------------------------------------- 0x04 42 58 30 30 BX00 0x04 - section data size in bytes, BIG-ENDIAN 0x04 - number of rectangles 0x0... - rectangles in turn (see format below) - BX00 texture rectangle format size Comment -------------------------------------------------------------------------------- 0x01 - X size (-1 pixel, i.e. 31 instead of 32, and so on) 0x01 - Y size (-1 pixel) 0x01 - unknown value 0x01 - unknown value 0x01 - X offset from the end (i.e. you need to subtract the width before using) 0x01 - Y offset
T000(#1,2,3....) Texture Section
This section contains the texture. Textures are not compressed by the compression algorithm, unlike sprites, so they are easy enough to extract with third-party tools such as XWE, TiledGGD and others. In this section, the texture has dimension data.
Texture Section Specifications
// Alien Trilogy // Texture Section format(combine BND Format) Size Comment ----------------------------------------------------------------------------- 0x04 46 4F 52 4D FORM 0x04 - file data size in bytes, BIG-ENDIAN 0x04 50 53 58 54 PSXT (probably format identifier) - further (in no particular order?) sections INFO, TP00, CL00, BX00..... - section INFO Size Comment ------------------------------------------------------------------------------- 0x04 49 4E 46 4F INFO 0x04 - section data size in bytes, BIG-ENDIAN 0x02 - texture size X 0x02 - texture size Y 0x0C - unknown information, 12 bytes - section TP00 here WxH pixels. each pixel = 1 byte. shift to the palette of the current screen. can be found in PALS / WSELECT.PAL (768 bytes, 3 bytes for each color, multiplied by 4 for each component, for 8-bit color variations)