From: Holger Schemel Date: Mon, 22 Apr 2019 11:08:40 +0000 (+0200) Subject: added forcing pointer-style global animations to stay inside window area X-Git-Tag: 4.1.3.0~9 X-Git-Url: https://git.artsoft.org/?p=rocksndiamonds.git;a=commitdiff_plain;h=98ae5fc5e9274fea99a2ed8873b78fc2110ce3ce added forcing pointer-style global animations to stay inside window area --- diff --git a/src/anim.c b/src/anim.c index d226d5cd..8256ce7f 100644 --- a/src/anim.c +++ b/src/anim.c @@ -863,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;