From 6fa6665526787de40c7dc094b54014e5a31df6e0 Mon Sep 17 00:00:00 2001 From: Holger Schemel Date: Thu, 7 Mar 2024 00:50:06 +0100 Subject: [PATCH] fixed preview size of intermission levels for native BD level sets --- src/tools.c | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/src/tools.c b/src/tools.c index b92cf01b..537a0e21 100644 --- a/src/tools.c +++ b/src/tools.c @@ -3465,11 +3465,27 @@ void DrawMiniLevel(int size_x, int size_y, int scroll_x, int scroll_y) redraw_mask |= REDRAW_FIELD; } +static int getPreviewLevelWidth(void) +{ + if (level.game_engine_type == GAME_ENGINE_TYPE_BD) + return (level.native_bd_level->cave->x2 - level.native_bd_level->cave->x1 + 1); + + return lev_fieldx; +} + +static int getPreviewLevelHeight(void) +{ + if (level.game_engine_type == GAME_ENGINE_TYPE_BD) + return (level.native_bd_level->cave->y2 - level.native_bd_level->cave->y1 + 1); + + return lev_fieldy; +} + static void DrawPreviewLevelPlayfield(int from_x, int from_y) { boolean show_level_border = (BorderElement != EL_EMPTY); - int level_xsize = lev_fieldx + (show_level_border ? 2 : 0); - int level_ysize = lev_fieldy + (show_level_border ? 2 : 0); + int level_xsize = getPreviewLevelWidth() + (show_level_border ? 2 : 0); + int level_ysize = getPreviewLevelHeight() + (show_level_border ? 2 : 0); int tile_size = preview.tile_size; int preview_width = preview.xsize * tile_size; int preview_height = preview.ysize * tile_size; -- 2.34.1