Crossfire Server, Branch 1.12
R12190
|
This file contains animation-related code. More...
Go to the source code of this file.
Functions | |
static int | anim_compare (const Animations *a, const Animations *b) |
Utility function to compare 2 animations based on their name. | |
void | animate_object (object *op, int dir) |
Updates the face-variable of an object. | |
void | apply_anim_suffix (object *who, sstring suffix) |
Applies a compound animation to an object. | |
int | find_animation (const char *name) |
Finds the animation id that matches name. | |
void | free_all_anim (void) |
Clears all animation-related memory. | |
void | init_anim (void) |
Loads the lib/animations file. | |
int | try_find_animation (const char *name) |
Tries to find the animation id that matches name, don't LOG() an error if not found. |
This file contains animation-related code.
Definition in file anim.c.
static int anim_compare | ( | const Animations * | a, |
const Animations * | b | ||
) | [static] |
Utility function to compare 2 animations based on their name.
Used for sorting/searching.
Definition at line 134 of file anim.c.
References animations_struct::name.
Referenced by try_find_animation().
void animate_object | ( | object * | op, |
int | dir | ||
) |
Updates the face-variable of an object.
If the object is the head of a multi-object, all objects are animated. The object's state is not changed, but merely updated if needed (out of bounds of new animation, reached end of animation, ...)
op | is the object to animate. |
dir | is the direction the object is facing. This is generally same as op->direction, but in some cases, op->facing is used instead - the caller has a better idea which one it really wants to be using, so let it pass along the right one. |
Definition at line 186 of file anim.c.
References animate_object(), blank_face, CLEAR_FLAG, dump_object(), FLAG_ALIVE, llevError, LOG(), NUM_ANIMATIONS, NUM_FACINGS, PLAYER, QUERY_FLAG, SET_ANIMATION, SET_FLAG, stringbuffer_finish(), stringbuffer_new(), and update_object().
Referenced by add_abilities(), animate_object(), apply_anim_suffix(), apply_changes_to_player(), dragon_ability_gain(), monster_use_scroll(), move_hole(), move_monster(), move_player(), process_events(), process_object(), turn_one_transport(), and turn_transport().
void apply_anim_suffix | ( | object * | who, |
sstring | suffix | ||
) |
Applies a compound animation to an object.
who | object to apply the animation to. Must not be NULL. |
suffix | animation suffix to apply. Must not be NULL. |
Definition at line 289 of file anim.c.
References animate_object(), animations, animations_struct::facings, MAX_BUF, animations_struct::name, animations_struct::num_animations, snprintf(), and try_find_animation().
Referenced by attack_ob_simple(), cast_spell(), do_skill(), and player_apply().
int find_animation | ( | const char * | name | ) |
Finds the animation id that matches name.
Will LOG() an error if not found.
name | the animation's name. |
Definition at line 146 of file anim.c.
References llevError, LOG(), and try_find_animation().
Referenced by cfapi_system_find_animation(), and transport_type_apply().
void free_all_anim | ( | void | ) |
Clears all animation-related memory.
Definition at line 41 of file anim.c.
References animations, free_string(), and num_animations.
Referenced by cleanup().
void init_anim | ( | void | ) |
Loads the lib/animations file.
Can be called multiple times without ill effects.
Definition at line 55 of file anim.c.
References add_string(), animations, animations_allocated, Settings::datadir, animations_struct::faces, animations_struct::facings, find_face(), llevDebug, llevError, LOG(), MAX_ANIMATIONS, MAX_BUF, animations_struct::name, animations_struct::num, animations_struct::num_animations, num_animations, settings, snprintf(), and strerror_local().
Referenced by cctk_init_std_archetypes(), and init_library().
int try_find_animation | ( | const char * | name | ) |
Tries to find the animation id that matches name, don't LOG() an error if not found.
name | the animation's name. |
Definition at line 161 of file anim.c.
References anim_compare(), animations, animations_struct::name, animations_struct::num, and num_animations.
Referenced by apply_anim_suffix(), apply_changes_to_player(), and find_animation().