# Conflicts:
#	src/CMakeLists.txt
This commit is contained in:
Rachael Alexanderson 2016-12-07 23:12:42 -05:00
commit 40b68bfea0
8 changed files with 141 additions and 26 deletions

View file

@ -60,6 +60,8 @@ long gl_frameCount;
EXTERN_CVAR(Int, gl_lightmode) EXTERN_CVAR(Int, gl_lightmode)
EXTERN_CVAR(Bool, gl_brightfog) EXTERN_CVAR(Bool, gl_brightfog)
EXTERN_CVAR(Bool, gl_lightadditivesurfaces) EXTERN_CVAR(Bool, gl_lightadditivesurfaces)
EXTERN_CVAR(Bool, gl_attenuate)
CUSTOM_CVAR(Float, maxviewpitch, 90.f, CVAR_ARCHIVE|CVAR_SERVERINFO) CUSTOM_CVAR(Float, maxviewpitch, 90.f, CVAR_ARCHIVE|CVAR_SERVERINFO)
{ {
@ -207,6 +209,7 @@ struct FGLROptions : public FOptionalMapinfoData
skyfog = 0; skyfog = 0;
brightfog = false; brightfog = false;
lightmode = -1; lightmode = -1;
attenuate = -1;
nocoloredspritelighting = -1; nocoloredspritelighting = -1;
notexturefill = -1; notexturefill = -1;
skyrotatevector = FVector3(0,0,1); skyrotatevector = FVector3(0,0,1);
@ -222,6 +225,7 @@ struct FGLROptions : public FOptionalMapinfoData
newopt->outsidefogdensity = outsidefogdensity; newopt->outsidefogdensity = outsidefogdensity;
newopt->skyfog = skyfog; newopt->skyfog = skyfog;
newopt->lightmode = lightmode; newopt->lightmode = lightmode;
newopt->attenuate = attenuate;
newopt->nocoloredspritelighting = nocoloredspritelighting; newopt->nocoloredspritelighting = nocoloredspritelighting;
newopt->notexturefill = notexturefill; newopt->notexturefill = notexturefill;
newopt->skyrotatevector = skyrotatevector; newopt->skyrotatevector = skyrotatevector;
@ -235,6 +239,7 @@ struct FGLROptions : public FOptionalMapinfoData
int skyfog; int skyfog;
int lightmode; int lightmode;
int brightfog; int brightfog;
int8_t attenuate;
int8_t lightadditivesurfaces; int8_t lightadditivesurfaces;
int8_t nocoloredspritelighting; int8_t nocoloredspritelighting;
int8_t notexturefill; int8_t notexturefill;
@ -325,6 +330,20 @@ DEFINE_MAP_OPTION(lightadditivesurfaces, false)
} }
} }
DEFINE_MAP_OPTION(attenuate, false)
{
FGLROptions *opt = info->GetOptData<FGLROptions>("gl_renderer");
if (parse.CheckAssign())
{
parse.sc.MustGetNumber();
opt->attenuate = !!parse.sc.Number;
}
else
{
opt->attenuate = true;
}
}
DEFINE_MAP_OPTION(skyrotate, false) DEFINE_MAP_OPTION(skyrotate, false)
{ {
FGLROptions *opt = info->GetOptData<FGLROptions>("gl_renderer"); FGLROptions *opt = info->GetOptData<FGLROptions>("gl_renderer");
@ -371,6 +390,22 @@ bool IsLightmodeValid()
return (glset.map_lightmode >= 0 && glset.map_lightmode <= 4) || glset.map_lightmode == 8; return (glset.map_lightmode >= 0 && glset.map_lightmode <= 4) || glset.map_lightmode == 8;
} }
static void ResetOpts()
{
if (!IsLightmodeValid()) glset.lightmode = gl_lightmode;
else glset.lightmode = glset.map_lightmode;
if (glset.map_nocoloredspritelighting == -1) glset.nocoloredspritelighting = gl_nocoloredspritelighting;
else glset.nocoloredspritelighting = !!glset.map_nocoloredspritelighting;
if (glset.map_notexturefill == -1) glset.notexturefill = gl_notexturefill;
else glset.notexturefill = !!glset.map_notexturefill;
if (glset.map_brightfog == -1) glset.brightfog = gl_brightfog;
else glset.brightfog = !!glset.map_brightfog;
if (glset.map_lightadditivesurfaces == -1) glset.lightadditivesurfaces = gl_lightadditivesurfaces;
else glset.lightadditivesurfaces = !!glset.map_lightadditivesurfaces;
if (glset.map_attenuate == -1) glset.attenuate = gl_attenuate;
else glset.attenuate = !!glset.map_attenuate;
}
void InitGLRMapinfoData() void InitGLRMapinfoData()
{ {
FGLROptions *opt = level.info->GetOptData<FGLROptions>("gl_renderer", false); FGLROptions *opt = level.info->GetOptData<FGLROptions>("gl_renderer", false);
@ -380,6 +415,7 @@ void InitGLRMapinfoData()
gl_SetFogParams(opt->fogdensity, level.info->outsidefog, opt->outsidefogdensity, opt->skyfog); gl_SetFogParams(opt->fogdensity, level.info->outsidefog, opt->outsidefogdensity, opt->skyfog);
glset.map_lightmode = opt->lightmode; glset.map_lightmode = opt->lightmode;
glset.map_lightadditivesurfaces = opt->lightadditivesurfaces; glset.map_lightadditivesurfaces = opt->lightadditivesurfaces;
glset.map_attenuate = opt->attenuate;
glset.map_brightfog = opt->brightfog; glset.map_brightfog = opt->brightfog;
glset.map_nocoloredspritelighting = opt->nocoloredspritelighting; glset.map_nocoloredspritelighting = opt->nocoloredspritelighting;
glset.map_notexturefill = opt->notexturefill; glset.map_notexturefill = opt->notexturefill;
@ -393,35 +429,18 @@ void InitGLRMapinfoData()
glset.map_lightmode = -1; glset.map_lightmode = -1;
glset.map_lightadditivesurfaces = -1; glset.map_lightadditivesurfaces = -1;
glset.map_brightfog = -1; glset.map_brightfog = -1;
glset.map_attenuate = -1;
glset.map_nocoloredspritelighting = -1; glset.map_nocoloredspritelighting = -1;
glset.map_notexturefill = -1; glset.map_notexturefill = -1;
glset.skyrotatevector = FVector3(0, 0, 1); glset.skyrotatevector = FVector3(0, 0, 1);
glset.skyrotatevector2 = FVector3(0, 0, 1); glset.skyrotatevector2 = FVector3(0, 0, 1);
glset.pixelstretch = 1.2f; glset.pixelstretch = 1.2f;
} }
ResetOpts();
if (!IsLightmodeValid()) glset.lightmode = gl_lightmode;
else glset.lightmode = glset.map_lightmode;
if (glset.map_nocoloredspritelighting == -1) glset.nocoloredspritelighting = gl_nocoloredspritelighting;
else glset.nocoloredspritelighting = !!glset.map_nocoloredspritelighting;
if (glset.map_notexturefill == -1) glset.notexturefill = gl_notexturefill;
else glset.notexturefill = !!glset.map_notexturefill;
if (glset.map_brightfog == -1) glset.brightfog = gl_brightfog;
else glset.brightfog = !!glset.map_brightfog;
if (glset.map_lightadditivesurfaces == -1) glset.brightfog = gl_brightfog;
else glset.lightadditivesurfaces = !!glset.map_lightadditivesurfaces;
} }
CCMD(gl_resetmap) CCMD(gl_resetmap)
{ {
if (!IsLightmodeValid()) glset.lightmode = gl_lightmode; ResetOpts();
else glset.lightmode = glset.map_lightmode;
if (glset.map_nocoloredspritelighting == -1) glset.nocoloredspritelighting = gl_nocoloredspritelighting;
else glset.nocoloredspritelighting = !!glset.map_nocoloredspritelighting;
if (glset.map_notexturefill == -1) glset.notexturefill = gl_notexturefill;
else glset.notexturefill = !!glset.map_notexturefill;
if (glset.map_brightfog == -1) glset.brightfog = gl_brightfog;
else glset.brightfog = !!glset.map_brightfog;
} }

