Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix sprite transparency to check for non-zero bits #28

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/pico8/gfx.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -621,7 +621,7 @@ void vm::api_tline(int16_t x0, int16_t y0, int16_t x1, int16_t y1,
{
int col = m_ram.gfx.get(sprite % 16 * 8 + (int(mx << 3) & 0x7),
sprite / 16 * 8 + (int(my << 3) & 0x7));
if ((ds.draw_palette[col] & 0x10) == 0)
if ((ds.draw_palette[col] & 0xf0) == 0)
{
uint32_t color_bits = (ds.draw_palette[col] & 0xf) << 16;
set_pixel(x, y, color_bits);
Expand Down Expand Up @@ -694,7 +694,7 @@ void vm::api_map(int16_t cel_x, int16_t cel_y, int16_t sx, int16_t sy,
{
int col = m_ram.gfx.get(sprite % 16 * 8 + (src_x + dx) % 8,
sprite / 16 * 8 + (src_y + dy) % 8);
if ((ds.draw_palette[col] & 0x10) == 0)
if ((ds.draw_palette[col] & 0xf0) == 0)
{
uint32_t color_bits = (ds.draw_palette[col] & 0xf) << 16;
set_pixel(sx + dx, sy + dy, color_bits);
Expand Down Expand Up @@ -957,7 +957,7 @@ void vm::api_spr(int16_t n, int16_t x, int16_t y, opt<fix32> w,
int16_t di = flip_x ? w8 - 1 - i : i;
int16_t dj = flip_y ? h8 - 1 - j : j;
uint8_t col = m_ram.gfx.safe_get(n % 16 * 8 + di, n / 16 * 8 + dj);
if ((ds.draw_palette[col] & 0x10) == 0)
if ((ds.draw_palette[col] & 0xf0) == 0)
{
uint32_t color_bits = (ds.draw_palette[col] & 0xf) << 16;
set_pixel(x + i, y + j, color_bits);
Expand Down Expand Up @@ -993,7 +993,7 @@ void vm::api_sspr(int16_t sx, int16_t sy, int16_t sw, int16_t sh,
int16_t y = sy + sh * dj / dh;

uint8_t col = m_ram.gfx.safe_get(x, y);
if ((ds.draw_palette[col] & 0x10) == 0)
if ((ds.draw_palette[col] & 0xf0) == 0)
{
uint32_t color_bits = (ds.draw_palette[col] & 0xf) << 16;
set_pixel(dx + i, dy + j, color_bits);
Expand Down