mirror of
https://github.com/FranLMSP/rmg-001.git
synced 2024-11-23 02:01:32 +00:00
Fix sprites bug
This commit is contained in:
parent
22c09895d7
commit
841cc96a67
26
src/ppu.rs
26
src/ppu.rs
@ -156,8 +156,8 @@ impl Sprite {
|
||||
true => 16,
|
||||
false => 8,
|
||||
};
|
||||
let x = lcd_x.saturating_sub(self.x.saturating_sub(8));
|
||||
let y = lcd_y.saturating_sub(self.y .saturating_sub(16));
|
||||
let x = (lcd_x + 8) - self.x;
|
||||
let y = (lcd_y + 16) - self.y;
|
||||
let x = match self.x_flip {
|
||||
true => 7 - x,
|
||||
false => x,
|
||||
@ -430,16 +430,28 @@ impl PPU {
|
||||
let y = self.read_oam(addr);
|
||||
let x = self.read_oam(addr + 1);
|
||||
|
||||
if x == 0 {
|
||||
addr += 4;
|
||||
continue;
|
||||
}
|
||||
|
||||
let sprite_height: u8 = match long_sprites {
|
||||
true => 16,
|
||||
false => 8,
|
||||
};
|
||||
|
||||
if x == 0 {
|
||||
addr += 4;
|
||||
continue;
|
||||
} else if x >= 160 + 8 {
|
||||
addr += 4;
|
||||
continue;
|
||||
} else if y == 0 {
|
||||
addr += 4;
|
||||
continue;
|
||||
} else if y >= 144 + 16 {
|
||||
addr += 4;
|
||||
continue;
|
||||
} else if !long_sprites && y <= 8 {
|
||||
addr += 4;
|
||||
continue;
|
||||
}
|
||||
|
||||
let lcd_y = self.lcd_y.saturating_add(16);
|
||||
|
||||
if lcd_y < y || lcd_y > (y + sprite_height - 1) {
|
||||
|
Loading…
Reference in New Issue
Block a user