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 tline wrapping when out of map bounds #31

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
6 changes: 3 additions & 3 deletions src/pico8/gfx.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -611,9 +611,9 @@ void vm::api_tline(int16_t x0, int16_t y0, int16_t x1, int16_t y1,
for (;;)
{
// Find sprite in map memory
int sx = (ds.tline.offset.x + int(mx)) & 0x7f;
int sy = (ds.tline.offset.y + int(my)) & 0x3f;
uint8_t sprite = m_ram.map[128 * sy + sx];
int sx = (ds.tline.offset.x + int(mx));
int sy = (ds.tline.offset.y + int(my));
uint8_t sprite = api_mget(sx, sy);
uint8_t bits = m_ram.gfx_flags[sprite];

// If found, draw pixel
Expand Down