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); 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 else
{ {
@ -907,6 +897,7 @@ static void render_scanline_text_base_normal(u32 layer,
multiple_tile_map(base, 8bpp, normal); multiple_tile_map(base, 8bpp, normal);
map_ptr = second_ptr; map_ptr = second_ptr;
end -= pixel_run; end -= pixel_run;
}
tile_run = end / 8; tile_run = end / 8;
multiple_tile_map(base, 8bpp, normal); 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); partial_tile_left_map(base, 8bpp, normal);
} }
} }
}
else else
{ {
/* color depth: 4bpp /* color depth: 4bpp
@ -958,16 +948,6 @@ static void render_scanline_text_base_normal(u32 layer,
partial_tile_right_map(base, 4bpp, normal); 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 else
{ {
@ -981,6 +961,7 @@ static void render_scanline_text_base_normal(u32 layer,
multiple_tile_map(base, 4bpp, normal); multiple_tile_map(base, 4bpp, normal);
map_ptr = second_ptr; map_ptr = second_ptr;
end -= pixel_run; end -= pixel_run;
}
tile_run = end / 8; tile_run = end / 8;
multiple_tile_map(base, 4bpp, normal); multiple_tile_map(base, 4bpp, normal);
@ -990,7 +971,6 @@ static void render_scanline_text_base_normal(u32 layer,
partial_tile_left_map(base, 4bpp, normal); partial_tile_left_map(base, 4bpp, normal);
} }
} }
}
} }
static void render_scanline_text_transparent_normal(u32 layer, static void render_scanline_text_transparent_normal(u32 layer,
@ -1090,16 +1070,6 @@ static void render_scanline_text_transparent_normal(u32 layer,
partial_tile_right_map(transparent, 8bpp, normal); 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 else
{ {
@ -1113,6 +1083,7 @@ static void render_scanline_text_transparent_normal(u32 layer,
multiple_tile_map(transparent, 8bpp, normal); multiple_tile_map(transparent, 8bpp, normal);
map_ptr = second_ptr; map_ptr = second_ptr;
end -= pixel_run; end -= pixel_run;
}
tile_run = end / 8; tile_run = end / 8;
multiple_tile_map(transparent, 8bpp, normal); 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); partial_tile_left_map(transparent, 8bpp, normal);
} }
} }
}
else else
{ {
/* color depth: 4bpp /* color depth: 4bpp
@ -1163,16 +1133,6 @@ static void render_scanline_text_transparent_normal(u32 layer,
partial_tile_right_map(transparent, 4bpp, normal); 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 else
{ {
@ -1186,6 +1146,8 @@ static void render_scanline_text_transparent_normal(u32 layer,
multiple_tile_map(transparent, 4bpp, normal); multiple_tile_map(transparent, 4bpp, normal);
map_ptr = second_ptr; map_ptr = second_ptr;
end -= pixel_run; end -= pixel_run;
}
tile_run = end / 8; tile_run = end / 8;
multiple_tile_map(transparent, 4bpp, normal); multiple_tile_map(transparent, 4bpp, normal);
@ -1195,7 +1157,6 @@ static void render_scanline_text_transparent_normal(u32 layer,
partial_tile_left_map(transparent, 4bpp, normal); partial_tile_left_map(transparent, 4bpp, normal);
} }
} }
}
} }
static void render_scanline_text_base_color16(u32 layer, static void render_scanline_text_base_color16(u32 layer,
@ -1294,16 +1255,6 @@ static void render_scanline_text_base_color16(u32 layer,
partial_tile_right_map(base, 8bpp, color16); 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 else
{ {
@ -1317,6 +1268,7 @@ static void render_scanline_text_base_color16(u32 layer,
multiple_tile_map(base, 8bpp, color16); multiple_tile_map(base, 8bpp, color16);
map_ptr = second_ptr; map_ptr = second_ptr;
end -= pixel_run; end -= pixel_run;
}
tile_run = end / 8; tile_run = end / 8;
multiple_tile_map(base, 8bpp, color16); 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); partial_tile_left_map(base, 8bpp, color16);
} }
} }
}
else else
{ {
/* color depth: 4bpp /* 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 else
{ {
@ -1389,16 +1331,17 @@ static void render_scanline_text_base_color16(u32 layer,
multiple_tile_map(base, 4bpp, color16); multiple_tile_map(base, 4bpp, color16);
map_ptr = second_ptr; map_ptr = second_ptr;
end -= pixel_run; end -= pixel_run;
}
tile_run = end / 8; tile_run = end / 8;
multiple_tile_map(base, 4bpp, color16); multiple_tile_map(base, 4bpp, color16);
partial_tile_run = end % 8; partial_tile_run = end % 8;
if(partial_tile_run) if(partial_tile_run)
{ {
partial_tile_left_map(base, 4bpp, color16); partial_tile_left_map(base, 4bpp, color16);
} }
} }
}
} }
static void render_scanline_text_transparent_color16(u32 layer, static void render_scanline_text_transparent_color16(u32 layer,
@ -1497,16 +1440,6 @@ static void render_scanline_text_transparent_color16(u32 layer,
partial_tile_right_map(transparent, 8bpp, color16); 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 else
{ {
@ -1520,6 +1453,7 @@ static void render_scanline_text_transparent_color16(u32 layer,
multiple_tile_map(transparent, 8bpp, color16); multiple_tile_map(transparent, 8bpp, color16);
map_ptr = second_ptr; map_ptr = second_ptr;
end -= pixel_run; end -= pixel_run;
}
tile_run = end / 8; tile_run = end / 8;
multiple_tile_map(transparent, 8bpp, color16); 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); partial_tile_left_map(transparent, 8bpp, color16);
} }
} }
}
else else
{ {
/* color depth: 4bpp /* 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 else
{ {
@ -1592,16 +1516,17 @@ static void render_scanline_text_transparent_color16(u32 layer,
multiple_tile_map(transparent, 4bpp, color16); multiple_tile_map(transparent, 4bpp, color16);
map_ptr = second_ptr; map_ptr = second_ptr;
end -= pixel_run; end -= pixel_run;
}
tile_run = end / 8; tile_run = end / 8;
multiple_tile_map(transparent, 4bpp, color16); multiple_tile_map(transparent, 4bpp, color16);
partial_tile_run = end % 8; partial_tile_run = end % 8;
if(partial_tile_run) if(partial_tile_run)
{ {
partial_tile_left_map(transparent, 4bpp, color16); partial_tile_left_map(transparent, 4bpp, color16);
} }
} }
}
} }
static void render_scanline_text_base_color32(u32 layer, static void render_scanline_text_base_color32(u32 layer,
@ -1700,16 +1625,6 @@ static void render_scanline_text_base_color32(u32 layer,
partial_tile_right_map(base, 8bpp, color32); 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 else
{ {
@ -1723,6 +1638,7 @@ static void render_scanline_text_base_color32(u32 layer,
multiple_tile_map(base, 8bpp, color32); multiple_tile_map(base, 8bpp, color32);
map_ptr = second_ptr; map_ptr = second_ptr;
end -= pixel_run; end -= pixel_run;
}
tile_run = end / 8; tile_run = end / 8;
multiple_tile_map(base, 8bpp, color32); 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); partial_tile_left_map(base, 8bpp, color32);
} }
} }
}
else else
{ {
/* color depth: 4bpp /* 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 else
{ {
@ -1795,16 +1701,17 @@ static void render_scanline_text_base_color32(u32 layer,
multiple_tile_map(base, 4bpp, color32); multiple_tile_map(base, 4bpp, color32);
map_ptr = second_ptr; map_ptr = second_ptr;
end -= pixel_run; end -= pixel_run;
}
tile_run = end / 8; tile_run = end / 8;
multiple_tile_map(base, 4bpp, color32); multiple_tile_map(base, 4bpp, color32);
partial_tile_run = end % 8; partial_tile_run = end % 8;
if(partial_tile_run) if(partial_tile_run)
{ {
partial_tile_left_map(base, 4bpp, color32); partial_tile_left_map(base, 4bpp, color32);
} }
} }
}
} }
static void render_scanline_text_transparent_color32(u32 layer, static void render_scanline_text_transparent_color32(u32 layer,
@ -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 else
{ {
@ -1926,16 +1824,17 @@ static void render_scanline_text_transparent_color32(u32 layer,
multiple_tile_map(transparent, 8bpp, color32); multiple_tile_map(transparent, 8bpp, color32);
map_ptr = second_ptr; map_ptr = second_ptr;
end -= pixel_run; end -= pixel_run;
}
tile_run = end / 8; tile_run = end / 8;
multiple_tile_map(transparent, 8bpp, color32); multiple_tile_map(transparent, 8bpp, color32);
partial_tile_run = end % 8; partial_tile_run = end % 8;
if(partial_tile_run) if(partial_tile_run)
{ {
partial_tile_left_map(transparent, 8bpp, color32); partial_tile_left_map(transparent, 8bpp, color32);
} }
} }
}
else else
{ {
/* color depth: 4bpp /* 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 else
{ {
@ -1998,16 +1888,17 @@ static void render_scanline_text_transparent_color32(u32 layer,
multiple_tile_map(transparent, 4bpp, color32); multiple_tile_map(transparent, 4bpp, color32);
map_ptr = second_ptr; map_ptr = second_ptr;
end -= pixel_run; end -= pixel_run;
}
tile_run = end / 8; tile_run = end / 8;
multiple_tile_map(transparent, 4bpp, color32); multiple_tile_map(transparent, 4bpp, color32);
partial_tile_run = end % 8; partial_tile_run = end % 8;
if(partial_tile_run) if(partial_tile_run)
{ {
partial_tile_left_map(transparent, 4bpp, color32); partial_tile_left_map(transparent, 4bpp, color32);
} }
} }
}
} }
static void render_scanline_text_base_alpha(u32 layer, static void render_scanline_text_base_alpha(u32 layer,
@ -2106,16 +1997,6 @@ static void render_scanline_text_base_alpha(u32 layer,
partial_tile_right_map(base, 8bpp, alpha); 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 else
{ {
@ -2129,6 +2010,7 @@ static void render_scanline_text_base_alpha(u32 layer,
multiple_tile_map(base, 8bpp, alpha); multiple_tile_map(base, 8bpp, alpha);
map_ptr = second_ptr; map_ptr = second_ptr;
end -= pixel_run; end -= pixel_run;
}
tile_run = end / 8; tile_run = end / 8;
multiple_tile_map(base, 8bpp, alpha); 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); partial_tile_left_map(base, 8bpp, alpha);
} }
} }
}
else else
{ {
/* color depth: 4bpp /* color depth: 4bpp
@ -2178,16 +2059,6 @@ static void render_scanline_text_base_alpha(u32 layer,
partial_tile_right_map(base, 4bpp, alpha); 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 else
{ {
@ -2201,6 +2072,7 @@ static void render_scanline_text_base_alpha(u32 layer,
multiple_tile_map(base, 4bpp, alpha); multiple_tile_map(base, 4bpp, alpha);
map_ptr = second_ptr; map_ptr = second_ptr;
end -= pixel_run; end -= pixel_run;
}
tile_run = end / 8; tile_run = end / 8;
multiple_tile_map(base, 4bpp, alpha); multiple_tile_map(base, 4bpp, alpha);
@ -2210,7 +2082,6 @@ static void render_scanline_text_base_alpha(u32 layer,
partial_tile_left_map(base, 4bpp, alpha); partial_tile_left_map(base, 4bpp, alpha);
} }
} }
}
} }
static void render_scanline_text_transparent_alpha(u32 layer, static void render_scanline_text_transparent_alpha(u32 layer,
@ -2309,16 +2180,6 @@ static void render_scanline_text_transparent_alpha(u32 layer,
partial_tile_right_map(transparent, 8bpp, alpha); 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 else
{ {
@ -2332,6 +2193,7 @@ static void render_scanline_text_transparent_alpha(u32 layer,
multiple_tile_map(transparent, 8bpp, alpha); multiple_tile_map(transparent, 8bpp, alpha);
map_ptr = second_ptr; map_ptr = second_ptr;
end -= pixel_run; end -= pixel_run;
}
tile_run = end / 8; tile_run = end / 8;
multiple_tile_map(transparent, 8bpp, alpha); 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); partial_tile_left_map(transparent, 8bpp, alpha);
} }
} }
}
else else
{ {
/* color depth: 4bpp /* color depth: 4bpp
@ -2381,16 +2242,6 @@ static void render_scanline_text_transparent_alpha(u32 layer,
partial_tile_right_map(transparent, 4bpp, alpha); 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 else
{ {
@ -2404,6 +2255,7 @@ static void render_scanline_text_transparent_alpha(u32 layer,
multiple_tile_map(transparent, 4bpp, alpha); multiple_tile_map(transparent, 4bpp, alpha);
map_ptr = second_ptr; map_ptr = second_ptr;
end -= pixel_run; end -= pixel_run;
}
tile_run = end / 8; tile_run = end / 8;
multiple_tile_map(transparent, 4bpp, alpha); multiple_tile_map(transparent, 4bpp, alpha);
@ -2413,7 +2265,6 @@ static void render_scanline_text_transparent_alpha(u32 layer,
partial_tile_left_map(transparent, 4bpp, alpha); partial_tile_left_map(transparent, 4bpp, alpha);
} }
} }
}
} }
s32 affine_reference_x[2]; s32 affine_reference_x[2];