From: Holger Schemel Date: Fri, 8 Jun 2018 21:13:53 +0000 (+0200) Subject: added event action parameter for global animations (no functionality yet) X-Git-Tag: 4.1.1.0~145 X-Git-Url: https://git.artsoft.org/?a=commitdiff_plain;h=bd5cd062;p=rocksndiamonds.git added event action parameter for global animations (no functionality yet) --- diff --git a/src/conf_gfx.c b/src/conf_gfx.c index ba530b3d..785b2e2a 100644 --- a/src/conf_gfx.c +++ b/src/conf_gfx.c @@ -61,7 +61,9 @@ struct ConfigTypeInfo image_config_suffix[] = { ".post_delay_fixed", ARG_UNDEFINED, TYPE_INTEGER }, { ".post_delay_random", ARG_UNDEFINED, TYPE_INTEGER }, { ".init_event", ARG_UNDEFINED, TYPE_STRING }, + { ".init_event_action", ARG_UNDEFINED, TYPE_STRING }, { ".anim_event", ARG_UNDEFINED, TYPE_STRING }, + { ".anim_event_action", ARG_UNDEFINED, TYPE_STRING }, { ".name", ARG_UNDEFINED, TYPE_STRING }, { ".scale_up_factor", ARG_UNDEFINED, TYPE_INTEGER }, { ".tile_size", ARG_UNDEFINED, TYPE_INTEGER }, diff --git a/src/init.c b/src/init.c index 863704ef..b32141fb 100644 --- a/src/init.c +++ b/src/init.c @@ -1289,6 +1289,8 @@ static void set_graphic_parameters_ext(int graphic, int *parameter, g->post_delay_random = 0; g->init_event = ANIM_EVENT_DEFAULT; g->anim_event = ANIM_EVENT_DEFAULT; + g->init_event_action = -1; + g->anim_event_action = -1; g->draw_masked = FALSE; g->draw_order = 0; g->fade_mode = FADE_MODE_DEFAULT; @@ -1511,6 +1513,10 @@ static void set_graphic_parameters_ext(int graphic, int *parameter, g->init_event = parameter[GFX_ARG_INIT_EVENT]; if (parameter[GFX_ARG_ANIM_EVENT] != ARG_UNDEFINED_VALUE) g->anim_event = parameter[GFX_ARG_ANIM_EVENT]; + if (parameter[GFX_ARG_INIT_EVENT_ACTION] != ARG_UNDEFINED_VALUE) + g->init_event_action = parameter[GFX_ARG_INIT_EVENT_ACTION]; + if (parameter[GFX_ARG_ANIM_EVENT_ACTION] != ARG_UNDEFINED_VALUE) + g->anim_event_action = parameter[GFX_ARG_ANIM_EVENT_ACTION]; /* used for toon animations and global animations */ g->step_offset = parameter[GFX_ARG_STEP_OFFSET]; diff --git a/src/libgame/misc.c b/src/libgame/misc.c index d31ed248..d57b5030 100644 --- a/src/libgame/misc.c +++ b/src/libgame/misc.c @@ -2806,6 +2806,25 @@ int get_anim_parameter_value(char *s) return result; } +int get_anim_action_parameter_value(char *token) +{ + int result = getImageIDFromToken(token); + + if (result == -1) + { + char *gfx_token = getStringCat2("gfx.", token); + + result = getImageIDFromToken(gfx_token); + + checked_free(gfx_token); + } + + if (result == -1) + result = ANIM_EVENT_ACTION_NONE; + + return result; +} + int get_parameter_value(char *value_raw, char *suffix, int type) { char *value = getStringToLower(value_raw); @@ -2887,6 +2906,11 @@ int get_parameter_value(char *value_raw, char *suffix, int type) // add optional "click:anim_X" or "click:anim_X.part_X" parameter result |= get_anim_parameter_value(value); } + else if (strEqual(suffix, ".init_event_action") || + strEqual(suffix, ".anim_event_action")) + { + result = get_anim_action_parameter_value(value); + } else if (strEqual(suffix, ".class")) { result = (strEqual(value, ARG_UNDEFINED) ? ARG_UNDEFINED_VALUE : diff --git a/src/libgame/system.h b/src/libgame/system.h index 47293837..ab8f43b0 100644 --- a/src/libgame/system.h +++ b/src/libgame/system.h @@ -345,6 +345,9 @@ #define ANIM_EVENT_DEFAULT ANIM_EVENT_NONE +/* values for special global animation event actions */ +#define ANIM_EVENT_ACTION_NONE -1 + /* values for fade mode */ #define FADE_TYPE_NONE 0 #define FADE_TYPE_FADE_IN (1 << 0) diff --git a/src/main.h b/src/main.h index 224c3513..6e4c5060 100644 --- a/src/main.h +++ b/src/main.h @@ -2359,26 +2359,28 @@ #define GFX_ARG_POST_DELAY_FIXED 39 #define GFX_ARG_POST_DELAY_RANDOM 40 #define GFX_ARG_INIT_EVENT 41 -#define GFX_ARG_ANIM_EVENT 42 -#define GFX_ARG_NAME 43 -#define GFX_ARG_SCALE_UP_FACTOR 44 -#define GFX_ARG_TILE_SIZE 45 -#define GFX_ARG_CLONE_FROM 46 -#define GFX_ARG_FADE_MODE 47 -#define GFX_ARG_FADE_DELAY 48 -#define GFX_ARG_POST_DELAY 49 -#define GFX_ARG_AUTO_DELAY 50 -#define GFX_ARG_ALIGN 51 -#define GFX_ARG_VALIGN 52 -#define GFX_ARG_SORT_PRIORITY 53 -#define GFX_ARG_CLASS 54 -#define GFX_ARG_STYLE 55 -#define GFX_ARG_ACTIVE_XOFFSET 56 -#define GFX_ARG_ACTIVE_YOFFSET 57 -#define GFX_ARG_PRESSED_XOFFSET 58 -#define GFX_ARG_PRESSED_YOFFSET 59 - -#define NUM_GFX_ARGS 60 +#define GFX_ARG_INIT_EVENT_ACTION 42 +#define GFX_ARG_ANIM_EVENT 43 +#define GFX_ARG_ANIM_EVENT_ACTION 44 +#define GFX_ARG_NAME 45 +#define GFX_ARG_SCALE_UP_FACTOR 46 +#define GFX_ARG_TILE_SIZE 47 +#define GFX_ARG_CLONE_FROM 48 +#define GFX_ARG_FADE_MODE 49 +#define GFX_ARG_FADE_DELAY 50 +#define GFX_ARG_POST_DELAY 51 +#define GFX_ARG_AUTO_DELAY 52 +#define GFX_ARG_ALIGN 53 +#define GFX_ARG_VALIGN 54 +#define GFX_ARG_SORT_PRIORITY 55 +#define GFX_ARG_CLASS 56 +#define GFX_ARG_STYLE 57 +#define GFX_ARG_ACTIVE_XOFFSET 58 +#define GFX_ARG_ACTIVE_YOFFSET 59 +#define GFX_ARG_PRESSED_XOFFSET 60 +#define GFX_ARG_PRESSED_YOFFSET 61 + +#define NUM_GFX_ARGS 62 /* values for sound configuration suffixes */ @@ -3407,7 +3409,9 @@ struct GraphicInfo int post_delay_random; /* animations (pause before next animation) */ int init_event; /* optional event triggering animation start */ + int init_event_action; /* optional action called on animation start */ int anim_event; /* optional event triggering animation end */ + int anim_event_action; /* optional action called on animation end */ int step_offset; /* optional step offset of toon animations */ int step_xoffset; /* optional step offset of toon animations */