Merge branch 'master' of https://github.com/raa-eruanna/qzdoom into qzdoom

This commit is contained in:
Magnus Norddahl 2016-10-13 11:17:00 +02:00
commit 6caa53529f
3 changed files with 22 additions and 10 deletions

View file

@ -1279,6 +1279,7 @@ set (PCH_SOURCES
p_3dfloors.cpp p_3dfloors.cpp
p_3dmidtex.cpp p_3dmidtex.cpp
p_acs.cpp p_acs.cpp
p_actionfunctions.cpp
p_buildmap.cpp p_buildmap.cpp
p_ceiling.cpp p_ceiling.cpp
p_conversation.cpp p_conversation.cpp
@ -1417,7 +1418,6 @@ set (PCH_SOURCES
textures/warptexture.cpp textures/warptexture.cpp
thingdef/olddecorations.cpp thingdef/olddecorations.cpp
thingdef/thingdef.cpp thingdef/thingdef.cpp
thingdef/thingdef_codeptr.cpp
thingdef/thingdef_data.cpp thingdef/thingdef_data.cpp
thingdef/thingdef_exp.cpp thingdef/thingdef_exp.cpp
thingdef/thingdef_expression.cpp thingdef/thingdef_expression.cpp

View file

@ -852,10 +852,11 @@ extern FTexture *rw_pic;
// since the most anyone can ever see of the sky is 500 pixels. // since the most anyone can ever see of the sky is 500 pixels.
// We need 4 skybufs because wallscan can draw up to 4 columns at a time. // We need 4 skybufs because wallscan can draw up to 4 columns at a time.
// Need two versions - one for true color and one for palette // Need two versions - one for true color and one for palette
#define MAXSKYBUF 3072
static BYTE skybuf[4][512]; static BYTE skybuf[4][512];
static uint32_t skybuf_bgra[4][512]; static uint32_t skybuf_bgra[MAXSKYBUF][512];
static DWORD lastskycol[4]; static DWORD lastskycol[4];
static DWORD lastskycol_bgra[4]; static DWORD lastskycol_bgra[MAXSKYBUF];
static int skycolplace; static int skycolplace;
static int skycolplace_bgra; static int skycolplace_bgra;
@ -888,9 +889,19 @@ static const BYTE *R_GetOneSkyColumn (FTexture *fronttex, int x)
// Get a column of sky when there are two overlapping sky textures // Get a column of sky when there are two overlapping sky textures
static const BYTE *R_GetTwoSkyColumns (FTexture *fronttex, int x) static const BYTE *R_GetTwoSkyColumns (FTexture *fronttex, int x)
{ {
DWORD ang = (skyangle + xtoviewangle[x]) ^ skyflip; DWORD ang, angle1, angle2;
DWORD angle1 = (DWORD)((UMulScale16(ang, frontcyl) + frontpos) >> FRACBITS);
DWORD angle2 = (DWORD)((UMulScale16(ang, backcyl) + backpos) >> FRACBITS); if (r_linearsky)
{
angle_t xangle = (angle_t)((0.5 - x / (double)viewwidth) * FocalTangent * ANGLE_90);
ang = (skyangle + xangle) ^ skyflip;
}
else
{
ang = (skyangle + xtoviewangle[x]) ^ skyflip;
}
angle1 = (DWORD)((UMulScale16(ang, frontcyl) + frontpos) >> FRACBITS);
angle2 = (DWORD)((UMulScale16(ang, backcyl) + backpos) >> FRACBITS);
// Check if this column has already been built. If so, there's // Check if this column has already been built. If so, there's
// no reason to waste time building it again. // no reason to waste time building it again.
@ -935,17 +946,18 @@ static const BYTE *R_GetTwoSkyColumns (FTexture *fronttex, int x)
else else
{ {
//return R_GetOneSkyColumn(fronttex, x); //return R_GetOneSkyColumn(fronttex, x);
for (i = 0; i < 4; ++i) for (i = skycolplace_bgra - 4; i < skycolplace_bgra; ++i)
{ {
if (lastskycol_bgra[i] == skycol) int ic = (i % MAXSKYBUF); // i "checker" - can wrap around the ends of the array
if (lastskycol_bgra[ic] == skycol)
{ {
return (BYTE*)(skybuf_bgra[i]); return (BYTE*)(skybuf_bgra[ic]);
} }
} }
lastskycol_bgra[skycolplace_bgra] = skycol; lastskycol_bgra[skycolplace_bgra] = skycol;
uint32_t *composite = skybuf_bgra[skycolplace_bgra]; uint32_t *composite = skybuf_bgra[skycolplace_bgra];
skycolplace_bgra = (skycolplace_bgra + 1) & 3; skycolplace_bgra = (skycolplace_bgra + 1) % MAXSKYBUF;
// The ordering of the following code has been tuned to allow VC++ to optimize // The ordering of the following code has been tuned to allow VC++ to optimize
// it well. In particular, this arrangement lets it keep count in a register // it well. In particular, this arrangement lets it keep count in a register