From 65272c421b7ddc2fe51bad7cc53ae62f3dd3cdf7 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Fri, 12 Dec 2014 01:17:36 +0100 Subject: And another one pt. 5 --- video.c | 128 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 126 insertions(+), 2 deletions(-) (limited to 'video.c') diff --git a/video.c b/video.c index 888d11b..35b2054 100644 --- a/video.c +++ b/video.c @@ -2145,7 +2145,69 @@ static void render_scanline_text_base_alpha(u32 layer, */ /* Render a single scanline of text tiles */ - tile_render(8bpp, base, alpha); + u32 vertical_pixel_offset = (vertical_offset % 8) * + tile_width_8bpp; + u32 vertical_pixel_flip = + ((tile_size_8bpp - tile_width_8bpp) - + vertical_pixel_offset) - vertical_pixel_offset; + tile_extra_variables_8bpp(); + u8 *tile_base = vram + (((bg_control >> 2) & 0x03) * (1024 * 16)) + + vertical_pixel_offset; + u32 pixel_run = 256 - (horizontal_offset % 256); + u32 current_tile; + + map_base += ((vertical_offset % 256) / 8) * 32; + partial_tile_offset = (horizontal_offset % 8); + + if(pixel_run >= end) + { + if(partial_tile_offset) + { + partial_tile_run = 8 - partial_tile_offset; + if(end < partial_tile_run) + { + partial_tile_run = end; + partial_tile_mid_map(base, 8bpp, alpha); + return; + } + else + { + end -= partial_tile_run; + 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 + { + if(partial_tile_offset) + { + partial_tile_run = 8 - partial_tile_offset; + partial_tile_right_map(base, 8bpp, alpha); + } + + tile_run = (pixel_run - partial_tile_run) / 8; + multiple_tile_map(base, 8bpp, alpha); + map_ptr = second_ptr; + end -= pixel_run; + 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 { @@ -2155,7 +2217,69 @@ static void render_scanline_text_base_alpha(u32 layer, */ /* Render a single scanline of text tiles */ - tile_render(4bpp, base, alpha); + u32 vertical_pixel_offset = (vertical_offset % 8) * + tile_width_4bpp; + u32 vertical_pixel_flip = + ((tile_size_4bpp - tile_width_4bpp) - + vertical_pixel_offset) - vertical_pixel_offset; + tile_extra_variables_4bpp(); + u8 *tile_base = vram + (((bg_control >> 2) & 0x03) * (1024 * 16)) + + vertical_pixel_offset; + u32 pixel_run = 256 - (horizontal_offset % 256); + u32 current_tile; + + map_base += ((vertical_offset % 256) / 8) * 32; + partial_tile_offset = (horizontal_offset % 8); + + if(pixel_run >= end) + { + if(partial_tile_offset) + { + partial_tile_run = 8 - partial_tile_offset; + if(end < partial_tile_run) + { + partial_tile_run = end; + partial_tile_mid_map(base, 4bpp, alpha); + return; + } + else + { + end -= partial_tile_run; + 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 + { + if(partial_tile_offset) + { + partial_tile_run = 8 - partial_tile_offset; + partial_tile_right_map(base, 4bpp, alpha); + } + + tile_run = (pixel_run - partial_tile_run) / 8; + multiple_tile_map(base, 4bpp, alpha); + map_ptr = second_ptr; + end -= pixel_run; + 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); + } + } } } -- cgit v1.2.3