@@ -269,7 +269,7 @@ int P_GetFriction(const Mobj *mo, int *frictionfactor)
269269 {
270270 for (m = mo->touching_sectorlist ; m; m = m->m_tnext )
271271 {
272- if (!P_SectorTouchesThingVertically (m->m_sector , mo))
272+ if (m-> flags & MSN_POLYLINE || !P_SectorTouchesThingVertically (m->m_sector , mo))
273273 continue ;
274274 if ((sec = m->m_sector )->flags & SECF_FRICTION && (sec->friction < friction || friction == ORIG_FRICTION ))
275275 {
@@ -2954,7 +2954,7 @@ bool P_CheckSector(sector_t *sector, int crunch, int amt, CheckSectorPlane plane
29542954
29552955 // Mark all things invalid
29562956 for (n = sector->touching_thinglist ; n; n = n->m_snext )
2957- n->visited = false ;
2957+ n->flags &= ~ MSN_VISITED ;
29582958
29592959 do
29602960 {
@@ -2963,9 +2963,9 @@ bool P_CheckSector(sector_t *sector, int crunch, int amt, CheckSectorPlane plane
29632963 // ioanch 20160115: portal aware
29642964 if (!P_SectorTouchesThingVertically (sector, n->m_thing ))
29652965 continue ;
2966- if (!n->visited ) // unprocessed thing found
2966+ if (!( n->flags & MSN_VISITED ) ) // unprocessed thing found
29672967 {
2968- n->visited = true ; // mark thing as processed
2968+ n->flags |= MSN_VISITED ; // mark thing as processed
29692969 if (!(n->m_thing ->flags & MF_NOBLOCKMAP )) // jff 4/7/98 don't do these
29702970 PIT_ChangeSector (n->m_thing , nullptr ); // process it
29712971 break ; // exit and start over
@@ -3039,6 +3039,12 @@ static void P_PutSecnode(msecnode_t *node)
30393039 headsecnode = node;
30403040}
30413041
3042+ enum class SecnodeType
3043+ {
3044+ normal,
3045+ polyline
3046+ };
3047+
30423048//
30433049// P_AddSecnode
30443050//
@@ -3050,7 +3056,7 @@ static void P_PutSecnode(msecnode_t *node)
30503056//
30513057// killough 11/98: reformatted
30523058//
3053- static msecnode_t *P_AddSecnode (sector_t *s, msecnode_t *sector_t ::*which_thinglist, Mobj *thing, msecnode_t *nextnode)
3059+ static msecnode_t *P_AddSecnode (sector_t *s, msecnode_t *sector_t ::*which_thinglist, Mobj *thing, msecnode_t *nextnode, SecnodeType type )
30543060{
30553061 msecnode_t *node;
30563062
@@ -3059,6 +3065,8 @@ static msecnode_t *P_AddSecnode(sector_t *s, msecnode_t *sector_t::*which_thingl
30593065 if (node->m_sector == s) // Already have a node for this sector?
30603066 {
30613067 node->m_thing = thing; // Yes. Setting m_thing says 'keep it'.
3068+ if (type == SecnodeType::normal)
3069+ node->flags &= ~MSN_POLYLINE ;
30623070 return nextnode;
30633071 }
30643072 }
@@ -3068,7 +3076,8 @@ static msecnode_t *P_AddSecnode(sector_t *s, msecnode_t *sector_t::*which_thingl
30683076
30693077 node = P_GetSecnode ();
30703078
3071- node->visited = 0 ; // killough 4/4/98, 4/7/98: mark new nodes unvisited.
3079+ // killough 4/4/98, 4/7/98: mark new nodes unvisited.
3080+ node->flags = type == SecnodeType::polyline ? MSN_POLYLINE : 0 ;
30723081
30733082 node->m_sector = s; // sector
30743083 node->m_thing = thing; // mobj
@@ -3187,10 +3196,9 @@ static bool PIT_GetSectors(line_t *ld, polyobj_t *po, void *vcontext)
31873196 bbox[BOXTOP ] = pClip->bbox [BOXTOP ] + link->y ;
31883197 bbox[BOXBOTTOM ] = pClip->bbox [BOXBOTTOM ] + link->y ;
31893198
3190- // Polyobject lines don't contribute with sector information (even with portals)
3191- bool polyline = demo_version >= 406 && Polyobj_IsLine (*ld);
3192- if (polyline && !(ld->intflags & MLI_1SPORTALLINE ))
3193- return true ;
3199+ const bool polyline = Polyobj_IsLine (*ld);
3200+ const SecnodeType type =
3201+ polyline && !(ld->intflags & MLI_1SPORTALLINE ) ? SecnodeType::polyline : SecnodeType::normal;
31943202
31953203 if (bbox[BOXRIGHT ] <= ld->bbox [BOXLEFT ] || bbox[BOXLEFT ] >= ld->bbox [BOXRIGHT ] ||
31963204 bbox[BOXTOP ] <= ld->bbox [BOXBOTTOM ] || bbox[BOXBOTTOM ] >= ld->bbox [BOXTOP ])
@@ -3227,7 +3235,8 @@ static bool PIT_GetSectors(line_t *ld, polyobj_t *po, void *vcontext)
32273235 pClip->thing ->groupid , frontsector, pClip->thing ->z ) ||
32283236 (context->master ->linegroups && context->master ->linegroups [ld->frontsector ->groupid ]))
32293237 {
3230- pClip->sector_list = P_AddSecnode (frontsector, context->which_thinglist , pClip->thing , pClip->sector_list );
3238+ pClip->sector_list =
3239+ P_AddSecnode (frontsector, context->which_thinglist , pClip->thing , pClip->sector_list , type);
32313240 }
32323241
32333242 if (!(ld->pflags & PS_PASSABLE ) && ld->backsector && ld->backsector != frontsector)
@@ -3240,7 +3249,7 @@ static bool PIT_GetSectors(line_t *ld, polyobj_t *po, void *vcontext)
32403249 pClip->thing ->groupid , ld->backsector , pClip->thing ->z ))
32413250 {
32423251 pClip->sector_list =
3243- P_AddSecnode (ld->backsector , context->which_thinglist , pClip->thing , pClip->sector_list );
3252+ P_AddSecnode (ld->backsector , context->which_thinglist , pClip->thing , pClip->sector_list , type );
32443253 }
32453254 }
32463255 }
@@ -3254,7 +3263,7 @@ static bool PIT_GetSectors(line_t *ld, polyobj_t *po, void *vcontext)
32543263 }
32553264 else
32563265 frontsector = ld->frontsector ;
3257- pClip->sector_list = P_AddSecnode (frontsector, context->which_thinglist , pClip->thing , pClip->sector_list );
3266+ pClip->sector_list = P_AddSecnode (frontsector, context->which_thinglist , pClip->thing , pClip->sector_list , type );
32583267
32593268 if (ld->pflags & PS_PASSABLE && context->master )
32603269 {
@@ -3273,7 +3282,7 @@ static bool PIT_GetSectors(line_t *ld, polyobj_t *po, void *vcontext)
32733282
32743283 if (!(ld->pflags & PS_PASSABLE ) && ld->backsector && ld->backsector != frontsector)
32753284 pClip->sector_list =
3276- P_AddSecnode (ld->backsector , context->which_thinglist , pClip->thing , pClip->sector_list );
3285+ P_AddSecnode (ld->backsector , context->which_thinglist , pClip->thing , pClip->sector_list , type );
32773286 }
32783287
32793288 return true ;
@@ -3295,8 +3304,8 @@ static bool PIT_transPortalGetSectors(int x, int y, int groupid, void *data)
32953304 // Get the offset from thing's position to the PREVIOUS groupid
32963305 if (groupid == inter.thing ->groupid )
32973306 {
3298- inter.sector_list =
3299- P_AddSecnode (inter. thing -> subsector -> sector , context-> which_thinglist , inter. thing , inter.sector_list );
3307+ inter.sector_list = P_AddSecnode (inter. thing -> subsector -> sector , context-> which_thinglist , inter. thing ,
3308+ inter.sector_list , SecnodeType::normal );
33003309 }
33013310 else
33023311 {
@@ -3305,7 +3314,8 @@ static bool PIT_transPortalGetSectors(int x, int y, int groupid, void *data)
33053314 if (sector)
33063315 {
33073316 // Add it
3308- inter.sector_list = P_AddSecnode (sector, context->which_thinglist , inter.thing , inter.sector_list );
3317+ inter.sector_list =
3318+ P_AddSecnode (sector, context->which_thinglist , inter.thing , inter.sector_list , SecnodeType::normal);
33093319 }
33103320 }
33113321 }
@@ -3403,7 +3413,7 @@ msecnode_t *P_CreateSecNodeList(Mobj *thing, fixed_t x, fixed_t y, fixed_t radiu
34033413 }
34043414
34053415 // Add the sector of the (x,y) point to sector_list.
3406- list = P_AddSecnode (thing->subsector ->sector , which_thinglist, thing, pClip->sector_list );
3416+ list = P_AddSecnode (thing->subsector ->sector , which_thinglist, thing, pClip->sector_list , SecnodeType::normal );
34073417 }
34083418
34093419 // Now delete any nodes that won't be used. These are the ones where
0 commit comments