- renamed ADynamicLight's intensity properties to radius, to have their name match their meaning.

This commit is contained in:
Christoph Oelckers 2016-04-17 13:53:29 +02:00
parent 357869a7b5
commit faeb0303fe
3 changed files with 25 additions and 26 deletions

View file

@ -101,7 +101,7 @@ void AVavoomLight::BeginPlay ()
void AVavoomLightWhite::BeginPlay () void AVavoomLightWhite::BeginPlay ()
{ {
m_intensity[0] = args[0] * 4; m_Radius[0] = args[0] * 4;
args[LIGHT_RED] = 128; args[LIGHT_RED] = 128;
args[LIGHT_GREEN] = 128; args[LIGHT_GREEN] = 128;
args[LIGHT_BLUE] = 128; args[LIGHT_BLUE] = 128;
@ -114,7 +114,7 @@ void AVavoomLightColor::BeginPlay ()
int l_args[5]; int l_args[5];
memcpy(l_args, args, sizeof(l_args)); memcpy(l_args, args, sizeof(l_args));
memset(args, 0, sizeof(args)); memset(args, 0, sizeof(args));
m_intensity[0] = l_args[0] * 4; m_Radius[0] = l_args[0] * 4;
args[LIGHT_RED] = l_args[1] >> 1; args[LIGHT_RED] = l_args[1] >> 1;
args[LIGHT_GREEN] = l_args[2] >> 1; args[LIGHT_GREEN] = l_args[2] >> 1;
args[LIGHT_BLUE] = l_args[3] >> 1; args[LIGHT_BLUE] = l_args[3] >> 1;
@ -139,8 +139,8 @@ void ADynamicLight::Serialize(FArchive &arc)
{ {
Super::Serialize (arc); Super::Serialize (arc);
arc << lightflags << lighttype; arc << lightflags << lighttype;
arc << m_tickCount << m_currentIntensity; arc << m_tickCount << m_currentRadius;
arc << m_intensity[0] << m_intensity[1]; arc << m_Radius[0] << m_Radius[1];
if (lighttype == PulseLight) arc << m_lastUpdate << m_cycler; if (lighttype == PulseLight) arc << m_lastUpdate << m_cycler;
if (arc.IsLoading()) LinkLight(); if (arc.IsLoading()) LinkLight();
@ -158,8 +158,8 @@ void ADynamicLight::BeginPlay()
//Super::BeginPlay(); //Super::BeginPlay();
ChangeStatNum(STAT_DLIGHT); ChangeStatNum(STAT_DLIGHT);
m_intensity[0] = args[LIGHT_INTENSITY]; m_Radius[0] = args[LIGHT_INTENSITY];
m_intensity[1] = args[LIGHT_SECONDARY_INTENSITY]; m_Radius[1] = args[LIGHT_SECONDARY_INTENSITY];
} }
//========================================================================== //==========================================================================
@ -190,7 +190,7 @@ void ADynamicLight::Activate(AActor *activator)
//Super::Activate(activator); //Super::Activate(activator);
flags2&=~MF2_DORMANT; flags2&=~MF2_DORMANT;
m_currentIntensity = float(m_intensity[0]); m_currentRadius = float(m_Radius[0]);
m_tickCount = 0; m_tickCount = 0;
if (lighttype == PulseLight) if (lighttype == PulseLight)
@ -198,10 +198,10 @@ void ADynamicLight::Activate(AActor *activator)
float pulseTime = Angles.Yaw.Degrees / TICRATE; float pulseTime = Angles.Yaw.Degrees / TICRATE;
m_lastUpdate = level.maptime; m_lastUpdate = level.maptime;
m_cycler.SetParams(float(m_intensity[1]), float(m_intensity[0]), pulseTime); m_cycler.SetParams(float(m_Radius[1]), float(m_Radius[0]), pulseTime);
m_cycler.ShouldCycle(true); m_cycler.ShouldCycle(true);
m_cycler.SetCycleType(CYCLE_Sin); m_cycler.SetCycleType(CYCLE_Sin);
m_currentIntensity = (BYTE)m_cycler.GetVal(); m_currentRadius = (BYTE)m_cycler.GetVal();
} }
} }
@ -252,7 +252,7 @@ void ADynamicLight::Tick()
m_lastUpdate = level.maptime; m_lastUpdate = level.maptime;
m_cycler.Update(diff); m_cycler.Update(diff);
m_currentIntensity = m_cycler.GetVal(); m_currentRadius = m_cycler.GetVal();
break; break;
} }
@ -261,20 +261,20 @@ void ADynamicLight::Tick()
BYTE rnd = randLight(); BYTE rnd = randLight();
float pct = Angles.Yaw.Degrees / 360.f; float pct = Angles.Yaw.Degrees / 360.f;
m_currentIntensity = float(m_intensity[rnd >= pct * 255]); m_currentRadius = float(m_Radius[rnd >= pct * 255]);
break; break;
} }
case RandomFlickerLight: case RandomFlickerLight:
{ {
int flickerRange = m_intensity[1] - m_intensity[0]; int flickerRange = m_Radius[1] - m_Radius[0];
float amt = randLight() / 255.f; float amt = randLight() / 255.f;
m_tickCount++; m_tickCount++;
if (m_tickCount > Angles.Yaw.Degrees) if (m_tickCount > Angles.Yaw.Degrees)
{ {
m_currentIntensity = float(m_intensity[0] + (amt * flickerRange)); m_currentRadius = float(m_Radius[0] + (amt * flickerRange));
m_tickCount = 0; m_tickCount = 0;
} }
break; break;
@ -287,20 +287,20 @@ void ADynamicLight::Tick()
BYTE rnd = randLight(); BYTE rnd = randLight();
float pct = Angles.Yaw.Degrees/360.f; float pct = Angles.Yaw.Degrees/360.f;
m_currentIntensity = m_intensity[rnd >= pct * 255]; m_currentRadius = m_Radius[rnd >= pct * 255];
break; break;
} }
case RandomColorFlickerLight: case RandomColorFlickerLight:
{ {
int flickerRange = m_intensity[1] - m_intensity[0]; int flickerRange = m_Radius[1] - m_Radius[0];
float amt = randLight() / 255.f; float amt = randLight() / 255.f;
m_tickCount++; m_tickCount++;
if (m_tickCount > Angles.Yaw.Degrees) if (m_tickCount > Angles.Yaw.Degrees)
{ {
m_currentIntensity = m_intensity[0] + (amt * flickerRange); m_currentRadius = m_Radius[0] + (amt * flickerRange);
m_tickCount = 0; m_tickCount = 0;
} }
break; break;
@ -317,12 +317,12 @@ void ADynamicLight::Tick()
intensity = Sector->lightlevel * scale; intensity = Sector->lightlevel * scale;
intensity = clamp<float>(intensity, 0.f, 255.f); intensity = clamp<float>(intensity, 0.f, 255.f);
m_currentIntensity = intensity; m_currentRadius = intensity;
break; break;
} }
case PointLight: case PointLight:
m_currentIntensity = float(m_intensity[0]); m_currentRadius = float(m_Radius[0]);
break; break;
} }
@ -365,11 +365,11 @@ void ADynamicLight::UpdateLocation()
if (lighttype == FlickerLight || lighttype == RandomFlickerLight || lighttype == PulseLight) if (lighttype == FlickerLight || lighttype == RandomFlickerLight || lighttype == PulseLight)
{ {
intensity = float(MAX(m_intensity[0], m_intensity[1])); intensity = float(MAX(m_Radius[0], m_Radius[1]));
} }
else else
{ {
intensity = m_currentIntensity; intensity = m_currentRadius;
} }
radius = intensity * 2.0f * gl_lights_size; radius = intensity * 2.0f * gl_lights_size;

