Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
Sign in to follow this  
printz

Self-referencing sectors cannot be used in maps with linked portals

Recommended Posts

I've discovered that old vanilla "self-referencing sector" hacks will not work properly in maps with linked portals.

For those who don't know: self-referencing sectors are made by creating a polygon inside a larger sector, and making both sides of the polygon lines point to the inner sector. This is used to make deep water or invisible platforms in vanilla Doom. It has since been superseded by Boom's transfer-heights special (242) on both accounts.

Why they don't work with linked portals: the self-ref sectors have no linedefs with sides pointing to other sectors, i.e. they're isolated. They get excluded from grouping into layers. So it means that when you're inside them, your logical coordinates will be shifted far away, and physics will be broken.

Share this post


Link to post

That problem should be solvable, shouldn't it?

I've been thinking about this, too, for other reasons, in GZDoom. Since I use GL nodes there it was relatively simple, but if you can't rely on those my idea would have been to use P_PathTraverse to see what these self-referencing sectors actually connect to.

That would involve to actually group all areas that are not connected to portals as well, starting at any one-sided line in an ungrouped sector, until no more sectors with one-sided lines can be found. What's left must be self-referencing in some way but since everything else has been grouped, just doing a single P_PathTraverse from one of the lines of such a sector should be enough to eventually find something that has been grouped before. Such an approach would possibly catch 99% of all self referencing sector setups, if not all, provided these aren't caused by actual mapping bugs.

Share this post


Link to post

Given the existence of the Boom transfers, I think it's perfectly fine to have this limitation.

Share this post


Link to post
Graf Zahl said:

That may be, but if it can be addressed - why not?

Addressed how? By using P_PathTraverse to scan the map until encountering the first valid linedef? It sounds like a hack meant to work around another hack that's even replaceable.

The problem is that the self-referencing sector problem described here is insidious. No warning appears and you might only see the bug in some situations.

Share this post


Link to post

No actual handling of self-referencing sectors but doing this should at least print some messages about them:

			// mark everything that connects to a one-sided line
			for (int i = 0; i < numlines; i++)
			{
				if (lines[i].backsector == NULL && lines[i].frontsector->PortalGroup == 0)
				{
					CollectSectors(-1, lines[i].frontsector);
				}
			}
			// and now print a message for everything that still wasn't processed.
			for (int i = 0; i < numsectors; i++)
			{
				if (sectors[i].PortalGroup == 0)
				{
					Printf("Unable to assign sector %d to any group. Possibly self-referencing\n", i);
				}
				else if (sectors[i].PortalGroup == -1) sectors[i].PortalGroup = 0;
			}
Which, considering that they produce serious glitches, is important.

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  
×