![]() |
Crossfire Server, Trunk
1.75.0
|
#include <assert.h>
#include <stdarg.h>
#include <stdlib.h>
#include <string.h>
#include "cfanim.h"
#include "svnversion.h"
Go to the source code of this file.
Data Structures | |
struct | param_moveto |
Destination for moveto command. More... | |
struct | teleport_params |
Functions | |
static void | animate (void) |
Animates all currently running animations. More... | |
static void | animate_one (CFanimation *animation, long int milliseconds) |
Checks if an animation can execute one or more moves, and if so does them. More... | |
CF_PLUGIN int | cfanim_globalEventListener (int *type,...) |
CF_PLUGIN anim_move_result | cfanim_runPluginCommand (object *op, char *params) |
CF_PLUGIN int | closePlugin (void) |
static int | compareAnims (const void *a, const void *b) |
static CFanimation * | create_animation (void) |
Create a new animation. More... | |
static int | equality_split (char *buffer, char **variable, char **value) |
This function take buffer with a value like "blabla= things" and extracts some things. More... | |
CF_PLUGIN int | eventListener (int *type,...) |
static object * | find_by_name (object *origin, const char *name) |
static int | get_boolean (const char *strg, int *bl) |
This function gets a string containing [Y/y](es)/[N/n](o), 1/0 and set bl according to what's read if return value is true, strg was set successfully else, an error occured and bl was not touched. More... | |
static CFanimationHook * | get_command (char *command) |
static int | get_dir_from_name (const char *name) |
Returns the direction from its name. More... | |
CF_PLUGIN void * | getPluginProperty (int *type,...) |
static long int | initapply (const char *name, char *parameters, CFmovement *move_entity) |
static long int | initapplyobject (const char *name, char *parameters, CFmovement *move_entity) |
static long int | initcamera (const char *name, char *parameters, CFmovement *move_entity) |
static long int | initdropobject (const char *name, char *parameters, CFmovement *move_entity) |
static long int | initfire (const char *name, char *parameters, CFmovement *move_entity) |
static long int | initghosted (const char *name, char *parameters, CFmovement *move_entity) |
static long int | initmessage (const char *name, char *parameters, CFmovement *move_entity) |
static long int | initmovement (const char *name, char *parameters, CFmovement *move_entity) |
static long int | initmoveto (const char *name, char *parameters, CFmovement *move_entity) |
static long int | initnotice (const char *name, char *parameters, CFmovement *move_entity) |
static long int | initpickup (const char *name, char *parameters, CFmovement *move_entity) |
static long int | initpickupobject (const char *name, char *parameters, CFmovement *move_entity) |
CF_PLUGIN int | initPlugin (const char *iversion, f_plug_api gethooksptr) |
Plugin initialisation function. More... | |
static long int | initsay (const char *name, char *parameters, CFmovement *move_entity) |
static long int | initstop (const char *name, char *parameters, CFmovement *move_entity) |
static long int | initteleport (const char *name, char *parameters, CFmovement *move_entity) |
static long int | inittrigger (const char *name, char *parameters, CFmovement *move_entity) |
static long int | initturn (const char *name, char *parameters, CFmovement *move_entity) |
static long int | initvisible (const char *name, char *parameters, CFmovement *move_entity) |
static long int | initwizard (const char *name, char *parameters, CFmovement *move_entity) |
static int | is_animated_object (const object *ob) |
Is specified object currently being animated? More... | |
static CFmovement * | parse_animation_block (char *buffer, size_t buffer_size, FILE *fichier, CFanimation *parent) |
Parse an animation block in the animation file. More... | |
CF_PLUGIN int | postInitPlugin (void) |
static void | prepare_commands (void) |
static anim_move_result | runapply (CFanimation *animation, long int id, void *parameters) |
static anim_move_result | runapplyobject (CFanimation *animation, long int id, void *parameters) |
static anim_move_result | runcamera (CFanimation *animation, long int id, void *parameters) |
static anim_move_result | rundropobject (CFanimation *animation, long int id, void *parameters) |
static anim_move_result | runfire (CFanimation *animation, long int id, void *parameters) |
static anim_move_result | runghosted (CFanimation *animation, long int id, void *parameters) |
static anim_move_result | runmessage (CFanimation *animation, long int id, void *parameters) |
static anim_move_result | runmovement (CFanimation *animation, long int id, void *parameters) |
static anim_move_result | runmoveto (CFanimation *animation, long int id, void *parameters) |
static anim_move_result | runnotice (CFanimation *animation, long int id, void *parameters) |
static anim_move_result | runpickup (CFanimation *animation, long int id, void *parameters) |
static anim_move_result | runpickupobject (CFanimation *animation, long int id, void *parameters) |
static anim_move_result | runsay (CFanimation *animation, long int id, void *parameters) |
static anim_move_result | runstop (CFanimation *animation, long int id, void *parameters) |
static anim_move_result | runteleport (CFanimation *animation, long int id, void *parameters) |
static anim_move_result | runtrigger (CFanimation *animation, long int id, void *parameters) |
static anim_move_result | runturn (CFanimation *animation, long int id, void *parameters) |
static anim_move_result | runvisible (CFanimation *animation, long int id, void *parameters) |
static anim_move_result | runwizard (CFanimation *animation, long int id, void *parameters) |
static int | start_animation (object *who, object *activator, object *event, const char *file, const char *message) |
Create a new animation object according to file, option and activator (who) More... | |
long | usec_elapsed (struct timespec first, struct timespec second) |
Return the number of microseconds between two timespec structures. More... | |
Variables | |
CFanimationHook | animationbox [] |
Available animation commands. More... | |
int | animationcount = sizeof(animationbox)/sizeof(CFanimationHook) |
static CFanimation * | first_animation = NULL |
Animations we're currently processing. More... | |
static int | ordered_commands = 0 |
CF_PLUGIN char | SvnRevPlugin [] = SVN_REV |
|
static |
Animates all currently running animations.
Definition at line 1158 of file cfanim.cpp.
References animate_one(), cf_object_remove(), CFanimation::delete_end, CFanimation::event, first_animation, CFanimation::name, CFanimation::nextanimation, CFanimation::nextmovement, CFanimation::paralyze, object::speed, object::speed_left, usec_elapsed(), and CFanimation::victim.
Referenced by cfanim_globalEventListener().
|
static |
Checks if an animation can execute one or more moves, and if so does them.
animation | animation to check |
milliseconds | time elapsed since the last time this function was called. |
Definition at line 1096 of file cfanim.cpp.
References cf_log(), cf_object_set_flag(), cf_object_update(), FLAG_WIZ, FLAG_WIZCAST, FLAG_WIZPASS, CFmovement::func, CFmovement::id, CFanimation::invisible, object::invisible, llevDebug, mr_again, CFanimation::name, object::name, CFmovement::next, CFanimation::nextmovement, CFanimation::paralyze, CFmovement::parameters, PLAYER, object::speed_left, CFmovement::tick, CFanimation::tick_left, CFanimation::time_representation, time_second, object::type, UP_OBJ_CHANGE, CFanimation::verbose, CFanimation::victim, and CFanimation::wizard.
Referenced by animate().
CF_PLUGIN int cfanim_globalEventListener | ( | int * | type, |
... | |||
) |
Definition at line 1260 of file cfanim.cpp.
References animate(), EVENT_CLOCK, and is_valid_types_gen::type.
Referenced by postInitPlugin().
CF_PLUGIN anim_move_result cfanim_runPluginCommand | ( | object * | op, |
char * | params | ||
) |
Definition at line 1245 of file cfanim.cpp.
References mr_finished.
CF_PLUGIN int closePlugin | ( | void | ) |
Definition at line 1324 of file cfanim.cpp.
|
static |
Definition at line 616 of file cfanim.cpp.
Referenced by get_command(), and prepare_commands().
|
static |
Create a new animation.
Definition at line 803 of file cfanim.cpp.
References CFanimation::delete_end, CFanimation::event, first_animation, CFanimation::name, CFanimation::nextanimation, CFanimation::nextmovement, and CFanimation::victim.
Referenced by start_animation().
|
static |
This function take buffer with a value like "blabla= things" and extracts some things.
buffer | where equality is written | |
[out] | variable | will be positionned to where in buffer the variable name starts. leading spaces will be converted to \0 |
[out] | value | same as above but for the value part |
Definition at line 727 of file cfanim.cpp.
References buffer, and variable.
Referenced by start_animation().
CF_PLUGIN int eventListener | ( | int * | type, |
... | |||
) |
Definition at line 1277 of file cfanim.cpp.
Definition at line 825 of file cfanim.cpp.
References cf_find_string(), cf_map_get_height(), cf_map_get_width(), object::env, FOR_MAP_FINISH, FOR_MAP_PREPARE, object::map, and name.
Referenced by start_animation().
|
static |
This function gets a string containing [Y/y](es)/[N/n](o), 1/0 and set bl according to what's read if return value is true, strg was set successfully else, an error occured and bl was not touched.
strg | string to process. |
bl | value strg meant. |
Definition at line 758 of file cfanim.cpp.
Referenced by initghosted(), initvisible(), initwizard(), and start_animation().
|
static |
Definition at line 625 of file cfanim.cpp.
References animationbox, animationcount, command, compareAnims(), CFanimationHook::name, ordered_commands, and prepare_commands().
Referenced by parse_animation_block().
|
static |
Returns the direction from its name.
name | direction's name |
Definition at line 51 of file cfanim.cpp.
References name.
Referenced by initcamera(), initfire(), initmovement(), and initturn().
CF_PLUGIN void* getPluginProperty | ( | int * | type, |
... | |||
) |
Definition at line 1218 of file cfanim.cpp.
|
static |
Definition at line 215 of file cfanim.cpp.
References name.
|
static |
Definition at line 236 of file cfanim.cpp.
References cf_add_string(), name, CFmovement::parameters, and sstring.
|
static |
Definition at line 134 of file cfanim.cpp.
References get_dir_from_name(), name, and CFmovement::parameters.
|
static |
Definition at line 267 of file cfanim.cpp.
References cf_add_string(), name, CFmovement::parameters, and sstring.
|
static |
Definition at line 94 of file cfanim.cpp.
References get_dir_from_name(), name, and CFmovement::parameters.
|
static |
Definition at line 325 of file cfanim.cpp.
References cf_log(), get_boolean(), llevError, and name.
|
static |
Definition at line 496 of file cfanim.cpp.
References name, and CFmovement::parameters.
|
static |
Definition at line 71 of file cfanim.cpp.
References get_dir_from_name(), name, and CFmovement::parameters.
|
static |
Definition at line 459 of file cfanim.cpp.
References name, CFmovement::parameters, param_moveto::x, and param_moveto::y.
|
static |
Definition at line 423 of file cfanim.cpp.
References cf_strdup_local(), name, and CFmovement::parameters.
|
static |
Definition at line 286 of file cfanim.cpp.
References name.
|
static |
Definition at line 305 of file cfanim.cpp.
References cf_add_string(), name, CFmovement::parameters, and sstring.
CF_PLUGIN int initPlugin | ( | const char * | iversion, |
f_plug_api | gethooksptr | ||
) |
Plugin initialisation function.
iversion | server version. |
gethooksptr | function to get the hooks. |
Definition at line 1208 of file cfanim.cpp.
|
static |
Definition at line 194 of file cfanim.cpp.
References cf_log(), cf_strdup_local(), llevDebug, name, CFmovement::parameters, CFmovement::parent, and CFanimation::verbose.
|
static |
Definition at line 438 of file cfanim.cpp.
References name.
|
static |
Definition at line 372 of file cfanim.cpp.
References cf_log(), cf_strdup_local(), llevDebug, llevError, name, CFmovement::parameters, and teleport().
|
static |
Definition at line 515 of file cfanim.cpp.
References cf_log(), llevError, name, and CFmovement::parameters.
|
static |
Definition at line 111 of file cfanim.cpp.
References get_dir_from_name(), name, and CFmovement::parameters.
|
static |
Definition at line 156 of file cfanim.cpp.
References cf_log(), get_boolean(), llevError, and name.
|
static |
Definition at line 175 of file cfanim.cpp.
References cf_log(), get_boolean(), llevError, mr_finished, and name.
|
static |
Is specified object currently being animated?
ob | object to search for. |
Definition at line 789 of file cfanim.cpp.
References first_animation, CFanimation::nextanimation, and CFanimation::victim.
Referenced by eventListener().
|
static |
Parse an animation block in the animation file.
buffer | buffer to read data info, will have been modified when function exits. |
buffer_size | size of buffer. |
fichier | file to read from. |
parent | animation we're reading the block for. |
Definition at line 642 of file cfanim.cpp.
References buffer, cf_log(), CFanimation::errors_allowed, CFmovement::func, CFanimationHook::funcinit, CFanimationHook::funcrun, get_command(), CFmovement::id, llevDebug, llevError, name, CFmovement::next, CFmovement::parent, CFmovement::tick, time, and CFanimation::verbose.
Referenced by start_animation().
CF_PLUGIN int postInitPlugin | ( | void | ) |
Definition at line 1252 of file cfanim.cpp.
|
static |
Definition at line 620 of file cfanim.cpp.
References animationbox, animationcount, compareAnims(), and ordered_commands.
Referenced by get_command().
|
static |
Definition at line 222 of file cfanim.cpp.
References cf_object_apply_below(), object::container, mr_finished, PLAYER, object::type, and CFanimation::victim.
|
static |
Definition at line 242 of file cfanim.cpp.
References AP_APPLY, object::below, cf_free_string(), cf_object_apply(), cf_object_find_by_name(), FOR_OB_AND_BELOW_FINISH, FOR_OB_AND_BELOW_PREPARE, mr_finished, object::name, sstring, and CFanimation::victim.
|
static |
Definition at line 144 of file cfanim.cpp.
References cf_log(), llevDebug, mr_finished, and CFanimation::verbose.
|
static |
Definition at line 274 of file cfanim.cpp.
References cf_free_string(), cf_object_drop(), cf_object_find_by_name(), mr_finished, sstring, and CFanimation::victim.
|
static |
Definition at line 104 of file cfanim.cpp.
References cf_log(), llevDebug, mr_finished, and CFanimation::verbose.
|
static |
Definition at line 336 of file cfanim.cpp.
References cf_map_insert_object_there(), cf_object_clone(), cf_object_free_drop_inventory(), cf_object_remove(), cf_player_move(), CLEAR_FLAG, object::contr, CFanimation::corpse, FLAG_WIZ, CFanimation::ghosted, CFanimation::invisible, object::invisible, object::map, mr_finished, object::type, CFanimation::victim, CFanimation::wizard, object::x, and object::y.
|
static |
Definition at line 505 of file cfanim.cpp.
References cf_map_message(), object::map, mr_finished, NDI_GREEN, NDI_UNIQUE, and CFanimation::victim.
|
static |
Definition at line 80 of file cfanim.cpp.
References cf_log(), cf_object_move(), cf_player_move(), object::contr, llevDebug, mr_finished, PLAYER, object::type, CFanimation::verbose, and CFanimation::victim.
|
static |
Definition at line 475 of file cfanim.cpp.
References cf_object_move_to(), mr_again, mr_finished, CFanimation::victim, object::x, param_moveto::x, object::y, and param_moveto::y.
|
static |
Definition at line 428 of file cfanim.cpp.
References cf_player_message(), mr_finished, NDI_NAVY, NDI_UNIQUE, and CFanimation::victim.
|
static |
Definition at line 293 of file cfanim.cpp.
References object::below, cf_object_pickup(), mr_finished, and CFanimation::victim.
|
static |
Definition at line 311 of file cfanim.cpp.
References cf_free_string(), cf_object_pickup(), FOR_BELOW_FINISH, FOR_BELOW_PREPARE, mr_finished, sstring, and CFanimation::victim.
|
static |
Definition at line 205 of file cfanim.cpp.
References cf_log(), cf_object_say(), llevError, mr_finished, and CFanimation::victim.
|
static |
Definition at line 446 of file cfanim.cpp.
References cf_log(), llevDebug, mr_finished, and CFanimation::verbose.
|
static |
Definition at line 412 of file cfanim.cpp.
References cf_map_get_map(), cf_object_teleport(), mr_finished, teleport(), and CFanimation::victim.
|
static |
Definition at line 527 of file cfanim.cpp.
References mapstruct::buttons, cf_log(), cf_map_get_sstring_property(), cf_map_trigger_connected(), CFAPI_MAP_PROP_PATH, oblinkpt::link, llevError, object::map, mr_finished, oblinkpt::next, oblinkpt::value, and CFanimation::victim.
|
static |
Definition at line 120 of file cfanim.cpp.
References cf_log(), object::facing, llevDebug, mr_finished, CFanimation::verbose, and CFanimation::victim.
|
static |
Definition at line 167 of file cfanim.cpp.
References CFanimation::invisible, and mr_finished.
|
static |
Definition at line 186 of file cfanim.cpp.
References mr_finished, and CFanimation::wizard.
|
static |
Create a new animation object according to file, option and activator (who)
who | object that raised the event leading to the plugin. |
activator | object that caused who to get an event. |
event | actual event object linking who and this plugin. Can be removed. |
file | file name to read from, should be accessible from the current path. |
message | if non empty, will be the name of the used animation instead of the one specified in the file. |
Definition at line 868 of file cfanim.cpp.
References buffer, cf_add_string(), cf_free_string(), cf_log(), cf_object_remove(), cf_strdup_local(), CFanimation::corpse, create_animation(), CFanimation::delete_end, object::env, equality_split(), CFanimation::errors_allowed, CFanimation::event, find_by_name(), get_boolean(), CFanimation::ghosted, HUGE_BUF, CFanimation::invisible, llevDebug, llevError, message, name, CFanimation::name, CFanimation::nextmovement, CFanimation::paralyze, parse_animation_block(), PLAYER, CFanimation::tick_left, CFanimation::time_representation, time_second, time_tick, object::type, CFanimation::unique, variable, CFanimation::verbose, CFanimation::victim, and CFanimation::wizard.
Referenced by eventListener().
long usec_elapsed | ( | struct timespec | first, |
struct timespec | second | ||
) |
Return the number of microseconds between two timespec structures.
This function was copied from common/time.c since linking is too hard.
Definition at line 1149 of file cfanim.cpp.
Referenced by animate().
CFanimationHook animationbox[] |
Available animation commands.
Definition at line 562 of file cfanim.cpp.
Referenced by get_command(), and prepare_commands().
int animationcount = sizeof(animationbox)/sizeof(CFanimationHook) |
Definition at line 612 of file cfanim.cpp.
Referenced by get_command(), and prepare_commands().
|
static |
Animations we're currently processing.
Definition at line 42 of file cfanim.cpp.
Referenced by animate(), create_animation(), and is_animated_object().
|
static |
Definition at line 614 of file cfanim.cpp.
Referenced by get_command(), and prepare_commands().
Definition at line 40 of file cfanim.cpp.