From: Holger Schemel Date: Fri, 7 Oct 2016 07:03:28 +0000 (+0200) Subject: fixed drawing of crumbled borders for 64x64 sized game graphics X-Git-Tag: 4.0.0.0~39 X-Git-Url: https://git.artsoft.org/?a=commitdiff_plain;h=f85e877642f788205d1414ab1f7eee29679386e6;p=rocksndiamonds.git fixed drawing of crumbled borders for 64x64 sized game graphics --- diff --git a/src/game_em/export.h b/src/game_em/export.h index 837a9baf..efc02cc5 100644 --- a/src/game_em/export.h +++ b/src/game_em/export.h @@ -691,6 +691,7 @@ struct GraphicInfo_EM Bitmap *crumbled_bitmap; int crumbled_src_x, crumbled_src_y; int crumbled_border_size; + int crumbled_tile_size; boolean has_crumbled_graphics; boolean preserve_background; diff --git a/src/game_em/graphics.c b/src/game_em/graphics.c index 03934a71..54711e95 100644 --- a/src/game_em/graphics.c +++ b/src/game_em/graphics.c @@ -174,7 +174,8 @@ static void DrawLevelFieldCrumbled_EM(int x, int y, int sx, int sy, g = getObjectGraphic(x, y); - crumbled_border_size = g->crumbled_border_size * TILESIZE_VAR / TILESIZE; + crumbled_border_size = + g->crumbled_border_size * TILESIZE_VAR / g->crumbled_tile_size; for (i = 0; i < 4; i++) { diff --git a/src/game_em/tab_generate.c b/src/game_em/tab_generate.c index 936f63b3..95784516 100644 --- a/src/game_em/tab_generate.c +++ b/src/game_em/tab_generate.c @@ -4532,6 +4532,7 @@ void create_obj_graphics_info_em() g->crumbled_src_x = 0; g->crumbled_src_y = 0; g->crumbled_border_size = 0; + g->crumbled_tile_size = 0; g->has_crumbled_graphics = FALSE; g->preserve_background = FALSE; diff --git a/src/tools.c b/src/tools.c index e534cc29..68a81be9 100644 --- a/src/tools.c +++ b/src/tools.c @@ -1760,6 +1760,9 @@ static void DrawLevelFieldCrumbledInnerCorners(int x, int y, int dx, int dy, int width, height, cx, cy; int sx = SCREENX(x), sy = SCREENY(y); int crumbled_border_size = graphic_info[graphic].border_size; + int crumbled_tile_size = graphic_info[graphic].tile_size; + int crumbled_border_size_var = + crumbled_border_size * TILESIZE_VAR / crumbled_tile_size; int i; getGraphicSource(graphic, 0, &src_bitmap, &src_x, &src_y); @@ -1787,8 +1790,8 @@ static void DrawLevelFieldCrumbledInnerCorners(int x, int y, int dx, int dy, getGraphicSource(graphic, 1, &src_bitmap, &src_x, &src_y); - width = crumbled_border_size * TILESIZE_VAR / TILESIZE; - height = crumbled_border_size * TILESIZE_VAR / TILESIZE; + width = crumbled_border_size_var; + height = crumbled_border_size_var; cx = (dx > 0 ? TILESIZE_VAR - width : 0); cy = (dy > 0 ? TILESIZE_VAR - height : 0); @@ -1804,7 +1807,9 @@ static void DrawLevelFieldCrumbledBorders(int x, int y, int graphic, int frame, int width, height, bx, by, cx, cy; int sx = SCREENX(x), sy = SCREENY(y); int crumbled_border_size = graphic_info[graphic].border_size; - int crumbled_border_size_var = crumbled_border_size * TILESIZE_VAR / TILESIZE; + int crumbled_tile_size = graphic_info[graphic].tile_size; + int crumbled_border_size_var = + crumbled_border_size * TILESIZE_VAR / crumbled_tile_size; int crumbled_border_pos_var = TILESIZE_VAR - crumbled_border_size_var; int i; @@ -1823,7 +1828,7 @@ static void DrawLevelFieldCrumbledBorders(int x, int y, int graphic, int frame, /* (remaining middle border part must be at least as big as corner part) */ if (!(graphic_info[graphic].style & STYLE_ACCURATE_BORDERS) || - crumbled_border_size >= TILESIZE / 3) + crumbled_border_size_var >= TILESIZE_VAR / 3) return; /* correct corners of crumbled border, if needed */ @@ -7265,6 +7270,7 @@ inline static void set_crumbled_graphics_EM(struct GraphicInfo_EM *g_em, &g_em->crumbled_src_x, &g_em->crumbled_src_y); g_em->crumbled_border_size = graphic_info[crumbled].border_size; + g_em->crumbled_tile_size = graphic_info[crumbled].tile_size; g_em->has_crumbled_graphics = TRUE; } @@ -7274,6 +7280,7 @@ inline static void set_crumbled_graphics_EM(struct GraphicInfo_EM *g_em, g_em->crumbled_src_x = 0; g_em->crumbled_src_y = 0; g_em->crumbled_border_size = 0; + g_em->crumbled_tile_size = 0; g_em->has_crumbled_graphics = FALSE; }