Difference between revisions of "Background/Arena File Format (.BK)"

From WTFwiki
Jump to navigation Jump to search
(→‎Palettes: More info from long ago)
Line 58: Line 58:
  
 
{| border='1'
 
{| border='1'
| Palette data || 256*3 BYTES || A palette
+
| Palette data || 256 * 3 BYTES || A palette
 
|-
 
|-
| Unknown || 1024 BYTES ||
+
| Palette remapping tables || 19 * 256 BYTES || See below
 +
|}
 +
 
 +
The palette remapping tables are maps from image colour indices into palette indices, for various different colour effects. The tables are for:
 +
 
 +
{| border='1'
 +
! Index !! Purpose
 +
| 0-3 | Fade to black, for shadows
 
|-
 
|-
| Unknown || 3840 BYTES ||
+
| 4 | Dark blue, for menu backgrounds
 +
|-
 +
!colspan=2| Most BK files
 +
|-
 +
| 5-8 | Saturating to white, then black-and-white (newsroom transition?)
 +
|-
 +
| 9-13 | Saturating light blue -> white (lightning flashes?)
 +
|-
 +
| 14-18 | Green (?)
 +
|-
 +
!colspan=2| Fire pit [3 palettes: normal, fire, ice]
 +
|-
 +
| ?? | TODO
 +
|-
 +
!colspan=2| Desert [4 palettes]
 +
| 5-18 | Slow fade to white
 
|}
 
|}
  

Revision as of 21:28, 24 November 2009

The BK file format is similar in many ways to the AF file format, however, there are some signifigant differences.

Header

Unknown 1 DWORD 0 for INTRO, 2 for ending cutscenes,4 for main menu/newsroom/VS/Mechlab/melee, 6 for credits,

8 for Arena0, 16 for Arena1, 32 for Arena2, 64 for Arena3 and 128 for Arena4

Unknown 1 BYTE ? 1, 2 or variable
Width 1 WORD Background width (always 320?)
Height 1 WORD Background height (always 200?)

Animations

Each animation is preceded by the offset of the next animation stored as a DWORD, along with an animation number. Reading the animation and advancing the file pointer should result in the file pointer being the same as the next animation offset. An animation number >= 50 marks the end of the animations section. When this occurs, the next animation offset is set to the offset of the current animation.

Next animation 1 DWORD Position of next animation relative to start of file, in bytes
Animation number 1 BYTE Unique identifier for animation

Animation Header

Unknown 1 BYTE Nul padding?
Unknown 1 BYTE
Unknown 1 BYTE
Unknown 1 BYTE
Unknown 1 WORD
Unknown 1 BYTE
Something size 1 WORD
Something N BYTES Size is determined by the previous value

There then follows an animation structure (see .AF file format).

Footer

After the animations there is a footer structure:

Background image W*H BYTES W and H are the width and height in the file header
Num palettes 1 BYTE Specifies the number of palettes which follow

Palettes

Palette data 256 * 3 BYTES A palette
Palette remapping tables 19 * 256 BYTES See below

The palette remapping tables are maps from image colour indices into palette indices, for various different colour effects. The tables are for:

Index Purpose Fade to black, for shadows
Dark blue, for menu backgrounds
Most BK files
Saturating to white, then black-and-white (newsroom transition?)
Saturating light blue -> white (lightning flashes?)
Green (?)
Fire pit [3 palettes: normal, fire, ice]
TODO
Desert [4 palettes] Slow fade to white

Rest of footer

Unknown 30 BYTES

Sample Implementations

Sample python parser for .af and .bk files