projects
/
rocksndiamonds.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
ed79345
)
added forcing pointer-style global animations to stay inside window area
author
Holger Schemel
<info@artsoft.org>
Mon, 22 Apr 2019 11:08:40 +0000
(13:08 +0200)
committer
Holger Schemel
<info@artsoft.org>
Mon, 22 Apr 2019 11:08:40 +0000
(13:08 +0200)
src/anim.c
patch
|
blob
|
history
diff --git
a/src/anim.c
b/src/anim.c
index d226d5cddcc82626191dde2c34abb6edcca32f48..8256ce7f60f5ec62fda3ebf49adb086a5450cc3b 100644
(file)
--- 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"))
{
}
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;
viewport_width = part->graphic_info.width;
viewport_height = part->graphic_info.height;