Skip to content

Commit eb5eff0

Browse files
committed
Error fixes
* Consolidated with demo_version 406 checks * Fix broken msecnode flag update * Fix lack of link offsets * Remove trailing whitespaces * Added polyline check to rendering sprite thinglist
1 parent 741daf1 commit eb5eff0

4 files changed

Lines changed: 24 additions & 10 deletions

File tree

source/p_map.cpp

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -771,7 +771,7 @@ bool P_CheckLineBlocksThing(line_t *ld, const linkoffset_t *link, PODCollection<
771771
{
772772
clip.blockline = ld;
773773
bool result = clip.unstuck && !untouched(ld, link) &&
774-
FixedMul(clip.x - clip.thing->x, ld->dy) > FixedMul(clip.y - clip.thing->y, ld->dx);
774+
FixedMul(clip.x - clip.thing->x, ld->dy) > FixedMul(clip.y - clip.thing->y, ld->dx);
775775
if(!result && pushhit && ld->special && full_demo_version >= make_full_version(401, 0))
776776
{
777777
pushhit->add(ld);
@@ -2030,8 +2030,8 @@ bool P_TryMove(Mobj *thing, fixed_t x, fixed_t y, int dropoff)
20302030
int oldside;
20312031
if((oldside = P_PointOnLineSide(ox, oy, line)) != P_PointOnLineSide(tx, ty, line))
20322032
{
2033-
if(!P_LevelIsVanillaHexen() && line->intflags & MLI_DYNASEGLINE && line->flags & ML_TWOSIDED &&
2034-
line->backsector)
2033+
if(demo_version >= 406 && !P_LevelIsVanillaHexen() && line->intflags & MLI_DYNASEGLINE &&
2034+
line->flags & ML_TWOSIDED && line->backsector)
20352035
{
20362036
Thinker::AddMobileCrossLine(line, oldside, thing);
20372037
}
@@ -3056,17 +3056,24 @@ enum class SecnodeType
30563056
//
30573057
// killough 11/98: reformatted
30583058
//
3059-
static msecnode_t *P_AddSecnode(sector_t *s, msecnode_t *sector_t::*which_thinglist, Mobj *thing, msecnode_t *nextnode, SecnodeType type)
3059+
static msecnode_t *P_AddSecnode(sector_t *s, msecnode_t *sector_t::*which_thinglist, Mobj *thing, msecnode_t *nextnode,
3060+
SecnodeType type)
30603061
{
30613062
msecnode_t *node;
30623063

3064+
bool foundNormalNode = false;
30633065
for(node = nextnode; node; node = node->m_tnext)
30643066
{
30653067
if(node->m_sector == s) // Already have a node for this sector?
30663068
{
3069+
if(node->m_thing == thing && !(node->flags & MSN_POLYLINE))
3070+
foundNormalNode = true;
30673071
node->m_thing = thing; // Yes. Setting m_thing says 'keep it'.
3072+
30683073
if(type == SecnodeType::normal)
30693074
node->flags &= ~MSN_POLYLINE;
3075+
else if(type == SecnodeType::polyline && !foundNormalNode)
3076+
node->flags |= MSN_POLYLINE;
30703077
return nextnode;
30713078
}
30723079
}
@@ -3196,7 +3203,7 @@ static bool PIT_GetSectors(line_t *ld, polyobj_t *po, void *vcontext)
31963203
bbox[BOXTOP] = pClip->bbox[BOXTOP] + link->y;
31973204
bbox[BOXBOTTOM] = pClip->bbox[BOXBOTTOM] + link->y;
31983205

3199-
const bool polyline = Polyobj_IsLine(*ld);
3206+
const bool polyline = Polyobj_IsLine(*ld);
32003207
const SecnodeType type =
32013208
polyline && !(ld->intflags & MLI_1SPORTALLINE) ? SecnodeType::polyline : SecnodeType::normal;
32023209

@@ -3263,7 +3270,8 @@ static bool PIT_GetSectors(line_t *ld, polyobj_t *po, void *vcontext)
32633270
}
32643271
else
32653272
frontsector = ld->frontsector;
3266-
pClip->sector_list = P_AddSecnode(frontsector, context->which_thinglist, pClip->thing, pClip->sector_list, type);
3273+
pClip->sector_list =
3274+
P_AddSecnode(frontsector, context->which_thinglist, pClip->thing, pClip->sector_list, type);
32673275

32683276
if(ld->pflags & PS_PASSABLE && context->master)
32693277
{

source/polyobj.cpp

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1351,8 +1351,9 @@ static bool PolyobjIT_collectControlThings(int x, int y, int groupid, void *data
13511351
}
13521352
if(line->special && !(mo->flags & MF_TELEPORT))
13531353
{
1354-
context->linesToCross.add(
1355-
LineRelation{ .line = *line, .mobj{ mo }, .side = P_PointOnLineSidePrecise(mo->x, mo->y, line) });
1354+
const linkoffset_t *link = P_GetLinkOffset(mo->groupid, line->frontsector->groupid);
1355+
context->linesToCross.add(LineRelation{
1356+
.line = *line, .mobj{ mo }, .side = P_PointOnLineSide(mo->x + link->x, mo->y + link->y, line) });
13561357
}
13571358
}
13581359
}
@@ -1403,8 +1404,11 @@ static void Polyobj_makeThingsCrossLinesAfterMovement(const ControlThings &contr
14031404

14041405
for(const LineRelation &relation : controlThings.linesToCross)
14051406
{
1406-
if(relation.side != P_PointOnLineSidePrecise(relation.mobj->x, relation.mobj->y, &relation.line))
1407+
const linkoffset_t *link = P_GetLinkOffset(relation.mobj->groupid, relation.line.frontsector->groupid);
1408+
if(relation.side != P_PointOnLineSide(relation.mobj->x + link->x, relation.mobj->y + link->y, &relation.line))
1409+
{
14071410
Thinker::AddMobileCrossLine(&relation.line, relation.side, relation.mobj.get());
1411+
}
14081412
}
14091413
}
14101414

source/r_defs.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -579,7 +579,7 @@ struct msecnode_t
579579
msecnode_t *m_tnext; // next msecnode_t for this thing
580580
msecnode_t *m_sprev; // prev msecnode_t for this sector
581581
msecnode_t *m_snext; // next msecnode_t for this sector
582-
unsigned flags;
582+
unsigned flags;
583583
};
584584

585585
//

source/r_things.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1596,6 +1596,8 @@ void R_AddSprites(cmapcontext_t &cmapcontext, spritecontext_t &spritecontext, Zo
15961596
for(const msecnode_t *sectorNode = sec->touching_thinglist_by_sprites; sectorNode;
15971597
sectorNode = sectorNode->m_snext)
15981598
{
1599+
if(sectorNode->flags & MSN_POLYLINE)
1600+
continue;
15991601
const Mobj *const thing = sectorNode->m_thing;
16001602

16011603
if(R_checkAndMarkSprite(spritecontext, heap, thing))

0 commit comments

Comments
 (0)