From 6ffdd92dbb8360ae3e83f01d3c1061f4fef022ef Mon Sep 17 00:00:00 2001 From: Rekai Musuka Date: Fri, 30 Apr 2021 00:20:50 -0500 Subject: [PATCH] feat(ppu): implement sprite x-flip check --- src/ppu.rs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/ppu.rs b/src/ppu.rs index b6bef90..cb7700e 100644 --- a/src/ppu.rs +++ b/src/ppu.rs @@ -259,9 +259,12 @@ impl Ppu { let start = ((self.x_pos + 8) - attr.x) as usize; let end = 8 - self.fifo.object.len(); - for x in start..end { - let priority = attr.flags.priority(); + let x_flip = attr.flags.x_flip(); + for i in start..end { + let x = if x_flip { end - i } else { i }; + + let priority = attr.flags.priority(); let shade = palette.shade(tbpp.shade_id(x)); let fifo_info = ObjectFifoPixel {