typedef struct
{
int numpoints;
+ int padding;
double points[8][3]; // variable sized
}
winding_t;
int size;
if (points > MAX_POINTS_ON_WINDING)
- Host_Error("NewWinding: too many points\n");
+ Sys_Error("NewWinding: too many points\n");
size = sizeof(winding_t) + sizeof(double[3]) * (points - 8);
w = Mem_Alloc(loadmodel->mempool, size);
return in;
maxpts = in->numpoints+4; // can't use counts[0]+2 because of fp grouping errors
+ if (maxpts > MAX_POINTS_ON_WINDING)
+ Sys_Error ("ClipWinding: maxpts > MAX_POINTS_ON_WINDING");
+
neww = NewWinding (maxpts);
for (i = 0;i < in->numpoints;i++)
{
if (neww->numpoints >= maxpts)
- Host_Error ("ClipWinding: points exceeded estimate");
+ Sys_Error ("ClipWinding: points exceeded estimate");
+
+ Mem_CheckSentinels(neww);
p1 = in->points[i];
{
VectorCopy (p1, neww->points[neww->numpoints]);
neww->numpoints++;
+ Mem_CheckSentinels(neww);
continue;
}
{
VectorCopy (p1, neww->points[neww->numpoints]);
neww->numpoints++;
+ Mem_CheckSentinels(neww);
}
if (sides[i+1] == SIDE_ON || sides[i+1] == sides[i])
VectorCopy (mid, neww->points[neww->numpoints]);
neww->numpoints++;
+ Mem_CheckSentinels(neww);
}
// free the original winding
maxpts = in->numpoints+4; // can't use counts[0]+2 because of fp grouping errors
+ if (maxpts > MAX_POINTS_ON_WINDING)
+ Sys_Error ("ClipWinding: maxpts > MAX_POINTS_ON_WINDING");
+
*front = f = NewWinding (maxpts);
*back = b = NewWinding (maxpts);
for (i = 0;i < in->numpoints;i++)
{
if (f->numpoints >= maxpts || b->numpoints >= maxpts)
- Host_Error ("DivideWinding: points exceeded estimate");
+ Sys_Error ("DivideWinding: points exceeded estimate");
p1 = in->points[i];
{
VectorCopy (p1, f->points[f->numpoints]);
f->numpoints++;
+ Mem_CheckSentinels(f);
VectorCopy (p1, b->points[b->numpoints]);
b->numpoints++;
+ Mem_CheckSentinels(b);
continue;
}
{
VectorCopy (p1, f->points[f->numpoints]);
f->numpoints++;
+ Mem_CheckSentinels(f);
}
else if (sides[i] == SIDE_BACK)
{
VectorCopy (p1, b->points[b->numpoints]);
b->numpoints++;
+ Mem_CheckSentinels(b);
}
if (sides[i+1] == SIDE_ON || sides[i+1] == sides[i])
VectorCopy (mid, f->points[f->numpoints]);
f->numpoints++;
+ Mem_CheckSentinels(f);
VectorCopy (mid, b->points[b->numpoints]);
b->numpoints++;
+ Mem_CheckSentinels(b);
}
// debugging
mleaf_t *leaf, *endleaf;
winding_t *w;
+ Mem_CheckSentinelsGlobal();
+
// recalculate bounding boxes for all leafs (because qbsp is very sloppy)
leaf = loadmodel->leafs;
endleaf = leaf + loadmodel->numleafs;
Mod_RecursiveRecalcNodeBBox(loadmodel->nodes);
+ Mem_CheckSentinelsGlobal();
+
// tally up portal and point counts
p = portalchain;
numportals = 0;
FreePortal(p);
p = pnext;
}
+
+ Mem_CheckSentinelsGlobal();
}
/*