View file

@ -13,12 +13,14 @@ struct GLRenderSettings
bool notexturefill; bool notexturefill;
bool brightfog; bool brightfog;
bool lightadditivesurfaces; bool lightadditivesurfaces;
bool attenuate;
int8_t map_lightmode; int8_t map_lightmode;
int8_t map_nocoloredspritelighting; int8_t map_nocoloredspritelighting;
int8_t map_notexturefill; int8_t map_notexturefill;
int8_t map_brightfog; int8_t map_brightfog;
int8_t map_lightadditivesurfaces; int8_t map_lightadditivesurfaces;
int8_t map_attenuate;
FVector3 skyrotatevector; FVector3 skyrotatevector;
FVector3 skyrotatevector2; FVector3 skyrotatevector2;

View file

@ -54,6 +54,7 @@
#include "gl/textures/gl_skyboxtexture.h" #include "gl/textures/gl_skyboxtexture.h"
#include "gl/utility/gl_clock.h" #include "gl/utility/gl_clock.h"
#include "gl/utility/gl_convert.h" #include "gl/utility/gl_convert.h"
#include "gl/data/gl_data.h"
int ScriptDepth; int ScriptDepth;
void gl_InitGlow(FScanner &sc); void gl_InitGlow(FScanner &sc);
@ -128,6 +129,7 @@ public:
void SetSubtractive(bool subtract) { m_subtractive = subtract; } void SetSubtractive(bool subtract) { m_subtractive = subtract; }
void SetAdditive(bool add) { m_additive = add; } void SetAdditive(bool add) { m_additive = add; }
void SetDontLightSelf(bool add) { m_dontlightself = add; } void SetDontLightSelf(bool add) { m_dontlightself = add; }
void SetAttenuate(bool on) { m_attenuate = on; }
void SetHalo(bool halo) { m_halo = halo; } void SetHalo(bool halo) { m_halo = halo; }
protected: protected:
FName m_Name; FName m_Name;
@ -135,6 +137,7 @@ protected:
double m_Param; double m_Param;
DVector3 m_Pos; DVector3 m_Pos;
ELightType m_type; ELightType m_type;
int8_t m_attenuate;
bool m_subtractive, m_additive, m_halo, m_dontlightself; bool m_subtractive, m_additive, m_halo, m_dontlightself;
}; };
@ -159,6 +162,7 @@ FLightDefaults::FLightDefaults(FName name, ELightType type)
m_additive = false; m_additive = false;
m_halo = false; m_halo = false;
m_dontlightself = false; m_dontlightself = false;
m_attenuate = -1;
} }
void FLightDefaults::ApplyProperties(ADynamicLight * light) const void FLightDefaults::ApplyProperties(ADynamicLight * light) const
@ -175,6 +179,12 @@ void FLightDefaults::ApplyProperties(ADynamicLight * light) const
if (m_additive) light->flags4 |= MF4_ADDITIVE; if (m_additive) light->flags4 |= MF4_ADDITIVE;
if (m_dontlightself) light->flags4 |= MF4_DONTLIGHTSELF; if (m_dontlightself) light->flags4 |= MF4_DONTLIGHTSELF;
light->m_tickCount = 0; light->m_tickCount = 0;
switch (m_attenuate)
{
case 0: light->flags4 &= ~MF4_ATTENUATE; break;
case 1: light->flags4 |= MF4_ATTENUATE; break;
default: if (glset.attenuate) light->flags4 |= MF4_ATTENUATE; else light->flags4 &= ~MF4_ATTENUATE; break;
}
} }
@ -202,6 +212,7 @@ static const char *LightTags[]=
"additive", "additive",
"halo", "halo",
"dontlightself", "dontlightself",
"attenuate",
NULL NULL
}; };
@ -222,6 +233,7 @@ enum {
LIGHTTAG_ADDITIVE, LIGHTTAG_ADDITIVE,
LIGHTTAG_HALO, LIGHTTAG_HALO,
LIGHTTAG_DONTLIGHTSELF, LIGHTTAG_DONTLIGHTSELF,
LIGHTTAG_ATTENUATE
}; };
@ -349,6 +361,9 @@ void gl_ParsePointLight(FScanner &sc)
case LIGHTTAG_DONTLIGHTSELF: case LIGHTTAG_DONTLIGHTSELF:
defaults->SetDontLightSelf(gl_ParseInt(sc) != 0); defaults->SetDontLightSelf(gl_ParseInt(sc) != 0);
break; break;
case LIGHTTAG_ATTENUATE:
defaults->SetAttenuate(gl_ParseInt(sc) != 0);
break;
default: default:
sc.ScriptError("Unknown tag: %s\n", sc.String); sc.ScriptError("Unknown tag: %s\n", sc.String);
} }
@ -428,6 +443,9 @@ void gl_ParsePulseLight(FScanner &sc)
case LIGHTTAG_DONTLIGHTSELF: case LIGHTTAG_DONTLIGHTSELF:
defaults->SetDontLightSelf(gl_ParseInt(sc) != 0); defaults->SetDontLightSelf(gl_ParseInt(sc) != 0);
break; break;
case LIGHTTAG_ATTENUATE:
defaults->SetAttenuate(gl_ParseInt(sc) != 0);
break;
default: default:
sc.ScriptError("Unknown tag: %s\n", sc.String); sc.ScriptError("Unknown tag: %s\n", sc.String);
} }
@ -515,6 +533,9 @@ void gl_ParseFlickerLight(FScanner &sc)
case LIGHTTAG_DONTLIGHTSELF: case LIGHTTAG_DONTLIGHTSELF:
defaults->SetDontLightSelf(gl_ParseInt(sc) != 0); defaults->SetDontLightSelf(gl_ParseInt(sc) != 0);
break; break;
case LIGHTTAG_ATTENUATE:
defaults->SetAttenuate(gl_ParseInt(sc) != 0);
break;
default: default:
sc.ScriptError("Unknown tag: %s\n", sc.String); sc.ScriptError("Unknown tag: %s\n", sc.String);
} }
@ -594,6 +615,9 @@ void gl_ParseFlickerLight2(FScanner &sc)
case LIGHTTAG_DONTLIGHTSELF: case LIGHTTAG_DONTLIGHTSELF:
defaults->SetDontLightSelf(gl_ParseInt(sc) != 0); defaults->SetDontLightSelf(gl_ParseInt(sc) != 0);
break; break;
case LIGHTTAG_ATTENUATE:
defaults->SetAttenuate(gl_ParseInt(sc) != 0);
break;
default: default:
sc.ScriptError("Unknown tag: %s\n", sc.String); sc.ScriptError("Unknown tag: %s\n", sc.String);
} }
@ -671,6 +695,9 @@ void gl_ParseSectorLight(FScanner &sc)
case LIGHTTAG_DONTLIGHTSELF: case LIGHTTAG_DONTLIGHTSELF:
defaults->SetDontLightSelf(gl_ParseInt(sc) != 0); defaults->SetDontLightSelf(gl_ParseInt(sc) != 0);
break; break;
case LIGHTTAG_ATTENUATE:
defaults->SetAttenuate(gl_ParseInt(sc) != 0);
break;
default: default:
sc.ScriptError("Unknown tag: %s\n", sc.String); sc.ScriptError("Unknown tag: %s\n", sc.String);
} }

