FS2_Open
Open source remastering of the Freespace 2 engine
animplay.cpp File Reference
#include "anim/animplay.h"
#include "anim/packunpack.h"
#include "bmpman/bmpman.h"
#include "cfile/cfile.h"
#include "cmdline/cmdline.h"
#include "globalincs/linklist.h"
#include "graphics/2d.h"
#include "io/timer.h"
#include "pcxutils/pcxutils.h"
#include "render/3d.h"

Go to the source code of this file.

Macros

#define MAX_ANIM_INSTANCES   25
 

Functions

void anim_init ()
 Initialise animation. More...
 
void anim_render_all (int screen_id, float frametime)
 Display the frames for the currently playing anims. More...
 
void anim_render_one (int screen_id, anim_instance *ani, float frametime)
 Display the frames for the passed animation. More...
 
void anim_play_init (anim_play_struct *aps, anim *a_info, int x, int y, int base_w, int base_h)
 Setup an anim_play_struct for passing into anim_play(). More...
 
anim_instanceanim_play (anim_play_struct *aps)
 Will add an anim instance to the anim_render_list. This will cause the anim to be played at the x,y position specified in the parameter list. More...
 
int anim_show_next_frame (anim_instance *instance, float frametime)
 This function is called to blit the next frame of an anim instance to the screen. This is normally called by the anim_render_all() function. More...
 
int anim_stop_playing (anim_instance *instance)
 Stop an anim instance that is on the anim_render_list from playing. More...
 
void anim_release_render_instance (anim_instance *instance)
 Free a particular animation instance that is on the anim_render_list. Do not call this function to free an animation instance in general (use free_anim_instance() for that), only when you want to free an instance that is on the anim_render_list. More...
 
void anim_release_all_instances (int screen_id)
 Free all anim instances that are on the anim_render_list. More...
 
void anim_read_header (anim *ptr, CFILE *fp)
 
animanim_load (char *real_filename, int cf_dir_type, int file_mapped)
 Load an animation. This stores the compressed data, which instances of the animation can reference. Must be free'ed later with anim_free(). More...
 
int anim_free (anim *ptr)
 Free an animation that was loaded with anim_load(). More...
 
int anim_playing (anim_instance *ai)
 Return if an anim is playing or not. More...
 
void anim_level_init ()
 Called at the beginning of a mission to initialize any mission dependent anim data. More...
 
void anim_level_close ()
 Called after the end of a mission to clean up any mission dependent anim data. More...
 
int anim_write_frames_out (char *filename)
 Write the frames of a .ani file out to disk as .pcx files. More...
 
void anim_display_info (char *real_filename)
 Display information and statistics about a .ani file. More...
 
void anim_reverse_direction (anim_instance *ai)
 
void anim_pause (anim_instance *ai)
 
void anim_unpause (anim_instance *ai)
 
void anim_ignore_next_frametime ()
 
int anim_instance_is_streamed (anim_instance *ai)
 
unsigned char anim_instance_get_byte (anim_instance *ai, int offset)
 

Variables

animfirst_anim = NULL
 
anim_instance anim_free_list
 
anim_instance anim_render_list
 
anim_instance anim_render_instance [MAX_ANIM_INSTANCES]
 
int Anim_paused
 
int Anim_inited = FALSE
 Global variable to pause the playing back of anims. More...
 
fix t1
 
fix t2
 
int Anim_ignore_frametime =0
 

Macro Definition Documentation

#define MAX_ANIM_INSTANCES   25

Definition at line 31 of file animplay.cpp.

Function Documentation

void anim_display_info ( char *  real_filename)

Display information and statistics about a .ani file.

This is called when -i switch is on when running ac.exe

Definition at line 947 of file animplay.cpp.

int anim_free ( anim ptr)

Free an animation that was loaded with anim_load().

All instances referencing this animation must be free'ed or get an assert.

Definition at line 813 of file animplay.cpp.

void anim_ignore_next_frametime ( )

Definition at line 1062 of file animplay.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.

unsigned char anim_instance_get_byte ( anim_instance ai,
int  offset 
)

Definition at line 1073 of file animplay.cpp.

int anim_instance_is_streamed ( anim_instance ai)

Definition at line 1067 of file animplay.cpp.

void anim_level_close ( )

Called after the end of a mission to clean up any mission dependent anim data.

