From: Holger Schemel Date: Wed, 3 Apr 2019 17:22:26 +0000 (+0200) Subject: improved global animation class "pointer" for animation at mouse position X-Git-Tag: 4.1.3.0~18 X-Git-Url: https://git.artsoft.org/?a=commitdiff_plain;h=3cc2ee99e57014c6962d26365e92bd3eac36a492;p=rocksndiamonds.git improved global animation class "pointer" for animation at mouse position When using this animation class, the "real" mouse pointer is made invisible now. --- diff --git a/src/anim.c b/src/anim.c index eccd0185..be6c98f6 100644 --- a/src/anim.c +++ b/src/anim.c @@ -813,13 +813,24 @@ static void DrawGlobalAnimationsExt(int drawing_target, int drawing_stage) void DrawGlobalAnimations(int drawing_target, int drawing_stage) { + int last_cursor_mode_override = gfx.cursor_mode_override; + if (drawing_stage == DRAW_GLOBAL_ANIM_STAGE_1) + { ResetGlobalAnim_Clickable(); + gfx.cursor_mode_override = CURSOR_UNDEFINED; + } + DrawGlobalAnimationsExt(drawing_target, drawing_stage); if (drawing_stage == DRAW_GLOBAL_ANIM_STAGE_2) + { ResetGlobalAnim_Clicked(); + } + + if (gfx.cursor_mode_override != last_cursor_mode_override) + SetMouseCursor(gfx.cursor_mode); } static boolean SetGlobalAnimPart_Viewport(struct GlobalAnimPartControlInfo *part) @@ -856,6 +867,8 @@ static boolean SetGlobalAnimPart_Viewport(struct GlobalAnimPartControlInfo *part viewport_height = part->graphic_info.height; part->drawing_stage = DRAW_GLOBAL_ANIM_STAGE_2; + + gfx.cursor_mode_override = CURSOR_NONE; } else if (part->control_info.class == get_hash_from_key("door_1")) { diff --git a/src/libgame/system.c b/src/libgame/system.c index 15e86a4a..6f27daf6 100644 --- a/src/libgame/system.c +++ b/src/libgame/system.c @@ -317,6 +317,9 @@ void InitGfxCustomArtworkInfo(void) void InitGfxOtherSettings(void) { gfx.cursor_mode = CURSOR_DEFAULT; + gfx.cursor_mode_override = CURSOR_UNDEFINED; + gfx.cursor_mode_final = gfx.cursor_mode; + gfx.mouse_x = 0; gfx.mouse_y = 0; } @@ -1552,6 +1555,7 @@ void SetMouseCursor(int mode) static struct MouseCursorInfo *cursor_none = NULL; static struct MouseCursorInfo *cursor_playfield = NULL; struct MouseCursorInfo *cursor_new; + int mode_final = mode; if (cursor_none == NULL) cursor_none = get_cursor_from_image(cursor_image_none); @@ -1559,13 +1563,17 @@ void SetMouseCursor(int mode) if (cursor_playfield == NULL) cursor_playfield = get_cursor_from_image(cursor_image_playfield); - cursor_new = (mode == CURSOR_DEFAULT ? NULL : - mode == CURSOR_NONE ? cursor_none : - mode == CURSOR_PLAYFIELD ? cursor_playfield : NULL); + if (gfx.cursor_mode_override != CURSOR_UNDEFINED) + mode_final = gfx.cursor_mode_override; + + cursor_new = (mode_final == CURSOR_DEFAULT ? NULL : + mode_final == CURSOR_NONE ? cursor_none : + mode_final == CURSOR_PLAYFIELD ? cursor_playfield : NULL); SDLSetMouseCursor(cursor_new); gfx.cursor_mode = mode; + gfx.cursor_mode_final = mode_final; } diff --git a/src/libgame/system.h b/src/libgame/system.h index 4e64c326..d4e732e9 100644 --- a/src/libgame/system.h +++ b/src/libgame/system.h @@ -469,6 +469,7 @@ y >= gfx.ey && y < gfx.ey + gfx.eysize) // values for mouse cursor +#define CURSOR_UNDEFINED -1 #define CURSOR_DEFAULT 0 #define CURSOR_NONE 1 #define CURSOR_PLAYFIELD 2 @@ -1121,6 +1122,8 @@ struct GfxInfo void (*draw_tile_cursor_function)(int); int cursor_mode; + int cursor_mode_override; + int cursor_mode_final; int mouse_x, mouse_y; };