View file

@ -63,7 +63,8 @@ CUSTOM_CVAR(Bool, gl_enhanced_nightvision, true, CVAR_ARCHIVE|CVAR_NOINITCALL)
} }
} }
CVAR(Bool, gl_brightfog, false, CVAR_ARCHIVE); CVAR(Bool, gl_brightfog, false, CVAR_ARCHIVE);
CVAR(Bool, lightadditivesurfaces, false, CVAR_ARCHIVE); CVAR(Bool, gl_lightadditivesurfaces, false, CVAR_ARCHIVE);
CVAR(Bool, gl_attenuate, false, CVAR_ARCHIVE);

View file

@ -860,6 +860,26 @@ bool PIT_CheckLine(FMultiBlockLinesIterator &mit, FMultiBlockLinesIterator::Chec
FLineOpening open; FLineOpening open;
P_LineOpening(open, tm.thing, ld, ref, &cres.Position, cres.portalflags); P_LineOpening(open, tm.thing, ld, ref, &cres.Position, cres.portalflags);
if (!tm.thing->Sector->PortalBlocksMovement(sector_t::ceiling))
{
sector_t *oppsec = cres.line->frontsector == tm.thing->Sector ? cres.line->backsector : cres.line->frontsector;
if (oppsec->PortalBlocksMovement(sector_t::ceiling))
{
double portz = tm.thing->Sector->GetPortalPlaneZ(sector_t::ceiling);
if (tm.thing->Z() < portz && tm.thing->Z() + tm.thing->MaxStepHeight >= portz && tm.floorz < portz)
{
// Actor is stepping through a portal.
/*
tm.floorz = portz;
tm.floorsector = oppsec;
tm.floorpic = cres.line->sidedef[0]->GetTexture(side_t::mid);
tm.floorterrain = 0;
*/
tm.portalstep = true;
return true;
}
}
}
// [RH] Steep sectors count as dropoffs, if the actor touches the boundary between a steep slope and something else // [RH] Steep sectors count as dropoffs, if the actor touches the boundary between a steep slope and something else
if (!(tm.thing->flags & MF_DROPOFF) && if (!(tm.thing->flags & MF_DROPOFF) &&

View file

@ -1231,8 +1231,8 @@ bool P_CollectConnectedGroups(int startgroup, const DVector3 &position, double u
{ {
int othergroup = wsec->GetOppositePortalGroup(sector_t::floor); int othergroup = wsec->GetOppositePortalGroup(sector_t::floor);
DVector2 pos = Displacements.getOffset(startgroup, othergroup) + position; DVector2 pos = Displacements.getOffset(startgroup, othergroup) + position;
processMask.setBit(othergroup | FPortalGroupArray::LOWER); processMask.setBit(othergroup);
out.Add(othergroup); out.Add(othergroup | FPortalGroupArray::LOWER);
wsec = P_PointInSector(pos); // get lower sector at the exact spot we want to check and repeat wsec = P_PointInSector(pos); // get lower sector at the exact spot we want to check and repeat
retval = true; retval = true;
} }

View file

@ -104,6 +104,11 @@ DoomEdNums
9823 = SectorPointLightSubtractive 9823 = SectorPointLightSubtractive
9824 = PointLightFlickerRandomSubtractive 9824 = PointLightFlickerRandomSubtractive
9825 = VavoomLight 9825 = VavoomLight
9830 = PointLightAttenuated
9831 = PointLightPulseAttenuated
9832 = PointLightFlickerAttenuated
9833 = SectorPointLightAttenuated
9834 = PointLightFlickerRandomAttenuated
9982 = SecActEyesAboveC 9982 = SecActEyesAboveC
9983 = SecActEyesBelowC 9983 = SecActEyesBelowC
9988 = CustomSprite 9988 = CustomSprite

View file

@ -157,3 +157,44 @@ class VavoomLightColor : VavoomLight native
} }
} }
class PointLightAttenuated : PointLight
{
Default
{
+INCOMBAT
}
}
class PointLightPulseAttenuated : PointLightPulse
{
Default
{
+INCOMBAT
}
}
class PointLightFlickerAttenuated : PointLightFlicker
{
Default
{
+INCOMBAT
}
}
class SectorPointLightAttenuated : SectorPointLight
{
Default
{
+INCOMBAT
}
}
class PointLightFlickerRandomAttenuated :PointLightFlickerRandom
{
Default
{
+INCOMBAT
}
}