From 48b22acc96404bc35afdfd9cc153c2c60a419ca0 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Tue, 9 Dec 2014 14:12:31 +0100 Subject: [PATCH] Simplify big-endian CopySprites codepath --- src/ppu.c | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/src/ppu.c b/src/ppu.c index defffe8..4541cac 100644 --- a/src/ppu.c +++ b/src/ppu.c @@ -1022,32 +1022,23 @@ static void CopySprites(uint8 *target) { P[n + 3] = (sprlinebuf + 3)[n]; } #else - /* TODO: Simplify */ if (!(t & 0x80000000)) { - if (!(t & 0x40000000)) // Normal sprite - P[n] = sprlinebuf[n]; - else if (P[n] & 64) // behind bg sprite + if (!(t & 0x40000000) || (P[n] & 64)) // Normal sprite || behind bg sprite P[n] = sprlinebuf[n]; } if (!(t & 0x800000)) { - if (!(t & 0x400000)) // Normal sprite - P[n + 1] = (sprlinebuf + 1)[n]; - else if (P[n + 1] & 64) // behind bg sprite + if (!(t & 0x400000) || (P[n + 1] & 64)) // Normal sprite || behind bg sprite P[n + 1] = (sprlinebuf + 1)[n]; } if (!(t & 0x8000)) { - if (!(t & 0x4000)) // Normal sprite - P[n + 2] = (sprlinebuf + 2)[n]; - else if (P[n + 2] & 64) // behind bg sprite + if (!(t & 0x4000) || (P[n + 2] & 64)) // Normal sprite || behind bg sprite P[n + 2] = (sprlinebuf + 2)[n]; } if (!(t & 0x80)) { - if (!(t & 0x40)) // Normal sprite - P[n + 3] = (sprlinebuf + 3)[n]; - else if (P[n + 3] & 64) // behind bg sprite + if (!(t & 0x40) || (P[n + 3] & 64)) // Normal sprite || behind bg sprite P[n + 3] = (sprlinebuf + 3)[n]; } #endif