X-Git-Url: https://git.artsoft.org/?a=blobdiff_plain;f=src%2Feditor.c;h=5da47e5ecaccc60da999a2d97af0e0bf1cdf4ff7;hb=f4a36cca096bb25c4f564991bd454f9f6d532cd0;hp=721f4afe78e8e660381d31edddf6c5801051bdae;hpb=dc9fe7359bd0b8dea49f46b9fb2e59f006200a63;p=rocksndiamonds.git diff --git a/src/editor.c b/src/editor.c index 721f4afe..5da47e5e 100644 --- a/src/editor.c +++ b/src/editor.c @@ -4939,10 +4939,10 @@ static int editor_el_boulderdash_effects[] = EL_BD_MEGA_ROCK_FALLING, EL_BD_FLYING_DIAMOND_FLYING, - EL_BD_FLYING_ROCK_FLYING, EL_BD_FALLING_WALL_FALLING, EL_BD_NITRO_PACK_FALLING, EL_BD_NUT_FALLING, + EL_BD_FLYING_ROCK_FLYING, EL_BD_PLAYER_GROWING_1, EL_BD_PLAYER_GROWING_2, @@ -7356,10 +7356,47 @@ static void ScrollEditorLevel(int from_x, int from_y, int scroll) BackToFront(); } +static void getEditorGraphicAndFrame(int element, int *graphic, int *frame, boolean use_editor_gfx) +{ + if (use_editor_gfx) + { + *graphic = el2edimg(element); + *frame = 0; + } + else + { + *graphic = el2img(element); + *frame = (ANIM_MODE(*graphic) == ANIM_CE_VALUE ? + custom_element.ce_value_fixed_initial : + 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, int *x, int *y) { - getSizedGraphicSource(el2edimg(element), 0, tile_size, bitmap, x, y); + int graphic; + int frame; + + getEditorGraphicAndFrame(element, &graphic, &frame, TRUE); + + getSizedGraphicSource(graphic, frame, tile_size, bitmap, x, y); } static void CreateControlButtons(void) @@ -11950,11 +11987,10 @@ static void DrawPropertiesChange(void) static void DrawEditorElementAnimation(int x, int y) { - int graphic = el2img(properties_element); - int frame = (ANIM_MODE(graphic) == ANIM_CE_VALUE ? - custom_element.ce_value_fixed_initial : - ANIM_MODE(graphic) == ANIM_CE_SCORE ? - custom_element.collect_score_initial : FrameCounter); + int graphic; + int frame; + + getEditorGraphicAndFrame(properties_element, &graphic, &frame, FALSE); DrawFixedGraphicAnimationExt(drawto, x, y, graphic, frame, NO_MASKING); }