From 6c35be3177630da4fc8f902f53ec5d8b0e9b08c1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miloslav=20=C4=8C=C3=AD=C5=BE?= Date: Thu, 13 Sep 2018 11:07:34 +0200 Subject: [PATCH] Fix texturing --- raycastlib.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/raycastlib.h b/raycastlib.h index 6056c8a..0268d0f 100644 --- a/raycastlib.h +++ b/raycastlib.h @@ -863,8 +863,9 @@ for (uint_maybe32_t j = 0; j <= hitCount; ++j) #define drawVertical(pref,l1,l2,comp,inc)\ {\ limit = clamp(pref##Z2Screen,l1,l2);\ - Unit wallLength = pref##Z2Screen - pref##Z1Screen;\ - Unit wallPosition = absVal(pref##Z1Screen - pref##PosY);\ + Unit wallLength = pref##Z2Screen - pref##Z1Screen - 1;\ + wallLength = wallLength != 0 ? wallLength : 1;\ + Unit wallPosition = absVal(pref##Z1Screen - pref##PosY) + 1;\ for (i = pref##PosY inc 1; i comp##= limit; inc##inc i)\ {\ p.position.y = i;\