From 95de1faa808b6036b380f8e5b1ff16ac466e5119 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sun, 17 Apr 2016 01:16:46 +0200 Subject: [PATCH] - fixed: The portal coverage builder initialized node_t::len differently than the polyobject splitter. This was creating quite a mess when loading savegames with both portals and polyobjects. --- src/gl/data/gl_portaldata.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/gl/data/gl_portaldata.cpp b/src/gl/data/gl_portaldata.cpp index 497216bc8..98e19c80e 100644 --- a/src/gl/data/gl_portaldata.cpp +++ b/src/gl/data/gl_portaldata.cpp @@ -187,7 +187,7 @@ struct FCoverageBuilder double PartitionDistance(FCoverageVertex *vt, node_t *node) { - return fabs(double(-node->dy) * (vt->x - node->x) + double(node->dx) * (vt->y - node->y)) / node->len; + return fabs(double(-node->dy) * (vt->x - node->x) + double(node->dx) * (vt->y - node->y)) / (node->len * 65536.); } //========================================================================== @@ -379,8 +379,9 @@ void gl_InitPortals() for(int i=0;idx; - double fdy = (double)no->dy; + // Must be converted because the len value is also needed for polyobjects. + double fdx = FIXED2DBL(no->dx); + double fdy = FIXED2DBL(no->dy); no->len = (float)sqrt(fdx * fdx + fdy * fdy); }