From f9795a25334f0deff827f17b29dac0158cbf5c34 Mon Sep 17 00:00:00 2001 From: raa-eruanna Date: Mon, 3 Oct 2016 21:39:15 -0400 Subject: [PATCH] Revert "Remove linear sky again" This reverts commit 21390e91b8a28c71ba44bf62ee3c7545508a74e2. - also set r_linearsky to "false" by default. --- src/r_plane.cpp | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/src/r_plane.cpp b/src/r_plane.cpp index 0cfd51ca56..cfc30e1c7b 100644 --- a/src/r_plane.cpp +++ b/src/r_plane.cpp @@ -859,16 +859,30 @@ static DWORD lastskycol_bgra[4]; static int skycolplace; static int skycolplace_bgra; +CVAR(Bool, r_linearsky, false, CVAR_ARCHIVE | CVAR_GLOBALCONFIG); + // Get a column of sky when there is only one sky texture. static const BYTE *R_GetOneSkyColumn (FTexture *fronttex, int x) { - angle_t column = (skyangle + xtoviewangle[x]) ^ skyflip; - int tx = (UMulScale16(column, frontcyl) + frontpos) >> FRACBITS; + int tx; + if (r_linearsky) + { + angle_t xangle = (angle_t)((0.5 - x / (double)viewwidth) * FocalTangent * ANGLE_90); + angle_t column = (skyangle + xangle) ^ skyflip; + tx = (UMulScale16(column, frontcyl) + frontpos) >> FRACBITS; + } + else + { + angle_t column = (skyangle + xtoviewangle[x]) ^ skyflip; + tx = (UMulScale16(column, frontcyl) + frontpos) >> FRACBITS; + } if (!r_swtruecolor) return fronttex->GetColumn(tx, NULL); else + { return (const BYTE *)fronttex->GetColumnBgra(tx, NULL); + } } // Get a column of sky when there are two overlapping sky textures