Demacro-ize tile_render in render_scanline_text_base_normal
This commit is contained in:
		
							parent
							
								
									ee1a0377cf
								
							
						
					
					
						commit
						ad472bf85f
					
				
					 1 changed files with 156 additions and 2 deletions
				
			
		
							
								
								
									
										158
									
								
								video.c
									
										
									
									
									
								
							
							
						
						
									
										158
									
								
								video.c
									
										
									
									
									
								
							| 
						 | 
					@ -915,11 +915,151 @@ static void render_scanline_text_base_normal(u32 layer,
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  if(bg_control & 0x80)
 | 
					  if(bg_control & 0x80)
 | 
				
			||||||
  {
 | 
					  {
 | 
				
			||||||
    tile_render(8bpp, base, normal);
 | 
					     /* color depth: 8bpp 
 | 
				
			||||||
 | 
					      * combine: base
 | 
				
			||||||
 | 
					      * alpha : normal
 | 
				
			||||||
 | 
					      */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					     /* Render a single scanline of text tiles */
 | 
				
			||||||
 | 
					     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, normal);
 | 
				
			||||||
 | 
					              return;
 | 
				
			||||||
 | 
					           }
 | 
				
			||||||
 | 
					           else
 | 
				
			||||||
 | 
					           {
 | 
				
			||||||
 | 
					              end -= partial_tile_run;
 | 
				
			||||||
 | 
					              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
 | 
				
			||||||
 | 
					     {
 | 
				
			||||||
 | 
					        if(partial_tile_offset)
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					           partial_tile_run = 8 - partial_tile_offset;
 | 
				
			||||||
 | 
					           partial_tile_right_map(base, 8bpp, normal);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        tile_run = (pixel_run - partial_tile_run) / 8;
 | 
				
			||||||
 | 
					        multiple_tile_map(base, 8bpp, normal);
 | 
				
			||||||
 | 
					        map_ptr = second_ptr;
 | 
				
			||||||
 | 
					        end -= pixel_run;
 | 
				
			||||||
 | 
					        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
 | 
				
			||||||
  {
 | 
					  {
 | 
				
			||||||
    tile_render(4bpp, base, normal);
 | 
					     /* color depth: 4bpp 
 | 
				
			||||||
 | 
					      * combine: base
 | 
				
			||||||
 | 
					      * alpha : normal
 | 
				
			||||||
 | 
					      */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					     /* Render a single scanline of text tiles */
 | 
				
			||||||
 | 
					     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, normal);
 | 
				
			||||||
 | 
					              return;
 | 
				
			||||||
 | 
					           }
 | 
				
			||||||
 | 
					           else
 | 
				
			||||||
 | 
					           {
 | 
				
			||||||
 | 
					              end -= partial_tile_run;
 | 
				
			||||||
 | 
					              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
 | 
				
			||||||
 | 
					     {
 | 
				
			||||||
 | 
					        if(partial_tile_offset)
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					           partial_tile_run = 8 - partial_tile_offset;
 | 
				
			||||||
 | 
					           partial_tile_right_map(base, 4bpp, normal);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        tile_run = (pixel_run - partial_tile_run) / 8;
 | 
				
			||||||
 | 
					        multiple_tile_map(base, 4bpp, normal);
 | 
				
			||||||
 | 
					        map_ptr = second_ptr;
 | 
				
			||||||
 | 
					        end -= pixel_run;
 | 
				
			||||||
 | 
					        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);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					     }
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -982,10 +1122,12 @@ static void render_scanline_text_transparent_normal(u32 layer,
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  if(bg_control & 0x80)
 | 
					  if(bg_control & 0x80)
 | 
				
			||||||
  {
 | 
					  {
 | 
				
			||||||
 | 
					     /* Render a single scanline of text tiles */
 | 
				
			||||||
    tile_render(8bpp, transparent, normal);
 | 
					    tile_render(8bpp, transparent, normal);
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
  else
 | 
					  else
 | 
				
			||||||
  {
 | 
					  {
 | 
				
			||||||
 | 
					     /* Render a single scanline of text tiles */
 | 
				
			||||||
    tile_render(4bpp, transparent, normal);
 | 
					    tile_render(4bpp, transparent, normal);
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					@ -1049,10 +1191,12 @@ static void render_scanline_text_base_color16(u32 layer,
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  if(bg_control & 0x80)
 | 
					  if(bg_control & 0x80)
 | 
				
			||||||
  {
 | 
					  {
 | 
				
			||||||
 | 
					     /* Render a single scanline of text tiles */
 | 
				
			||||||
    tile_render(8bpp, base, color16);
 | 
					    tile_render(8bpp, base, color16);
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
  else
 | 
					  else
 | 
				
			||||||
  {
 | 
					  {
 | 
				
			||||||
 | 
					     /* Render a single scanline of text tiles */
 | 
				
			||||||
    tile_render(4bpp, base, color16);
 | 
					    tile_render(4bpp, base, color16);
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					@ -1116,10 +1260,12 @@ static void render_scanline_text_transparent_color16(u32 layer,
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  if(bg_control & 0x80)
 | 
					  if(bg_control & 0x80)
 | 
				
			||||||
  {
 | 
					  {
 | 
				
			||||||
 | 
					     /* Render a single scanline of text tiles */
 | 
				
			||||||
    tile_render(8bpp, transparent, color16);
 | 
					    tile_render(8bpp, transparent, color16);
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
  else
 | 
					  else
 | 
				
			||||||
  {
 | 
					  {
 | 
				
			||||||
 | 
					     /* Render a single scanline of text tiles */
 | 
				
			||||||
    tile_render(4bpp, transparent, color16);
 | 
					    tile_render(4bpp, transparent, color16);
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					@ -1183,10 +1329,12 @@ static void render_scanline_text_base_color32(u32 layer,
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  if(bg_control & 0x80)
 | 
					  if(bg_control & 0x80)
 | 
				
			||||||
  {
 | 
					  {
 | 
				
			||||||
 | 
					     /* Render a single scanline of text tiles */
 | 
				
			||||||
    tile_render(8bpp, base, color32);
 | 
					    tile_render(8bpp, base, color32);
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
  else
 | 
					  else
 | 
				
			||||||
  {
 | 
					  {
 | 
				
			||||||
 | 
					     /* Render a single scanline of text tiles */
 | 
				
			||||||
    tile_render(4bpp, base, color32);
 | 
					    tile_render(4bpp, base, color32);
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					@ -1250,10 +1398,12 @@ static void render_scanline_text_transparent_color32(u32 layer,
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  if(bg_control & 0x80)
 | 
					  if(bg_control & 0x80)
 | 
				
			||||||
  {
 | 
					  {
 | 
				
			||||||
 | 
					     /* Render a single scanline of text tiles */
 | 
				
			||||||
    tile_render(8bpp, transparent, color32);
 | 
					    tile_render(8bpp, transparent, color32);
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
  else
 | 
					  else
 | 
				
			||||||
  {
 | 
					  {
 | 
				
			||||||
 | 
					     /* Render a single scanline of text tiles */
 | 
				
			||||||
    tile_render(4bpp, transparent, color32);
 | 
					    tile_render(4bpp, transparent, color32);
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					@ -1317,10 +1467,12 @@ static void render_scanline_text_base_alpha(u32 layer,
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  if(bg_control & 0x80)
 | 
					  if(bg_control & 0x80)
 | 
				
			||||||
  {
 | 
					  {
 | 
				
			||||||
 | 
					     /* Render a single scanline of text tiles */
 | 
				
			||||||
    tile_render(8bpp, base, alpha);
 | 
					    tile_render(8bpp, base, alpha);
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
  else
 | 
					  else
 | 
				
			||||||
  {
 | 
					  {
 | 
				
			||||||
 | 
					     /* Render a single scanline of text tiles */
 | 
				
			||||||
    tile_render(4bpp, base, alpha);
 | 
					    tile_render(4bpp, base, alpha);
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					@ -1384,10 +1536,12 @@ static void render_scanline_text_transparent_alpha(u32 layer,
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  if(bg_control & 0x80)
 | 
					  if(bg_control & 0x80)
 | 
				
			||||||
  {
 | 
					  {
 | 
				
			||||||
 | 
					     /* Render a single scanline of text tiles */
 | 
				
			||||||
    tile_render(8bpp, transparent, alpha);
 | 
					    tile_render(8bpp, transparent, alpha);
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
  else
 | 
					  else
 | 
				
			||||||
  {
 | 
					  {
 | 
				
			||||||
 | 
					     /* Render a single scanline of text tiles */
 | 
				
			||||||
    tile_render(4bpp, transparent, alpha);
 | 
					    tile_render(4bpp, transparent, alpha);
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		
		Reference in a new issue