From b35513b69297befefa509ef2618d7593dfc5dfaa Mon Sep 17 00:00:00 2001 From: "BADIM-PC\\Vadim" Date: Sun, 17 Dec 2017 20:50:07 +0300 Subject: [PATCH] fixed textri() crash --- src/tic.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/tic.c b/src/tic.c index 692f762..1203570 100644 --- a/src/tic.c +++ b/src/tic.c @@ -1003,6 +1003,9 @@ static void api_textri(tic_mem* memory, float x1, float y1, float x2, float y2, s32 iu = (s32)u % MapWidth; s32 iv = (s32)v % MapHeight; + while (iu < 0) iu += MapWidth; + while (iv < 0) iv += MapHeight; + u8 tile = map[(iv>>3) * TIC_MAP_WIDTH + (iu>>3)]; const u8 *buffer = &ptr[tile << 5]; u8 color = tic_tool_peek4(buffer, (iu & 7) + ((iv & 7) << 3));