mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-11 07:12:02 +00:00
Added "DontLightActors" flag for dynamic lights. Actors will not be illuminated by lights that are given this flag.
This commit is contained in:
parent
bdf761e457
commit
99d1581c27
5 changed files with 25 additions and 4 deletions
|
@ -27,6 +27,7 @@ enum
|
||||||
#define MF4_DONTLIGHTSELF MF4_SEESDAGGERS
|
#define MF4_DONTLIGHTSELF MF4_SEESDAGGERS
|
||||||
#define MF4_ATTENUATE MF4_INCOMBAT
|
#define MF4_ATTENUATE MF4_INCOMBAT
|
||||||
#define MF4_NOSHADOWMAP MF4_STANDSTILL
|
#define MF4_NOSHADOWMAP MF4_STANDSTILL
|
||||||
|
#define MF4_DONTLIGHTACTORS MF4_EXTREMEDEATH
|
||||||
|
|
||||||
enum ELightType
|
enum ELightType
|
||||||
{
|
{
|
||||||
|
|
|
@ -127,6 +127,7 @@ public:
|
||||||
void SetDontLightSelf(bool add) { m_dontlightself = add; }
|
void SetDontLightSelf(bool add) { m_dontlightself = add; }
|
||||||
void SetAttenuate(bool on) { m_attenuate = on; }
|
void SetAttenuate(bool on) { m_attenuate = on; }
|
||||||
void SetHalo(bool halo) { m_halo = halo; }
|
void SetHalo(bool halo) { m_halo = halo; }
|
||||||
|
void SetDontLightActors(bool on) { m_dontlightactors = on; }
|
||||||
|
|
||||||
void OrderIntensities()
|
void OrderIntensities()
|
||||||
{
|
{
|
||||||
|
@ -144,7 +145,7 @@ protected:
|
||||||
DVector3 m_Pos;
|
DVector3 m_Pos;
|
||||||
ELightType m_type;
|
ELightType m_type;
|
||||||
int8_t m_attenuate;
|
int8_t m_attenuate;
|
||||||
bool m_subtractive, m_additive, m_halo, m_dontlightself;
|
bool m_subtractive, m_additive, m_halo, m_dontlightself, m_dontlightactors;
|
||||||
bool m_swapped = false;
|
bool m_swapped = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -187,6 +188,7 @@ void FLightDefaults::ApplyProperties(ADynamicLight * light) const
|
||||||
if (m_subtractive) light->flags4 |= MF4_SUBTRACTIVE;
|
if (m_subtractive) light->flags4 |= MF4_SUBTRACTIVE;
|
||||||
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;
|
||||||
|
if (m_dontlightactors) light->flags4 |= MF4_DONTLIGHTACTORS;
|
||||||
light->m_tickCount = 0;
|
light->m_tickCount = 0;
|
||||||
if (m_type == PulseLight)
|
if (m_type == PulseLight)
|
||||||
{
|
{
|
||||||
|
@ -236,6 +238,7 @@ static const char *LightTags[]=
|
||||||
"halo",
|
"halo",
|
||||||
"dontlightself",
|
"dontlightself",
|
||||||
"attenuate",
|
"attenuate",
|
||||||
|
"dontlightactors",
|
||||||
NULL
|
NULL
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -256,7 +259,8 @@ enum {
|
||||||
LIGHTTAG_ADDITIVE,
|
LIGHTTAG_ADDITIVE,
|
||||||
LIGHTTAG_HALO,
|
LIGHTTAG_HALO,
|
||||||
LIGHTTAG_DONTLIGHTSELF,
|
LIGHTTAG_DONTLIGHTSELF,
|
||||||
LIGHTTAG_ATTENUATE
|
LIGHTTAG_ATTENUATE,
|
||||||
|
LIGHTTAG_DONTLIGHTACTORS,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -394,6 +398,9 @@ static void ParsePointLight(FScanner &sc)
|
||||||
case LIGHTTAG_ATTENUATE:
|
case LIGHTTAG_ATTENUATE:
|
||||||
defaults->SetAttenuate(ParseInt(sc) != 0);
|
defaults->SetAttenuate(ParseInt(sc) != 0);
|
||||||
break;
|
break;
|
||||||
|
case LIGHTTAG_DONTLIGHTACTORS:
|
||||||
|
defaults->SetDontLightActors(ParseInt(sc) != 0);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
sc.ScriptError("Unknown tag: %s\n", sc.String);
|
sc.ScriptError("Unknown tag: %s\n", sc.String);
|
||||||
}
|
}
|
||||||
|
@ -476,6 +483,9 @@ static void ParsePulseLight(FScanner &sc)
|
||||||
case LIGHTTAG_ATTENUATE:
|
case LIGHTTAG_ATTENUATE:
|
||||||
defaults->SetAttenuate(ParseInt(sc) != 0);
|
defaults->SetAttenuate(ParseInt(sc) != 0);
|
||||||
break;
|
break;
|
||||||
|
case LIGHTTAG_DONTLIGHTACTORS:
|
||||||
|
defaults->SetDontLightActors(ParseInt(sc) != 0);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
sc.ScriptError("Unknown tag: %s\n", sc.String);
|
sc.ScriptError("Unknown tag: %s\n", sc.String);
|
||||||
}
|
}
|
||||||
|
@ -560,6 +570,9 @@ void ParseFlickerLight(FScanner &sc)
|
||||||
case LIGHTTAG_ATTENUATE:
|
case LIGHTTAG_ATTENUATE:
|
||||||
defaults->SetAttenuate(ParseInt(sc) != 0);
|
defaults->SetAttenuate(ParseInt(sc) != 0);
|
||||||
break;
|
break;
|
||||||
|
case LIGHTTAG_DONTLIGHTACTORS:
|
||||||
|
defaults->SetDontLightActors(ParseInt(sc) != 0);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
sc.ScriptError("Unknown tag: %s\n", sc.String);
|
sc.ScriptError("Unknown tag: %s\n", sc.String);
|
||||||
}
|
}
|
||||||
|
@ -643,6 +656,9 @@ void ParseFlickerLight2(FScanner &sc)
|
||||||
case LIGHTTAG_ATTENUATE:
|
case LIGHTTAG_ATTENUATE:
|
||||||
defaults->SetAttenuate(ParseInt(sc) != 0);
|
defaults->SetAttenuate(ParseInt(sc) != 0);
|
||||||
break;
|
break;
|
||||||
|
case LIGHTTAG_DONTLIGHTACTORS:
|
||||||
|
defaults->SetDontLightActors(ParseInt(sc) != 0);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
sc.ScriptError("Unknown tag: %s\n", sc.String);
|
sc.ScriptError("Unknown tag: %s\n", sc.String);
|
||||||
}
|
}
|
||||||
|
@ -723,6 +739,9 @@ static void ParseSectorLight(FScanner &sc)
|
||||||
case LIGHTTAG_ATTENUATE:
|
case LIGHTTAG_ATTENUATE:
|
||||||
defaults->SetAttenuate(ParseInt(sc) != 0);
|
defaults->SetAttenuate(ParseInt(sc) != 0);
|
||||||
break;
|
break;
|
||||||
|
case LIGHTTAG_DONTLIGHTACTORS:
|
||||||
|
defaults->SetDontLightActors(ParseInt(sc) != 0);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
sc.ScriptError("Unknown tag: %s\n", sc.String);
|
sc.ScriptError("Unknown tag: %s\n", sc.String);
|
||||||
}
|
}
|
||||||
|
|
|
@ -62,7 +62,7 @@ void gl_SetDynSpriteLight(AActor *self, float x, float y, float z, subsector_t *
|
||||||
while (node)
|
while (node)
|
||||||
{
|
{
|
||||||
light=node->lightsource;
|
light=node->lightsource;
|
||||||
if (light->visibletoplayer && !(light->flags2&MF2_DORMANT) && (!(light->flags4&MF4_DONTLIGHTSELF) || light->target != self))
|
if (light->visibletoplayer && !(light->flags2&MF2_DORMANT) && (!(light->flags4&MF4_DONTLIGHTSELF) || light->target != self) && !(light->flags4&MF4_DONTLIGHTACTORS))
|
||||||
{
|
{
|
||||||
float dist;
|
float dist;
|
||||||
|
|
||||||
|
|
|
@ -488,6 +488,7 @@ static FFlagDef DynLightFlagDefs[] =
|
||||||
DEFINE_FLAG(MF4, DONTLIGHTSELF, ADynamicLight, flags4),
|
DEFINE_FLAG(MF4, DONTLIGHTSELF, ADynamicLight, flags4),
|
||||||
DEFINE_FLAG(MF4, ATTENUATE, ADynamicLight, flags4),
|
DEFINE_FLAG(MF4, ATTENUATE, ADynamicLight, flags4),
|
||||||
DEFINE_FLAG(MF4, NOSHADOWMAP, ADynamicLight, flags4),
|
DEFINE_FLAG(MF4, NOSHADOWMAP, ADynamicLight, flags4),
|
||||||
|
DEFINE_FLAG(MF4, DONTLIGHTACTORS, ADynamicLight, flags4),
|
||||||
};
|
};
|
||||||
|
|
||||||
static FFlagDef PowerSpeedFlagDefs[] =
|
static FFlagDef PowerSpeedFlagDefs[] =
|
||||||
|
|
|
@ -237,7 +237,7 @@ namespace swrenderer
|
||||||
while (node != nullptr)
|
while (node != nullptr)
|
||||||
{
|
{
|
||||||
ADynamicLight *light = node->lightsource;
|
ADynamicLight *light = node->lightsource;
|
||||||
if (light->visibletoplayer && !(light->flags2&MF2_DORMANT) && (!(light->flags4&MF4_DONTLIGHTSELF) || light->target != thing))
|
if (light->visibletoplayer && !(light->flags2&MF2_DORMANT) && (!(light->flags4&MF4_DONTLIGHTSELF) || light->target != thing) && !(light->flags4&MF4_DONTLIGHTACTORS))
|
||||||
{
|
{
|
||||||
float lx = (float)(light->X() - thing->X());
|
float lx = (float)(light->X() - thing->X());
|
||||||
float ly = (float)(light->Y() - thing->Y());
|
float ly = (float)(light->Y() - thing->Y());
|
||||||
|
|
Loading…
Reference in a new issue