Cut down a lot of duplicate code in tile_render functions

This commit is contained in:
twinaphex 2014-12-12 01:30:05 +01:00
parent bf17a15988
commit c54cff8f70
1 changed files with 118 additions and 267 deletions

193
video.c
View File

@ -884,16 +884,6 @@ static void render_scanline_text_base_normal(u32 layer,
partial_tile_right_map(base, 8bpp, normal);
}
}
tile_run = end / 8;
multiple_tile_map(base, 8bpp, normal);
partial_tile_run = end % 8;
if(partial_tile_run)
{
partial_tile_left_map(base, 8bpp, normal);
}
}
else
{
@ -907,6 +897,7 @@ static void render_scanline_text_base_normal(u32 layer,
multiple_tile_map(base, 8bpp, normal);
map_ptr = second_ptr;
end -= pixel_run;
}
tile_run = end / 8;
multiple_tile_map(base, 8bpp, normal);
@ -916,7 +907,6 @@ static void render_scanline_text_base_normal(u32 layer,
partial_tile_left_map(base, 8bpp, normal);
}
}
}
else
{
/* color depth: 4bpp
@ -958,16 +948,6 @@ static void render_scanline_text_base_normal(u32 layer,
partial_tile_right_map(base, 4bpp, normal);
}
}
tile_run = end / 8;
multiple_tile_map(base, 4bpp, normal);
partial_tile_run = end % 8;
if(partial_tile_run)
{
partial_tile_left_map(base, 4bpp, normal);
}
}
else
{
@ -981,6 +961,7 @@ static void render_scanline_text_base_normal(u32 layer,
multiple_tile_map(base, 4bpp, normal);
map_ptr = second_ptr;
end -= pixel_run;
}
tile_run = end / 8;
multiple_tile_map(base, 4bpp, normal);
@ -991,7 +972,6 @@ static void render_scanline_text_base_normal(u32 layer,
}
}
}
}
static void render_scanline_text_transparent_normal(u32 layer,
u32 start, u32 end, void *scanline)
@ -1090,16 +1070,6 @@ static void render_scanline_text_transparent_normal(u32 layer,
partial_tile_right_map(transparent, 8bpp, normal);
}
}
tile_run = end / 8;
multiple_tile_map(transparent, 8bpp, normal);
partial_tile_run = end % 8;
if(partial_tile_run)
{
partial_tile_left_map(transparent, 8bpp, normal);
}
}
else
{
@ -1113,6 +1083,7 @@ static void render_scanline_text_transparent_normal(u32 layer,
multiple_tile_map(transparent, 8bpp, normal);
map_ptr = second_ptr;
end -= pixel_run;
}
tile_run = end / 8;
multiple_tile_map(transparent, 8bpp, normal);
@ -1122,7 +1093,6 @@ static void render_scanline_text_transparent_normal(u32 layer,
partial_tile_left_map(transparent, 8bpp, normal);
}
}
}
else
{
/* color depth: 4bpp
@ -1163,16 +1133,6 @@ static void render_scanline_text_transparent_normal(u32 layer,
partial_tile_right_map(transparent, 4bpp, normal);
}
}
tile_run = end / 8;
multiple_tile_map(transparent, 4bpp, normal);
partial_tile_run = end % 8;
if(partial_tile_run)
{
partial_tile_left_map(transparent, 4bpp, normal);
}
}
else
{
@ -1186,6 +1146,8 @@ static void render_scanline_text_transparent_normal(u32 layer,
multiple_tile_map(transparent, 4bpp, normal);
map_ptr = second_ptr;
end -= pixel_run;
}
tile_run = end / 8;
multiple_tile_map(transparent, 4bpp, normal);
@ -1196,7 +1158,6 @@ static void render_scanline_text_transparent_normal(u32 layer,
}
}
}
}
static void render_scanline_text_base_color16(u32 layer,
u32 start, u32 end, void *scanline)
@ -1294,16 +1255,6 @@ static void render_scanline_text_base_color16(u32 layer,
partial_tile_right_map(base, 8bpp, color16);
}
}
tile_run = end / 8;
multiple_tile_map(base, 8bpp, color16);
partial_tile_run = end % 8;
if(partial_tile_run)
{
partial_tile_left_map(base, 8bpp, color16);
}
}
else
{
@ -1317,6 +1268,7 @@ static void render_scanline_text_base_color16(u32 layer,
multiple_tile_map(base, 8bpp, color16);
map_ptr = second_ptr;
end -= pixel_run;
}
tile_run = end / 8;
multiple_tile_map(base, 8bpp, color16);
@ -1326,7 +1278,6 @@ static void render_scanline_text_base_color16(u32 layer,
partial_tile_left_map(base, 8bpp, color16);
}
}
}
else
{
/* color depth: 4bpp
@ -1367,15 +1318,6 @@ static void render_scanline_text_base_color16(u32 layer,
}
}
tile_run = end / 8;
multiple_tile_map(base, 4bpp, color16);
partial_tile_run = end % 8;
if(partial_tile_run)
{
partial_tile_left_map(base, 4bpp, color16);
}
}
else
{
@ -1389,17 +1331,18 @@ static void render_scanline_text_base_color16(u32 layer,
multiple_tile_map(base, 4bpp, color16);
map_ptr = second_ptr;
end -= pixel_run;
}
tile_run = end / 8;
multiple_tile_map(base, 4bpp, color16);
partial_tile_run = end % 8;
if(partial_tile_run)
{
partial_tile_left_map(base, 4bpp, color16);
}
}
}
}
static void render_scanline_text_transparent_color16(u32 layer,
u32 start, u32 end, void *scanline)
@ -1497,16 +1440,6 @@ static void render_scanline_text_transparent_color16(u32 layer,
partial_tile_right_map(transparent, 8bpp, color16);
}
}
tile_run = end / 8;
multiple_tile_map(transparent, 8bpp, color16);
partial_tile_run = end % 8;
if(partial_tile_run)
{
partial_tile_left_map(transparent, 8bpp, color16);
}
}
else
{
@ -1520,6 +1453,7 @@ static void render_scanline_text_transparent_color16(u32 layer,
multiple_tile_map(transparent, 8bpp, color16);
map_ptr = second_ptr;
end -= pixel_run;
}
tile_run = end / 8;
multiple_tile_map(transparent, 8bpp, color16);
@ -1529,7 +1463,6 @@ static void render_scanline_text_transparent_color16(u32 layer,
partial_tile_left_map(transparent, 8bpp, color16);
}
}
}
else
{
/* color depth: 4bpp
@ -1570,15 +1503,6 @@ static void render_scanline_text_transparent_color16(u32 layer,
}
}
tile_run = end / 8;
multiple_tile_map(transparent, 4bpp, color16);
partial_tile_run = end % 8;
if(partial_tile_run)
{
partial_tile_left_map(transparent, 4bpp, color16);
}
}
else
{
@ -1592,17 +1516,18 @@ static void render_scanline_text_transparent_color16(u32 layer,
multiple_tile_map(transparent, 4bpp, color16);
map_ptr = second_ptr;
end -= pixel_run;
}
tile_run = end / 8;
multiple_tile_map(transparent, 4bpp, color16);
partial_tile_run = end % 8;
if(partial_tile_run)
{
partial_tile_left_map(transparent, 4bpp, color16);
}
}
}
}
static void render_scanline_text_base_color32(u32 layer,
u32 start, u32 end, void *scanline)
@ -1700,16 +1625,6 @@ static void render_scanline_text_base_color32(u32 layer,
partial_tile_right_map(base, 8bpp, color32);
}
}
tile_run = end / 8;
multiple_tile_map(base, 8bpp, color32);
partial_tile_run = end % 8;
if(partial_tile_run)
{
partial_tile_left_map(base, 8bpp, color32);
}
}
else
{
@ -1723,6 +1638,7 @@ static void render_scanline_text_base_color32(u32 layer,
multiple_tile_map(base, 8bpp, color32);
map_ptr = second_ptr;
end -= pixel_run;
}
tile_run = end / 8;
multiple_tile_map(base, 8bpp, color32);
@ -1732,7 +1648,6 @@ static void render_scanline_text_base_color32(u32 layer,
partial_tile_left_map(base, 8bpp, color32);
}
}
}
else
{
/* color depth: 4bpp
@ -1773,15 +1688,6 @@ static void render_scanline_text_base_color32(u32 layer,
}
}
tile_run = end / 8;
multiple_tile_map(base, 4bpp, color32);
partial_tile_run = end % 8;
if(partial_tile_run)
{
partial_tile_left_map(base, 4bpp, color32);
}
}
else
{
@ -1795,17 +1701,18 @@ static void render_scanline_text_base_color32(u32 layer,
multiple_tile_map(base, 4bpp, color32);
map_ptr = second_ptr;
end -= pixel_run;
}
tile_run = end / 8;
multiple_tile_map(base, 4bpp, color32);
partial_tile_run = end % 8;
if(partial_tile_run)
{
partial_tile_left_map(base, 4bpp, color32);
}
}
}
}
static void render_scanline_text_transparent_color32(u32 layer,
u32 start, u32 end, void *scanline)
@ -1904,15 +1811,6 @@ static void render_scanline_text_transparent_color32(u32 layer,
}
}
tile_run = end / 8;
multiple_tile_map(transparent, 8bpp, color32);
partial_tile_run = end % 8;
if(partial_tile_run)
{
partial_tile_left_map(transparent, 8bpp, color32);
}
}
else
{
@ -1926,16 +1824,17 @@ static void render_scanline_text_transparent_color32(u32 layer,
multiple_tile_map(transparent, 8bpp, color32);
map_ptr = second_ptr;
end -= pixel_run;
}
tile_run = end / 8;
multiple_tile_map(transparent, 8bpp, color32);
partial_tile_run = end % 8;
if(partial_tile_run)
{
partial_tile_left_map(transparent, 8bpp, color32);
}
}
}
else
{
/* color depth: 4bpp
@ -1976,15 +1875,6 @@ static void render_scanline_text_transparent_color32(u32 layer,
}
}
tile_run = end / 8;
multiple_tile_map(transparent, 4bpp, color32);
partial_tile_run = end % 8;
if(partial_tile_run)
{
partial_tile_left_map(transparent, 4bpp, color32);
}
}
else
{
@ -1998,17 +1888,18 @@ static void render_scanline_text_transparent_color32(u32 layer,
multiple_tile_map(transparent, 4bpp, color32);
map_ptr = second_ptr;
end -= pixel_run;
}
tile_run = end / 8;
multiple_tile_map(transparent, 4bpp, color32);
partial_tile_run = end % 8;
if(partial_tile_run)
{
partial_tile_left_map(transparent, 4bpp, color32);
}
}
}
}
static void render_scanline_text_base_alpha(u32 layer,
u32 start, u32 end, void *scanline)
@ -2106,16 +1997,6 @@ static void render_scanline_text_base_alpha(u32 layer,
partial_tile_right_map(base, 8bpp, alpha);
}
}
tile_run = end / 8;
multiple_tile_map(base, 8bpp, alpha);
partial_tile_run = end % 8;
if(partial_tile_run)
{
partial_tile_left_map(base, 8bpp, alpha);
}
}
else
{
@ -2129,6 +2010,7 @@ static void render_scanline_text_base_alpha(u32 layer,
multiple_tile_map(base, 8bpp, alpha);
map_ptr = second_ptr;
end -= pixel_run;
}
tile_run = end / 8;
multiple_tile_map(base, 8bpp, alpha);
@ -2138,7 +2020,6 @@ static void render_scanline_text_base_alpha(u32 layer,
partial_tile_left_map(base, 8bpp, alpha);
}
}
}
else
{
/* color depth: 4bpp
@ -2178,16 +2059,6 @@ static void render_scanline_text_base_alpha(u32 layer,
partial_tile_right_map(base, 4bpp, alpha);
}
}
tile_run = end / 8;
multiple_tile_map(base, 4bpp, alpha);
partial_tile_run = end % 8;
if(partial_tile_run)
{
partial_tile_left_map(base, 4bpp, alpha);
}
}
else
{
@ -2201,6 +2072,7 @@ static void render_scanline_text_base_alpha(u32 layer,
multiple_tile_map(base, 4bpp, alpha);
map_ptr = second_ptr;
end -= pixel_run;
}
tile_run = end / 8;
multiple_tile_map(base, 4bpp, alpha);
@ -2211,7 +2083,6 @@ static void render_scanline_text_base_alpha(u32 layer,
}
}
}
}
static void render_scanline_text_transparent_alpha(u32 layer,
u32 start, u32 end, void *scanline)
@ -2309,16 +2180,6 @@ static void render_scanline_text_transparent_alpha(u32 layer,
partial_tile_right_map(transparent, 8bpp, alpha);
}
}
tile_run = end / 8;
multiple_tile_map(transparent, 8bpp, alpha);
partial_tile_run = end % 8;
if(partial_tile_run)
{
partial_tile_left_map(transparent, 8bpp, alpha);
}
}
else
{
@ -2332,6 +2193,7 @@ static void render_scanline_text_transparent_alpha(u32 layer,
multiple_tile_map(transparent, 8bpp, alpha);
map_ptr = second_ptr;
end -= pixel_run;
}
tile_run = end / 8;
multiple_tile_map(transparent, 8bpp, alpha);
@ -2341,7 +2203,6 @@ static void render_scanline_text_transparent_alpha(u32 layer,
partial_tile_left_map(transparent, 8bpp, alpha);
}
}
}
else
{
/* color depth: 4bpp
@ -2381,16 +2242,6 @@ static void render_scanline_text_transparent_alpha(u32 layer,
partial_tile_right_map(transparent, 4bpp, alpha);
}
}
tile_run = end / 8;
multiple_tile_map(transparent, 4bpp, alpha);
partial_tile_run = end % 8;
if(partial_tile_run)
{
partial_tile_left_map(transparent, 4bpp, alpha);
}
}
else
{
@ -2404,6 +2255,7 @@ static void render_scanline_text_transparent_alpha(u32 layer,
multiple_tile_map(transparent, 4bpp, alpha);
map_ptr = second_ptr;
end -= pixel_run;
}
tile_run = end / 8;
multiple_tile_map(transparent, 4bpp, alpha);
@ -2414,7 +2266,6 @@ static void render_scanline_text_transparent_alpha(u32 layer,
}
}
}
}
s32 affine_reference_x[2];
s32 affine_reference_y[2];