From: Holger Schemel Date: Tue, 16 May 2017 21:36:08 +0000 (+0200) Subject: fixed line style drawing with empty space over MM style walls in editor X-Git-Tag: 4.1.0.0~106 X-Git-Url: https://git.artsoft.org/?a=commitdiff_plain;h=45e0606e403584e46cd3c005d488cc274db8e871;p=rocksndiamonds.git fixed line style drawing with empty space over MM style walls in editor --- diff --git a/src/editor.c b/src/editor.c index 1edadc31..dddcaa8e 100644 --- a/src/editor.c +++ b/src/editor.c @@ -10297,6 +10297,7 @@ static void SetElementSimpleExt(int x, int y, int dx, int dy, int element, int sx = x - level_xpos; int sy = y - level_ypos; int old_element = Feld[x][y]; + int new_element = element; unsigned int new_bitmask = (getDrawModeHiRes() ? (dx + 1) << (dy * 2) : 0x0f); boolean draw_masked = FALSE; @@ -10325,7 +10326,9 @@ static void SetElementSimpleExt(int x, int y, int dx, int dy, int element, if (IN_ED_FIELD(sx, sy)) { - if (draw_masked) + if (IS_MM_WALL(old_element) && new_element == EL_EMPTY) + DrawSizedWallParts_MM(sx, sy, EL_EMPTY, ed_tilesize, FALSE, new_bitmask); + else if (draw_masked) DrawEditorElementThruMask(sx, sy, element); else DrawEditorElement(sx, sy, element); diff --git a/src/tools.c b/src/tools.c index 173c40aa..6b817e85 100644 --- a/src/tools.c +++ b/src/tools.c @@ -2486,12 +2486,14 @@ void DrawLevelField(int x, int y) } static void DrawSizedWallExt_MM(int dst_x, int dst_y, int element, int tilesize, - int (*el2img_function)(int), boolean masked) + int (*el2img_function)(int), boolean masked, + int element_bits_draw) { int element_base = map_mm_wall_element(element); int element_bits = (IS_DF_WALL(element) ? element - EL_DF_WALL_START : - element - EL_MM_WALL_START) & 0x000f; + IS_MM_WALL(element) ? + element - EL_MM_WALL_START : EL_EMPTY) & 0x000f; int graphic = el2img_function(element_base); int tilesize_draw = tilesize / 2; Bitmap *src_bitmap; @@ -2505,6 +2507,9 @@ static void DrawSizedWallExt_MM(int dst_x, int dst_y, int element, int tilesize, int dst_draw_x = dst_x + (i % 2) * tilesize_draw; int dst_draw_y = dst_y + (i / 2) * tilesize_draw; + if (!(element_bits_draw & (1 << i))) + continue; + if (element_bits & (1 << i)) { if (masked) @@ -2523,10 +2528,18 @@ static void DrawSizedWallExt_MM(int dst_x, int dst_y, int element, int tilesize, } } +void DrawSizedWallParts_MM(int x, int y, int element, int tilesize, + boolean masked, int element_bits_draw) +{ + DrawSizedWallExt_MM(SX + x * tilesize, SY + y * tilesize, + element, tilesize, el2edimg, masked, element_bits_draw); +} + void DrawSizedWall_MM(int dst_x, int dst_y, int element, int tilesize, int (*el2img_function)(int)) { - DrawSizedWallExt_MM(dst_x, dst_y, element, tilesize, el2img_function, FALSE); + DrawSizedWallExt_MM(dst_x, dst_y, element, tilesize, el2img_function, FALSE, + 0x000f); } void DrawSizedElementExt(int x, int y, int element, int tilesize, @@ -2535,7 +2548,7 @@ void DrawSizedElementExt(int x, int y, int element, int tilesize, if (IS_MM_WALL(element)) { DrawSizedWallExt_MM(SX + x * tilesize, SY + y * tilesize, - element, tilesize, el2edimg, masked); + element, tilesize, el2edimg, masked, 0x000f); } else { diff --git a/src/tools.h b/src/tools.h index 7727ab69..794cc085 100644 --- a/src/tools.h +++ b/src/tools.h @@ -178,6 +178,7 @@ void DrawLevelElement(int, int, int); void DrawScreenField(int, int); void DrawLevelField(int, int); +void DrawSizedWallParts_MM(int, int, int, int, boolean, int); void DrawSizedElement(int, int, int, int); void DrawSizedElementThruMask(int, int, int, int); void DrawSizedElementOrWall(int, int, int, int, int);