From 21c7dd458cb00fc8d3379ed24b2ddb2c34f3a928 Mon Sep 17 00:00:00 2001 From: G To Date: Mon, 24 Sep 2018 01:56:40 +0700 Subject: [PATCH] Enable palette map for sprite transparency --- src/tic.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/tic.c b/src/tic.c index 8d12d02..bd78e7c 100644 --- a/src/tic.c +++ b/src/tic.c @@ -293,8 +293,18 @@ static void drawRectBorder(tic_machine* machine, s32 x, s32 y, s32 width, s32 he static void drawTile(tic_machine* machine, const tic_tile* buffer, s32 x, s32 y, u8* colors, s32 count, s32 scale, tic_flip flip, tic_rotate rotate) { static u8 mapping[TIC_PALETTE_SIZE]; - for (s32 i = 0; i < TIC_PALETTE_SIZE; i++) mapping[i] = tic_tool_peek4(machine->memory.ram.vram.mapping, i); - for (s32 i = 0; i < count; i++) mapping[colors[i]] = 255; + for (s32 i = 0; i < TIC_PALETTE_SIZE; i++) + { + u8 mapped = tic_tool_peek4(machine->memory.ram.vram.mapping, i); + for (s32 j = 0; j < count; j++) + { + if (mapped == colors[j]) { + mapped = 255; + break; + } + } + mapping[i] = mapped; + } rotate &= 0b11; u32 orientation = flip & 0b11;