mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2025-04-20 17:21:22 +00:00
Fall back to old R_PointInSubsector for slopes
This commit is contained in:
parent
1ef47ea178
commit
a33cf4225c
3 changed files with 14 additions and 7 deletions
|
@ -588,7 +588,7 @@ static pslope_t *MakeViaMapthings(INT16 tag1, INT16 tag2, INT16 tag3, UINT8 flag
|
|||
vx[i].y = mt->y << FRACBITS;
|
||||
vx[i].z = mt->z << FRACBITS;
|
||||
if (!mt->args[0])
|
||||
vx[i].z += R_PointInSubsector(vx[i].x, vx[i].y)->sector->floorheight;
|
||||
vx[i].z += R_OldPointInSubsector(vx[i].x, vx[i].y)->sector->floorheight;
|
||||
}
|
||||
|
||||
ReconfigureViaVertexes(ret, vx[0], vx[1], vx[2]);
|
||||
|
|
10
src/r_main.c
10
src/r_main.c
|
@ -1036,6 +1036,16 @@ boolean R_IsPointInSector(sector_t *sector, fixed_t x, fixed_t y)
|
|||
return passes % 2;
|
||||
}
|
||||
|
||||
subsector_t *R_OldPointInSubsector(fixed_t x, fixed_t y)
|
||||
{
|
||||
size_t nodenum = numnodes-1;
|
||||
|
||||
while (!(nodenum & NF_SUBSECTOR))
|
||||
nodenum = nodes[nodenum].children[R_OldPointOnSide(x, y, nodes+nodenum)];
|
||||
|
||||
return &subsectors[nodenum & ~NF_SUBSECTOR];
|
||||
}
|
||||
|
||||
//
|
||||
// R_PointInSubsector
|
||||
//
|
||||
|
|
|
@ -79,9 +79,7 @@ static inline INT32 R_PointOnSide(fixed_t x, fixed_t y, node_t *node)
|
|||
{
|
||||
// use cross product to determine side quickly
|
||||
INT64 v = ((INT64)y - node->y) * node->dx - ((INT64)x - node->x) * node->dy;
|
||||
if (v == 0) // if we're on the line, use the old algorithm
|
||||
return R_OldPointOnSide(x, y, node);
|
||||
return v > 0;
|
||||
return v >= 0;
|
||||
}
|
||||
|
||||
static inline INT32 R_PointOnSegSide(fixed_t x, fixed_t y, seg_t *line)
|
||||
|
@ -93,9 +91,7 @@ static inline INT32 R_PointOnSegSide(fixed_t x, fixed_t y, seg_t *line)
|
|||
|
||||
// use cross product to determine side quickly
|
||||
INT64 v = ((INT64)y - ly) * ldx - ((INT64)x - lx) * ldy;
|
||||
if (v == 0) // if we're on the line, use the old algorithm
|
||||
return R_OldPointOnSegSide(x, y, line);
|
||||
return v > 0;
|
||||
return v >= 0;
|
||||
}
|
||||
|
||||
angle_t R_PointToAngle(fixed_t x, fixed_t y);
|
||||
|
@ -105,6 +101,7 @@ fixed_t R_PointToDist(fixed_t x, fixed_t y);
|
|||
fixed_t R_PointToDist2(fixed_t px2, fixed_t py2, fixed_t px1, fixed_t py1);
|
||||
|
||||
boolean R_IsPointInSector(sector_t *sector, fixed_t x, fixed_t y);
|
||||
subsector_t *R_OldPointInSubsector(fixed_t x, fixed_t y);
|
||||
subsector_t *R_PointInSubsector(fixed_t x, fixed_t y);
|
||||
subsector_t *R_PointInSubsectorOrNull(fixed_t x, fixed_t y);
|
||||
|
||||
|
|
Loading…
Reference in a new issue