by drfrag » Thu Nov 11, 2021 11:42 am
I think the old version it's fixed (zero case). If you think it's correct and there's interest i could make a PR, after all it's not a big deal.
Code: Select all
diff --git a/src/p_local.h b/src/p_local.h
index 098c9c4ff3..2f0a311148 100644
--- a/src/p_local.h
+++ b/src/p_local.h
@@ -397,7 +397,7 @@ nodetype *P_AddSecnode(linktype *s, AActor *thing, nodetype *nextnode, nodetype
template<class nodetype, class linktype>
nodetype* P_DelSecnode(nodetype *, nodetype *linktype::*head);
-msecnode_t *P_CreateSecNodeList(AActor *thing, double radius, msecnode_t *sector_list, msecnode_t *sector_t::*seclisthead);
+msecnode_t *P_CreateSecNodeList(AActor *thing, double radius, msecnode_t *sector_list, msecnode_t *sector_t::*seclisthead, bool restricted = false);
double P_GetMoveFactor(const AActor *mo, double *frictionp); // phares 3/6/98
double P_GetFriction(const AActor *mo, double *frictionfactor);
diff --git a/src/p_maputl.cpp b/src/p_maputl.cpp
index 053f44c13a..b191902060 100644
--- a/src/p_maputl.cpp
+++ b/src/p_maputl.cpp
@@ -463,7 +463,10 @@ void AActor::LinkToWorld(FLinkContext *ctx, bool spawningmapthing, sector_t *sec
// at sector_t->touching_thinglist) are broken. When a node is
// added, new sector links are created.
touching_sectorlist = P_CreateSecNodeList(this, radius, ctx != nullptr? ctx->sector_list : nullptr, §or_t::touching_thinglist); // Attach to thing
- if (renderradius >= 0) touching_rendersectors = P_CreateSecNodeList(this, MAX(radius, renderradius), ctx != nullptr ? ctx->render_list : nullptr, §or_t::touching_renderthings);
+ if (renderradius == 0)
+ touching_rendersectors = P_CreateSecNodeList(this, radius, ctx != nullptr ? ctx->render_list : nullptr, §or_t::touching_renderthings, true);
+ else if (renderradius > 0)
+ touching_rendersectors = P_CreateSecNodeList(this, MAX(radius, renderradius), ctx != nullptr ? ctx->render_list : nullptr, §or_t::touching_renderthings);
else
{
touching_rendersectors = nullptr;
diff --git a/src/p_secnodes.cpp b/src/p_secnodes.cpp
index b351f0e580..58b1820fc5 100644
--- a/src/p_secnodes.cpp
+++ b/src/p_secnodes.cpp
@@ -219,7 +219,7 @@ void P_DelSeclist(portnode_t *node, portnode_t *FLinePortal::*sechead)
//
//=============================================================================
-msecnode_t *P_CreateSecNodeList(AActor *thing, double radius, msecnode_t *sector_list, msecnode_t *sector_t::*seclisthead)
+msecnode_t *P_CreateSecNodeList(AActor *thing, double radius, msecnode_t *sector_list, msecnode_t *sector_t::*seclisthead, bool restricted)
{
msecnode_t *node;
@@ -239,7 +239,7 @@ msecnode_t *P_CreateSecNodeList(AActor *thing, double radius, msecnode_t *sector
FBlockLinesIterator it(box);
line_t *ld;
- while ((ld = it.Next()))
+ while (!restricted && (ld = it.Next()))
{
if (!box.inRange(ld) || box.BoxOnLineSide(ld) != -1)
continue;
I think the old version it's fixed (zero case). If you think it's correct and there's interest i could make a PR, after all it's not a big deal.
[code]diff --git a/src/p_local.h b/src/p_local.h
index 098c9c4ff3..2f0a311148 100644
--- a/src/p_local.h
+++ b/src/p_local.h
@@ -397,7 +397,7 @@ nodetype *P_AddSecnode(linktype *s, AActor *thing, nodetype *nextnode, nodetype
template<class nodetype, class linktype>
nodetype* P_DelSecnode(nodetype *, nodetype *linktype::*head);
-msecnode_t *P_CreateSecNodeList(AActor *thing, double radius, msecnode_t *sector_list, msecnode_t *sector_t::*seclisthead);
+msecnode_t *P_CreateSecNodeList(AActor *thing, double radius, msecnode_t *sector_list, msecnode_t *sector_t::*seclisthead, bool restricted = false);
double P_GetMoveFactor(const AActor *mo, double *frictionp); // phares 3/6/98
double P_GetFriction(const AActor *mo, double *frictionfactor);
diff --git a/src/p_maputl.cpp b/src/p_maputl.cpp
index 053f44c13a..b191902060 100644
--- a/src/p_maputl.cpp
+++ b/src/p_maputl.cpp
@@ -463,7 +463,10 @@ void AActor::LinkToWorld(FLinkContext *ctx, bool spawningmapthing, sector_t *sec
// at sector_t->touching_thinglist) are broken. When a node is
// added, new sector links are created.
touching_sectorlist = P_CreateSecNodeList(this, radius, ctx != nullptr? ctx->sector_list : nullptr, §or_t::touching_thinglist); // Attach to thing
- if (renderradius >= 0) touching_rendersectors = P_CreateSecNodeList(this, MAX(radius, renderradius), ctx != nullptr ? ctx->render_list : nullptr, §or_t::touching_renderthings);
+ if (renderradius == 0)
+ touching_rendersectors = P_CreateSecNodeList(this, radius, ctx != nullptr ? ctx->render_list : nullptr, §or_t::touching_renderthings, true);
+ else if (renderradius > 0)
+ touching_rendersectors = P_CreateSecNodeList(this, MAX(radius, renderradius), ctx != nullptr ? ctx->render_list : nullptr, §or_t::touching_renderthings);
else
{
touching_rendersectors = nullptr;
diff --git a/src/p_secnodes.cpp b/src/p_secnodes.cpp
index b351f0e580..58b1820fc5 100644
--- a/src/p_secnodes.cpp
+++ b/src/p_secnodes.cpp
@@ -219,7 +219,7 @@ void P_DelSeclist(portnode_t *node, portnode_t *FLinePortal::*sechead)
//
//=============================================================================
-msecnode_t *P_CreateSecNodeList(AActor *thing, double radius, msecnode_t *sector_list, msecnode_t *sector_t::*seclisthead)
+msecnode_t *P_CreateSecNodeList(AActor *thing, double radius, msecnode_t *sector_list, msecnode_t *sector_t::*seclisthead, bool restricted)
{
msecnode_t *node;
@@ -239,7 +239,7 @@ msecnode_t *P_CreateSecNodeList(AActor *thing, double radius, msecnode_t *sector
FBlockLinesIterator it(box);
line_t *ld;
- while ((ld = it.Next()))
+ while (!restricted && (ld = it.Next()))
{
if (!box.inRange(ld) || box.BoxOnLineSide(ld) != -1)
continue;
[/code]