From d5e29a1c9024ddfdf7c88ea764dc2494ece56f81 Mon Sep 17 00:00:00 2001 From: Jonathan Date: Thu, 15 Dec 2022 04:30:22 -0500 Subject: [PATCH] add _nofill key, which causes an entity to not count as an entity for the purposes of occupancy (for lights in walls, etc) add _nonudge key, to disabling nudging of lights "stuck" inside walls --- include/light/entities.hh | 1 + light/entities.cc | 5 +++-- qbsp/outside.cc | 7 +++---- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/include/light/entities.hh b/include/light/entities.hh index 12cc677a..65d022d0 100644 --- a/include/light/entities.hh +++ b/include/light/entities.hh @@ -101,6 +101,7 @@ public: settings::setting_int32 surflight_group; settings::setting_int32 light_channel_mask; settings::setting_int32 shadow_channel_mask; + settings::setting_bool nonudge; light_t(); diff --git a/light/entities.cc b/light/entities.cc index 23355923..d00ce06b 100644 --- a/light/entities.cc +++ b/light/entities.cc @@ -107,7 +107,8 @@ light_t::light_t() : nostaticlight{this, "nostaticlight", false}, surflight_group{this, "surflight_group", 0}, light_channel_mask{this, "light_channel_mask", CHANNEL_MASK_DEFAULT}, - shadow_channel_mask{this, "shadow_channel_mask", CHANNEL_MASK_DEFAULT} + shadow_channel_mask{this, "shadow_channel_mask", CHANNEL_MASK_DEFAULT}, + nonudge{this, "nonudge", false} {} std::string light_t::classname() const @@ -1021,7 +1022,7 @@ static qvec3d FixLightOnFace(const mbsp_t *bsp, const qvec3d &point) void FixLightsOnFaces(const mbsp_t *bsp) { for (auto &entity : all_lights) { - if (entity->light.value() != 0) { + if (entity->light.value() != 0 && !entity->nonudge.value()) { entity->origin.setValue(FixLightOnFace(bsp, entity->origin.value()), settings::source::MAP); } } diff --git a/qbsp/outside.cc b/qbsp/outside.cc index f8507f93..3f469ddc 100644 --- a/qbsp/outside.cc +++ b/qbsp/outside.cc @@ -322,11 +322,10 @@ static void MarkOccupiedClusters(node_t *headnode) if (qv::epsilonEmpty(entity.origin, QBSP_EQUAL_EPSILON)) continue; -#if 0 - /* skip lights */ - if (strcmp(ValueForKey(entity, "classname"), "light") == 0) + // skip nofill entities + if (entity.epairs.has("_nofill") && entity.epairs.get_int("_nofill")) { continue; -#endif + } /* find the leaf it's in. Skip opqaue leafs */ node_t *cluster = PointInLeaf(headnode, entity.origin);