From: Holger Schemel Date: Mon, 11 Jun 2018 19:10:05 +0000 (+0200) Subject: added "multiple_actions" option for clickable global animations X-Git-Tag: 4.1.1.0~132 X-Git-Url: https://git.artsoft.org/?p=rocksndiamonds.git;a=commitdiff_plain;h=b3be19debfe6a782dced04fe3ee4406b7d8a2135 added "multiple_actions" option for clickable global animations This change adds a new option for the "graphicsinfo.conf" file to be able to explicitly allow multiple event actions for clickable global animations, which is deactivated by default to prevent unwanted side effects. This would make it possible to trigger two actions that make sense when executed at the same time, like triggering the "play" and "pause" buttons of the tape recorder together, for example.) The new option works like this (with "global.anim_1.part_1.MAIN" also being defined): global.anim_2.part_1.MAIN.anim_event: click:anim_1.part_1 global.anim_2.part_1.MAIN.anim_event_action: some.action global.anim_2.part_1.MAIN.style: multiple_actions global.anim_3.part_1.MAIN.anim_event: click:anim_1.part_1 global.anim_3.part_1.MAIN.anim_event_action: another.action When clicking the first global animation (on the main menu screen), there might be two or more other global animation which are triggered by clicking the first animation and which each execute their own event action when triggered. (The style "multiple_actions" must be defined for all animations that should *not* stop the chain of event actions to be executed, so it's easiest to just define it for all animations that should execute their event actions together when triggered.) This option can be combined with "passthrough_clicks". --- diff --git a/src/anim.c b/src/anim.c index 50cbba7b..81441829 100644 --- a/src/anim.c +++ b/src/anim.c @@ -1450,8 +1450,14 @@ static boolean DoGlobalAnim_EventAction(struct GlobalAnimPartControlInfo *part) if (anim_event_action == -1) return FALSE; - return (DoGadgetAction(anim_event_action) || - DoScreenAction(anim_event_action)); + boolean action_executed = (DoGadgetAction(anim_event_action) || + DoScreenAction(anim_event_action)); + + // check if further actions are allowed to be executed + if (part->control_info.style & STYLE_MULTIPLE_ACTIONS) + return FALSE; + + return action_executed; } static void InitGlobalAnim_Clickable() diff --git a/src/libgame/misc.c b/src/libgame/misc.c index 4a71d544..fb265fab 100644 --- a/src/libgame/misc.c +++ b/src/libgame/misc.c @@ -2931,6 +2931,9 @@ int get_parameter_value(char *value_raw, char *suffix, int type) if (string_has_parameter(value, "passthrough_clicks")) result |= STYLE_PASSTHROUGH; + + if (string_has_parameter(value, "multiple_actions")) + result |= STYLE_MULTIPLE_ACTIONS; } else if (strEqual(suffix, ".fade_mode")) { diff --git a/src/libgame/system.h b/src/libgame/system.h index e396a369..1b2b079b 100644 --- a/src/libgame/system.h +++ b/src/libgame/system.h @@ -332,6 +332,7 @@ /* values for special event handling style (used for global animation) */ #define STYLE_PASSTHROUGH (1 << 3) +#define STYLE_MULTIPLE_ACTIONS (1 << 4) #define STYLE_DEFAULT STYLE_NONE