X-Git-Url: https://git.artsoft.org/?a=blobdiff_plain;ds=sidebyside;f=src%2Fanim.c;h=0cb2023d85b6b21f1eb0f14bcf551f352942ace2;hb=895d5cb33db251c933445778400bb3e50b76d4ab;hp=82cb8dd248fc461b09ed6d081119c984ebced894;hpb=c4cfe09e6e5db671cf17fa7e7689d3773255eca3;p=rocksndiamonds.git diff --git a/src/anim.c b/src/anim.c index 82cb8dd2..0cb2023d 100644 --- a/src/anim.c +++ b/src/anim.c @@ -360,10 +360,8 @@ static int compareGlobalAnimPartControlInfo(const void *obj1, const void *obj2) (struct GlobalAnimPartControlInfo *)obj2; int compare_result; - if (o1->control_info.draw_order != o2->control_info.draw_order) - compare_result = o1->control_info.draw_order - o2->control_info.draw_order; - else - compare_result = o1->nr - o2->nr; + // do not sort animations parts by draw order (as it would be confusing) + compare_result = o1->nr - o2->nr; return compare_result; } @@ -537,6 +535,10 @@ static void InitGlobalAnimControls(void) anim->state = ANIM_STATE_INACTIVE; + // if draw order is undefined, set to default value "0" + if (anim->control_info.draw_order == ARG_UNDEFINED_VALUE) + anim->control_info.draw_order = 0; + part_nr = 0; for (p = 0; p < NUM_GLOBAL_ANIM_PARTS_ALL; p++) @@ -604,19 +606,14 @@ static void InitGlobalAnimControls(void) anim->has_base = TRUE; } - // apply special settings for pointer-style animations - if (part->control_info.class == get_hash_from_key("pointer")) - { - // force animation to be on top (must set anim and part control) - if (anim->control_info.draw_order == 0) - anim->control_info.draw_order = 1000000; - if (part->control_info.draw_order == 0) - part->control_info.draw_order = 1000000; - - // force animation to pass-through clicks (must set part control) - if (part->control_info.style == STYLE_DEFAULT) - part->control_info.style |= STYLE_PASSTHROUGH; - } + // force pointer-style animations to pass-through clicks + if (part->control_info.class == get_hash_from_key("pointer") && + part->control_info.style == STYLE_DEFAULT) + part->control_info.style |= STYLE_PASSTHROUGH; + + // if draw order is undefined, inherit it from main animation + if (part->control_info.draw_order == ARG_UNDEFINED_VALUE) + part->control_info.draw_order = anim->control_info.draw_order; } if (anim->num_parts > 0 || anim->has_base) @@ -2122,7 +2119,8 @@ static boolean InitGlobalAnim_Clicked(int mx, int my, int clicked_event) int mode_nr; int i; - for (mode_nr = 0; mode_nr < NUM_GAME_MODES; mode_nr++) + // check game modes in reverse draw order (to stop when clicked) + for (mode_nr = NUM_GAME_MODES - 1; mode_nr >= 0; mode_nr--) { struct GlobalAnimControlInfo *ctrl = &global_anim_ctrl[mode_nr]; int anim_nr;