Definition at line 887 of file animplay.cpp.

void anim_level_init ( )

Called at the beginning of a mission to initialize any mission dependent anim data.

Todo:
Redundant?

Definition at line 880 of file animplay.cpp.

anim* anim_load ( char *  real_filename,
int  cf_dir_type,
int  file_mapped 
)

Load an animation. This stores the compressed data, which instances of the animation can reference. Must be free'ed later with anim_free().

Parameters
real_filenameFilename of animation
cf_dir_type
file_mappedWhether to use memory-mapped file or not.

Memory-mapped files will page in the animation from disk as it is needed, but performance is not as good.

Returns
Pointer to anim that is loaded if sucess, NULL if failure.

Definition at line 687 of file animplay.cpp.

void anim_pause ( anim_instance ai)

Definition at line 1052 of file animplay.cpp.

anim_instance* anim_play ( anim_play_struct aps)

Will add an anim instance to the anim_render_list. This will cause the anim to be played at the x,y position specified in the parameter list.

Parameters
apsCompressed animation that we should make an instance from
Returns
If success pointer to instance, NULL if anim anim could not be played

Definition at line 143 of file animplay.cpp.

void anim_play_init ( anim_play_struct aps,
anim a_info,
int  x,
int  y,
int  base_w,
int  base_h 
)

Setup an anim_play_struct for passing into anim_play().

Will fill in default values, which you can then change before calling anim_play().

Definition at line 117 of file animplay.cpp.

int anim_playing ( anim_instance ai)

Return if an anim is playing or not.

Definition at line 866 of file animplay.cpp.

void anim_read_header ( anim ptr,
CFILE fp 
)

Definition at line 607 of file animplay.cpp.

void anim_release_all_instances ( int  screen_id)

Free all anim instances that are on the anim_render_list.

Parameters
screen_idOptional parameter that lets you only free a subset of the anim instances. A screen_id of 0 is the default value, and this is used for animations that always play when they are placed on the aim_render_list.

Definition at line 567 of file animplay.cpp.

void anim_release_render_instance ( anim_instance instance)

Free a particular animation instance that is on the anim_render_list. Do not call this function to free an animation instance in general (use free_anim_instance() for that), only when you want to free an instance that is on the anim_render_list.

Definition at line 538 of file animplay.cpp.

void anim_render_all ( int  screen_id,
float  frametime 
)

Display the frames for the currently playing anims.

Definition at line 67 of file animplay.cpp.

void anim_render_one ( int  screen_id,
anim_instance ani,
float  frametime 
)

Display the frames for the passed animation.

It will ignore animations which do not have the same id as the passed screen_id

Definition at line 93 of file animplay.cpp.

void anim_reverse_direction ( anim_instance ai)

Definition at line 1019 of file animplay.cpp.

int anim_show_next_frame ( anim_instance instance,
float  frametime 
)

This function is called to blit the next frame of an anim instance to the screen. This is normally called by the anim_render_all() function.

Parameters
instancePointer to animation instance
frametimeTime elapsed since last call, in seconds

Definition at line 254 of file animplay.cpp.

int anim_stop_playing ( anim_instance instance)

Stop an anim instance that is on the anim_render_list from playing.

Definition at line 522 of file animplay.cpp.

void anim_unpause ( anim_instance ai)

Definition at line 1057 of file animplay.cpp.

int anim_write_frames_out ( char *  filename)

Write the frames of a .ani file out to disk as .pcx files.

Use naming convention: filename0000.pcx, filename0001.pcx etc.

Returns
If success 0, or if failed -1

Definition at line 898 of file animplay.cpp.

Variable Documentation

anim_instance anim_free_list

Definition at line 28 of file animplay.cpp.

int Anim_ignore_frametime =0

Definition at line 39 of file animplay.cpp.

int Anim_inited = FALSE

Global variable to pause the playing back of anims.

Definition at line 35 of file animplay.cpp.

int Anim_paused

Definition at line 34 of file animplay.cpp.

anim_instance anim_render_instance[MAX_ANIM_INSTANCES]

Definition at line 32 of file animplay.cpp.

anim_instance anim_render_list

Definition at line 29 of file animplay.cpp.

anim* first_anim = NULL

Definition at line 27 of file animplay.cpp.

fix t1

Definition at line 37 of file animplay.cpp.

fix t2

Definition at line 37 of file animplay.cpp.