From 2c7082a475bd94055b6c87818f177b4f167aa0da Mon Sep 17 00:00:00 2001 From: TehRealSalt Date: Sun, 8 Jul 2018 15:44:01 -0400 Subject: [PATCH] Internal sky improvement ports Horizon lines, barrel sky distortion --- src/r_plane.c | 1 + src/r_segs.c | 30 ++++++++++++++++++------------ 2 files changed, 19 insertions(+), 12 deletions(-) diff --git a/src/r_plane.c b/src/r_plane.c index 3ec97efb..92e0cacb 100644 --- a/src/r_plane.c +++ b/src/r_plane.c @@ -714,6 +714,7 @@ void R_DrawPlanes(void) if (dc_yl <= dc_yh) { angle = (pl->viewangle + xtoviewangle[x])>>ANGLETOSKYSHIFT; + dc_iscale = FixedMul(skyscale, FINECOSINE(xtoviewangle[x]>>ANGLETOFINESHIFT)); dc_x = x; dc_source = R_GetColumn(skytexture, diff --git a/src/r_segs.c b/src/r_segs.c index b997c2a8..025c920c 100644 --- a/src/r_segs.c +++ b/src/r_segs.c @@ -2674,22 +2674,28 @@ void R_StoreWallRange(INT32 start, INT32 stop) worldbottomslope >>= 4; #endif - topstep = -FixedMul (rw_scalestep, worldtop); - topfrac = (centeryfrac>>4) - FixedMul (worldtop, rw_scale); + if (linedef->special == 41) { // HORIZON LINES + topstep = bottomstep = 0; + topfrac = bottomfrac = (centeryfrac>>4); + topfrac++; // Prevent 1px HOM + } else { + topstep = -FixedMul (rw_scalestep, worldtop); + topfrac = (centeryfrac>>4) - FixedMul (worldtop, rw_scale); - bottomstep = -FixedMul (rw_scalestep,worldbottom); - bottomfrac = (centeryfrac>>4) - FixedMul (worldbottom, rw_scale); + bottomstep = -FixedMul (rw_scalestep,worldbottom); + bottomfrac = (centeryfrac>>4) - FixedMul (worldbottom, rw_scale); #ifdef ESLOPE - if (frontsector->c_slope) { - fixed_t topfracend = (centeryfrac>>4) - FixedMul (worldtopslope, ds_p->scale2); - topstep = (topfracend-topfrac)/(range); - } - if (frontsector->f_slope) { - fixed_t bottomfracend = (centeryfrac>>4) - FixedMul (worldbottomslope, ds_p->scale2); - bottomstep = (bottomfracend-bottomfrac)/(range); - } + if (frontsector->c_slope) { + fixed_t topfracend = (centeryfrac>>4) - FixedMul (worldtopslope, ds_p->scale2); + topstep = (topfracend-topfrac)/(range); + } + if (frontsector->f_slope) { + fixed_t bottomfracend = (centeryfrac>>4) - FixedMul (worldbottomslope, ds_p->scale2); + bottomstep = (bottomfracend-bottomfrac)/(range); + } #endif + } dc_numlights = 0;