static boolean checkGlobalAnimEvent(int anim_event, int mask)
{
- int trigger_mask = ANIM_EVENT_ANIM_MASK | ANIM_EVENT_PART_MASK;
- int mask_anim_only = mask & ANIM_EVENT_ANIM_MASK;
+ int mask_anim_only = mask & ~ANIM_EVENT_PART_MASK;
if (mask & ANIM_EVENT_ANY)
return (anim_event & ANIM_EVENT_ANY);
else if (mask & ANIM_EVENT_SELF)
return (anim_event & ANIM_EVENT_SELF);
else
- return ((anim_event & trigger_mask) == mask ||
- (anim_event & trigger_mask) == mask_anim_only);
+ return (anim_event == mask ||
+ anim_event == mask_anim_only);
}
static boolean isClickablePart(struct GlobalAnimPartControlInfo *part, int mask)
// check if this click is defined to trigger other animations
int gic_anim_nr = part->old_anim_nr + 1; // X as in "anim_X"
int gic_part_nr = part->old_nr + 1; // Y as in "part_Y"
- int mask = gic_anim_nr << ANIM_EVENT_ANIM_BIT;
+ int mask = ANIM_EVENT_CLICK | (gic_anim_nr << ANIM_EVENT_ANIM_BIT);
if (!part->is_base)
mask |= gic_part_nr << ANIM_EVENT_PART_BIT;
static int get_anim_parameter_value(char *s)
{
- char *pattern_1 = "click:anim_";
+ int event_value[] =
+ {
+ ANIM_EVENT_CLICK
+ };
+ char *pattern_1[] =
+ {
+ "click:anim_"
+ };
char *pattern_2 = ".part_";
char *matching_char = NULL;
char *s_ptr = s;
+ int pattern_1_len = 0;
int result = ANIM_EVENT_NONE;
+ int i;
+
+ for (i = 0; i < ARRAY_SIZE(event_value); i++)
+ {
+ matching_char = strstr(s_ptr, pattern_1[i]);
+ pattern_1_len = strlen(pattern_1[i]);
+ result = event_value[i];
+
+ if (matching_char != NULL)
+ break;
+ }
- matching_char = strstr(s_ptr, pattern_1);
if (matching_char == NULL)
return ANIM_EVENT_NONE;
- s_ptr = matching_char + strlen(pattern_1);
+ s_ptr = matching_char + pattern_1_len;
// check for main animation number ("anim_X" or "anim_XX")
if (*s_ptr >= '0' && *s_ptr <= '9')
#define ANIM_EVENT_NONE 0
#define ANIM_EVENT_SELF (1 << 16)
#define ANIM_EVENT_ANY (1 << 17)
+#define ANIM_EVENT_CLICK (1 << 18)
+// anim number: bits 0-7
+// part number: bits 8-15
#define ANIM_EVENT_ANIM_BIT 0
#define ANIM_EVENT_PART_BIT 8