FS2_Open
Open source remastering of the Freespace 2 engine
packunpack.cpp File Reference
#include "anim/animplay.h"
#include "anim/packunpack.h"
#include "bmpman/bmpman.h"
#include "graphics/2d.h"

Go to the source code of this file.

Functions

void anim_check_for_palette_change (anim_instance *instance)
 
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)
 
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...
 
void convert_24_to_16 (int bit_24, ushort *bit_16)
 Convert a 24 bit value to a 16 bit value. More...
 
int unpack_pixel (anim_instance *ai, ubyte *data, ubyte pix, int aabitmap, int bpp)
 Unpack a pixel given the passed index and the anim_instance's palette. More...
 
int unpack_pixel_count (anim_instance *ai, ubyte *data, ubyte pix, int count=0, int aabitmap=0, int bpp=8)
 Unpack a pixel given the passed index and the anim_instance's palette. 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_set_palette (anim *ptr)
 Set animation palette. More...
 

Variables

const int packer_code = PACKER_CODE
 
const int transparent_code = 254
 

Function Documentation

void anim_check_for_palette_change ( anim_instance instance)

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_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 convert_24_to_16 ( int  bit_24,
ushort bit_16 
)

Convert a 24 bit value to a 16 bit value.

Parameters
bit_2424 bit value
bit_1616 bit value (output)

Definition at line 485 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.

int unpack_pixel ( anim_instance ai,
ubyte data,
ubyte  pix,
int  aabitmap,
int  bpp 
)

Unpack a pixel given the passed index and the anim_instance's palette.

Returns
Bytes stuffed

Definition at line 497 of file packunpack.cpp.

int unpack_pixel_count ( anim_instance ai,
ubyte data,
ubyte  pix,
int  count = 0,
int  aabitmap = 0,
int  bpp = 8 
)

Unpack a pixel given the passed index and the anim_instance's palette.

Returns
Bytes stuffed

Definition at line 580 of file packunpack.cpp.

Variable Documentation

const int packer_code = PACKER_CODE

Definition at line 18 of file packunpack.cpp.

const int transparent_code = 254

Definition at line 19 of file packunpack.cpp.