From f5dee2c0ab4366b4ece25debdef7f989169b9cc7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miloslav=20=C4=8C=C3=AD=C5=BE?= Date: Tue, 18 Sep 2018 17:52:22 +0200 Subject: [PATCH] Fix floor rendering --- raycastlib.h | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/raycastlib.h b/raycastlib.h index ac94d10..bfff03f 100644 --- a/raycastlib.h +++ b/raycastlib.h @@ -1205,7 +1205,10 @@ void _columnFunctionSimple(RCL_HitResult *hits, uint16_t hitCount, uint16_t x, coordHelper = -1 * wallStart; coordHelper = coordHelper >= 0 ? coordHelper : 0; - wallEnd = RCL_clamp(wallStart + wallHeightScreen,0,_RCL_camResYLimit); + wallEnd = RCL_clamp(wallStart + wallHeightScreen,0, + _RCL_camera.resolution.y); + // ^ intentionally allow outside screen + wallStart = RCL_clamp(wallStart,0,_RCL_camResYLimit); } } @@ -1306,7 +1309,9 @@ RCL_Unit coordStep = 1; p.position.y = y; RCL_PIXEL_FUNCTION(&p); + ++y; + p.depth -= _RCL_horizontalDepthStep; if (p.depth < 0) // just in case