From 196c9bc34d0654b152465a85fd833d21bf7e9e8a Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Mon, 11 Jan 2016 20:29:24 +0100 Subject: [PATCH] - cleaned up the skybox type detection logic. --- src/gl/scene/gl_portal.cpp | 4 +-- src/gl/scene/gl_sky.cpp | 51 +++++++++++++++++---------------- src/gl/scene/gl_walls.cpp | 2 +- src/p_spec.cpp | 3 +- src/r_bsp.cpp | 4 +-- src/r_sky.h | 6 ++++ wadsrc/static/xlat/eternity.txt | 12 ++++---- 7 files changed, 45 insertions(+), 37 deletions(-) diff --git a/src/gl/scene/gl_portal.cpp b/src/gl/scene/gl_portal.cpp index c2087f2f4..cb8f361a9 100644 --- a/src/gl/scene/gl_portal.cpp +++ b/src/gl/scene/gl_portal.cpp @@ -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); } diff --git a/src/gl/scene/gl_sky.cpp b/src/gl/scene/gl_sky.cpp index c4a6c1c60..17e864476 100644 --- a/src/gl/scene/gl_sky.cpp +++ b/src/gl/scene/gl_sky.cpp @@ -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 ? §or->ceilingplane : §or->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? §or->ceilingplane : §or->floorplane; - } - else return; - PutWall(0); } diff --git a/src/gl/scene/gl_walls.cpp b/src/gl/scene/gl_walls.cpp index 68a60f062..ad2a3aa93 100644 --- a/src/gl/scene/gl_walls.cpp +++ b/src/gl/scene/gl_walls.cpp @@ -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); diff --git a/src/p_spec.cpp b/src/p_spec.cpp index 4a3df3994..fba5e2a2d 100644 --- a/src/p_spec.cpp +++ b/src/p_spec.cpp @@ -1465,8 +1465,7 @@ void P_SpawnSpecials (void) line_t *line = &lines[i]; ASkyViewpoint *origin = Spawn(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); } diff --git a/src/r_bsp.cpp b/src/r_bsp.cpp index b7fd7b4f6..09c39b49e 100644 --- a/src/r_bsp.cpp +++ b/src/r_bsp.cpp @@ -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 || diff --git a/src/r_sky.h b/src/r_sky.h index 2c8c62dc7..6881f4943 100644 --- a/src/r_sky.h +++ b/src/r_sky.h @@ -24,6 +24,12 @@ #include "textures/textures.h" +enum +{ + SKYBOX_MAP = 0, + SKYBOX_PLANE, + SKYBOX_HORIZON +}; extern FTextureID skyflatnum; extern fixed_t sky1cyl, sky2cyl; diff --git a/wadsrc/static/xlat/eternity.txt b/wadsrc/static/xlat/eternity.txt index 7b4367ee3..ba569393e 100644 --- a/wadsrc/static/xlat/eternity.txt +++ b/wadsrc/static/xlat/eternity.txt @@ -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