View file

@ -176,8 +176,8 @@ void FLightDefaults::ApplyProperties(ADynamicLight * light) const
light->SetOffset(m_Pos); light->SetOffset(m_Pos);
light->halo = m_halo; light->halo = m_halo;
for (int a = 0; a < 3; a++) light->args[a] = clamp<int>((int)(m_Args[a] * gl_lights_intensity), 0, 255); for (int a = 0; a < 3; a++) light->args[a] = clamp<int>((int)(m_Args[a] * gl_lights_intensity), 0, 255);
light->m_intensity[0] = int(m_Args[LIGHT_INTENSITY]); light->m_Radius[0] = int(m_Args[LIGHT_INTENSITY]);
light->m_intensity[1] = int(m_Args[LIGHT_SECONDARY_INTENSITY]); light->m_Radius[1] = int(m_Args[LIGHT_SECONDARY_INTENSITY]);
light->flags4 &= ~(MF4_ADDITIVE | MF4_SUBTRACTIVE | MF4_DONTLIGHTSELF); light->flags4 &= ~(MF4_ADDITIVE | MF4_SUBTRACTIVE | MF4_DONTLIGHTSELF);
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;

View file

@ -75,8 +75,7 @@ public:
BYTE GetRed() const { return args[LIGHT_RED]; } BYTE GetRed() const { return args[LIGHT_RED]; }
BYTE GetGreen() const { return args[LIGHT_GREEN]; } BYTE GetGreen() const { return args[LIGHT_GREEN]; }
BYTE GetBlue() const { return args[LIGHT_BLUE]; } BYTE GetBlue() const { return args[LIGHT_BLUE]; }
float GetIntensity() const { return m_currentIntensity; } float GetRadius() const { return (IsActive() ? m_currentRadius * 2.f : 0.f); }
float GetRadius() const { return (IsActive() ? GetIntensity() * 2.f : 0.f); }
void LinkLight(); void LinkLight();
void UnlinkLight(); void UnlinkLight();
size_t PointerSubstitution (DObject *old, DObject *notOld); size_t PointerSubstitution (DObject *old, DObject *notOld);
@ -104,14 +103,14 @@ private:
protected: protected:
DVector3 m_off; DVector3 m_off;
float m_currentIntensity; float m_currentRadius;
int m_tickCount; int m_tickCount;
unsigned int m_lastUpdate; unsigned int m_lastUpdate;
FCycler m_cycler; FCycler m_cycler;
subsector_t * subsector; subsector_t * subsector;
public: public:
int m_intensity[2]; int m_Radius[2];
BYTE lightflags; BYTE lightflags;
BYTE lighttype; BYTE lighttype;
bool owned; bool owned;