Sectorlist traversal
MOM GET THE CAMERA
There's a LOT of code in the source that ended up mixing m_snext (the node for the next thing in the sector's thinglist) and m_tnext (the node for the next sector in the thing's sectorlist), so I renamed the following:
- m_snext ==> m_thinglist_next
- m_sprev ==> m_thinglist_prev
- m_tnext ==> m_sectorlist_next
- m_tprev ==> m_sectorlist_prev
Then, I changed all the instances where the code was trying to go m_thinglist_next on a mobj's touching_sectorlist (which would've just gone to the node for the next thing in the same sector, instead of the node for the next sector for the same thing). Notable samples:
- FF_SHATTER blocks now disappear the moment you go into their sector. You still can't give FF_SOLID to them because in that case they will still stop you if you never enter their sector at all (ie - clip on corners), but having them nonsolid no longer allows you to phase through entirely without busting them (which was the whole downside of making them intangible in the first place).
- You can now bump into multiple Mario blocks at a time, even if you're not exclusively in their sector.
- No more getting randomly stopped on the edges of bouncy FOFs.
- Landing on polyobjects might behave a little more consistently at the edge of their host sector.
- Teetering did a SHITTON of code that basically never got executed, and then had directly-blockmap-accessing code as a backup. The code was activatable by replacing the m_thinglist_next with m_sectorlist_next, but it behaved SUPER differently from what we're used to with teetering (if the player mobj's edge was JUST off the edge of a platform, you ended up in teetering frames - even if it looked like you could stand) so I ended up removing that section entirely.
Any objections?
Merge request reports
Activity
Got to love it when the fixes for seemingly complicated issues turn out to be hilariously simple. Nice find there.I think the problem here was that m_tprev/m_tnext and m_sprev/m_snext are really easy to mix up by name (and purpose), it's no wonder nobody noticed the slipups for over a decade it turns out lol.
can't sleep, too hype about this fix
I think what I'm gonna do once I get up is rename those fields to sector_thinglist_next/prev and thing_sectorlist_next/prev. Less ambiguous, no need for macros, makes it clear what it should belong to and what you're going to want to use it for.
I'll check out the other errors then, btw, but no auto findreplace since I figure there ARE potential legitimate uses of iterating through thing nodes instead of sector nodes...
Added 1 new commit:
- 17e0adcb - Renamed some struct variables so the problem this branch sets out to fix is more…
Added 1 new commit:
- 7af14c20 - Everywhere in the code that was doing things wrong has been changed.
2849 2849 // 2850 2850 static void P_DoTeeter(player_t *player) 2851 2851 { 2852 msecnode_t *node; 2853 2852 boolean teeter = false; 2854 2853 boolean roverfloor; // solid 3d floors? 2855 boolean checkedforteeter = false; 2856 2854 const fixed_t tiptop = FixedMul(MAXSTEPMOVE, player->mo->scale); // Distance you have to be above the ground in order to teeter. 2857 2855 2858 for (node = player->mo->touching_sectorlist; node; node = node->m_thinglist_next) mentioned in commit 8fc61bb6