From 21e33411cb221de827be347312ad67c59b7d5a95 Mon Sep 17 00:00:00 2001 From: Holger Schemel Date: Mon, 2 Oct 2023 11:54:12 +0200 Subject: [PATCH] moved code to draw envelope request over global animations --- src/anim.c | 2 -- src/init.c | 1 + src/libgame/sdl.c | 4 ++++ src/libgame/system.c | 5 +++++ src/libgame/system.h | 2 ++ src/tools.c | 5 ++--- src/tools.h | 2 +- 7 files changed, 15 insertions(+), 6 deletions(-) diff --git a/src/anim.c b/src/anim.c index 4d67b458..5e3a896e 100644 --- a/src/anim.c +++ b/src/anim.c @@ -974,8 +974,6 @@ void DrawGlobalAnimations(int drawing_target, int drawing_stage) ResetGlobalAnim_Clicked(); } - DrawEnvelopeRequestToScreen(drawing_target, drawing_stage); - if (gfx.cursor_mode_override != last_cursor_mode_override) SetMouseCursor(gfx.cursor_mode); } diff --git a/src/init.c b/src/init.c index 3362ac97..e96344eb 100644 --- a/src/init.c +++ b/src/init.c @@ -5917,6 +5917,7 @@ static void InitGfx(void) InitGfxDrawGlobalAnimFunction(DrawGlobalAnimations); InitGfxDrawGlobalBorderFunction(DrawMaskedBorderToTarget); InitGfxDrawTileCursorFunction(DrawTileCursor); + InitGfxDrawEnvelopeRequestFunction(DrawEnvelopeRequestToScreen); gfx.fade_border_source_status = global.border_status; gfx.fade_border_target_status = global.border_status; diff --git a/src/libgame/sdl.c b/src/libgame/sdl.c index 71d9fbbe..9ecc97fc 100644 --- a/src/libgame/sdl.c +++ b/src/libgame/sdl.c @@ -62,6 +62,10 @@ static void FinalizeScreen(int draw_target) if (gfx.draw_global_anim_function != NULL) gfx.draw_global_anim_function(draw_target, DRAW_GLOBAL_ANIM_STAGE_2); + // copy envelope request to render target buffer, if needed (above all) + if (gfx.draw_envelope_request_function != NULL) + gfx.draw_envelope_request_function(draw_target); + // copy tile selection cursor to render target buffer, if defined (above all) if (gfx.draw_tile_cursor_function != NULL) gfx.draw_tile_cursor_function(draw_target); diff --git a/src/libgame/system.c b/src/libgame/system.c index 5a63172f..a3eae882 100644 --- a/src/libgame/system.c +++ b/src/libgame/system.c @@ -292,6 +292,11 @@ void InitGfxDrawTileCursorFunction(void (*draw_tile_cursor_function)(int)) gfx.draw_tile_cursor_function = draw_tile_cursor_function; } +void InitGfxDrawEnvelopeRequestFunction(void (*draw_envelope_request_function)(int)) +{ + gfx.draw_envelope_request_function = draw_envelope_request_function; +} + void InitGfxCustomArtworkInfo(void) { gfx.override_level_graphics = FALSE; diff --git a/src/libgame/system.h b/src/libgame/system.h index 44745de9..39fd1dfc 100644 --- a/src/libgame/system.h +++ b/src/libgame/system.h @@ -1244,6 +1244,7 @@ struct GfxInfo void (*draw_global_anim_function)(int, int); void (*draw_global_border_function)(int); void (*draw_tile_cursor_function)(int); + void (*draw_envelope_request_function)(int); int cursor_mode; int cursor_mode_override; @@ -1978,6 +1979,7 @@ void InitGfxDrawBusyAnimFunction(void (*draw_busy_anim_function)(boolean)); void InitGfxDrawGlobalAnimFunction(void (*draw_global_anim_function)(int, int)); void InitGfxDrawGlobalBorderFunction(void (*draw_global_border_function)(int)); void InitGfxDrawTileCursorFunction(void (*draw_tile_cursor_function)(int)); +void InitGfxDrawEnvelopeRequestFunction(void (*draw_envelope_request_function)(int)); void InitGfxCustomArtworkInfo(void); void InitGfxOtherSettings(void); void InitTileCursorInfo(void); diff --git a/src/tools.c b/src/tools.c index c1605b43..e66df891 100644 --- a/src/tools.c +++ b/src/tools.c @@ -3042,13 +3042,12 @@ static void PrepareEnvelopeRequestToScreen(Bitmap *bitmap, int sx, int sy, request.ysize = ysize; } -void DrawEnvelopeRequestToScreen(int drawing_target, int drawing_stage) +void DrawEnvelopeRequestToScreen(int drawing_target) { if (global.use_envelope_request && game.request_active_or_moving && request.sort_priority > 0 && - drawing_target == DRAW_TO_SCREEN && - drawing_stage == DRAW_GLOBAL_ANIM_STAGE_2) + drawing_target == DRAW_TO_SCREEN) { BlitToScreen(request.bitmap, 0, 0, request.xsize, request.ysize, request.sx, request.sy); diff --git a/src/tools.h b/src/tools.h index e80efbf2..562d0937 100644 --- a/src/tools.h +++ b/src/tools.h @@ -203,7 +203,7 @@ void DrawMiniElementOrWall(int, int, int, int); void ShowEnvelope(int); void ShowEnvelopeDoor(char *, int); -void DrawEnvelopeRequestToScreen(int, int); +void DrawEnvelopeRequestToScreen(int); void DrawLevel(int); void DrawSizedLevel(int, int, int, int, int); -- 2.34.1