mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2025-02-08 17:22:18 +00:00
Fix physics quirkiness on slopes with convex sectors
This commit is contained in:
parent
8c1cd73859
commit
d6c53b0438
1 changed files with 10 additions and 2 deletions
12
src/r_main.c
12
src/r_main.c
|
@ -1025,12 +1025,20 @@ boolean R_IsPointInSector(sector_t *sector, fixed_t x, fixed_t y)
|
||||||
|
|
||||||
for (i = 0; i < sector->linecount; i++)
|
for (i = 0; i < sector->linecount; i++)
|
||||||
{
|
{
|
||||||
vertex_t v;
|
vertex_t v, *v1, *v2;
|
||||||
fixed_t dist;
|
fixed_t dist;
|
||||||
|
|
||||||
// find the line closest to the point we're looking for.
|
// find the line closest to the point we're looking for.
|
||||||
P_ClosestPointOnLine(x, y, sector->lines[i], &v);
|
P_ClosestPointOnLine(x, y, sector->lines[i], &v);
|
||||||
dist = R_PointToDist2(0, 0, v.x - x, v.y - y);
|
|
||||||
|
v1 = sector->lines[i]->v1;
|
||||||
|
v2 = sector->lines[i]->v2;
|
||||||
|
// do some correction in order to prevent points outside the line from being measured.
|
||||||
|
if (R_PointToDist2(v.x, v.y, v1->x, v1->y) > R_PointToDist2(v1->x, v1->y, v2->x, v2->y))
|
||||||
|
v = *v1;
|
||||||
|
if (R_PointToDist2(v.x, v.y, v2->x, v2->y) > R_PointToDist2(v1->x, v1->y, v2->x, v2->y))
|
||||||
|
v = *v1;
|
||||||
|
dist = R_PointToDist2(v.x, v.y, x, y);
|
||||||
if (dist < closestdist)
|
if (dist < closestdist)
|
||||||
{
|
{
|
||||||
closest = sector->lines[i];
|
closest = sector->lines[i];
|
||||||
|
|
Loading…
Reference in a new issue