Difference between revisions of "HAR File Format (.AF)"

From WTFwiki
Jump to navigation Jump to search
(→‎Animation: Added sprite information)
Line 55: Line 55:
 
|}
 
|}
  
==== Extra Animation Strings ====
+
=== Extra Animation Strings ===
 
{| border="1"
 
{| border="1"
 
|String Length || 1 WORD || Length of string
 
|String Length || 1 WORD || Length of string
Line 64: Line 64:
 
|-
 
|-
 
|}
 
|}
 +
 +
=== Sprites ===
 +
 +
There then follow N sprites, where N is the frame count specified in the animation header. The sprite header is as follows:
 +
 +
{| border='1'
 +
|Length || 1 WORD || Length of sprite
 +
|-
 +
|X Position || 1 SIGNED WORD || TODO
 +
|-
 +
|Y Position || 1 SIGNED WORD || TODO
 +
|-
 +
|Width || 1 WORD || Width of the sprite, in pixels
 +
|-
 +
|Height || 1 WORD || Height of the sprite, in pixels
 +
|-
 +
|Mirrored || 1 BYTE || Is the sprite Mirrored
 +
|-
 +
|}
 +
 +
If the sprite's mirrored value is '''non''' zero, the sprite data appears elsewhere and the sprite data is fetched from the sprite whose '''index''' value is the current's sprite's ''mirrored'' value.
 +
 +
If the sprite is '''not''' mirrored, Length bytes of sprite data follow. The sprite data is decoded thusly:
 +
 +
* Initalize X and Y to 0
 +
* Read 1 WORD as P
 +
* Modulus P by 4 to get OPCODE
 +
* Integer divide P by 4 to get DATA
 +
* Compare the OPCODE against the following and take that action
 +
<ol start="0">
 +
<li>Set X to DATA</li>
 +
<li><ul><li>While DATA is greater than 0</li><ul><li>Read 1 BYTE</li><li>Store that byte as the pixel at X,Y in the sprite</li><li>Increment X</li><li>Decrement DATA</li></ul></ul></li>
 +
<li>Set Y to DATA</li>
 +
<li>End of sprite data</li>
 +
</ol>
  
 
''' TO BE COMPLETED '''
 
''' TO BE COMPLETED '''

Revision as of 17:15, 21 November 2009

The AF files contain all the information related to HARs; sprites, key-combos, projectile sprites, base damage, etc. The format is not entirely understood but a large portion has been dissected and understood. All AF files are broken up into the following sections:

Fighter Header

This contains the basic data about the HAR. Unmodified speeds, endurance, power, etc.

HAR Number 1 WORD Must be the same number as in the filename eg: FIGHTR1.AF
Unknown Data 3 bytes ?
Endurance 3 bytes Max is 2,143,755. Above or below that results in permanantly stunned state.
Unknown Data 1 byte ?
Power 1 WORD Damage Resistance, max is 8717.
Forward Speed 1 signed DWORD Speed at which the HAR moves towards opponent
Backward Speed 1 signed DWORD Speed at which HAR retreats from opponent
Upward Speed 1 signed DWORD Initial jump speed, this should be negative
Downward Speed 1 signed DWORD How quickly the HAR falls while being airborne, should be positive
Unknown Data 1 WORD ?

Animation

Animation Header

Animation Number 1 BYTES Unique Identifier for animation
Unknown Data 8 BYTES Zero padding?
Overlay Amount 1 WORD TODO
Frame Count 1 BYTE How many frames in this animation
Overlay Table N DWORDS TODO

Animation String Header

String Length 1 DWORD Length of the string
String N BYTES Animation string
Unknown Data 1 BYTE ?
Number of Extra Strings 1 BYTE How many other animation strings there are

Extra Animation Strings

String Length 1 WORD Length of string
String N BYTES Extra Animation String
Unknown Data 1 BYTE ?

Sprites

There then follow N sprites, where N is the frame count specified in the animation header. The sprite header is as follows:

Length 1 WORD Length of sprite
X Position 1 SIGNED WORD TODO
Y Position 1 SIGNED WORD TODO
Width 1 WORD Width of the sprite, in pixels
Height 1 WORD Height of the sprite, in pixels
Mirrored 1 BYTE Is the sprite Mirrored

If the sprite's mirrored value is non zero, the sprite data appears elsewhere and the sprite data is fetched from the sprite whose index value is the current's sprite's mirrored value.

If the sprite is not mirrored, Length bytes of sprite data follow. The sprite data is decoded thusly:

  • Initalize X and Y to 0
  • Read 1 WORD as P
  • Modulus P by 4 to get OPCODE
  • Integer divide P by 4 to get DATA
  • Compare the OPCODE against the following and take that action
  1. Set X to DATA
    • While DATA is greater than 0
      • Read 1 BYTE
      • Store that byte as the pixel at X,Y in the sprite
      • Increment X
      • Decrement DATA
  2. Set Y to DATA
  3. End of sprite data

TO BE COMPLETED