-// Shadow Volume BSP code written by Forest "LordHavoc" Hale on 2003-11-06 and placed into public domain.
-// Modified by LordHavoc (to make it work and other nice things like that) on 2007-01-24 and 2007-01-25
-// Optimized by LordHavoc on 2009-12-24 and 2009-12-25
+// Shadow Volume BSP code written by Ashley Rose Hale (LadyHavoc) on 2003-11-06 and placed into public domain.
+// Modified by LadyHavoc (to make it work and other nice things like that) on 2007-01-24 and 2007-01-25
+// Optimized by LadyHavoc on 2009-12-24 and 2009-12-25
#include <math.h>
#include <string.h>
#include "svbsp.h"
#include "polygon.h"
-#define MAX_SVBSP_POLYGONPOINTS 16
+#define MAX_SVBSP_POLYGONPOINTS 64
#define SVBSP_CLIP_EPSILON (1.0f / 1024.0f)
#define SVBSP_DotProduct(a,b) ((a)[0]*(b)[0]+(a)[1]*(b)[1]+(a)[2]*(b)[2])
// note we still allow points and lines to be tested...
if (numpoints < 1)
return 0;
+ // if the polygon has too many points, we would crash
+ if (numpoints > MAX_SVBSP_POLYGONPOINTS)
+ return 0;
poly.numpoints = numpoints;
for (i = 0;i < numpoints;i++)
{