- replaced all direct access to vertex coordinates with wrapper functions.

So that code replacement can be done piece by piece and not all at once.
This commit is contained in:
Christoph Oelckers 2016-03-29 10:07:06 +02:00
commit c7ae4688a3
26 changed files with 328 additions and 299 deletions

View file

@ -725,34 +725,34 @@ void sector_t::ClosestPoint(fixed_t fx, fixed_t fy, fixed_t &ox, fixed_t &oy) co
{
vertex_t *v1 = lines[i]->v1;
vertex_t *v2 = lines[i]->v2;
double a = v2->x - v1->x;
double b = v2->y - v1->y;
double a = v2->fixX() - v1->fixX();
double b = v2->fixY() - v1->fixY();
double den = a*a + b*b;
double ix, iy, dist;
if (den == 0)
{ // Line is actually a point!
ix = v1->x;
iy = v1->y;
ix = v1->fixX();
iy = v1->fixY();
}
else
{
double num = (x - v1->x) * a + (y - v1->y) * b;
double num = (x - v1->fixX()) * a + (y - v1->fixY()) * b;
double u = num / den;
if (u <= 0)
{
ix = v1->x;
iy = v1->y;
ix = v1->fixX();
iy = v1->fixY();
}
else if (u >= 1)
{
ix = v2->x;
iy = v2->y;
ix = v2->fixX();
iy = v2->fixY();
}
else
{
ix = v1->x + u * a;
iy = v1->y + u * b;
ix = v1->fixX() + u * a;
iy = v1->fixY() + u * b;
}
}
a = (ix - x);
@ -1136,10 +1136,10 @@ bool P_AlignFlat (int linenum, int side, int fc)
if (!sec)
return false;
fixed_t x = line->v1->x;
fixed_t y = line->v1->y;
fixed_t x = line->v1->fixX();
fixed_t y = line->v1->fixY();
angle_t angle = R_PointToAngle2 (x, y, line->v2->x, line->v2->y);
angle_t angle = R_PointToAngle2 (x, y, line->v2->fixX(), line->v2->fixY());
angle_t norm = (angle-ANGLE_90) >> ANGLETOFINESHIFT;
fixed_t dist = -DMulScale16 (finecosine[norm], x, finesine[norm], y);