From: Holger Schemel Date: Mon, 18 Mar 2019 22:57:46 +0000 (+0100) Subject: added global animation class "pointer" for animation at mouse position X-Git-Tag: 4.1.3.0~29 X-Git-Url: https://git.artsoft.org/?p=rocksndiamonds.git;a=commitdiff_plain;h=f50b39e5a25f45c554d42130174da25d90131e57 added global animation class "pointer" for animation at mouse position The animation's x and y position values are used to set the animation position relative to the mouse pointer position when using this class. --- diff --git a/src/anim.c b/src/anim.c index 9d1f0b5c..2ebf520f 100644 --- a/src/anim.c +++ b/src/anim.c @@ -828,7 +828,8 @@ static boolean SetGlobalAnimPart_Viewport(struct GlobalAnimPartControlInfo *part int viewport_height; boolean changed = FALSE; - if (part->last_anim_status == global.anim_status) + if (part->last_anim_status == global.anim_status && + part->control_info.class != get_hash_from_key("pointer")) return FALSE; part->last_anim_status = global.anim_status; @@ -845,6 +846,15 @@ static boolean SetGlobalAnimPart_Viewport(struct GlobalAnimPartControlInfo *part part->drawing_stage = DRAW_GLOBAL_ANIM_STAGE_2; } + 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; + viewport_width = part->graphic_info.width; + viewport_height = part->graphic_info.height; + + part->drawing_stage = DRAW_GLOBAL_ANIM_STAGE_2; + } else if (part->control_info.class == get_hash_from_key("door_1")) { viewport_x = DX; @@ -1256,10 +1266,13 @@ static int HandleGlobalAnim_Part(struct GlobalAnimPartControlInfo *part, part->step_yoffset = 0; } - if (c->x != ARG_UNDEFINED_VALUE) - part->x = c->x; - if (c->y != ARG_UNDEFINED_VALUE) - part->y = c->y; + if (part->control_info.class != get_hash_from_key("pointer")) + { + if (c->x != ARG_UNDEFINED_VALUE) + part->x = c->x; + if (c->y != ARG_UNDEFINED_VALUE) + part->y = c->y; + } if (c->position == POS_LAST && anim->last_x > -g->width && anim->last_x < part->viewport_width &&