- 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.
This commit is contained in:
Christoph Oelckers 2016-04-18 12:54:55 +02:00
parent c5c032911c
commit 8c1eb201eb

View file

@ -1344,9 +1344,11 @@ subsector_t *P_PointInSubsector (double x, double y)
node = gamenodes + numgamenodes - 1; node = gamenodes + numgamenodes - 1;
fixed_t xx = FLOAT2FIXED(x);
fixed_t yy = FLOAT2FIXED(y);
do do
{ {
side = R_PointOnSide (x, y, node); side = R_PointOnSide (xx, yy, node);
node = (node_t *)node->children[side]; node = (node_t *)node->children[side];
} }
while (!((size_t)node & 1)); while (!((size_t)node & 1));