- [FIX] Arreglades "noisy lines" entre piso i lower_wall de sector anterior.
- [FIX] Arreglades "noisy lines" al interpolar textures (no totes).
This commit is contained in:
24
main.cpp
24
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;
|
if (wall_start+i>=end) break;
|
||||||
float light_dist = 1.0f - (dist>light_zoom ? 1.0f : dist/light_zoom);
|
float light_dist = 1.0f - (dist>light_zoom ? 1.0f : dist/light_zoom);
|
||||||
float light = 1.0f - (light_dist*s.light);
|
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];
|
pixcolor = colormap[pixcolor + int(light*31)*256];
|
||||||
draw::putpd(screen_column, wall_start+i, pixcolor, stright_dist);
|
draw::putpd(screen_column, wall_start+i, pixcolor, stright_dist);
|
||||||
cpix += dpix;
|
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;
|
upper_wall_height -= wall_cut;
|
||||||
if (upper_wall_height>0.0f)
|
if (upper_wall_height>0.0f)
|
||||||
{
|
{
|
||||||
// Pinta la pared
|
// Pinta la pared superior
|
||||||
if (w->upper_surf)
|
if (w->upper_surf)
|
||||||
for (int i=0; i<upper_wall_height; ++i) {
|
for (int i=0; i<upper_wall_height; ++i) {
|
||||||
if (wall_start+i>=end) break;
|
if (wall_start+i>=end) break;
|
||||||
float light_dist = 1.0f - (dist>light_zoom ? 1.0f : dist/light_zoom);
|
float light_dist = 1.0f - (dist>light_zoom ? 1.0f : dist/light_zoom);
|
||||||
float light = 1.0f - (light_dist*s.light);
|
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];
|
pixcolor = colormap[pixcolor + int(light*31)*256];
|
||||||
draw::putpd(screen_column, wall_start+i, pixcolor, stright_dist);
|
draw::putpd(screen_column, wall_start+i, pixcolor, stright_dist);
|
||||||
cpix += dpix;
|
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_height = sectors[w->portal].floor_height - s.floor_height;
|
||||||
float lower_wall_height = (lower_height*FOV)/dist;
|
float lower_wall_height = (lower_height*FOV)/dist;
|
||||||
int wall_end = wall_start+wall_height+1;
|
float fwall_end = wall_start+wall_height+1;
|
||||||
if (lower_wall_height>0.0f) wall_end -= lower_wall_height;
|
if (lower_wall_height>0.0f) fwall_end -= lower_wall_height;
|
||||||
wall_end = SDL_min(wall_end, end);
|
int wall_end = SDL_min(fwall_end, end);
|
||||||
|
|
||||||
//SDL_assert(&s != §ors[w->portal]);
|
//SDL_assert(&s != §ors[w->portal]);
|
||||||
//printf("Anem al sector: %i\n", 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;
|
if (wall_start+i>=end) break;
|
||||||
float light_dist = 1.0f - (dist>light_zoom ? 1.0f : dist/light_zoom);
|
float light_dist = 1.0f - (dist>light_zoom ? 1.0f : dist/light_zoom);
|
||||||
float light = 1.0f - (light_dist*s.light);
|
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];
|
pixcolor = colormap[pixcolor + int(light*31)*256];
|
||||||
draw::putps(screen_column, wall_start+i, pixcolor, stright_dist);
|
draw::putps(screen_column, wall_start+i, pixcolor, stright_dist);
|
||||||
cpix += dpix;
|
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)
|
if (lower_wall_height>0.0f)
|
||||||
{
|
{
|
||||||
cpix += (wall_height-lower_wall_height)*dpix;
|
cpix += (wall_height-lower_wall_height)*dpix;
|
||||||
// Pinta la pared
|
// Pinta la pared inferior
|
||||||
if (w->lower_surf)
|
if (w->lower_surf)
|
||||||
for (int i=0; i<lower_wall_height; ++i) {
|
for (int i=0; i<lower_wall_height; ++i) {
|
||||||
if (wall_end+i>=end) break;
|
if (wall_end+i>=end) break;
|
||||||
float light_dist = 1.0f - (dist>light_zoom ? 1.0f : dist/light_zoom);
|
float light_dist = 1.0f - (dist>light_zoom ? 1.0f : dist/light_zoom);
|
||||||
float light = 1.0f - (light_dist*s.light);
|
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];
|
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;
|
cpix += dpix;
|
||||||
}
|
}
|
||||||
//wall_start += upper_wall_height;
|
//wall_start += upper_wall_height;
|
||||||
|
|||||||
Reference in New Issue
Block a user