Trying to implement some y-mirroring

This commit is contained in:
Kevin Hamacher 2020-02-21 18:50:57 +01:00
parent 52c73538cb
commit 65e65be0eb

View File

@ -449,7 +449,6 @@ impl Display {
// Calculate correct coords
let x: u8 = sprite.x.wrapping_sub(8);
// Flip sprite, TODO: What does this do in WIDE mode?
let y: u8 = sprite.y.wrapping_sub(16);
let render_y = self.curline;
@ -457,13 +456,14 @@ impl Display {
let wide_mode = self.control & CTRL_BG_SPRITE_SIZE > 0;
let actual_h = if wide_mode { 16 } else { 8 };
if sprite.is_y_flipped() {
eprintln!("Sorry, no y flip support yet, rendering as-is");
}
if y.wrapping_add(actual_h) > render_y && y <= render_y {
num_rendered += 1;
let tile_offset_y: usize = render_y as usize - y as usize;
let tile_offset_y = if sprite.is_y_flipped() {
render_y as usize - (y as usize) ^ (actual_h as usize - 1)
} else {
render_y as usize - y as usize
};
let tile_base_addr: usize = sprite.tile as usize * 16;
let tile_addr = tile_base_addr + tile_offset_y * 2;