Merge branch 'portals2_visual'

This commit is contained in:
Braden Obrzut 2016-02-05 00:10:46 -05:00
commit ba54d73e07
18 changed files with 886 additions and 127 deletions

View file

@ -58,6 +58,7 @@
#include "r_3dfloors.h"
#include "v_palette.h"
#include "r_data/colormaps.h"
#include "portal.h"
#ifdef _MSC_VER
#pragma warning(disable:4244)
@ -686,9 +687,12 @@ visplane_t *R_FindPlane (const secplane_t &height, FTextureID picnum, int lightl
yscale == check->yscale &&
angle == check->angle &&
sky == check->sky &&
CurrentMirror == check->CurrentMirror &&
CurrentPortalUniq == check->CurrentPortalUniq &&
MirrorFlags == check->MirrorFlags &&
CurrentSkybox == check->CurrentSkybox
CurrentSkybox == check->CurrentSkybox &&
viewx == check->viewx &&
viewy == check->viewy &&
viewz == check->viewz
)
{
return check;
@ -718,7 +722,7 @@ visplane_t *R_FindPlane (const secplane_t &height, FTextureID picnum, int lightl
check->viewangle = stacked_angle;
check->Alpha = alpha;
check->Additive = additive;
check->CurrentMirror = CurrentMirror;
check->CurrentPortalUniq = CurrentPortalUniq;
check->MirrorFlags = MirrorFlags;
check->CurrentSkybox = CurrentSkybox;
@ -807,7 +811,7 @@ visplane_t *R_CheckPlane (visplane_t *pl, int start, int stop)
new_pl->sky = pl->sky;
new_pl->Alpha = pl->Alpha;
new_pl->Additive = pl->Additive;
new_pl->CurrentMirror = pl->CurrentMirror;
new_pl->CurrentPortalUniq = pl->CurrentPortalUniq;
new_pl->MirrorFlags = pl->MirrorFlags;
new_pl->CurrentSkybox = pl->CurrentSkybox;
pl = new_pl;
@ -1043,7 +1047,7 @@ int R_DrawPlanes ()
for (pl = visplanes[i]; pl; pl = pl->next)
{
// kg3D - draw only correct planes
if(pl->CurrentMirror != CurrentMirror || pl->CurrentSkybox != CurrentSkybox)
if(pl->CurrentPortalUniq != CurrentPortalUniq || pl->CurrentSkybox != CurrentSkybox)
continue;
// kg3D - draw only real planes now
if(pl->sky >= 0) {
@ -1063,22 +1067,31 @@ void R_DrawHeightPlanes(fixed_t height)
ds_color = 3;
fixed_t oViewX = viewx, oViewY = viewy, oViewZ = viewz;
angle_t oViewAngle = viewangle;
for (i = 0; i < MAXVISPLANES; i++)
{
for (pl = visplanes[i]; pl; pl = pl->next)
{
// kg3D - draw only correct planes
if(pl->CurrentSkybox != CurrentSkybox)
if(pl->CurrentSkybox != CurrentSkybox || pl->CurrentPortalUniq != CurrentPortalUniq)
continue;
if(pl->sky < 0 && pl->height.Zat0() == height) {
viewx = pl->viewx;
viewy = pl->viewy;
viewz = pl->viewz;
viewangle = pl->viewangle;
MirrorFlags = pl->MirrorFlags;
R_DrawSinglePlane (pl, pl->sky & 0x7FFFFFFF, pl->Additive, true);
}
}
}
viewx = oViewX;
viewy = oViewY;
viewz = oViewZ;
viewangle = oViewAngle;
}
@ -1180,6 +1193,7 @@ void R_DrawSkyBoxes ()
return;
R_3D_EnterSkybox();
CurrentPortalInSkybox = true;
int savedextralight = extralight;
fixed_t savedx = viewx;
@ -1270,6 +1284,7 @@ void R_DrawSkyBoxes ()
// Create a drawseg to clip sprites to the sky plane
R_CheckDrawSegs ();
ds_p->CurrentPortalUniq = CurrentPortalUniq;
ds_p->siz1 = INT_MAX;
ds_p->siz2 = INT_MAX;
ds_p->sz1 = 0;
@ -1281,6 +1296,7 @@ void R_DrawSkyBoxes ()
ds_p->sprtopclip = R_NewOpening (pl->right - pl->left);
ds_p->maskedtexturecol = ds_p->swall = -1;
ds_p->bFogBoundary = false;
ds_p->curline = NULL;
ds_p->fake = 0;
memcpy (openings + ds_p->sprbottomclip, floorclip + pl->left, (pl->right - pl->left)*sizeof(short));
memcpy (openings + ds_p->sprtopclip, ceilingclip + pl->left, (pl->right - pl->left)*sizeof(short));
@ -1354,6 +1370,7 @@ void R_DrawSkyBoxes ()
viewangle = savedangle;
R_SetViewAngle ();
CurrentPortalInSkybox = false;
R_3D_LeaveSkybox();
if(fakeActive) return;