FS2_Open
Open source remastering of the Freespace 2 engine
packunpack.h File Reference

Go to the source code of this file.

Classes

struct  key_frame
 
struct  anim
 
struct  anim_instance
 

Macros

#define ANI_STREAM_CACHE_SIZE   4096
 
#define PACKER_CODE   0xEE
 
#define PACKING_METHOD_RLE   0
 
#define PACKING_METHOD_RLE_KEY   1
 
#define PACKING_METHOD_STD_RLE   2
 
#define PACKING_METHOD_STD_RLE_KEY   3
 
#define STD_RLE_CODE   0x80
 
#define ANF_MEM_MAPPED   (1<<0)
 
#define ANF_STREAMED   (1<<1)
 
#define ANF_XPARENT   (1<<2)
 
#define ANF_ALL_KEYFRAMES   (1<<3)
 
#define ANIM_DIRECT_FORWARD   0
 
#define ANIM_DIRECT_REVERSE   1
 

Typedefs

typedef struct key_frame key_frame
 
typedef struct anim anim
 
typedef struct anim_instance anim_instance
 

Functions

int pack_key_frame (ubyte *frame, ubyte *save, long size, long max, int compress_type)
 Pack key frame. More...
 
int pack_frame (ubyte *frame, ubyte *frame2, ubyte *save, long size, long max, int compress_type)
 Pack frame. More...
 
ubyteunpack_frame (anim_instance *ai, ubyte *ptr, ubyte *frame, int size, ubyte *pal_translate, int aabitmap, int bpp)
 Unpack frame. More...
 
int unpack_frame_from_file (anim_instance *ai, ubyte *frame, int size, ubyte *pal_translate, int aabitmap, int bpp)
 Unpack frame from file. More...
 
void anim_init ()
 Initialise animation. More...
 
anim_instanceinit_anim_instance (anim *ptr, int bpp)
 
void free_anim_instance (anim_instance *inst)
 
int anim_get_next_frame (anim_instance *inst)
 
ubyteanim_get_next_raw_buffer (anim_instance *inst, int xlate_pal, int aabitmap, int bpp)
 
void anim_set_palette (anim *a)
 Set animation palette. More...
 
void anim_check_for_palette_change (anim_instance *inst)
 

Macro Definition Documentation

#define ANF_ALL_KEYFRAMES   (1<<3)

Definition at line 37 of file packunpack.h.

#define ANF_MEM_MAPPED   (1<<0)

Definition at line 34 of file packunpack.h.

#define ANF_STREAMED   (1<<1)

Definition at line 35 of file packunpack.h.

#define ANF_XPARENT   (1<<2)

Definition at line 36 of file packunpack.h.

#define ANI_STREAM_CACHE_SIZE   4096

Definition at line 19 of file packunpack.h.

#define ANIM_DIRECT_FORWARD   0

Definition at line 68 of file packunpack.h.

#define ANIM_DIRECT_REVERSE   1

Definition at line 69 of file packunpack.h.

#define PACKER_CODE   0xEE

Definition at line 21 of file packunpack.h.

#define PACKING_METHOD_RLE   0

Definition at line 22 of file packunpack.h.

#define PACKING_METHOD_RLE_KEY   1

Definition at line 23 of file packunpack.h.

#define PACKING_METHOD_STD_RLE   2

Definition at line 24 of file packunpack.h.

#define PACKING_METHOD_STD_RLE_KEY   3

Definition at line 25 of file packunpack.h.

#define STD_RLE_CODE   0x80

Definition at line 27 of file packunpack.h.

Typedef Documentation

typedef struct anim anim
typedef struct anim_instance anim_instance
typedef struct key_frame key_frame

Function Documentation

void anim_check_for_palette_change ( anim_instance inst)

Definition at line 21 of file packunpack.cpp.

int anim_get_next_frame ( anim_instance inst)

Definition at line 81 of file packunpack.cpp.

ubyte* anim_get_next_raw_buffer ( anim_instance inst,
int  xlate_pal,
int  aabitmap,
int  bpp 
)

Definition at line 127 of file packunpack.cpp.

void anim_init ( )

Initialise animation.

Queue all the anim_render_instance[] elements onto the anim_free_list

Definition at line 45 of file animplay.cpp.

void anim_set_palette ( anim ptr)

Set animation palette.

Todo:
Actually convert the frame data to correct palette at this point

Definition at line 1053 of file packunpack.cpp.

void free_anim_instance ( anim_instance inst)

Definition at line 68 of file packunpack.cpp.

anim_instance* init_anim_instance ( anim ptr,
int  bpp 
)

Definition at line 28 of file packunpack.cpp.

int pack_frame ( ubyte frame,
ubyte frame2,
ubyte save,
long  size,
long  max,
int  compress_type 
)

Pack frame.

Parameters
frameFrame pixel data to pack
frame2Previous frame's pixel data
saveMemory to store packed data to
sizeNumber of bytes to pack
maxMaximum number of packed bytes (size of buffer)
compress_typeCompress type
Returns
Actual number of bytes data packed to or -1 if error

Definition at line 326 of file packunpack.cpp.

int pack_key_frame ( ubyte frame,
ubyte save,
long  size,
long  max,
int  compress_type 
)

Pack key frame.

Parameters
frameFrame pixel data to pack
saveMemory to store packed data to
sizeNumber of bytes to pack
maxMaximum number of packed bytes (size of buffer)
compress_typeCompress type
Returns
Actual number of bytes data packed to or -1 if error

Definition at line 175 of file packunpack.cpp.

ubyte* unpack_frame ( anim_instance ai,
ubyte ptr,
ubyte frame,
int  size,
ubyte pal_translate,
int  aabitmap,
int  bpp 
)

Unpack frame.

Parameters
aiAnimation instance
ptrPacked data to unpack
frameWhere to store unpacked data to
sizeTotal number of unpacked pixels requested
pal_translateColor translation lookup table (NULL if no palette translation desired)
aabitmap
bpp

Definition at line 669 of file packunpack.cpp.

int unpack_frame_from_file ( anim_instance ai,
ubyte frame,
int  size,
ubyte pal_translate,
int  aabitmap,
int  bpp 
)

Unpack frame from file.

Parameters
aiAnimation instance
frameWhere to store unpacked data to
sizeTotal number of unpacked pixels requested
pal_translateColor translation lookup table (NULL if no palette translation desired)
aabitmap
bpp

Definition at line 858 of file packunpack.cpp.