From 65022b780ae586d95e05e3deccf6c7f7584e53a2 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Mon, 11 Jan 2016 22:44:53 +0100 Subject: [PATCH] - implemented 'copy portal to wall' linedef type. --- src/gl/scene/gl_sky.cpp | 41 ++++++++++++++++++++++++++++++++- src/gl/scene/gl_wall.h | 1 + src/gl/scene/gl_walls.cpp | 15 +++++++----- src/p_saveg.cpp | 5 ++++ src/p_spec.cpp | 17 ++++++++++++++ src/r_defs.h | 1 + src/version.h | 2 +- wadsrc/static/xlat/eternity.txt | 2 +- 8 files changed, 75 insertions(+), 9 deletions(-) diff --git a/src/gl/scene/gl_sky.cpp b/src/gl/scene/gl_sky.cpp index 17e864476c..2b3b06eaac 100644 --- a/src/gl/scene/gl_sky.cpp +++ b/src/gl/scene/gl_sky.cpp @@ -131,9 +131,10 @@ void GLSkyInfo::init(int sky1, PalEntry FadeColor) //========================================================================== // -// Calculate sky texture +// Calculate sky texture for ceiling or floor // //========================================================================== + void GLWall::SkyPlane(sector_t *sector, int plane, bool allowreflect) { FPortal *portal = sector->portals[plane]; @@ -178,6 +179,35 @@ void GLWall::SkyPlane(sector_t *sector, int plane, bool allowreflect) } +//========================================================================== +// +// Calculate sky texture for a line +// +//========================================================================== + +void GLWall::SkyLine(line_t *line) +{ + ASkyViewpoint * skyboxx = line->skybox; + 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(line->frontsector->sky, Colormap.FadeColor); + type = RENDERWALL_SKY; + sky = UniqueSkies.Get(&skyinfo); + } + PutWall(0); +} + + //========================================================================== // // Skies on one sided walls @@ -191,6 +221,15 @@ void GLWall::SkyNormal(sector_t * fs,vertex_t * v1,vertex_t * v2) zbottom[1]=zceil[1]; SkyPlane(fs, sector_t::ceiling, true); + if (seg->linedef->skybox != NULL) + { + ztop[0] = zceil[0]; + ztop[1] = zceil[1]; + zbottom[0] = zfloor[0]; + zbottom[1] = zfloor[1]; + SkyLine(seg->linedef); + } + ztop[0]=zfloor[0]; ztop[1]=zfloor[1]; zbottom[0]=zbottom[1]=-32768.0f; diff --git a/src/gl/scene/gl_wall.h b/src/gl/scene/gl_wall.h index 47ac06c466..b7f8653e9d 100644 --- a/src/gl/scene/gl_wall.h +++ b/src/gl/scene/gl_wall.h @@ -171,6 +171,7 @@ private: void FloodPlane(int pass); void SkyPlane(sector_t *sector, int plane, bool allowmirror); + void SkyLine(line_t *line); void SkyNormal(sector_t * fs,vertex_t * v1,vertex_t * v2); void SkyTop(seg_t * seg,sector_t * fs,sector_t * bs,vertex_t * v1,vertex_t * v2); void SkyBottom(seg_t * seg,sector_t * fs,sector_t * bs,vertex_t * v1,vertex_t * v2); diff --git a/src/gl/scene/gl_walls.cpp b/src/gl/scene/gl_walls.cpp index ad2a3aa93f..bb23922954 100644 --- a/src/gl/scene/gl_walls.cpp +++ b/src/gl/scene/gl_walls.cpp @@ -1569,13 +1569,16 @@ void GLWall::Process(seg_t *seg, sector_t * frontsector, sector_t * backsector) // sector's sky SkyNormal(frontsector, v1, v2); - // normal texture - gltexture = FMaterial::ValidateTexture(seg->sidedef->GetTexture(side_t::mid), false, true); - if (gltexture) + if (seg->linedef->skybox == NULL) { - DoTexture(RENDERWALL_M1S, seg, (seg->linedef->flags & ML_DONTPEGBOTTOM) > 0, - realfront->GetPlaneTexZ(sector_t::ceiling), realfront->GetPlaneTexZ(sector_t::floor), // must come from the original! - fch1, fch2, ffh1, ffh2, 0); + // normal texture + gltexture = FMaterial::ValidateTexture(seg->sidedef->GetTexture(side_t::mid), false, true); + if (gltexture) + { + DoTexture(RENDERWALL_M1S, seg, (seg->linedef->flags & ML_DONTPEGBOTTOM) > 0, + realfront->GetPlaneTexZ(sector_t::ceiling), realfront->GetPlaneTexZ(sector_t::floor), // must come from the original! + fch1, fch2, ffh1, ffh2, 0); + } } } else // two sided diff --git a/src/p_saveg.cpp b/src/p_saveg.cpp index 7a09b2ee8c..bcbc3deeb7 100644 --- a/src/p_saveg.cpp +++ b/src/p_saveg.cpp @@ -478,6 +478,11 @@ void P_SerializeWorld (FArchive &arc) } arc << li->args[1] << li->args[2] << li->args[3] << li->args[4]; + if (SaveVersion >= 4531) + { + arc << li->skybox; + } + for (j = 0; j < 2; j++) { if (li->sidedef[j] == NULL) diff --git a/src/p_spec.cpp b/src/p_spec.cpp index fba5e2a2d9..520586791a 100644 --- a/src/p_spec.cpp +++ b/src/p_spec.cpp @@ -1044,6 +1044,23 @@ static void CopyPortal(int sectortag, int plane, ASkyViewpoint *origin, fixed_t } } } + if (tolines && lines[j].special == Sector_SetPortal && + lines[j].args[1] == 5 && + lines[j].args[3] == sectortag) + { + if (lines[j].args[0] == 0) + { + lines[j].skybox = origin; + } + else + { + FLineIdIterator itr(lines[j].args[0]); + while ((s = itr.Next()) >= 0) + { + lines[s].skybox = origin; + } + } + } } } diff --git a/src/r_defs.h b/src/r_defs.h index 0b68bcb8a8..11e4a0e6df 100644 --- a/src/r_defs.h +++ b/src/r_defs.h @@ -1057,6 +1057,7 @@ struct line_t sector_t *frontsector, *backsector; int validcount; // if == validcount, already checked int locknumber; // [Dusk] lock number for special + TObjPtr skybox; }; // phares 3/14/98 diff --git a/src/version.h b/src/version.h index 1ebc9ac5da..875b009df3 100644 --- a/src/version.h +++ b/src/version.h @@ -76,7 +76,7 @@ const char *GetVersionString(); // Use 4500 as the base git save version, since it's higher than the // SVN revision ever got. -#define SAVEVER 4530 +#define SAVEVER 4531 #define SAVEVERSTRINGIFY2(x) #x #define SAVEVERSTRINGIFY(x) SAVEVERSTRINGIFY2(x) diff --git a/wadsrc/static/xlat/eternity.txt b/wadsrc/static/xlat/eternity.txt index ba569393ec..7d52af39c0 100644 --- a/wadsrc/static/xlat/eternity.txt +++ b/wadsrc/static/xlat/eternity.txt @@ -39,7 +39,7 @@ define Unsupported (0) 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" +289 = 0, Sector_SetPortal(0, 5, 0, tag) // "Portal_LineTransfer" // Skybox portals 290 = 0, Sector_SetPortal(tag, 2, 1, 1, 0) // "Portal_SkyboxCeiling"