Skip to content

Commit 0316ac2

Browse files
committed
Optimize P_DivlineSide
1 parent 07383da commit 0316ac2

File tree

1 file changed

+2
-9
lines changed

1 file changed

+2
-9
lines changed

src/p_sight.c

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -91,12 +91,7 @@ P_DivlineSide
9191
left = (node->dy>>FRACBITS) * (dx>>FRACBITS);
9292
right = (dy>>FRACBITS) * (node->dx>>FRACBITS);
9393

94-
if (right < left)
95-
return 0; // front side
96-
97-
if (left == right)
98-
return 2;
99-
return 1; // back side
94+
return (left <= right) + (left == right);
10095
}
10196

10297

@@ -271,9 +266,7 @@ boolean P_CrossBSPNode (int bspnum)
271266
bsp = &nodes[bspnum];
272267

273268
// decide which side the start point is on
274-
side = P_DivlineSide (strace.x, strace.y, (divline_t *)bsp);
275-
if (side == 2)
276-
side = 0; // an "on" should cross both sides
269+
side = P_DivlineSide (strace.x, strace.y, (divline_t *)bsp) & 1;
277270

278271
// cross the starting side
279272
if (!P_CrossBSPNode (bsp->children[side]) )

0 commit comments

Comments
 (0)