diff --git a/src/p_maputl.c b/src/p_maputl.c index 8fcd8f271..9eb80f2fc 100644 --- a/src/p_maputl.c +++ b/src/p_maputl.c @@ -136,33 +136,21 @@ void P_ClosestPointOnLine3D(fixed_t x, fixed_t y, fixed_t z, line_t *line, verte // INT32 P_PointOnLineSide(fixed_t x, fixed_t y, line_t *line) { - const vertex_t *v1 = line->v1; fixed_t dx, dy, left, right; if (!line->dx) - { - if (x <= v1->x) - return (line->dy > 0); + return x <= line->v1->x ? line->dy > 0 : line->dy < 0; - return (line->dy < 0); - } if (!line->dy) - { - if (y <= v1->y) - return (line->dx < 0); + return y <= line->v1->y ? line->dx < 0 : line->dx > 0; - return (line->dx > 0); - } - - dx = (x - v1->x); - dy = (y - v1->y); + dx = (x - line->v1->x); + dy = (y - line->v1->y); left = FixedMul(line->dy>>FRACBITS, dx); right = FixedMul(dy, line->dx>>FRACBITS); - if (right < left) - return 0; // front side - return 1; // back side + return right < left ? 0 : 1; } // @@ -225,39 +213,25 @@ static INT32 P_PointOnDivlineSide(fixed_t x, fixed_t y, divline_t *line) fixed_t dx, dy, left, right; if (!line->dx) - { - if (x <= line->x) - return line->dy > 0; + return x <= line->x ? line->dy > 0 : line->dy < 0; - return line->dy < 0; - } if (!line->dy) - { - if (y <= line->y) - return line->dx < 0; - - return line->dx > 0; - } + return y <= line->y ? line->dx < 0 : line->dx > 0; dx = (x - line->x); dy = (y - line->y); // try to quickly decide by looking at sign bits if ((line->dy ^ line->dx ^ dx ^ dy) & 0x80000000) - { - if ((line->dy ^ dx) & 0x80000000) - return 1; // left is negative - return 0; - } + return ((line->dy ^ dx) & 0x80000000) ? 1 : 0; left = FixedMul(line->dy>>8, dx>>8); right = FixedMul(dy>>8, line->dx>>8); - if (right < left) - return 0; // front side - return 1; // back side + return right < left ? 0 : 1; } + // // P_MakeDivline //