- Fixed: Since UDMF allows for fractional vertex coordinates, it is no longer

safe for P_AlignPlane() to truncate coordinates when searching for the
  furthest vertex from the line.


SVN r1676 (trunk)
This commit is contained in:
Randy Heit 2009-06-23 02:33:18 +00:00
parent 0506606efc
commit 861a955cef
2 changed files with 11 additions and 10 deletions

View file

@ -1,4 +1,9 @@
June 19, 2009 June 22, 2009
- Fixed: Since UDMF allows for fractional vertex coordinates, it is no longer
safe for P_AlignPlane() to truncate coordinates when searching for the
furthest vertex from the line.
June 19, 2009
- The reorganized DirectInput game controller code finally compiles. (Ugh! It - The reorganized DirectInput game controller code finally compiles. (Ugh! It
took far too long to reach this point.) Manual axis configuration is took far too long to reach this point.) Manual axis configuration is
currently disabled, since I need to rewrite that, too. The eventual point of currently disabled, since I need to rewrite that, too. The eventual point of

View file

@ -462,7 +462,7 @@ void P_SpawnSlopeMakers (FMapThing *firstmt, FMapThing *lastmt)
static void P_AlignPlane (sector_t *sec, line_t *line, int which) static void P_AlignPlane (sector_t *sec, line_t *line, int which)
{ {
sector_t *refsec; sector_t *refsec;
int bestdist; double bestdist;
vertex_t *refvert = (*sec->lines)->v1; // Shut up, GCC vertex_t *refvert = (*sec->lines)->v1; // Shut up, GCC
int i; int i;
line_t **probe; line_t **probe;
@ -471,23 +471,19 @@ static void P_AlignPlane (sector_t *sec, line_t *line, int which)
return; return;
// Find furthest vertex from the reference line. It, along with the two ends // Find furthest vertex from the reference line. It, along with the two ends
// of the line will define the plane. // of the line, will define the plane.
bestdist = 0; bestdist = 0;
for (i = sec->linecount*2, probe = sec->lines; i > 0; i--) for (i = sec->linecount*2, probe = sec->lines; i > 0; i--)
{ {
int dist; double dist;
vertex_t *vert; vertex_t *vert;
// Do calculations with only the upper bits, because the lower ones
// are all zero, and we would overflow for a lot of distances if we
// kept them around.
if (i & 1) if (i & 1)
vert = (*probe++)->v2; vert = (*probe++)->v2;
else else
vert = (*probe)->v1; vert = (*probe)->v1;
dist = abs (((line->v1->y - vert->y) >> FRACBITS) * (line->dx >> FRACBITS) - dist = fabs((double(line->v1->y) - vert->y) * line->dx -
((line->v1->x - vert->x) >> FRACBITS) * (line->dy >> FRACBITS)); (double(line->v1->x) - vert->x) * line->dy);
if (dist > bestdist) if (dist > bestdist)
{ {