From e361984c402b1a69d2329d90b1994236dba0a1b7 Mon Sep 17 00:00:00 2001 From: "Zed A. Shaw" Date: Sat, 24 May 2025 00:47:01 -0400 Subject: [PATCH] Fixed a long standing bug I didn't realize where I did -1 on the map in the raycaster which made the textures not actually work. --- raycaster.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/raycaster.cpp b/raycaster.cpp index e0a8b1c..2608ff7 100644 --- a/raycaster.cpp +++ b/raycaster.cpp @@ -37,7 +37,7 @@ union ColorConv { // inline uint32_t new_new_lighting(uint32_t pixel, float dist, int level) { ColorConv conv{.as_int=pixel}; - float intensity = (float(level) * PERCENT) / (dist+1) * 2.5; + float intensity = (float(level) * PERCENT) / (dist + 1) * 2.5; conv.as_color.r *= intensity; conv.as_color.g *= intensity; @@ -304,7 +304,7 @@ void Raycaster::cast_rays() { int draw_end = line_height / 2 + $height / 2 + $pitch; if(draw_end >= $height) draw_end = $height - 1; - auto texture = textures::get_surface($map[map_y][map_x] - 1); + auto texture = textures::get_surface($map[map_y][map_x]); // calculate value of wall_x double wall_x; // where exactly the wall was hit