Anim File Format

From WinWolf3D/WDC

The Blake Stone games have their own animation file format. These anim files are similiar to FLI files. Basically you start with a fullscreen image and update only the sections of that image that change.

Contents

Files

The files used by Aliens of Gold are:

  • EANIM.BS6
  • GANIM.BS6
  • IANIM.BS6 - The JAM Intro
  • SANIM.BS6 - Mission 1 Ending

The files used by Planet Strike are:

  • EANIM.VSI
  • IANIM.VSI - The JAM Intro

Instructions

The file is made of a bunch of instructions. Each instruction contains the following information:

typedef struct {
    char InstructionType[2];
    unsigned long InstructionNum;
    unsigned long DataSize;
} AnimInstructionHeader
  • InstructionType: There are only six instruction types.
Code Meaning
FIFade In
FOFade Out
GRGraphic
PAPause
SDSound
XXExit (Must be the last instruction)
  • InstructionNum: The instruction number starts at 1 and increments for each instruction. It is not known whether this number is of any actual importance or simply a reference number.
  • DataSize: This is the number of bytes in the instruction's data.

Fade In/Out

The data size for these two instructions is always 0 since there is nothing more to say about fading in and out.

Graphics

This is the most complex instruction in the file and contains strands of data that is used to update the screen's image. Note that palette data is NOT stored in the animation file. It must be provided by the program.

Initial Instruction

The first graphic instruction also contains the background color for the image. This is given as a single byte at the start of the instruction's data. Once this byte is read, the entire screen is cleared to the given color.

Strands

Graphic instructions are made up of strands of byte data that are sent to the screen. Each strand is headed by

 typedef struct {
    unsigned int HasCommand;
    unsigned int StartPixel;
    unsigned int Length;
} GraphicStrand

When you read a strand's header, you first make sure HasCommand is 1 because there is always an "empty strand" at the end of the graphics data which has a HasCommand value of 0. Once you're sure you have an actual strand, you place your pointer at "StartPixel" bytes into the screen. Then you read another "Length" bytes while updating your image.

Note that each graphic instruction has at least an "empty strand", which would mean that the screen does not change for that instruction.

Pause

The data size is always 2 and the data is an unsigned integer representing the number of tics to pause (70 tics per second).

Sound

The data size is always 2 and the data is an unsigned integer representing the AUDIOT sound chunk to play.

Exit

The final instruction. The data size is always 0.

Editors

Implementing the files in Wolfenstein 3D

This tutorial can be used to add ANIM file support to the Wolfenstein 3D code.