From c2e427e3011570cdf1ac796de0f9c21c5f0e60a1 Mon Sep 17 00:00:00 2001 From: Hans Kokx Date: Wed, 2 Sep 2026 19:56:46 +0200 Subject: [PATCH] Fix texture mapping Signed-off-by: Hans Kokx --- raycaster.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/raycaster.c b/raycaster.c index d5f2efa..59b1f3e 100644 --- a/raycaster.c +++ b/raycaster.c @@ -862,8 +862,7 @@ void drawRays3D() if (shade == 1) // North-south walls (PI -> (2 * PI)) { - - textureX = (int)(rayX / 2.0) % 32; + textureX = (int)rayX % mapSize; if (rayAngle < PI) // South walls { @@ -872,7 +871,7 @@ void drawRays3D() } else // East-west walls (PI2 -> PI3) { - textureX = (int)(rayY / 2.0) % 32; + textureX = (int)rayY % mapSize; if (rayAngle > PI2 || rayAngle < PI3) // West { textureX = 31 - textureX;