X-Git-Url: https://git.artsoft.org/?p=rocksndiamonds.git;a=blobdiff_plain;f=src%2Fanim.c;h=8256ce7f60f5ec62fda3ebf49adb086a5450cc3b;hp=be6c98f6d4ee82587a1b3c0cd3b23ad18e3fcdd3;hb=98ae5fc5e9274fea99a2ed8873b78fc2110ce3ce;hpb=3cc2ee99e57014c6962d26365e92bd3eac36a492;ds=sidebyside diff --git a/src/anim.c b/src/anim.c index be6c98f6..8256ce7f 100644 --- a/src/anim.c +++ b/src/anim.c @@ -230,6 +230,8 @@ static int anim_classes_last = ANIM_CLASS_NONE; static boolean drawing_to_fading_buffer = FALSE; +static boolean handle_click = FALSE; + // ============================================================================ // generic animation frame calculation @@ -861,8 +863,11 @@ static boolean SetGlobalAnimPart_Viewport(struct GlobalAnimPartControlInfo *part } else if (part->control_info.class == get_hash_from_key("pointer")) { - viewport_x = gfx.mouse_x + part->control_info.x; - viewport_y = gfx.mouse_y + part->control_info.y; + int mx = MIN(MAX(0, gfx.mouse_x), WIN_XSIZE - 1); + int my = MIN(MAX(0, gfx.mouse_y), WIN_YSIZE - 1); + + viewport_x = mx + part->control_info.x; + viewport_y = my + part->control_info.y; viewport_width = part->graphic_info.width; viewport_height = part->graphic_info.height; @@ -1198,6 +1203,9 @@ static void HandleGlobalAnimEvent(struct GlobalAnimPartControlInfo *part, static int HandleGlobalAnim_Part(struct GlobalAnimPartControlInfo *part, int state) { + if (handle_click && !part->clicked) + return state; + struct GlobalAnimControlInfo *ctrl = &global_anim_ctrl[part->mode_nr]; struct GlobalAnimMainControlInfo *anim = &ctrl->anim[part->anim_nr]; struct GraphicInfo *g = &part->graphic_info; @@ -1828,6 +1836,15 @@ static boolean InitGlobalAnim_Clicked(int mx, int my, int clicked_event) } } + if (anything_clicked) + { + handle_click = TRUE; + + HandleGlobalAnim(ANIM_CONTINUE, game_status); + + handle_click = FALSE; + } + return (anything_clicked || any_event_action); }