diff --git a/src/g_shared/a_dynlight.cpp b/src/g_shared/a_dynlight.cpp index 98d57c4ab..b6e83abdc 100644 --- a/src/g_shared/a_dynlight.cpp +++ b/src/g_shared/a_dynlight.cpp @@ -574,7 +574,7 @@ void ADynamicLight::CollectWithinRadius(const DVector3 &opos, subsector_t *subSe { subSec = collected_ss[i].sub; - touching_subsectors = AddLightNode(&subSec->lighthead, subSec, this, touching_subsectors); + //touching_subsectors = AddLightNode(&subSec->lighthead, subSec, this, touching_subsectors); if (subSec->sector->validcount != ::validcount) { touching_sector = AddLightNode(&subSec->render_sector->lighthead, subSec->sector, this, touching_sector); @@ -682,12 +682,6 @@ void ADynamicLight::LinkLight() { node->lightsource = NULL; node = node->nextTarget; - } - node = touching_subsectors; - while (node) - { - node->lightsource = NULL; - node = node->nextTarget; } node = touching_sector; while (node) @@ -719,17 +713,6 @@ void ADynamicLight::LinkLight() node = node->nextTarget; } - node = touching_subsectors; - while (node) - { - if (node->lightsource == NULL) - { - node = DeleteLightNode(node); - } - else - node = node->nextTarget; - } - node = touching_sector; while (node) { @@ -763,7 +746,6 @@ void ADynamicLight::UnlinkLight () } } while (touching_sides) touching_sides = DeleteLightNode(touching_sides); - while (touching_subsectors) touching_subsectors = DeleteLightNode(touching_subsectors); while (touching_sector) touching_sector = DeleteLightNode(touching_sector); shadowmapped = false; } @@ -918,7 +900,7 @@ void AActor::RecreateAllAttachedLights() CCMD(listlights) { - int walls, sectors, subsecs; + int walls, sectors; int allwalls=0, allsectors=0, allsubsecs = 0; int i=0, shadowcount = 0; ADynamicLight * dl; @@ -928,7 +910,6 @@ CCMD(listlights) { walls=0; sectors=0; - subsecs = 0; Printf("%s at (%f, %f, %f), color = 0x%02x%02x%02x, radius = %f %s %s", dl->target? dl->target->GetClass()->TypeName.GetChars() : dl->GetClass()->TypeName.GetChars(), dl->X(), dl->Y(), dl->Z(), dl->args[LIGHT_RED], @@ -954,14 +935,6 @@ CCMD(listlights) node = node->nextTarget; } - node=dl->touching_subsectors; - - while (node) - { - allsubsecs++; - subsecs++; - node = node->nextTarget; - } node = dl->touching_sector; @@ -971,27 +944,10 @@ CCMD(listlights) sectors++; node = node->nextTarget; } - Printf("- %d walls, %d subsectors, %d sectors\n", walls, subsecs, sectors); + Printf("- %d walls, %d sectors\n", walls, sectors); } - Printf("%i dynamic lights, %d shadowmapped, %d walls, %d subsectors, %d sectors\n\n\n", i, shadowcount, allwalls, allsubsecs, allsectors); -} - -CCMD(listsublights) -{ - for(auto &sub : level.subsectors) - { - int lights = 0; - - FLightNode * node = sub.lighthead; - while (node != NULL) - { - lights++; - node = node->nextLight; - } - - Printf(PRINT_LOG, "Subsector %d - %d lights\n", sub.Index(), lights); - } + Printf("%i dynamic lights, %d shadowmapped, %d walls, %d sectors\n\n\n", i, shadowcount, allwalls, allsectors); } diff --git a/src/g_shared/a_dynlight.h b/src/g_shared/a_dynlight.h index fa9d5840e..671c7812f 100644 --- a/src/g_shared/a_dynlight.h +++ b/src/g_shared/a_dynlight.h @@ -206,7 +206,6 @@ public: bool IsSpot() { return !!(lightflags & LF_SPOT); } FState *targetState; FLightNode * touching_sides; - FLightNode * touching_subsectors; FLightNode * touching_sector; private: diff --git a/src/hwrenderer/scene/hw_renderhacks.cpp b/src/hwrenderer/scene/hw_renderhacks.cpp index 5fbc96aea..05770125d 100644 --- a/src/hwrenderer/scene/hw_renderhacks.cpp +++ b/src/hwrenderer/scene/hw_renderhacks.cpp @@ -54,7 +54,7 @@ int HWDrawInfo::SetupLightsForOtherPlane(subsector_t * sub, FDynLightData &light if (level.HasDynamicLights && !isFullbrightScene()) { Plane p; - FLightNode * node = sub->lighthead; + FLightNode * node = sub->sector->lighthead; lightdata.Clear(); while (node) diff --git a/src/hwrenderer/scene/hw_spritelight.cpp b/src/hwrenderer/scene/hw_spritelight.cpp index 9ce11f859..3b5a0c1d8 100644 --- a/src/hwrenderer/scene/hw_spritelight.cpp +++ b/src/hwrenderer/scene/hw_spritelight.cpp @@ -131,11 +131,11 @@ void HWDrawInfo::GetDynSpriteLight(AActor *thing, particle_t *particle, float *o { if (thing != NULL) { - GetDynSpriteLight(thing, (float)thing->X(), (float)thing->Y(), (float)thing->Center(), thing->subsector->lighthead, thing->Sector->PortalGroup, out); + GetDynSpriteLight(thing, (float)thing->X(), (float)thing->Y(), (float)thing->Center(), thing->Sector->lighthead, thing->Sector->PortalGroup, out); } else if (particle != NULL) { - GetDynSpriteLight(NULL, (float)particle->Pos.X, (float)particle->Pos.Y, (float)particle->Pos.Z, particle->subsector->lighthead, particle->subsector->sector->PortalGroup, out); + GetDynSpriteLight(NULL, (float)particle->Pos.X, (float)particle->Pos.Y, (float)particle->Pos.Z, particle->subsector->sector->lighthead, particle->subsector->sector->PortalGroup, out); } } @@ -160,7 +160,7 @@ void hw_GetDynModelLight(AActor *self, FDynLightData &modellightdata) BSPWalkCircle(x, y, radiusSquared, [&](subsector_t *subsector) // Iterate through all subsectors potentially touched by actor { - FLightNode * node = subsector->lighthead; + FLightNode * node = subsector->sector->lighthead; while (node) // check all lights touching a subsector { ADynamicLight *light = node->lightsource; diff --git a/src/hwrenderer/scene/hw_walls.cpp b/src/hwrenderer/scene/hw_walls.cpp index 8c5e90d87..b782c54e9 100644 --- a/src/hwrenderer/scene/hw_walls.cpp +++ b/src/hwrenderer/scene/hw_walls.cpp @@ -302,7 +302,7 @@ void GLWall::SetupLights(HWDrawInfo *di, FDynLightData &lightdata) else if (sub) { // Polobject segs cannot be checked per sidedef so use the subsector instead. - node = sub->lighthead; + node = sub->sector->lighthead; } else node = NULL; diff --git a/src/polyrenderer/scene/poly_model.cpp b/src/polyrenderer/scene/poly_model.cpp index 39695c016..78520826f 100644 --- a/src/polyrenderer/scene/poly_model.cpp +++ b/src/polyrenderer/scene/poly_model.cpp @@ -70,7 +70,7 @@ void PolyModelRenderer::AddLights(AActor *actor) BSPWalkCircle(x, y, radiusSquared, [&](subsector_t *subsector) // Iterate through all subsectors potentially touched by actor { - FLightNode * node = subsector->lighthead; + FLightNode * node = subsector->sector->lighthead; while (node) // check all lights touching a subsector { ADynamicLight *light = node->lightsource; diff --git a/src/polyrenderer/scene/poly_plane.cpp b/src/polyrenderer/scene/poly_plane.cpp index 08a8897e7..076a334f9 100644 --- a/src/polyrenderer/scene/poly_plane.cpp +++ b/src/polyrenderer/scene/poly_plane.cpp @@ -275,7 +275,7 @@ void RenderPolyPlane::SetDynLights(PolyRenderThread *thread, PolyDrawArgs &args, return; } - FLightNode *light_list = sub->lighthead; + FLightNode *light_list = sub->sector->lighthead; auto cameraLight = PolyCameraLight::Instance(); if ((cameraLight->FixedLightLevel() >= 0) || (cameraLight->FixedColormap() != nullptr)) diff --git a/src/r_defs.h b/src/r_defs.h index 4bccef526..9f1e7c265 100644 --- a/src/r_defs.h +++ b/src/r_defs.h @@ -1460,7 +1460,6 @@ struct subsector_t uint16_t sectorindex; // subsector related GL data - FLightNode * lighthead; // Light nodes (blended and additive) int validcount; short mapsection; char hacked; // 1: is part of a render hack diff --git a/src/swrenderer/things/r_model.cpp b/src/swrenderer/things/r_model.cpp index 1f02e0b6c..a3ce1a5bb 100644 --- a/src/swrenderer/things/r_model.cpp +++ b/src/swrenderer/things/r_model.cpp @@ -111,7 +111,7 @@ namespace swrenderer BSPWalkCircle(x, y, radiusSquared, [&](subsector_t *subsector) // Iterate through all subsectors potentially touched by actor { - FLightNode * node = subsector->lighthead; + FLightNode * node = subsector->sector->lighthead; while (node) // check all lights touching a subsector { ADynamicLight *light = node->lightsource;