This commit is contained in:
Gene 2025-04-07 04:21:35 -07:00
commit 9e32e58c8f
11 changed files with 101 additions and 75 deletions

View file

@ -159,13 +159,15 @@ void HWFlat::SetupLights(HWDrawInfo *di, FDynLightData &lightdata, int portalgro
return; // no lights on additively blended surfaces.
}
auto flatLightList = di->Level->lightlists.flat_dlist.find(section);
auto flatLightList = di->Level->lightlists.flat_dlist.CheckKey(section);
if (flatLightList != di->Level->lightlists.flat_dlist.end())
if (flatLightList)
{
for (auto nodeIterator = flatLightList->second.begin(); nodeIterator != flatLightList->second.end(); nodeIterator++)
TMap<FDynamicLight *, FLightNode *>::Iterator it(*flatLightList);
TMap<FDynamicLight *, FLightNode *>::Pair *pair;
while (it.NextPair(pair))
{
auto node = nodeIterator->second;
auto node = pair->Value;
if (!node) continue;
FDynamicLight * light = node->lightsource;

View file

@ -117,13 +117,15 @@ int HWDrawInfo::SetupLightsForOtherPlane(subsector_t * sub, FDynLightData &light
lightdata.Clear();
auto flatLightList = Level->lightlists.flat_dlist.find(sub->section);
auto flatLightList = Level->lightlists.flat_dlist.CheckKey(sub->section);
if (flatLightList != Level->lightlists.flat_dlist.end())
if (flatLightList)
{
for (auto nodeIterator = flatLightList->second.begin(); nodeIterator != flatLightList->second.end(); nodeIterator++)
TMap<FDynamicLight *, FLightNode *>::Iterator it(*flatLightList);
TMap<FDynamicLight *, FLightNode *>::Pair *pair;
while (it.NextPair(pair))
{
auto node = nodeIterator->second;
auto node = pair->Value;
if (!node) continue;
FDynamicLight * light = node->lightsource;

View file

@ -124,13 +124,15 @@ void HWDrawInfo::GetDynSpriteLight(AActor *self, float x, float y, float z, FSec
}
// Go through both light lists
auto flatLightList = Level->lightlists.flat_dlist.find(sec);
auto flatLightList = Level->lightlists.flat_dlist.CheckKey(sec);
if (flatLightList != Level->lightlists.flat_dlist.end())
if (flatLightList)
{
for (auto nodeIterator = flatLightList->second.begin(); nodeIterator != flatLightList->second.end(); nodeIterator++)
TMap<FDynamicLight *, FLightNode *>::Iterator it(*flatLightList);
TMap<FDynamicLight *, FLightNode *>::Pair *pair;
while (it.NextPair(pair))
{
auto node = nodeIterator->second;
auto node = pair->Value;
if (!node) continue;
light=node->lightsource;
@ -248,12 +250,14 @@ void hw_GetDynModelLight(AActor *self, FDynLightData &modellightdata)
{
auto section = subsector->section;
if (section->validcount == dl_validcount) return; // already done from a previous subsector.
auto flatLightList = self->Level->lightlists.flat_dlist.find(subsector->section);
if (flatLightList != self->Level->lightlists.flat_dlist.end())
auto flatLightList = self->Level->lightlists.flat_dlist.CheckKey(subsector->section);
if (flatLightList)
{
for (auto nodeIterator = flatLightList->second.begin(); nodeIterator != flatLightList->second.end(); nodeIterator++)
TMap<FDynamicLight *, FLightNode *>::Iterator it(*flatLightList);
TMap<FDynamicLight *, FLightNode *>::Pair *pair;
while (it.NextPair(pair))
{ // check all lights touching a subsector
auto node = nodeIterator->second;
auto node = pair->Value;
if (!node) continue;
FDynamicLight *light = node->lightsource;
if (light->ShouldLightActor(self))

View file

@ -427,13 +427,15 @@ void HWWall::SetupLights(HWDrawInfo*di, FDynLightData &lightdata)
if ((seg->sidedef->Flags & WALLF_POLYOBJ) && sub)
{
// Polobject segs cannot be checked per sidedef so use the subsector instead.
auto flatLightList = di->Level->lightlists.flat_dlist.find(sub->section);
auto flatLightList = di->Level->lightlists.flat_dlist.CheckKey(sub->section);
if (flatLightList != di->Level->lightlists.flat_dlist.end())
if (flatLightList)
{
for (auto nodeIterator = flatLightList->second.begin(); nodeIterator != flatLightList->second.end(); nodeIterator++)
TMap<FDynamicLight *, FLightNode *>::Iterator it(*flatLightList);
TMap<FDynamicLight *, FLightNode *>::Pair *pair;
while (it.NextPair(pair))
{
auto node = nodeIterator->second;
auto node = pair->Value;
if (!node) continue;
if (node->lightsource->IsActive() && !node->lightsource->DontLightMap())
@ -490,13 +492,15 @@ void HWWall::SetupLights(HWDrawInfo*di, FDynLightData &lightdata)
}
else
{
auto wallLightList = di->Level->lightlists.wall_dlist.find(seg->sidedef);
auto wallLightList = di->Level->lightlists.wall_dlist.CheckKey(seg->sidedef);
if (wallLightList != di->Level->lightlists.wall_dlist.end())
if (wallLightList)
{
for (auto nodeIterator = wallLightList->second.begin(); nodeIterator != wallLightList->second.end(); nodeIterator++)
TMap<FDynamicLight *, FLightNode *>::Iterator it(*wallLightList);
TMap<FDynamicLight *, FLightNode *>::Pair *pair;
while (it.NextPair(pair))
{
auto node = nodeIterator->second;
auto node = pair->Value;
if (!node) continue;
if (node->lightsource->IsActive() && !node->lightsource->DontLightMap())

View file

@ -224,12 +224,14 @@ namespace swrenderer
else if (curline && curline->sidedef)
{
auto Level = curline->Subsector->sector->Level;
auto wallLightList = Level->lightlists.wall_dlist.find(curline->sidedef);
if (wallLightList != Level->lightlists.wall_dlist.end())
auto wallLightList = Level->lightlists.wall_dlist.CheckKey(curline->sidedef);
if (wallLightList)
{
for (auto nodeIterator = wallLightList->second.begin(); nodeIterator != wallLightList->second.end(); nodeIterator++)
TMap<FDynamicLight *, FLightNode *>::Iterator it(*wallLightList);
TMap<FDynamicLight *, FLightNode *>::Pair *pair;
while (it.NextPair(pair))
{
auto node = nodeIterator->second;
auto node = pair->Value;
if (!node) continue;
if (node->lightsource->IsActive())

View file

@ -76,12 +76,14 @@ namespace swrenderer
return; // [SP] no dynlights if invul or lightamp
auto Level = sec->sector->Level;
auto flatLightList = Level->lightlists.flat_dlist.find(sec);
if (flatLightList != Level->lightlists.flat_dlist.end())
auto flatLightList = Level->lightlists.flat_dlist.CheckKey(sec);
if (flatLightList)
{
for (auto nodeIterator = flatLightList->second.begin(); nodeIterator != flatLightList->second.end(); nodeIterator++)
TMap<FDynamicLight *, FLightNode *>::Iterator it(*flatLightList);
TMap<FDynamicLight *, FLightNode *>::Pair *pair;
while (it.NextPair(pair))
{
auto node = nodeIterator->second;
auto node = pair->Value;
if (!node) continue;
if (node->lightsource->IsActive() && (height.PointOnSide(node->lightsource->Pos) > 0))

View file

@ -209,12 +209,14 @@ namespace swrenderer
float lit_green = 0;
float lit_blue = 0;
auto Level = vis->sector->Level;
auto flatLightList = Level->lightlists.flat_dlist.find(vis->section);
if (flatLightList != Level->lightlists.flat_dlist.end())
auto flatLightList = Level->lightlists.flat_dlist.CheckKey(vis->section);
if (flatLightList)
{
for (auto nodeIterator = flatLightList->second.begin(); nodeIterator != flatLightList->second.end(); nodeIterator++)
TMap<FDynamicLight *, FLightNode *>::Iterator it(*flatLightList);
TMap<FDynamicLight *, FLightNode *>::Pair *pair;
while (it.NextPair(pair))
{
auto node = nodeIterator->second;
auto node = pair->Value;
if (!node) continue;
FDynamicLight *light = node->lightsource;