From c486f9e74a6faf4ef1e2c573b28745d8286b8545 Mon Sep 17 00:00:00 2001 From: Raimon Zamora Date: Mon, 2 Mar 2026 16:44:11 +0100 Subject: [PATCH] - [FIX] Arreglades "noisy lines" entre piso i lower_wall de sector anterior. - [FIX] Arreglades "noisy lines" al interpolar textures (no totes). --- main.cpp | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/main.cpp b/main.cpp index 389198f..1216780 100644 --- a/main.cpp +++ b/main.cpp @@ -396,7 +396,8 @@ void drawColumn(sector &s, int screen_column, int start, int end, float a_inc, v if (wall_start+i>=end) break; float light_dist = 1.0f - (dist>light_zoom ? 1.0f : dist/light_zoom); float light = 1.0f - (light_dist*s.light); - uint8_t pixcolor = surf->pixels[(int(v)%surf->w)+(int(cpix)%surf->h)*surf->w]; + int i_cpix = SDL_roundf(cpix); + uint8_t pixcolor = surf->pixels[(int(v)%surf->w)+(i_cpix%surf->h)*surf->w]; pixcolor = colormap[pixcolor + int(light*31)*256]; draw::putpd(screen_column, wall_start+i, pixcolor, stright_dist); cpix += dpix; @@ -410,13 +411,14 @@ void drawColumn(sector &s, int screen_column, int start, int end, float a_inc, v upper_wall_height -= wall_cut; if (upper_wall_height>0.0f) { - // Pinta la pared + // Pinta la pared superior if (w->upper_surf) for (int i=0; i=end) break; float light_dist = 1.0f - (dist>light_zoom ? 1.0f : dist/light_zoom); float light = 1.0f - (light_dist*s.light); - uint8_t pixcolor = w->upper_surf->pixels[(int(v)%w->upper_surf->w)+(int(cpix)%w->upper_surf->h)*w->upper_surf->w]; + int i_cpix = SDL_roundf(cpix); + uint8_t pixcolor = w->upper_surf->pixels[(int(v)%w->upper_surf->w)+(i_cpix%w->upper_surf->h)*w->upper_surf->w]; pixcolor = colormap[pixcolor + int(light*31)*256]; draw::putpd(screen_column, wall_start+i, pixcolor, stright_dist); cpix += dpix; @@ -427,9 +429,9 @@ void drawColumn(sector &s, int screen_column, int start, int end, float a_inc, v } float lower_height = sectors[w->portal].floor_height - s.floor_height; float lower_wall_height = (lower_height*FOV)/dist; - int wall_end = wall_start+wall_height+1; - if (lower_wall_height>0.0f) wall_end -= lower_wall_height; - wall_end = SDL_min(wall_end, end); + float fwall_end = wall_start+wall_height+1; + if (lower_wall_height>0.0f) fwall_end -= lower_wall_height; + int wall_end = SDL_min(fwall_end, end); //SDL_assert(&s != §ors[w->portal]); //printf("Anem al sector: %i\n", w->portal); @@ -452,7 +454,8 @@ void drawColumn(sector &s, int screen_column, int start, int end, float a_inc, v if (wall_start+i>=end) break; float light_dist = 1.0f - (dist>light_zoom ? 1.0f : dist/light_zoom); float light = 1.0f - (light_dist*s.light); - uint8_t pixcolor = surf->pixels[(int(v)%surf->w)+(int(cpix)%surf->h)*surf->w]; + int i_cpix = SDL_roundf(cpix); + uint8_t pixcolor = surf->pixels[(int(v)%surf->w)+(i_cpix%surf->h)*surf->w]; pixcolor = colormap[pixcolor + int(light*31)*256]; draw::putps(screen_column, wall_start+i, pixcolor, stright_dist); cpix += dpix; @@ -462,15 +465,16 @@ void drawColumn(sector &s, int screen_column, int start, int end, float a_inc, v if (lower_wall_height>0.0f) { cpix += (wall_height-lower_wall_height)*dpix; - // Pinta la pared + // Pinta la pared inferior if (w->lower_surf) for (int i=0; i=end) break; float light_dist = 1.0f - (dist>light_zoom ? 1.0f : dist/light_zoom); float light = 1.0f - (light_dist*s.light); - uint8_t pixcolor = w->lower_surf->pixels[(int(v)%w->lower_surf->w)+(int(cpix)%w->lower_surf->h)*w->lower_surf->w]; + int i_cpix = SDL_roundf(cpix); + uint8_t pixcolor = w->lower_surf->pixels[(int(v)%w->lower_surf->w)+(i_cpix%w->lower_surf->h)*w->lower_surf->w]; pixcolor = colormap[pixcolor + int(light*31)*256]; - draw::putpd(screen_column, wall_end+i, pixcolor, stright_dist); + draw::putpd(screen_column, wall_end+i-1, pixcolor, stright_dist); cpix += dpix; } //wall_start += upper_wall_height;