mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2025-10-30 08:01:28 +00:00
Use sector lines when snapping anchor to point
Sometimes segs skip a point!
This commit is contained in:
parent
0cddfdee74
commit
ff7813ef38
1 changed files with 6 additions and 8 deletions
|
|
@ -89,22 +89,20 @@ static const vertex_t *
|
||||||
nearest_point
|
nearest_point
|
||||||
(
|
(
|
||||||
mapthing_t * a,
|
mapthing_t * a,
|
||||||
const subsector_t * sub
|
const sector_t * sector
|
||||||
){
|
){
|
||||||
const fixed_t x = a->x << FRACBITS;
|
const fixed_t x = a->x << FRACBITS;
|
||||||
const fixed_t y = a->y << FRACBITS;
|
const fixed_t y = a->y << FRACBITS;
|
||||||
|
|
||||||
const UINT16 lastline = sub->firstline + sub->numlines;
|
|
||||||
|
|
||||||
const vertex_t * nearest = NULL;/* shut compiler up, should never be NULL */
|
const vertex_t * nearest = NULL;/* shut compiler up, should never be NULL */
|
||||||
fixed_t nearest_distance = INT32_MAX;
|
fixed_t nearest_distance = INT32_MAX;
|
||||||
|
|
||||||
UINT16 i;
|
size_t i;
|
||||||
|
|
||||||
for (i = sub->firstline; i < lastline; ++i)
|
for (i = 0; i < sector->linecount; ++i)
|
||||||
{
|
{
|
||||||
compare_vertex_distance(&nearest, &nearest_distance, x, y, segs[i].v1);
|
compare_vertex_distance(&nearest, &nearest_distance, x, y, sector->lines[i]->v1);
|
||||||
compare_vertex_distance(&nearest, &nearest_distance, x, y, segs[i].v2);
|
compare_vertex_distance(&nearest, &nearest_distance, x, y, sector->lines[i]->v2);
|
||||||
}
|
}
|
||||||
|
|
||||||
return nearest;
|
return nearest;
|
||||||
|
|
@ -151,7 +149,7 @@ set_anchor
|
||||||
|
|
||||||
a->z = anchor_height(a, sub->sector);
|
a->z = anchor_height(a, sub->sector);
|
||||||
|
|
||||||
v = nearest_point(a, sub);
|
v = nearest_point(a, sub->sector);
|
||||||
|
|
||||||
a->x = ( v->x >> FRACBITS );
|
a->x = ( v->x >> FRACBITS );
|
||||||
a->y = ( v->y >> FRACBITS );
|
a->y = ( v->y >> FRACBITS );
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue