- 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.
This commit is contained in:
Christoph Oelckers 2016-04-17 01:16:46 +02:00
parent 01983cdee1
commit 95de1faa80

View file

@ -187,7 +187,7 @@ struct FCoverageBuilder
double PartitionDistance(FCoverageVertex *vt, node_t *node) 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;i<numnodes;i++) for(int i=0;i<numnodes;i++)
{ {
node_t *no = &nodes[i]; node_t *no = &nodes[i];
double fdx = (double)no->dx; // Must be converted because the len value is also needed for polyobjects.
double fdy = (double)no->dy; double fdx = FIXED2DBL(no->dx);
double fdy = FIXED2DBL(no->dy);
no->len = (float)sqrt(fdx * fdx + fdy * fdy); no->len = (float)sqrt(fdx * fdx + fdy * fdy);
} }