Go to the documentation of this file.
52 if (!strcmp(
name,
"north"))
54 if (!strcmp(
name,
"north_east"))
56 if (!strcmp(
name,
"east"))
58 if (!strcmp(
name,
"south_east"))
60 if (!strcmp(
name,
"south"))
62 if (!strcmp(
name,
"south_west"))
64 if (!strcmp(
name,
"west"))
66 if (!strcmp(
name,
"north_west"))
163 cf_log(
llevError,
"CFAnim: Error in animation - possible values for 'invisible' are 'yes' and 'no'\n");
182 cf_log(
llevError,
"CFAnim: Error in animation - possible values for 'wizard' are 'yes' and 'no'\n");
211 cf_log(
llevError,
"CFAnim: Error in animation: nothing to say with say function\n");
223 object *current_container;
332 cf_log(
llevError,
"CFAnim: Error in animation: possible values for 'ghosted' are 'yes' and 'no'\n");
340 || (!
id && !animation->
ghosted))
348 corpse->
contr = NULL;
352 animation->
corpse = corpse;
545 for (olp =
map->buttons; olp; olp = olp->
next) {
546 if (olp->
value ==
id) {
654 while (fgets(buffer, buffer_size, fichier)) {
655 if (buffer[0] ==
'[')
657 if (buffer[0] ==
'#')
659 buffer[strlen(buffer)-strlen(
"\n")] =
'\0';
660 while (buffer[strlen(buffer)-1] ==
' ')
661 buffer[strlen(buffer)-1] =
'\0';
662 if (strlen(buffer) <= 0)
666 name = strstr(buffer,
" ");
693 if (!animationhook) {
702 next->parent = parent;
728 if (!strcmp(&buffer[strlen(buffer)-strlen(
"\n")],
"\n"))
729 buffer[strlen(buffer)-strlen(
"\n")] =
'\0';
730 *
value = strstr(buffer,
"=");
736 while ((strlen(*variable) > 0) && ((*variable)[strlen(*variable)-1] ==
' '))
737 (*variable)[strlen(*variable)-1] =
'\0';
739 (*value)[strlen(*
value)-1] =
'\0';
740 while (**
value ==
' ')
742 if ((**variable ==
'\0') || (**
value ==
'\0'))
769 else if (*strg ==
'n')
771 else if (*strg ==
'Y')
773 else if (*strg ==
'N')
775 else if (*strg ==
'1')
777 else if (*strg ==
'0')
813 new->nextmovement = NULL;
814 new->nextanimation = NULL;
834 while (origin && !origin->
map)
835 origin = origin->
env;
837 if (!origin || !origin->
map)
845 for (
x = 0;
x < w;
x++) {
846 for (
y = 0;
y < h;
y++) {
848 if (
ob->name == sname)
874 int always_delete = 0;
881 int errors_allowed = 0;
883 const char *animationitem = NULL;
887 int errors_found = 0;
890 fichier = fopen(
file,
"r");
891 if (fichier == NULL) {
895 while (fgets(buffer,
HUGE_BUF, fichier)) {
896 if (buffer[0] ==
'[')
898 if (buffer[0] ==
'#')
900 if (!strcmp(buffer,
"\n"))
909 if (strncmp(buffer,
"[Config]", 8)) {
910 cf_log(
llevError,
"CFAnim: Fatal error in %s: [Config] must be the first group defined.\n",
file);
914 while (fgets(buffer,
HUGE_BUF, fichier)) {
915 if (buffer[0] ==
'[')
917 if (buffer[0] ==
'#')
919 if (!strcmp(buffer,
"\n"))
924 if (!strcmp(variable,
"name")) {
930 }
else if (!strcmp(variable,
"victimtype")) {
931 if (!strcmp(
value,
"player"))
933 else if (!strcmp(
value,
"object"))
935 else if (!strcmp(
value,
"any"))
937 else if (!strcmp(
value,
"byname"))
941 }
else if (!strcmp(variable,
"victim")) {
943 if (!strcmp(
value,
"who"))
945 else if (!strcmp(
value,
"activator"))
947 else if (!strcmp(
value,
"who_owner"))
950 cf_log(
llevError,
"CFAnim: Warning: object \"who\" doesn't exist and you're victimized it's owner\n");
953 else if (!strcmp(
value,
"activator_owner"))
956 cf_log(
llevError,
"CFAnim: Warning: object \"activator\" doesn't exist and you're victimized it's owner\n");
959 else if (victimtype == 3) {
963 }
else if (!strcmp(variable,
"unique")) {
966 }
else if (!strcmp(variable,
"always_delete")) {
969 }
else if (!strcmp(variable,
"delete_event_end")) {
972 }
else if (!strcmp(variable,
"parallel")) {
975 }
else if (!strcmp(variable,
"paralyzed")) {
978 }
else if (!strcmp(variable,
"invisible")) {
981 }
else if (!strcmp(variable,
"wizard")) {
984 }
else if (!strcmp(variable,
"errors_allowed")) {
987 }
else if (!strcmp(variable,
"verbose")) {
990 }
else if (!strcmp(variable,
"time_representation")) {
991 if (!strcmp(
value,
"second"))
993 else if (!strcmp(
value,
"tick"))
997 }
else if (!strcmp(variable,
"animation")) {
1009 if (buffer[0] ==
'\0') {
1016 if (!animationitem) {
1035 if (always_delete) {
1042 || (errors_found && !errors_allowed)) {
1044 cf_log(
llevError,
"CFAnim: No correct victim found or errors found, aborting.\n");
1051 if (unique && !always_delete) {
1059 current_anim->
paralyze = paralyzed;
1061 current_anim->
wizard = wizard;
1062 current_anim->
unique = unique;
1065 current_anim->
corpse = NULL;
1067 current_anim->
verbose = verbose;
1071 while (buffer[0] ==
'[') {
1072 while (strncmp(&buffer[1], animationitem, strlen(animationitem))) {
1074 if (buffer[0] ==
'[')
1076 if (
value == NULL) {
1077 cf_log(
llevError,
"CFAnim: no matching animation %s in file.\n", animationitem);
1150 time_t sec_elapsed = second.tv_sec - first.tv_sec;
1151 long nsec_elapsed = second.tv_nsec - first.tv_nsec;
1152 return (sec_elapsed * 1e6) + (nsec_elapsed / 1e3);
1162 struct timespec now;
1163 static struct timespec yesterday;
1164 static int already_passed = 0;
1165 long int delta_milli;
1167 clock_gettime(CLOCK_MONOTONIC, &now);
1168 if (!already_passed) {
1218 const char *propname;
1223 propname = va_arg(
args,
const char *);
1225 if (!strcmp(propname,
"Identification")) {
1227 size = va_arg(
args,
int);
1231 }
else if (!strcmp(propname,
"FullName")) {
1233 size = va_arg(
args,
int);
1261 event_code = va_arg(
args,
int);
1282 va_arg(
args,
object *);
1291 query = va_arg(
args,
int);
1292 event = va_arg(
args,
object *);
1294 if (query == 1 && strcmp(
message,
"query_object_is_animated") == 0) {
1307 }
else if (
who != NULL) {
static anim_move_result runvisible(struct CFanimation_struct *animation, long int id, void *parameters)
static long int initmessage(const char *name, char *parameters, struct CFmovement_struct *move_entity)
void cf_log(LogLevel logLevel, const char *format,...)
int cf_map_get_height(mapstruct *map)
static anim_move_result runcamera(struct CFanimation_struct *animation, long int id, void *parameters)
static long int initnotice(const char *name, char *parameters, struct CFmovement_struct *move_entity)
sstring cf_add_string(const char *str)
static void animate(void)
sstring cf_map_get_sstring_property(mapstruct *map, int propcode)
int cf_object_teleport(object *ob, mapstruct *map, int x, int y)
static long int initwizard(const char *name, char *parameters, struct CFmovement_struct *move_entity)
void cf_object_apply_below(object *pl)
static long int initapply(const char *name, char *parameters, struct CFmovement_struct *move_entity)
static anim_move_result runapply(struct CFanimation_struct *animation, long int id, void *parameters)
static anim_move_result runmovement(struct CFanimation_struct *animation, long int id, void *parameters)
static anim_move_result runstop(struct CFanimation_struct *animation, long int id, void *parameters)
char * cf_strdup_local(const char *str)
#define FOR_BELOW_PREPARE(op_, it_)
static anim_move_result runapplyobject(struct CFanimation_struct *animation, long int id, void *parameters)
CF_PLUGIN int postInitPlugin(void)
static anim_move_result runtrigger(struct CFanimation_struct *animation, long int id, void *parameters)
static long int initmovement(const char *name, char *parameters, struct CFmovement_struct *move_entity)
struct CFmovement_struct * next
static anim_move_result runpickup(struct CFanimation_struct *animation, long int id, void *parameters)
int cf_object_apply(object *op, object *author, int flags)
static int equality_split(char *buffer, char **variable, char **value)
enum time_enum time_representation
static long int initturn(const char *name, char *parameters, struct CFmovement_struct *move_entity)
int cf_object_move_to(object *op, int x, int y)
static void animate_one(CFanimation *animation, long int milliseconds)
void cf_object_free_drop_inventory(object *ob)
sstring cf_find_string(const char *str)
int cf_player_move(player *pl, int dir)
static long int initfire(const char *name, char *parameters, struct CFmovement_struct *move_entity)
static anim_move_result runghosted(struct CFanimation_struct *animation, long int id, void *parameters)
#define FOR_BELOW_FINISH()
static CFanimation * create_animation(void)
static int get_dir_from_name(const char *name)
int teleport(object *teleporter, uint8_t tele_type, object *user)
CF_PLUGIN anim_move_result cfanim_runPluginCommand(object *op, char *params)
static int get_boolean(const char *strg, int *bl)
static object * find_by_name(object *origin, const char *name)
static int ordered_commands
static anim_move_result runfire(struct CFanimation_struct *animation, long int id, void *parameters)
static long int initcamera(const char *name, char *parameters, struct CFmovement_struct *move_entity)
struct CFanimation_struct * nextanimation
object * cf_map_insert_object_there(object *op, mapstruct *m, object *originator, int flag)
void(* f_plug_api)(int *type,...)
static long int initmoveto(const char *name, char *parameters, struct CFmovement_struct *move_entity)
#define FOR_OB_AND_BELOW_FINISH()
int cf_init_plugin(f_plug_api getHooks)
struct CFanimation_struct * parent
CF_PLUGIN int closePlugin(void)
static anim_move_result runwizard(struct CFanimation_struct *animation, long int id, void *parameters)
static int compareAnims(const void *a, const void *b)
static anim_move_result runturn(struct CFanimation_struct *animation, long int id, void *parameters)
static long int initghosted(const char *name, char *parameters, struct CFmovement_struct *move_entity)
object * cf_object_clone(object *op, int clonetype)
#define CFAPI_MAP_PROP_PATH
static long int inittrigger(const char *name, char *parameters, struct CFmovement_struct *move_entity)
static void prepare_commands(void)
static long int initpickupobject(const char *name, char *parameters, struct CFmovement_struct *move_entity)
void cf_map_message(mapstruct *m, const char *msg, int color)
static anim_move_result runmoveto(struct CFanimation_struct *animation, long int id, void *parameters)
#define FOR_OB_AND_BELOW_PREPARE(op_)
void cf_object_drop(object *op, object *author)
CF_PLUGIN int eventListener(int *type,...)
static CFanimationHook * get_command(char *command)
void cf_free_string(sstring str)
object * cf_object_find_by_name(const object *who, const char *name)
void cf_object_pickup(object *op, object *what)
static long int initpickup(const char *name, char *parameters, struct CFmovement_struct *move_entity)
#define FOR_MAP_PREPARE(map_, mx_, my_, it_)
static long int initdropobject(const char *name, char *parameters, struct CFmovement_struct *move_entity)
static long int initsay(const char *name, char *parameters, struct CFmovement_struct *move_entity)
int cf_object_move(object *op, int dir, object *originator)
static long int initstop(const char *name, char *parameters, struct CFmovement_struct *move_entity)
void cf_system_register_global_event(int event, const char *name, f_plug_event hook)
CF_PLUGIN int initPlugin(const char *iversion, f_plug_api gethooksptr)
static long int initvisible(const char *name, char *parameters, struct CFmovement_struct *move_entity)
void cf_map_trigger_connected(objectlink *ol, object *cause, int state)
void cf_object_set_flag(object *ob, int flag, int value)
CF_PLUGIN void * getPluginProperty(int *type,...)
static int is_animated_object(const object *ob)
static long int initteleport(const char *name, char *parameters, struct CFmovement_struct *move_entity)
char * cf_get_maps_directory(const char *name, char *buf, int size)
#define CLEAR_FLAG(xyz, p)
static CFmovement * parse_animation_block(char *buffer, size_t buffer_size, FILE *fichier, CFanimation *parent)
CFanimationHook animationbox[]
static CFanimation * first_animation
static anim_move_result runteleport(struct CFanimation_struct *animation, long int id, void *parameters)
static anim_move_result runsay(struct CFanimation_struct *animation, long int id, void *parameters)
event
DIALOGCHECK MINARGS 1 MAXARGS 2
mapstruct * cf_map_get_map(const char *name, int flags)
struct CFmovement_struct * nextmovement
static anim_move_result runpickupobject(struct CFanimation_struct *animation, long int id, void *parameters)
void cf_object_update(object *op, int flags)
static anim_move_result rundropobject(struct CFanimation_struct *animation, long int id, void *parameters)
void cf_object_remove(object *op)
static anim_move_result runnotice(struct CFanimation_struct *animation, long int id, void *parameters)
void cf_object_say(object *op, char *msg)
static long int initapplyobject(const char *name, char *parameters, struct CFmovement_struct *move_entity)
void cf_player_message(object *op, char *txt, int flags)
static anim_move_result runmessage(struct CFanimation_struct *animation, long int id, void *parameters)
int cf_map_get_width(mapstruct *map)
CF_PLUGIN int cfanim_globalEventListener(int *type,...)
static int start_animation(object *who, object *activator, object *event, const char *file, const char *message)
long usec_elapsed(struct timespec first, struct timespec second)
CF_PLUGIN char SvnRevPlugin[]