From: Holger Schemel Date: Wed, 19 Apr 2017 19:05:27 +0000 (+0200) Subject: added using '.draw_masked' for global animation and toon graphics X-Git-Tag: 4.0.1.0~48 X-Git-Url: https://git.artsoft.org/?a=commitdiff_plain;h=e14d20831f1abdbcfccd5c8afcaf715e3849f468;p=rocksndiamonds.git added using '.draw_masked' for global animation and toon graphics --- diff --git a/src/anim.c b/src/anim.c index ef0fb92a..b566bddc 100644 --- a/src/anim.c +++ b/src/anim.c @@ -698,6 +698,10 @@ void DrawGlobalAnimationsExt(int drawing_target, int drawing_stage) int cut_y = 0; int sync_frame; int frame; + void (*blit_bitmap)(Bitmap *, Bitmap *, int, int, int, int, int, int) = + (g->draw_masked ? BlitBitmapMasked : BlitBitmap); + void (*blit_screen)(Bitmap *, int, int, int, int, int, int) = + (g->draw_masked ? BlitToScreenMasked : BlitToScreen); if (!(part->state & ANIM_STATE_RUNNING)) continue; @@ -741,11 +745,11 @@ void DrawGlobalAnimationsExt(int drawing_target, int drawing_stage) src_y += cut_y; if (drawing_target == DRAW_TO_SCREEN) - BlitToScreenMasked(src_bitmap, src_x, src_y, width, height, - dst_x, dst_y); + blit_screen(src_bitmap, src_x, src_y, width, height, + dst_x, dst_y); else - BlitBitmapMasked(src_bitmap, fade_bitmap, src_x, src_y, width, height, - dst_x, dst_y); + blit_bitmap(src_bitmap, fade_bitmap, src_x, src_y, width, height, + dst_x, dst_y); } } } diff --git a/src/conf_gfx.c b/src/conf_gfx.c index 935d6f14..1a14bf85 100644 --- a/src/conf_gfx.c +++ b/src/conf_gfx.c @@ -52,7 +52,7 @@ struct ConfigTypeInfo image_config_suffix[] = { ".position", ARG_UNDEFINED, TYPE_STRING }, { ".draw_xoffset", "0", TYPE_INTEGER }, { ".draw_yoffset", "0", TYPE_INTEGER }, - { ".draw_masked", "false", TYPE_BOOLEAN }, + { ".draw_masked", ARG_UNDEFINED, TYPE_BOOLEAN }, { ".draw_order", ARG_UNDEFINED, TYPE_INTEGER }, { ".init_delay_fixed", ARG_UNDEFINED, TYPE_INTEGER }, { ".init_delay_random", ARG_UNDEFINED, TYPE_INTEGER }, diff --git a/src/init.c b/src/init.c index a4b7f59f..d5a66835 100644 --- a/src/init.c +++ b/src/init.c @@ -84,6 +84,10 @@ static int copy_properties[][5] = }; +/* forward declaration for internal use */ +static int get_graphic_parameter_value(char *, char *, int); + + void DrawInitAnim() { struct GraphicInfo *graphic_info_last = graphic_info; @@ -604,6 +608,19 @@ void InitGlobalAnimGraphicInfo() special = GFX_SPECIAL_ARG_DEFAULT; global_anim_info[anim_nr].graphic[part_nr][special] = graphic; + + /* fix default value for ".draw_masked" (for backward compatibility) */ + struct GraphicInfo *g = &graphic_info[graphic]; + struct FileInfo *image = getImageListEntryFromImageID(graphic); + char **parameter_raw = image->parameter; + int p = GFX_ARG_DRAW_MASKED; + int draw_masked = get_graphic_parameter_value(parameter_raw[p], + image_config_suffix[p].token, + image_config_suffix[p].type); + + /* if ".draw_masked" parameter is undefined, use default value "TRUE" */ + if (draw_masked == ARG_UNDEFINED_VALUE) + g->draw_masked = TRUE; } #if 0 @@ -1260,6 +1277,7 @@ static void set_graphic_parameters_ext(int graphic, int *parameter, g->post_delay_random = 0; g->init_event = ANIM_EVENT_DEFAULT; g->anim_event = ANIM_EVENT_DEFAULT; + g->draw_masked = FALSE; g->draw_order = 0; g->fade_mode = FADE_MODE_DEFAULT; g->fade_delay = -1; @@ -1496,8 +1514,14 @@ static void set_graphic_parameters_ext(int graphic, int *parameter, g->draw_xoffset = parameter[GFX_ARG_DRAW_XOFFSET]; g->draw_yoffset = parameter[GFX_ARG_DRAW_YOFFSET]; - /* this is only used for drawing envelope graphics */ - g->draw_masked = parameter[GFX_ARG_DRAW_MASKED]; + /* use a different default value for global animations and toons */ + if ((graphic >= IMG_GFX_GLOBAL_ANIM_1 && graphic <= IMG_GFX_GLOBAL_ANIM_8) || + (graphic >= IMG_TOON_1 && graphic <= IMG_TOON_20)) + g->draw_masked = TRUE; + + /* this is used for drawing envelopes, global animations and toons */ + if (parameter[GFX_ARG_DRAW_MASKED] != ARG_UNDEFINED_VALUE) + g->draw_masked = parameter[GFX_ARG_DRAW_MASKED]; /* used for toon animations and global animations */ if (parameter[GFX_ARG_DRAW_ORDER] != ARG_UNDEFINED_VALUE)