-
- return outpoints;
-}
-
-
-int Portal_PortalThroughPortalPlanes(tinyplane_t *clipplanes, int clipnumplanes, float *targpoints, int targnumpoints, float *out, int maxpoints)
-{
- int numpoints, i;
- if (targnumpoints < 3)
- return targnumpoints;
- if (maxpoints < 3)
- return -1;
- numpoints = targnumpoints;
- memcpy(&portaltemppoints[0][0][0], targpoints, numpoints * 3 * sizeof(float));
- for (i = 0;i < clipnumplanes;i++)
- {
- numpoints = Portal_ClipPolygonToPlane(&portaltemppoints[0][0][0], &portaltemppoints[1][0][0], numpoints, 256, clipplanes + i);
- if (numpoints < 3)
- return numpoints;
- memcpy(&portaltemppoints[0][0][0], &portaltemppoints[1][0][0], numpoints * 3 * sizeof(float));
- }
- if (numpoints > maxpoints)
- return -1;
- memcpy(out, &portaltemppoints[0][0][0], numpoints * 3 * sizeof(float));
+ numpoints = min(numpoints, maxpoints);
+ if (numpoints > 0)
+ memcpy(out, &portaltemppoints[w][0][0], numpoints * 3 * sizeof(float));