From ef5d05db53cb1cac15ade1230c069aeb1c5bff1e Mon Sep 17 00:00:00 2001 From: Thomas Harte Date: Tue, 21 Feb 2023 22:28:39 -0500 Subject: [PATCH] Scale down new-mode coordinates; add note to self. --- Components/9918/Implementation/Draw.hpp | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/Components/9918/Implementation/Draw.hpp b/Components/9918/Implementation/Draw.hpp index 52c1d0300..31a4a49f7 100644 --- a/Components/9918/Implementation/Draw.hpp +++ b/Components/9918/Implementation/Draw.hpp @@ -109,6 +109,19 @@ void Base::draw_sprites(LineBuffer &buffer, int start, int end, int } } +// Mode 2 logic, as I currently understand it, as a note for my future self: +// +// If a sprite is marked as 'CC' then it doesn't collide, but its colour value is +// ORd with those of all lower-numbered sprites down to the next one that is visible on +// that line and not marked CC. +// +// If no previous sprite meets that criteria, no pixels are displayed. But if one does +// then pixels are displayed even where they don't overlap with the earlier sprites. +// +// ... so in terms of my loop above, I guess I need temporary storage to accumulate +// an OR mask up until I hit a non-CC sprite, at which point I composite everything out? +// I'm not immediately sure whether I can appropriately reuse sprite_buffer, but possibly? + // MARK: - TMS9918 template @@ -331,7 +344,7 @@ void Base::draw_yamaha(LineBuffer &buffer, int start, int end) { draw_sprites< SpriteMode::Mode2, mode == ScreenMode::YamahaGraphics5 || mode == ScreenMode::YamahaGraphics6 - >(buffer, start, end); + >(buffer, start >> 2, end >> 2); } template