Skip to content

Commit

Permalink
Add more ways to prevent GZDoom from drawing skybox walls
Browse files Browse the repository at this point in the history
Add noskywalls flag to sectors and linedefs
  • Loading branch information
Talon1024 authored and coelckers committed Jan 11, 2020
1 parent f9fa07d commit 9b59801
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 4 deletions.
3 changes: 3 additions & 0 deletions specs/udmf_zdoom.txt
Expand Up @@ -140,6 +140,7 @@ Note: All <bool> fields default to false unless mentioned otherwise.
// 12: Unexplored secret wall.
// 13: Portal line.
revealed = <bool>; // true = line is initially visible on automap.
noskywalls = <bool>; // true = skies are not drawn above or below this line

health = <int>; // Amount of hitpoints for this line.
healthgroup = <int>; // ID of destructible object to synchronize hitpoints (optional, default is 0)
Expand Down Expand Up @@ -294,6 +295,8 @@ Note: All <bool> fields default to false unless mentioned otherwise.
colorization_floor = <int>; // Sets a colorization record for the floor texture. Colorization records must be defined in TEXTURES.
colorization_ceiling = <int>; // Sets a colorization record for the ceiling texture. Colorization records must be defined in TEXTURES.

noskywalls = <bool>; // If true, do not draw skybox walls above/below this sector

portal_ceil_blocksound = <bool>; // ceiling portal blocks sound.
portal_ceil_disabled = <bool>; // ceiling portal disabled.
portal_ceil_nopass = <bool>; // ceiling portal blocks movement if true.
Expand Down
2 changes: 1 addition & 1 deletion src/doomdata.h
Expand Up @@ -173,7 +173,7 @@ enum ELineFlags : unsigned
ML_BLOCKHITSCAN = 0x08000000, // blocks hitscan attacks
ML_3DMIDTEX_IMPASS = 0x10000000, // [TP] if 3D midtex, behaves like a height-restricted ML_BLOCKING
ML_REVEALED = 0x20000000, // set if revealed in automap

ML_NOSKYWALLS = 0x40000000, // Don't draw sky above or below walls
ML_PORTALCONNECT = 0x80000000, // for internal use only: This line connects to a sector with a linked portal (used to speed up sight checks.)
};

Expand Down
1 change: 1 addition & 0 deletions src/gamedata/r_defs.h
Expand Up @@ -485,6 +485,7 @@ enum
SECMF_DRAWN = 128, // sector has been drawn at least once
SECMF_HIDDEN = 256, // Do not draw on textured automap
SECMF_OVERLAPPING = 512, // floor and ceiling overlap and require special renderer action.
SECMF_NOSKYWALLS = 1024, // Do not draw "sky walls"
};

enum
Expand Down
8 changes: 8 additions & 0 deletions src/maploader/udmf.cpp
Expand Up @@ -1074,6 +1074,10 @@ class UDMFParser : public UDMFParserBase
ld->automapstyle = AutomapLineStyle(CheckInt(key));
continue;

case NAME_NoSkyWalls:
Flag(ld->flags, ML_NOSKYWALLS, key);
continue;

case NAME_MoreIds:
// delay parsing of the tag string until parsing of the sector is complete
// This ensures that the ID is always the first tag in the list.
Expand Down Expand Up @@ -1662,6 +1666,10 @@ class UDMFParser : public UDMFParserBase
sec->AdditiveColors[sector_t::sprites] = CheckInt(key) | 0xff000000;
break;

case NAME_NoSkyWalls:
Flag(sec->MoreFlags, SECMF_NOSKYWALLS, key);
break;

case NAME_colorization_floor:
sec->SetTextureFx(sector_t::floor, TexMan.GetTextureManipulation(CheckString(key)));
break;
Expand Down
6 changes: 3 additions & 3 deletions src/rendering/hwrenderer/scene/hw_sky.cpp
Expand Up @@ -230,8 +230,8 @@ void HWWall::SkyTop(HWDrawInfo *di, seg_t * seg,sector_t * fs,sector_t * bs,vert
{
if (fs->GetTexture(sector_t::ceiling)==skyflatnum)
{
if (bs->special == GLSector_NoSkyDraw) return;
if (bs->GetTexture(sector_t::ceiling)==skyflatnum)
if (bs->special == GLSector_NoSkyDraw || bs->MoreFlags & SECMF_NOSKYWALLS || seg->linedef->flags & ML_NOSKYWALLS) return;
if (bs->GetTexture(sector_t::ceiling)==skyflatnum)
{
// if the back sector is closed the sky must be drawn!
if (bs->ceilingplane.ZatPoint(v1) > bs->floorplane.ZatPoint(v1) ||
Expand Down Expand Up @@ -324,7 +324,7 @@ void HWWall::SkyBottom(HWDrawInfo *di, seg_t * seg,sector_t * fs,sector_t * bs,v
{
if (fs->GetTexture(sector_t::floor)==skyflatnum)
{
if (bs->special == GLSector_NoSkyDraw) return;
if (bs->special == GLSector_NoSkyDraw || bs->MoreFlags & SECMF_NOSKYWALLS || seg->linedef->flags & ML_NOSKYWALLS) return;
FTexture * tex = TexMan.GetTexture(seg->sidedef->GetTexture(side_t::bottom), true);

// For lower skies the normal logic only applies to walls with no lower texture.
Expand Down
1 change: 1 addition & 0 deletions src/utility/namedef.h
Expand Up @@ -594,6 +594,7 @@ xx(ColorAdd_Floor)
xx(ColorAdd_Ceiling)
xx(ColorAdd_Sprites)
xx(ColorAdd_Walls)
xx(NoSkyWalls)
xx(Desaturation)
xx(SoundSequence)
xx(Silent)
Expand Down

0 comments on commit 9b59801

Please sign in to comment.