From: Holger Schemel Date: Sat, 23 Mar 2024 14:17:46 +0000 (+0100) Subject: added "effects" element graphics for native BD engine to level editor X-Git-Tag: 4.4.0.0-test-1~159 X-Git-Url: https://git.artsoft.org/?a=commitdiff_plain;h=bd826a8c1635d94fc84b15c785377b975a6cd7e1;p=rocksndiamonds.git added "effects" element graphics for native BD engine to level editor --- diff --git a/src/editor.c b/src/editor.c index 721f4afe..750e0fa8 100644 --- a/src/editor.c +++ b/src/editor.c @@ -7359,7 +7359,25 @@ static void ScrollEditorLevel(int from_x, int from_y, int scroll) static void getEditorGraphicSource(int element, int tile_size, Bitmap **bitmap, int *x, int *y) { - getSizedGraphicSource(el2edimg(element), 0, tile_size, bitmap, x, y); + int graphic = el2edimg(element); + int frame = 0; + + if (graphic == IMG_UNKNOWN) + { + // no graphic defined -- if BD style, try to get runtime ("effect") element graphics + // (normal BD style elements have graphics, but runtime ("effects") elements do not) + int element_bd = map_element_RND_to_BD_cave(element); + + if (element_bd != O_UNKNOWN) + { + struct GraphicInfo_BD *g_bd = &graphic_info_bd_object[element_bd][0]; + + graphic = g_bd->graphic; + frame = g_bd->frame; + } + } + + getSizedGraphicSource(graphic, frame, tile_size, bitmap, x, y); } static void CreateControlButtons(void) diff --git a/src/game_bd/export_bd.h b/src/game_bd/export_bd.h index f14d8f84..3b8c7721 100644 --- a/src/game_bd/export_bd.h +++ b/src/game_bd/export_bd.h @@ -65,6 +65,9 @@ struct GraphicInfo_BD Bitmap *bitmap; int src_x, src_y; int width, height; + + int graphic; + int frame; }; struct EngineSnapshotInfo_BD diff --git a/src/tools.c b/src/tools.c index aa15883d..26df7535 100644 --- a/src/tools.c +++ b/src/tools.c @@ -10578,6 +10578,9 @@ void InitGraphicInfo_BD(void) g_bd->src_y = src_y; g_bd->width = TILEX; g_bd->height = TILEY; + + g_bd->graphic = graphic; + g_bd->frame = frame; } } @@ -10594,6 +10597,9 @@ void InitGraphicInfo_BD(void) g_bd->src_y = src_y; g_bd->width = TILEX; g_bd->height = TILEY; + + g_bd->graphic = graphic; + g_bd->frame = 0; } void InitGraphicInfo_EM(void)