- cleaned up the skybox type detection logic.

This commit is contained in:
Christoph Oelckers 2016-01-11 20:29:24 +01:00
parent 0e017f1e2d
commit 196c9bc34d
7 changed files with 45 additions and 37 deletions

View file

@ -1121,7 +1121,7 @@ void GLEEHorizonPortal::DrawContents()
horz.plane.GetFromSector(origin->Sector, true);
horz.lightlevel = gl_ClampLight(origin->Sector->GetCeilingLight());
horz.colormap = origin->Sector->ColorMap;
if (origin->flags & MF_FLOAT)
if (origin->special1 == SKYBOX_PLANE)
{
horz.plane.texheight = viewz + abs(horz.plane.texheight);
}
@ -1134,7 +1134,7 @@ void GLEEHorizonPortal::DrawContents()
horz.plane.GetFromSector(origin->Sector, false);
horz.lightlevel = gl_ClampLight(origin->Sector->GetFloorLight());
horz.colormap = origin->Sector->ColorMap;
if (origin->flags & MF_FLOAT)
if (origin->special1 == SKYBOX_PLANE)
{
horz.plane.texheight = viewz - abs(horz.plane.texheight);
}

View file

@ -139,39 +139,42 @@ void GLWall::SkyPlane(sector_t *sector, int plane, bool allowreflect)
FPortal *portal = sector->portals[plane];
if (portal != NULL)
{
if (GLPortal::instack[1-plane]) return;
type=RENDERWALL_SECTORSTACK;
if (GLPortal::instack[1 - plane]) return;
type = RENDERWALL_SECTORSTACK;
this->portal = portal;
}
else if (sector->GetTexture(plane)==skyflatnum)
else
{
GLSkyInfo skyinfo;
ASkyViewpoint * skyboxx = sector->GetSkyBox(plane);
// JUSTHIT is used as an indicator that a skybox is in use.
// This is to avoid recursion
if (!gl_noskyboxes && skyboxx && GLRenderer->mViewActor!=skyboxx && !(skyboxx->flags&MF_JUSTHIT))
if (sector->GetTexture(plane) == skyflatnum || (skyboxx != NULL && skyboxx->bAlways))
{
type=RENDERWALL_SKYBOX;
skybox=skyboxx;
GLSkyInfo skyinfo;
// JUSTHIT is used as an indicator that a skybox is in use.
// This is to avoid recursion
if (!gl_noskyboxes && skyboxx && GLRenderer->mViewActor != skyboxx && !(skyboxx->flags&MF_JUSTHIT))
{
type = RENDERWALL_SKYBOX;
skybox = skyboxx;
}
else
{
skyinfo.init(sector->sky, Colormap.FadeColor);
type = RENDERWALL_SKY;
sky = UniqueSkies.Get(&skyinfo);
}
}
else
else if (allowreflect && sector->GetReflect(plane) > 0)
{
skyinfo.init(sector->sky, Colormap.FadeColor);
type = RENDERWALL_SKY;
sky=UniqueSkies.Get(&skyinfo);
if ((plane == sector_t::ceiling && viewz > sector->ceilingplane.d) ||
(plane == sector_t::floor && viewz < -sector->floorplane.d)) return;
type = RENDERWALL_PLANEMIRROR;
planemirror = plane == sector_t::ceiling ? &sector->ceilingplane : &sector->floorplane;
}
else return;
PutWall(0);
}
else if (allowreflect && sector->GetReflect(plane) > 0)
{
if ((plane == sector_t::ceiling && viewz > sector->ceilingplane.d) ||
(plane == sector_t::floor && viewz < -sector->floorplane.d)) return;
type=RENDERWALL_PLANEMIRROR;
planemirror = plane == sector_t::ceiling? &sector->ceilingplane : &sector->floorplane;
}
else return;
PutWall(0);
}

View file

