mirror of
https://github.com/ZDoom/qzdoom-gpl.git
synced 2024-11-16 01:02:03 +00:00
- replaced all code that changed a sector's light level with a setter function.
SVN r1762 (trunk)
This commit is contained in:
parent
a47ec74eba
commit
cd95473d57
4 changed files with 42 additions and 27 deletions
|
@ -92,7 +92,7 @@ void DLightningThinker::LightningFlash ()
|
|||
if (LightningLightLevels[numsectors+(j>>3)] & (1<<(j&7)) &&
|
||||
LightningLightLevels[j] < tempSec->lightlevel-4)
|
||||
{
|
||||
tempSec->lightlevel -= 4;
|
||||
tempSec->ChangeLightLevel(-4);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -103,7 +103,7 @@ void DLightningThinker::LightningFlash ()
|
|||
{
|
||||
if (LightningLightLevels[numsectors+(j>>3)] & (1<<(j&7)))
|
||||
{
|
||||
tempSec->lightlevel = LightningLightLevels[j];
|
||||
tempSec->SetLightLevel(LightningLightLevels[j]);
|
||||
}
|
||||
}
|
||||
memset (&LightningLightLevels[numsectors], 0, (numsectors+7)/8);
|
||||
|
@ -128,19 +128,19 @@ void DLightningThinker::LightningFlash ()
|
|||
LightningLightLevels[numsectors+(j>>3)] |= 1<<(j&7);
|
||||
if (special == Light_IndoorLightning1)
|
||||
{
|
||||
tempSec->lightlevel = MIN<int> (tempSec->lightlevel+64, flashLight);
|
||||
tempSec->SetLightLevel(MIN<int> (tempSec->lightlevel+64, flashLight));
|
||||
}
|
||||
else if (special == Light_IndoorLightning2)
|
||||
{
|
||||
tempSec->lightlevel = MIN<int> (tempSec->lightlevel+32, flashLight);
|
||||
tempSec->SetLightLevel(MIN<int> (tempSec->lightlevel+32, flashLight));
|
||||
}
|
||||
else
|
||||
{
|
||||
tempSec->lightlevel = flashLight;
|
||||
tempSec->SetLightLevel(flashLight);
|
||||
}
|
||||
if (tempSec->lightlevel < LightningLightLevels[j])
|
||||
{
|
||||
tempSec->lightlevel = LightningLightLevels[j];
|
||||
tempSec->SetLightLevel(LightningLightLevels[j]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -90,7 +90,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_LightGoesOut)
|
|||
vertex_t *spot;
|
||||
fixed_t newheight;
|
||||
|
||||
sec->lightlevel = 0;
|
||||
sec->SetLightLevel(0);
|
||||
|
||||
newheight = sec->FindLowestFloorSurrounding (&spot);
|
||||
sec->floorplane.d = sec->floorplane.PointToDist (spot, newheight);
|
||||
|
|
|
@ -81,9 +81,9 @@ void DFireFlicker::Tick ()
|
|||
|
||||
// [RH] Shouldn't this be (m_MaxLight - amount < m_MinLight)?
|
||||
if (m_Sector->lightlevel - amount < m_MinLight)
|
||||
m_Sector->lightlevel = m_MinLight;
|
||||
m_Sector->SetLightLevel(m_MinLight);
|
||||
else
|
||||
m_Sector->lightlevel = m_MaxLight - amount;
|
||||
m_Sector->SetLightLevel(m_MaxLight - amount);
|
||||
|
||||
m_Count = 4;
|
||||
}
|
||||
|
@ -132,12 +132,12 @@ void DFlicker::Tick ()
|
|||
}
|
||||
else if (m_Sector->lightlevel == m_MaxLight)
|
||||
{
|
||||
m_Sector->lightlevel = m_MinLight;
|
||||
m_Sector->SetLightLevel(m_MinLight);
|
||||
m_Count = (pr_flicker()&7)+1;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_Sector->lightlevel = m_MaxLight;
|
||||
m_Sector->SetLightLevel(m_MaxLight);
|
||||
m_Count = (pr_flicker()&31)+1;
|
||||
}
|
||||
}
|
||||
|
@ -189,12 +189,12 @@ void DLightFlash::Tick ()
|
|||
{
|
||||
if (m_Sector->lightlevel == m_MaxLight)
|
||||
{
|
||||
m_Sector->lightlevel = m_MinLight;
|
||||
m_Sector->SetLightLevel(m_MinLight);
|
||||
m_Count = (pr_lightflash() & m_MinTime) + 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_Sector->lightlevel = m_MaxLight;
|
||||
m_Sector->SetLightLevel(m_MaxLight);
|
||||
m_Count = (pr_lightflash() & m_MaxTime) + 1;
|
||||
}
|
||||
}
|
||||
|
@ -251,12 +251,12 @@ void DStrobe::Tick ()
|
|||
{
|
||||
if (m_Sector->lightlevel == m_MinLight)
|
||||
{
|
||||
m_Sector->lightlevel = m_MaxLight;
|
||||
m_Sector->SetLightLevel(m_MaxLight);
|
||||
m_Count = m_BrightTime;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_Sector->lightlevel = m_MinLight;
|
||||
m_Sector->SetLightLevel(m_MinLight);
|
||||
m_Count = m_DarkTime;
|
||||
}
|
||||
}
|
||||
|
@ -353,7 +353,7 @@ void EV_TurnTagLightsOff (int tag)
|
|||
if (tsec->lightlevel < min)
|
||||
min = tsec->lightlevel;
|
||||
}
|
||||
sector->lightlevel = min;
|
||||
sector->SetLightLevel(min);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -390,7 +390,7 @@ void EV_LightTurnOn (int tag, int bright)
|
|||
bright = temp->lightlevel;
|
||||
}
|
||||
}
|
||||
sector->lightlevel = clamp (bright, 0, 255);
|
||||
sector->SetLightLevel(bright);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -433,7 +433,7 @@ void EV_LightTurnOnPartway (int tag, fixed_t frac)
|
|||
}
|
||||
}
|
||||
}
|
||||
sector->lightlevel = (BYTE)DMulScale16 (frac, bright, FRACUNIT-frac, min);
|
||||
sector->SetLightLevel(DMulScale16 (frac, bright, FRACUNIT-frac, min));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -450,7 +450,7 @@ void EV_LightChange (int tag, int value)
|
|||
while ((secnum = P_FindSectorFromTag (tag, secnum)) >= 0)
|
||||
{
|
||||
int newlight = sectors[secnum].lightlevel + value;
|
||||
sectors[secnum].lightlevel = clamp (newlight, 0, 255);
|
||||
sectors[secnum].SetLightLevel(newlight);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -496,7 +496,7 @@ void DGlow::Tick ()
|
|||
}
|
||||
break;
|
||||
}
|
||||
m_Sector->lightlevel = newlight;
|
||||
m_Sector->SetLightLevel(newlight);
|
||||
}
|
||||
|
||||
|
||||
|
@ -530,7 +530,7 @@ void DGlow2::Tick ()
|
|||
{
|
||||
if (m_OneShot)
|
||||
{
|
||||
m_Sector->lightlevel = m_End;
|
||||
m_Sector->SetLightLevel(m_End);
|
||||
Destroy ();
|
||||
return;
|
||||
}
|
||||
|
@ -543,7 +543,7 @@ void DGlow2::Tick ()
|
|||
}
|
||||
}
|
||||
|
||||
m_Sector->lightlevel = ((m_End - m_Start) * m_Tics) / m_MaxTics + m_Start;
|
||||
m_Sector->SetLightLevel(((m_End - m_Start) * m_Tics) / m_MaxTics + m_Start);
|
||||
}
|
||||
|
||||
DGlow2::DGlow2 (sector_t *sector, int start, int end, int tics, bool oneshot)
|
||||
|
@ -597,7 +597,7 @@ void EV_StartLightFading (int tag, int value, int tics)
|
|||
|
||||
if (tics <= 0)
|
||||
{
|
||||
sec->lightlevel = value;
|
||||
sec->SetLightLevel(value);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -631,12 +631,12 @@ void DPhased::Tick ()
|
|||
const int steps = 12;
|
||||
|
||||
if (m_Phase < steps)
|
||||
m_Sector->lightlevel = ((255 - m_BaseLevel) * m_Phase) / steps + m_BaseLevel;
|
||||
m_Sector->SetLightLevel( ((255 - m_BaseLevel) * m_Phase) / steps + m_BaseLevel);
|
||||
else if (m_Phase < 2*steps)
|
||||
m_Sector->lightlevel = ((255 - m_BaseLevel) * (2*steps - m_Phase - 1) / steps
|
||||
+ m_BaseLevel);
|
||||
m_Sector->SetLightLevel( ((255 - m_BaseLevel) * (2*steps - m_Phase - 1) / steps
|
||||
+ m_BaseLevel));
|
||||
else
|
||||
m_Sector->lightlevel = m_BaseLevel;
|
||||
m_Sector->SetLightLevel(m_BaseLevel);
|
||||
|
||||
if (m_Phase == 0)
|
||||
m_Phase = 63;
|
||||
|
|
15
src/r_defs.h
15
src/r_defs.h
|
@ -590,6 +590,21 @@ struct sector_t
|
|||
return (MoreFlags & SECF_IGNOREHEIGHTSEC)? NULL : heightsec;
|
||||
}
|
||||
|
||||
void ChangeLightLevel(int newval)
|
||||
{
|
||||
lightlevel = (BYTE)clamp(lightlevel + newval, 0, 255);
|
||||
}
|
||||
|
||||
void SetLightLevel(int newval)
|
||||
{
|
||||
lightlevel = (BYTE)clamp(newval, 0, 255);
|
||||
}
|
||||
|
||||
int GetLightLevel() const
|
||||
{
|
||||
return lightlevel;
|
||||
}
|
||||
|
||||
|
||||
// Member variables
|
||||
fixed_t CenterFloor () const { return floorplane.ZatPoint (soundorg[0], soundorg[1]); }
|
||||
|
|
Loading…
Reference in a new issue