- roughly 50 more, mostly search and replace.

This commit is contained in:
Christoph Oelckers 2019-01-27 19:16:14 +01:00
commit b4a95ccaa9
12 changed files with 74 additions and 65 deletions

View file

@ -100,7 +100,7 @@ DEFINE_CLASS_PROPERTY(type, S, DynamicLight)
//
//==========================================================================
static FDynamicLight *GetLight()
static FDynamicLight *GetLight(FLevelLocals *Level)
{
FDynamicLight *ret;
if (FreeList.Size())
@ -109,11 +109,12 @@ static FDynamicLight *GetLight()
}
else ret = (FDynamicLight*)DynLightArena.Alloc(sizeof(FDynamicLight));
memset(ret, 0, sizeof(*ret));
ret->next = level.lights;
level.lights = ret;
ret->next = Level->lights;
Level->lights = ret;
if (ret->next) ret->next->prev = ret;
ret->visibletoplayer = true;
ret->mShadowmapIndex = 1024;
ret->Level = Level;
ret->Pos.X = -10000000; // not a valid coordinate.
return ret;
}
@ -128,7 +129,7 @@ static FDynamicLight *GetLight()
void AttachLight(AActor *self)
{
auto light = GetLight();
auto light = GetLight(self->Level);
light->pSpotInnerAngle = &self->AngleVar(NAME_SpotInnerAngle);
light->pSpotOuterAngle = &self->AngleVar(NAME_SpotOuterAngle);
@ -221,9 +222,9 @@ DEFINE_ACTION_FUNCTION_NATIVE(ADynamicLight, SetOffset, SetOffset)
void FDynamicLight::ReleaseLight()
{
assert(prev != nullptr || this == level.lights);
assert(prev != nullptr || this == Level->lights);
if (prev != nullptr) prev->next = next;
else level.lights = next;
else Level->lights = next;
if (next != nullptr) next->prev = prev;
next = prev = nullptr;
FreeList.Push(this);
@ -245,7 +246,7 @@ void FDynamicLight::Activate()
{
float pulseTime = float(specialf1 / TICRATE);
m_lastUpdate = level.maptime;
m_lastUpdate = Level->maptime;
if (!swapped) m_cycler.SetParams(float(GetSecondaryIntensity()), float(GetIntensity()), pulseTime);
else m_cycler.SetParams(float(GetIntensity()), float(GetSecondaryIntensity()), pulseTime);
m_cycler.ShouldCycle(true);
@ -294,9 +295,9 @@ void FDynamicLight::Tick()
{
case PulseLight:
{
float diff = (level.maptime - m_lastUpdate) / (float)TICRATE;
float diff = (Level->maptime - m_lastUpdate) / (float)TICRATE;
m_lastUpdate = level.maptime;
m_lastUpdate = Level->maptime;
m_cycler.Update(diff);
m_currentRadius = float(m_cycler.GetVal());
break;
@ -760,7 +761,7 @@ void AActor::AttachLight(unsigned int count, const FLightDefaults *lightdef)
}
else
{
light = GetLight();
light = GetLight(Level);
light->SetActor(this, true);
AttachedLights.Push(light);
}