From bf5c081ab992ec57ca729c681c532a60e93b56dd Mon Sep 17 00:00:00 2001 From: Toni Wilen Date: Sun, 27 Oct 2019 18:07:09 +0200 Subject: [PATCH] Erase old sprite (if same numbered sprite) pixels. --- custom.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/custom.cpp b/custom.cpp index 19dce571..25dc3bab 100644 --- a/custom.cpp +++ b/custom.cpp @@ -3858,6 +3858,7 @@ static void do_sprite_collisions (void) static void record_sprite_1 (int sprxp, uae_u16 *buf, uae_u32 datab, int num, int dbl, unsigned int mask, int do_collisions, uae_u32 collision_mask) { + uae_u16 erasemask = ~(3 << (2 * num)); int j = 0; while (datab) { unsigned int col = 0; @@ -3870,14 +3871,14 @@ static void record_sprite_1 (int sprxp, uae_u16 *buf, uae_u32 datab, int num, in col ^= (uaerand () << 16) | uaerand (); #endif if ((j & mask) == 0) { - unsigned int tmp = (*buf) | col; + unsigned int tmp = ((*buf) & erasemask) | col; *buf++ = tmp; if (do_collisions) coltmp |= tmp; sprxp++; } if (dbl > 0) { - unsigned int tmp = (*buf) | col; + unsigned int tmp = ((*buf) & erasemask) | col; *buf++ = tmp; if (do_collisions) coltmp |= tmp; @@ -3885,11 +3886,11 @@ static void record_sprite_1 (int sprxp, uae_u16 *buf, uae_u32 datab, int num, in } if (dbl > 1) { unsigned int tmp; - tmp = (*buf) | col; + tmp = ((*buf) & erasemask) | col; *buf++ = tmp; if (do_collisions) coltmp |= tmp; - tmp = (*buf) | col; + tmp = ((*buf) & erasemask) | col; *buf++ = tmp; if (do_collisions) coltmp |= tmp; -- 2.47.3