From 7b67afea1a19f2d094b01ad2e802bc216d60b744 Mon Sep 17 00:00:00 2001 From: Jon Bell Date: Wed, 23 Jun 2021 09:26:21 -0600 Subject: [PATCH] Fix tline wrapping when out of map bounds --- src/pico8/gfx.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/pico8/gfx.cpp b/src/pico8/gfx.cpp index 990b24e..a6ebc08 100644 --- a/src/pico8/gfx.cpp +++ b/src/pico8/gfx.cpp @@ -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