@ -180,7 +180,7 @@ void GLWall::PutWall(bool translucent)
if (!portal)
{
// either a regulat skybox or an Eternity-style horizon
if (skybox->flags7 & MF7_HANDLENODELAY) portal = new GLEEHorizonPortal(skybox);
if (skybox->special1 != SKYBOX_MAP) portal = new GLEEHorizonPortal(skybox);
else portal = new GLSkyboxPortal(skybox);
}
portal->AddLine(this);

View file

@ -1465,8 +1465,7 @@ void P_SpawnSpecials (void)
line_t *line = &lines[i];
ASkyViewpoint *origin = Spawn<ASkyViewpoint>(0, 0, 0, NO_REPLACE);
origin->Sector = line->frontsector;
origin->flags7 |= MF7_HANDLENODELAY; // mark as 'special'
if (line->args[1] == 3) origin->flags |= MF_FLOAT; // well, it actually does 'float'... :P
origin->special1 = line->args[1] == 3? SKYBOX_PLANE:SKYBOX_HORIZON;
CopyPortal(line->args[0], line->args[2], origin, 0, true);
}

View file

@ -1088,7 +1088,7 @@ void R_Subsector (subsector_t *sub)
}
skybox = frontsector->GetSkyBox(sector_t::ceiling);
if (skybox->flags7 & MF7_HANDLENODELAY) skybox = NULL; // HW renderer only.
if (skybox->special1 != SKYBOX_MAP) skybox = NULL; // HW renderer only.
ceilingplane = frontsector->ceilingplane.PointOnSide(viewx, viewy, viewz) > 0 ||
frontsector->GetTexture(sector_t::ceiling) == skyflatnum ||
@ -1131,7 +1131,7 @@ void R_Subsector (subsector_t *sub)
// killough 10/98: add support for skies transferred from sidedefs
skybox = frontsector->GetSkyBox(sector_t::floor);
if (skybox->flags7 & MF7_HANDLENODELAY) skybox = NULL; // HW renderer only.
if (skybox->special1 != SKYBOX_MAP) skybox = NULL; // HW renderer only.
floorplane = frontsector->floorplane.PointOnSide(viewx, viewy, viewz) > 0 || // killough 3/7/98
frontsector->GetTexture(sector_t::floor) == skyflatnum ||

View file

@ -24,6 +24,12 @@
#include "textures/textures.h"
enum
{
SKYBOX_MAP = 0,
SKYBOX_PLANE,
SKYBOX_HORIZON
};
extern FTextureID skyflatnum;
extern fixed_t sky1cyl, sky2cyl;

View file

@ -33,12 +33,12 @@ define Unsupported (0)
282 = 0, Sector_Attach3DMidtex(tag, 0, 1) // "3DMidTex_MoveWithCeiling"
// Plane portals are not supported in ZDoom, though they probably wouldn't be too hard to implement.
283 = 0, Unsupported() // "Portal_PlaneCeiling"
284 = 0, Unsupported() // "Portal_PlaneFloor"
285 = 0, Unsupported() // "Portal_PlaneFloorCeiling"
286 = 0, Unsupported() // "Portal_HorizonCeiling"
287 = 0, Unsupported() // "Portal_HorizonFloor"
288 = 0, Unsupported() // "Portal_HorizonFloorCeiling"
283 = 0, Sector_SetPortal(tag,3, 1, 0, 0) // "Portal_PlaneCeiling"
284 = 0, Sector_SetPortal(tag,3, 0, 0, 0) // "Portal_PlaneFloor"
285 = 0, Sector_SetPortal(tag,3, 2, 0, 0) // "Portal_PlaneFloorCeiling"
286 = 0, Sector_SetPortal(tag,4, 1, 0, 0) // "Portal_HorizonCeiling"
287 = 0, Sector_SetPortal(tag,4, 0, 0, 0) // "Portal_HorizonFloor"
288 = 0, Sector_SetPortal(tag,4, 2, 0, 0) // "Portal_HorizonFloorCeiling"
289 = 0, Unsupported() // "Portal_LineTransfer"
// Skybox portals