From 8c1eb201eb97d142b083c5987aeac3dfc94df4d5 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Mon, 18 Apr 2016 12:54:55 +0200 Subject: [PATCH] - optimized P_PointInSubsector. It costs more to convert the floating point coordinate for each node check than to convert it once up front and only use fixed point math afterward. --- src/p_glnodes.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/p_glnodes.cpp b/src/p_glnodes.cpp index becd1f3be..bc96f14bd 100644 --- a/src/p_glnodes.cpp +++ b/src/p_glnodes.cpp @@ -1344,9 +1344,11 @@ subsector_t *P_PointInSubsector (double x, double y) node = gamenodes + numgamenodes - 1; + fixed_t xx = FLOAT2FIXED(x); + fixed_t yy = FLOAT2FIXED(y); do { - side = R_PointOnSide (x, y, node); + side = R_PointOnSide (xx, yy, node); node = (node_t *)node->children[side]; } while (!((size_t)node & 1));