From: Holger Schemel Date: Mon, 4 Dec 2023 07:13:32 +0000 (+0100) Subject: fixed tile cursor drawing position X-Git-Tag: 4.3.8.0~14 X-Git-Url: https://git.artsoft.org/?p=rocksndiamonds.git;a=commitdiff_plain;h=89237f2f4d7189714da64da53c1515979ad49b2d fixed tile cursor drawing position --- diff --git a/src/game_mm/export.h b/src/game_mm/export.h index b555511b..1d063969 100644 --- a/src/game_mm/export.h +++ b/src/game_mm/export.h @@ -238,7 +238,7 @@ void InitGameActions_MM(void); void GameActions_MM(struct MouseActionInfo); void DrawLaser_MM(void); -void DrawTileCursor_MM(int, boolean); +void DrawTileCursor_MM(int, int, boolean); boolean ClickElement(int, int, int); diff --git a/src/game_mm/mm_tools.c b/src/game_mm/mm_tools.c index 6aeadd31..12ca83ce 100644 --- a/src/game_mm/mm_tools.c +++ b/src/game_mm/mm_tools.c @@ -1057,7 +1057,8 @@ static void DrawTileCursor_Xsn(int draw_target) } } -void DrawTileCursor_MM(int draw_target, boolean tile_cursor_active) +void DrawTileCursor_MM(int draw_target, int drawing_stage, + boolean tile_cursor_active) { if (program.headless) return; @@ -1072,7 +1073,12 @@ void DrawTileCursor_MM(int draw_target, boolean tile_cursor_active) int width = tilesize; int height = tilesize; - DrawTileCursor_Xsn(draw_target); + if (!drawing_stage) + { + DrawTileCursor_Xsn(draw_target); + + return; + } if (!tile_cursor.enabled || !tile_cursor.active || diff --git a/src/game_mm/mm_tools.h b/src/game_mm/mm_tools.h index 5f116c90..28ba5c33 100644 --- a/src/game_mm/mm_tools.h +++ b/src/game_mm/mm_tools.h @@ -88,7 +88,7 @@ void DrawWallsExt_MM(int, int, int, int); void DrawWalls_MM(int, int, int); void DrawWallsAnimation_MM(int, int, int, int, int); void DrawMicroLevel_MM(int, int, boolean); -void DrawTileCursor_MM(int, boolean); +void DrawTileCursor_MM(int, int, boolean); boolean Request(char *, unsigned int); unsigned int OpenDoor(unsigned int); diff --git a/src/libgame/sdl.c b/src/libgame/sdl.c index 06805765..096eeb70 100644 --- a/src/libgame/sdl.c +++ b/src/libgame/sdl.c @@ -62,9 +62,9 @@ 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 tile selection cursor to render target buffer, if defined (above all) + // copy tile selection cursor to render target buffer, if defined (part 1) if (gfx.draw_tile_cursor_function != NULL) - gfx.draw_tile_cursor_function(draw_target); + gfx.draw_tile_cursor_function(draw_target, TRUE); // copy envelope request to render target buffer, if needed (above all) if (gfx.draw_envelope_request_function != NULL) @@ -73,6 +73,10 @@ static void FinalizeScreen(int draw_target) // copy global animations to render target buffer, if defined (mouse pointer) if (gfx.draw_global_anim_function != NULL) gfx.draw_global_anim_function(draw_target, DRAW_GLOBAL_ANIM_STAGE_3); + + // copy tile selection cursor to render target buffer, if defined (part 2) + if (gfx.draw_tile_cursor_function != NULL) + gfx.draw_tile_cursor_function(draw_target, FALSE); } static void UpdateScreenExt(SDL_Rect *rect, boolean with_frame_delay) diff --git a/src/libgame/system.c b/src/libgame/system.c index 2f21541d..2fad2227 100644 --- a/src/libgame/system.c +++ b/src/libgame/system.c @@ -287,7 +287,7 @@ void InitGfxDrawGlobalBorderFunction(void (*draw_global_border_function)(int)) gfx.draw_global_border_function = draw_global_border_function; } -void InitGfxDrawTileCursorFunction(void (*draw_tile_cursor_function)(int)) +void InitGfxDrawTileCursorFunction(void (*draw_tile_cursor_function)(int, int)) { gfx.draw_tile_cursor_function = draw_tile_cursor_function; } diff --git a/src/libgame/system.h b/src/libgame/system.h index e5938dee..b4194801 100644 --- a/src/libgame/system.h +++ b/src/libgame/system.h @@ -1245,7 +1245,7 @@ struct GfxInfo void (*draw_busy_anim_function)(boolean); void (*draw_global_anim_function)(int, int); void (*draw_global_border_function)(int); - void (*draw_tile_cursor_function)(int); + void (*draw_tile_cursor_function)(int, int); void (*draw_envelope_request_function)(int); int cursor_mode; @@ -1980,7 +1980,7 @@ void InitGfxClipRegion(boolean, int, int, int, int); 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 InitGfxDrawTileCursorFunction(void (*draw_tile_cursor_function)(int, int)); void InitGfxDrawEnvelopeRequestFunction(void (*draw_envelope_request_function)(int)); void InitGfxCustomArtworkInfo(void); void InitGfxOtherSettings(void); diff --git a/src/tools.c b/src/tools.c index 26532a75..ec647a63 100644 --- a/src/tools.c +++ b/src/tools.c @@ -646,9 +646,11 @@ void DrawMaskedBorderToTarget(int draw_target) } } -void DrawTileCursor(int draw_target) +void DrawTileCursor(int draw_target, int drawing_stage) { - DrawTileCursor_MM(draw_target, game_status == GAME_MODE_PLAYING); + int tile_cursor_active = (game_status == GAME_MODE_PLAYING); + + DrawTileCursor_MM(draw_target, drawing_stage, tile_cursor_active); } void BlitScreenToBitmapExt_RND(Bitmap *target_bitmap, int fx, int fy) diff --git a/src/tools.h b/src/tools.h index 5901208c..5f597f42 100644 --- a/src/tools.h +++ b/src/tools.h @@ -83,7 +83,7 @@ void DrawMaskedBorder_DOOR_3(void); void DrawMaskedBorder_ALL(void); void DrawMaskedBorder(int); void DrawMaskedBorderToTarget(int); -void DrawTileCursor(int); +void DrawTileCursor(int, int); void SetDrawtoField(int); int GetDrawtoField(void);