ref: 60d4aaf6f0e28fb4893c8d14e0fd86f5a2fb76e1
parent: be3c7fb217f02c60b51fbec558acdd1a4489a622
author: Sigrid Solveig Haflínudóttir <sigrid@ftrv.se>
date: Sat Oct 14 20:45:55 EDT 2023
steal a fix for items falling out of world from JoeQuake
--- a/mathlib.h
+++ b/mathlib.h
@@ -22,6 +22,7 @@
#define IS_NAN(x) (((*(int *)&x)&nanmask)==nanmask)
#define DotProduct(x,y) (x[0]*y[0]+x[1]*y[1]+x[2]*y[2])
+#define DotProductDouble(x,y) ((double)x[0]*y[0]+(double)x[1]*y[1]+(double)x[2]*y[2])
#define VectorSubtract(a,b,c) {c[0]=a[0]-b[0];c[1]=a[1]-b[1];c[2]=a[2]-b[2];}
#define VectorAdd(a,b,c) {c[0]=a[0]+b[0];c[1]=a[1]+b[1];c[2]=a[2]+b[2];}
#define VectorCopy(a,b) {b[0]=a[0];b[1]=a[1];b[2]=a[2];}
--- a/r_light.c
+++ b/r_light.c
@@ -172,8 +172,8 @@
tex = surf->texinfo;
- s = DotProduct (mid, tex->vecs[0]) + tex->vecs[0][3];
- t = DotProduct (mid, tex->vecs[1]) + tex->vecs[1][3];;
+ s = DotProductDouble (mid, tex->vecs[0]) + tex->vecs[0][3];
+ t = DotProductDouble (mid, tex->vecs[1]) + tex->vecs[1][3];;
if (s < surf->texturemins[0] ||
t < surf->texturemins[1])
--- a/world.c
+++ b/world.c
@@ -458,7 +458,7 @@
if (plane->type < 3)
d = p[plane->type] - plane->dist;
else
- d = DotProduct (plane->normal, p) - plane->dist;
+ d = DotProductDouble(plane->normal, p) - plane->dist;
if (d < 0)
num = node->children[1];
else
@@ -572,8 +572,8 @@
}
else
{
- t1 = DotProduct (plane->normal, p1) - plane->dist;
- t2 = DotProduct (plane->normal, p2) - plane->dist;
+ t1 = DotProductDouble(plane->normal, p1) - plane->dist;
+ t2 = DotProductDouble(plane->normal, p2) - plane->dist;
}
/*