From: Holger Schemel Date: Sat, 27 Apr 2024 11:49:01 +0000 (+0200) Subject: moved workaround for BD runtime elements in editor to separate function X-Git-Tag: 4.4.0.0-test-1~30 X-Git-Url: https://git.artsoft.org/?a=commitdiff_plain;h=5934610dc0048580758ec4b9c2d2a9c75e3a2615;p=rocksndiamonds.git moved workaround for BD runtime elements in editor to separate function --- diff --git a/src/editor.c b/src/editor.c index 34bcb2f9..6ec52ee3 100644 --- a/src/editor.c +++ b/src/editor.c @@ -8102,8 +8102,7 @@ static void getEditorGraphicAndFrame(int element, int *graphic, int *frame, bool { if (use_editor_gfx) { - *graphic = el2edimg(element); - *frame = 0; + el2edimg_with_frame(element, graphic, frame); } else { @@ -8113,21 +8112,6 @@ static void getEditorGraphicAndFrame(int element, int *graphic, int *frame, bool ANIM_MODE(*graphic) == ANIM_CE_SCORE ? custom_element.collect_score_initial : FrameCounter); } - - 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; - } - } } static void getEditorGraphicSource(int element, int tile_size, Bitmap **bitmap, diff --git a/src/tools.c b/src/tools.c index 7c81b8f7..b12c7ea6 100644 --- a/src/tools.c +++ b/src/tools.c @@ -10163,6 +10163,31 @@ int el2edimg(int element) return element_info[element].special_graphic[GFX_SPECIAL_ARG_EDITOR]; } +int el2edimg_with_frame(int element, int *graphic, int *frame) +{ + element = GFX_ELEMENT(element); + + *graphic = element_info[element].special_graphic[GFX_SPECIAL_ARG_EDITOR]; + *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; + } + } + + return *graphic; +} + int el2preimg(int element) { element = GFX_ELEMENT(element); diff --git a/src/tools.h b/src/tools.h index 67e0d8c5..11204005 100644 --- a/src/tools.h +++ b/src/tools.h @@ -264,6 +264,7 @@ int el_dir2img(int, int); int el2baseimg(int); int el2img(int); int el2edimg(int); +int el2edimg_with_frame(int, int *, int *); int el2preimg(int); int el2panelimg(int); int font2baseimg(int);