From 411dffb336bdcdd487225bc78d82bb3bafa3016e Mon Sep 17 00:00:00 2001 From: Holger Schemel Date: Wed, 8 Apr 2020 14:15:40 +0200 Subject: [PATCH] added option to generally set global animations to block clicks --- src/anim.c | 8 ++++++++ src/files.c | 3 +++ src/libgame/system.h | 5 +++-- 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/src/anim.c b/src/anim.c index 3c19176f..e7a30860 100644 --- a/src/anim.c +++ b/src/anim.c @@ -1146,6 +1146,11 @@ static boolean isClickedPart(struct GlobalAnimPartControlInfo *part, return TRUE; } +static boolean clickBlocked(struct GlobalAnimPartControlInfo *part) +{ + return (part->control_info.style & STYLE_BLOCK ? TRUE : FALSE); +} + static boolean clickConsumed(struct GlobalAnimPartControlInfo *part) { return (part->control_info.style & STYLE_PASSTHROUGH ? FALSE : TRUE); @@ -1874,6 +1879,9 @@ static boolean InitGlobalAnim_Clicked(int mx, int my, int clicked_event) click_consumed |= clickConsumed(part); } + // determine if mouse clicks should be blocked by this animation + click_consumed |= clickBlocked(part); + // check if this click is defined to trigger other animations InitGlobalAnim_Triggered(part, &click_consumed, &any_event_action, ANIM_EVENT_CLICK, "CLICK"); diff --git a/src/files.c b/src/files.c index fd7cfcf4..54835e28 100644 --- a/src/files.c +++ b/src/files.c @@ -10309,6 +10309,9 @@ int get_parameter_value(char *value_raw, char *suffix, int type) if (string_has_parameter(value, "reverse")) result |= STYLE_REVERSE; + if (string_has_parameter(value, "block_clicks")) + result |= STYLE_BLOCK; + if (string_has_parameter(value, "passthrough_clicks")) result |= STYLE_PASSTHROUGH; diff --git a/src/libgame/system.h b/src/libgame/system.h index a949914e..f70b6b5f 100644 --- a/src/libgame/system.h +++ b/src/libgame/system.h @@ -347,8 +347,9 @@ #define STYLE_REVERSE (1 << 2) // values for special event handling style (used for global animation) -#define STYLE_PASSTHROUGH (1 << 3) -#define STYLE_MULTIPLE_ACTIONS (1 << 4) +#define STYLE_BLOCK (1 << 3) +#define STYLE_PASSTHROUGH (1 << 4) +#define STYLE_MULTIPLE_ACTIONS (1 << 5) #define STYLE_DEFAULT STYLE_NONE -- 2.34.1