- implemented 'copy portal to wall' linedef type.

This commit is contained in:
Christoph Oelckers 2016-01-11 22:44:53 +01:00
parent 196c9bc34d
commit 65022b780a
8 changed files with 75 additions and 9 deletions

View file

@ -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) void GLWall::SkyPlane(sector_t *sector, int plane, bool allowreflect)
{ {
FPortal *portal = sector->portals[plane]; 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 // 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]; zbottom[1]=zceil[1];
SkyPlane(fs, sector_t::ceiling, true); 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[0]=zfloor[0];
ztop[1]=zfloor[1]; ztop[1]=zfloor[1];
zbottom[0]=zbottom[1]=-32768.0f; zbottom[0]=zbottom[1]=-32768.0f;

View file

@ -171,6 +171,7 @@ private:
void FloodPlane(int pass); void FloodPlane(int pass);
void SkyPlane(sector_t *sector, int plane, bool allowmirror); 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 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 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); void SkyBottom(seg_t * seg,sector_t * fs,sector_t * bs,vertex_t * v1,vertex_t * v2);

View file

@ -1569,6 +1569,8 @@ void GLWall::Process(seg_t *seg, sector_t * frontsector, sector_t * backsector)
// sector's sky // sector's sky
SkyNormal(frontsector, v1, v2); SkyNormal(frontsector, v1, v2);
if (seg->linedef->skybox == NULL)
{
// normal texture // normal texture
gltexture = FMaterial::ValidateTexture(seg->sidedef->GetTexture(side_t::mid), false, true); gltexture = FMaterial::ValidateTexture(seg->sidedef->GetTexture(side_t::mid), false, true);
if (gltexture) if (gltexture)
@ -1578,6 +1580,7 @@ void GLWall::Process(seg_t *seg, sector_t * frontsector, sector_t * backsector)
fch1, fch2, ffh1, ffh2, 0); fch1, fch2, ffh1, ffh2, 0);
} }
} }
}
else // two sided else // two sided
{ {

View file

@ -478,6 +478,11 @@ void P_SerializeWorld (FArchive &arc)
} }
arc << li->args[1] << li->args[2] << li->args[3] << li->args[4]; 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++) for (j = 0; j < 2; j++)
{ {
if (li->sidedef[j] == NULL) if (li->sidedef[j] == NULL)

View file

@ -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;
}
}
}
} }
} }

View file

@ -1057,6 +1057,7 @@ struct line_t
sector_t *frontsector, *backsector; sector_t *frontsector, *backsector;
int validcount; // if == validcount, already checked int validcount; // if == validcount, already checked
int locknumber; // [Dusk] lock number for special int locknumber; // [Dusk] lock number for special
TObjPtr<ASkyViewpoint> skybox;
}; };
// phares 3/14/98 // phares 3/14/98

View file

@ -76,7 +76,7 @@ const char *GetVersionString();
// Use 4500 as the base git save version, since it's higher than the // Use 4500 as the base git save version, since it's higher than the
// SVN revision ever got. // SVN revision ever got.
#define SAVEVER 4530 #define SAVEVER 4531
#define SAVEVERSTRINGIFY2(x) #x #define SAVEVERSTRINGIFY2(x) #x
#define SAVEVERSTRINGIFY(x) SAVEVERSTRINGIFY2(x) #define SAVEVERSTRINGIFY(x) SAVEVERSTRINGIFY2(x)

View file

@ -39,7 +39,7 @@ define Unsupported (0)
286 = 0, Sector_SetPortal(tag,4, 1, 0, 0) // "Portal_HorizonCeiling" 286 = 0, Sector_SetPortal(tag,4, 1, 0, 0) // "Portal_HorizonCeiling"
287 = 0, Sector_SetPortal(tag,4, 0, 0, 0) // "Portal_HorizonFloor" 287 = 0, Sector_SetPortal(tag,4, 0, 0, 0) // "Portal_HorizonFloor"
288 = 0, Sector_SetPortal(tag,4, 2, 0, 0) // "Portal_HorizonFloorCeiling" 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 // Skybox portals
290 = 0, Sector_SetPortal(tag, 2, 1, 1, 0) // "Portal_SkyboxCeiling" 290 = 0, Sector_SetPortal(tag, 2, 1, 1, 0) // "Portal_SkyboxCeiling"