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 anim->nextmovement = NULL;
814 anim->nextanimation = NULL;
815 anim->delete_end = 0;
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) {
1220 const char *propname;
1225 propname = va_arg(
args,
const char *);
1227 if (!strcmp(propname,
"Identification")) {
1229 size = va_arg(
args,
int);
1233 }
else if (!strcmp(propname,
"FullName")) {
1235 size = va_arg(
args,
int);
1266 event_code = va_arg(
args,
int);
1288 va_arg(
args,
object *);
1297 query = va_arg(
args,
int);
1298 event = va_arg(
args,
object *);
1300 if (query == 1 && strcmp(
message,
"query_object_is_animated") == 0) {
1313 }
else if (
who != NULL) {
static void animate_one(CFanimation *animation, long int milliseconds)
static long int initsay(const char *name, char *parameters, CFmovement *move_entity)
void cf_log(LogLevel logLevel, const char *format,...)
int cf_map_get_height(mapstruct *map)
sstring cf_add_string(const char *str)
sstring cf_map_get_sstring_property(mapstruct *map, int propcode)
int cf_object_teleport(object *ob, mapstruct *map, int x, int y)
void cf_object_apply_below(object *pl)
static anim_move_result runsay(CFanimation *animation, long int id, void *parameters)
CF_PLUGIN int eventListener(int *type,...)
CF_PLUGIN anim_move_result cfanim_runPluginCommand(object *op, char *params)
static long int initapply(const char *name, char *parameters, CFmovement *move_entity)
static void prepare_commands(void)
static int ordered_commands
static anim_move_result runmoveto(CFanimation *animation, long int id, void *parameters)
static long int initmoveto(const char *name, char *parameters, CFmovement *move_entity)
static anim_move_result runghosted(CFanimation *animation, long int id, void *parameters)
char * cf_strdup_local(const char *str)
static long int initwizard(const char *name, char *parameters, CFmovement *move_entity)
#define FOR_BELOW_PREPARE(op_, it_)
CF_PLUGIN int closePlugin(void)
static anim_move_result runwizard(CFanimation *animation, long int id, void *parameters)
int cf_object_apply(object *op, object *author, int flags)
int cf_object_move_to(object *op, int x, int y)
void cf_object_free_drop_inventory(object *ob)
sstring cf_find_string(const char *str)
static long int initnotice(const char *name, char *parameters, CFmovement *move_entity)
int cf_player_move(player *pl, int dir)
static anim_move_result runteleport(CFanimation *animation, long int id, void *parameters)
static long int initteleport(const char *name, char *parameters, CFmovement *move_entity)
static int get_boolean(const char *strg, int *bl)
static object * find_by_name(object *origin, const char *name)
static long int initvisible(const char *name, char *parameters, CFmovement *move_entity)
static anim_move_result rundropobject(CFanimation *animation, long int id, void *parameters)
#define FOR_BELOW_FINISH()
static anim_move_result runtrigger(CFanimation *animation, long int id, void *parameters)
int teleport(object *teleporter, uint8_t tele_type, object *user)
static int start_animation(object *who, object *activator, object *event, const char *file, const char *message)
void cf_object_say(object *op, const char *msg)
static long int initfire(const char *name, char *parameters, CFmovement *move_entity)
object * cf_map_insert_object_there(object *op, mapstruct *m, object *originator, int flag)
void(* f_plug_api)(int *type,...)
static int is_animated_object(const object *ob)
CF_PLUGIN char SvnRevPlugin[]
static anim_move_result runpickup(CFanimation *animation, long int id, void *parameters)
#define FOR_OB_AND_BELOW_FINISH()
int cf_init_plugin(f_plug_api getHooks)
static CFanimation * first_animation
static int compareAnims(const void *a, const void *b)
CFmovement * nextmovement
static int get_dir_from_name(const char *name)
static anim_move_result runpickupobject(CFanimation *animation, long int id, void *parameters)
static long int initmovement(const char *name, char *parameters, CFmovement *move_entity)
static int equality_split(char *buffer, char **variable, char **value)
object * cf_object_clone(object *op, int clonetype)
#define CFAPI_MAP_PROP_PATH
static long int inittrigger(const char *name, char *parameters, CFmovement *move_entity)
static long int initmessage(const char *name, char *parameters, CFmovement *move_entity)
void cf_map_message(mapstruct *m, const char *msg, int color)
#define FOR_OB_AND_BELOW_PREPARE(op_)
static anim_move_result runnotice(CFanimation *animation, long int id, void *parameters)
void cf_object_drop(object *op, object *author)
CF_PLUGIN void * getPluginProperty(int *type,...)
static anim_move_result runmovement(CFanimation *animation, long int id, void *parameters)
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 initdropobject(const char *name, char *parameters, CFmovement *move_entity)
static long int initapplyobject(const char *name, char *parameters, CFmovement *move_entity)
static anim_move_result runapplyobject(CFanimation *animation, long int id, void *parameters)
#define FOR_MAP_PREPARE(map_, mx_, my_, it_)
enum time_enum time_representation
int cf_object_move(object *op, int dir, object *originator)
static CFanimation * create_animation(void)
void cf_system_register_global_event(int event, const char *name, f_plug_event hook)
void cf_map_trigger_connected(objectlink *ol, object *cause, int state)
static anim_move_result runstop(CFanimation *animation, long int id, void *parameters)
void cf_object_set_flag(object *ob, int flag, int value)
CF_PLUGIN int postInitPlugin(void)
const typedef char * sstring
struct CFanimation * parent
static long int initpickup(const char *name, char *parameters, CFmovement *move_entity)
static CFanimationHook * get_command(char *command)
char * cf_get_maps_directory(const char *name, char *buf, int size)
#define CLEAR_FLAG(xyz, p)
CFanimation * nextanimation
static anim_move_result runturn(CFanimation *animation, long int id, void *parameters)
static anim_move_result runapply(CFanimation *animation, long int id, void *parameters)
CF_PLUGIN int cfanim_globalEventListener(int *type,...)
static long int initstop(const char *name, char *parameters, CFmovement *move_entity)
static anim_move_result runfire(CFanimation *animation, long int id, void *parameters)
static anim_move_result runvisible(CFanimation *animation, long int id, void *parameters)
static long int initturn(const char *name, char *parameters, CFmovement *move_entity)
event
DIALOGCHECK MINARGS 1 MAXARGS 2
void cf_player_message(object *op, const char *txt, int flags)
static long int initcamera(const char *name, char *parameters, CFmovement *move_entity)
mapstruct * cf_map_get_map(const char *name, int flags)
static void animate(void)
static long int initpickupobject(const char *name, char *parameters, CFmovement *move_entity)
void cf_object_update(object *op, int flags)
void cf_object_remove(object *op)
static CFmovement * parse_animation_block(char *buffer, size_t buffer_size, FILE *fichier, CFanimation *parent)
int cf_map_get_width(mapstruct *map)
CF_PLUGIN int initPlugin(const char *iversion, f_plug_api gethooksptr)
static anim_move_result runcamera(CFanimation *animation, long int id, void *parameters)
CFanimationHook animationbox[]
static anim_move_result runmessage(CFanimation *animation, long int id, void *parameters)
static long int initghosted(const char *name, char *parameters, CFmovement *move_entity)
long usec_elapsed(struct timespec first, struct timespec second)