+ *hitent = cl.brushmodel_entities[n];
+ Matrix4x4_Transform3x3(&ent->matrix, trace.plane.normal, cliptrace.plane.normal);
+ }
+ cliptrace.startsupercontents |= trace.startsupercontents;
+ }
+ }
+ if (hitplayers)
+ {
+ tracemins[0] = min(start[0], end[0]) + mins[0];
+ tracemaxs[0] = max(start[0], end[0]) + maxs[0];
+ tracemins[1] = min(start[1], end[1]) + mins[1];
+ tracemaxs[1] = max(start[1], end[1]) + maxs[1];
+ tracemins[2] = min(start[2], end[2]) + mins[2];
+ tracemaxs[2] = max(start[2], end[2]) + maxs[2];
+
+ for (n = 1;n < cl.maxclients+1;n++)
+ {
+ if (n != cl.playerentity)
+ {
+ ent = &cl.entities[n].render;
+ // FIXME: crouch
+ playermins = cl.playerstandmins;
+ playermaxs = cl.playerstandmaxs;
+ Matrix4x4_OriginFromMatrix(&ent->matrix, origin);
+ VectorAdd(origin, playermins, entmins);
+ VectorAdd(origin, playermaxs, entmaxs);
+ if (!BoxesOverlap(tracemins, tracemaxs, entmins, entmaxs))
+ continue;
+
+ memset (&trace, 0 , sizeof(trace_t));
+ trace.fraction = 1;
+ trace.realfraction = 1;
+
+ Matrix4x4_Transform(&ent->inversematrix, start, starttransformed);
+ Matrix4x4_Transform(&ent->inversematrix, end, endtransformed);
+ Collision_ClipTrace_Box(&trace, playermins, playermaxs, starttransformed, mins, maxs, endtransformed, hitsupercontentsmask, SUPERCONTENTS_SOLID);
+
+ // LordHavoc: take the 'best' answers from the new trace and combine with existing data
+ if (trace.allsolid)
+ cliptrace.allsolid = true;
+ if (trace.startsolid)
+ {
+ cliptrace.startsolid = true;
+ if (cliptrace.realfraction == 1)
+ if (hitent)
+ *hitent = n;
+ }
+ // don't set this except on the world, because it can easily confuse
+ // monsters underwater if there's a bmodel involved in the trace
+ // (inopen && inwater is how they check water visibility)
+ //if (trace.inopen)
+ // cliptrace.inopen = true;
+ if (trace.inwater)
+ cliptrace.inwater = true;
+ if (trace.realfraction < cliptrace.realfraction)