UFO: Alien Invasion
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
r_mesh_anim.cpp File Reference

animation parsing and playing More...

#include "r_local.h"
#include "r_mesh.h"
#include "r_mesh_anim.h"

Go to the source code of this file.

Macros

#define LOOPNEXT(x)   ((x + 1 < MAX_ANIMLIST) ? x + 1 : 0)
 
#define R_AnimGetAliasAnim(mod, as)   ((mod)->alias.animdata + (as)->list[(as)->lcur])
 Get the mAliasAnim_t for the given animation state. More...
 

Functions

static void R_AnimAdd (animState_t *as, const model_t *mod, const mAliasAnim_t *anim)
 Adds the given animation to the animation state. More...
 
static const mAliasAnim_tR_AnimGet (const model_t *mod, const char *name)
 Searches a given animation id in the given model data. More...
 
void R_AnimAppend (animState_t *as, const model_t *mod, const char *name)
 Appends a new animation to the current running one. More...
 
void R_AnimChange (animState_t *as, const model_t *mod, const char *name)
 Changes the animation for md2 models. More...
 
void R_AnimRun (animState_t *as, const model_t *mod, int msec)
 Run the animation of the given model. More...
 
const char * R_AnimGetName (const animState_t *as, const model_t *mod)
 Get the current running animation for a model. More...
 

Detailed Description

animation parsing and playing

Definition in file r_mesh_anim.cpp.

Macro Definition Documentation

#define LOOPNEXT (   x)    ((x + 1 < MAX_ANIMLIST) ? x + 1 : 0)

Definition at line 30 of file r_mesh_anim.cpp.

Referenced by R_AnimAdd(), R_AnimChange(), and R_AnimRun().

#define R_AnimGetAliasAnim (   mod,
  as 
)    ((mod)->alias.animdata + (as)->list[(as)->lcur])

Get the mAliasAnim_t for the given animation state.

Definition at line 47 of file r_mesh_anim.cpp.

Referenced by R_AnimChange(), R_AnimGetName(), and R_AnimRun().

Function Documentation

static void R_AnimAdd ( animState_t as,
const model_t mod,
const mAliasAnim_t anim 
)
inlinestatic

Adds the given animation to the animation state.

Definition at line 35 of file r_mesh_anim.cpp.

References model_s::alias, mAliasModel_s::animdata, animState_s::ladd, animState_s::list, and LOOPNEXT.

Referenced by R_AnimAppend(), and R_AnimChange().

void R_AnimAppend ( animState_t as,
const model_t mod,
const char *  name 
)

Appends a new animation to the current running one.

See also
R_AnimGet
R_AnimChange
R_AnimRun
R_AnimGetName
Parameters
[in,out]asThe animation state to append the new animation to
[in]modThe model to append the animation for
[in]nameThe animation name (from the *.anm file) to append

Definition at line 84 of file r_mesh_anim.cpp.

References model_s::alias, animState_s::backlerp, animState_s::change, Com_Printf(), animState_s::dt, animState_s::frame, mAliasAnim_s::from, animState_s::ladd, animState_s::lcur, model_s::name, mAliasModel_s::num_anims, animState_s::oldframe, R_AnimAdd(), R_AnimGet(), animState_s::time, mAliasAnim_s::time, and mAliasAnim_s::to.

Referenced by CL_ActorDie(), and CL_ActorDoShoot().

void R_AnimChange ( animState_t as,
const model_t mod,
const char *  name 
)
static const mAliasAnim_t* R_AnimGet ( const model_t mod,
const char *  name 
)
static

Searches a given animation id in the given model data.

See also
R_AnimChange
R_AnimAppend
R_AnimRun
R_AnimGetName
Parameters
[in]modThe model to search the given animation id in
[in]nameThe animation name (from the *.anm file) to search
Returns
nullptr if not found, otherwise the animation data

Definition at line 59 of file r_mesh_anim.cpp.

References model_s::alias, mAliasModel_s::animdata, i, mAliasAnim_s::name, mAliasModel_s::num_anims, and Q_streq.

Referenced by R_AnimAppend(), and R_AnimChange().

const char* R_AnimGetName ( const animState_t as,
const model_t mod 
)

Get the current running animation for a model.

See also
R_AnimGet
R_AnimAppend
R_AnimRun
R_AnimChange
Parameters
[in]asThe animation state to check
[in]modThe model to check
Returns
nullptr if no animation is set or running or the name of the current running animation otherwise.

Definition at line 242 of file r_mesh_anim.cpp.

References model_s::alias, animState_s::ladd, animState_s::lcur, MAX_ANIMLIST, mAliasAnim_s::name, mAliasModel_s::num_anims, and R_AnimGetAliasAnim.

Referenced by HUD_UpdateActorCvar(), UI_DrawModelNode(), and UI_DrawModelNodeWithUIModel().

void R_AnimRun ( animState_t as,
const model_t mod,
int  msec 
)

Run the animation of the given model.

See also
R_AnimGet
R_AnimAppend
R_AnimChange
R_AnimGetName
Parameters
[in,out]asThe animation state to run
[in]modThe model to run the animation for
[in]msecThe milliseconds since this was called last

Definition at line 192 of file r_mesh_anim.cpp.

References model_s::alias, animState_s::backlerp, animState_s::change, animState_s::dt, animState_s::frame, mAliasAnim_s::from, animState_s::ladd, animState_s::lcur, LOOPNEXT, MAX_ANIMLIST, mAliasModel_s::num_anims, animState_s::oldframe, R_AnimGetAliasAnim, animState_s::time, mAliasAnim_s::time, and mAliasAnim_s::to.

Referenced by LE_Think(), LM_AddToSceneOrder(), SEQ_Render3D(), UI_DrawModelNode(), and UI_DrawModelNodeWithUIModel().