if (hitent)
*hitent = NULL;
Mod_CheckLoaded(cl.worldmodel);
- Collision_ClipTrace(&trace, NULL, cl.worldmodel, vec3_origin, vec3_origin, vec3_origin, vec3_origin, start, vec3_origin, vec3_origin, end);
+ if (cl.worldmodel && cl.worldmodel->brush.TraceBox)
+ cl.worldmodel->brush.TraceBox(cl.worldmodel, vec3_origin, vec3_origin, &trace, NULL, start, vec3_origin, vec3_origin, end);
+ else
+ Collision_ClipTrace(&trace, NULL, cl.worldmodel, vec3_origin, vec3_origin, vec3_origin, vec3_origin, start, vec3_origin, vec3_origin, end);
if (impact)
VectorCopy (trace.endpos, impact);
|| ent->mins[2] > tracemaxs[2] || ent->maxs[2] < tracemins[2])
continue;
- Collision_ClipTrace(&trace, ent, ent->model, ent->origin, ent->angles, ent->mins, ent->maxs, start, vec3_origin, vec3_origin, end);
+ if (ent->model && ent->model->brush.TraceBox)
+ ent->model->brush.TraceBox(ent->model, ent->origin, ent->angles, &trace, NULL, start, vec3_origin, vec3_origin, end);
+ else
+ Collision_ClipTrace(&trace, ent, ent->model, ent->origin, ent->angles, ent->mins, ent->maxs, start, vec3_origin, vec3_origin, end);
if (trace.allsolid || trace.startsolid || trace.fraction < maxfrac)
{
void CL_FindNonSolidLocation(const vec3_t in, vec3_t out, vec_t radius)
{
// FIXME: check multiple brush models
- if (cl.worldmodel && cl.worldmodel->brushq1.FindNonSolidLocation)
- cl.worldmodel->brushq1.FindNonSolidLocation(cl.worldmodel, in, out, radius);
+ if (cl.worldmodel && cl.worldmodel->brush.FindNonSolidLocation)
+ cl.worldmodel->brush.FindNonSolidLocation(cl.worldmodel, in, out, radius);
}
int CL_PointContents(const vec3_t p)
{
// FIXME: check multiple brush models
- if (cl.worldmodel && cl.worldmodel->brushq1.PointContents)
- return cl.worldmodel->brushq1.PointContents(cl.worldmodel, p);
+ if (cl.worldmodel && cl.worldmodel->brush.PointContents)
+ return cl.worldmodel->brush.PointContents(cl.worldmodel, p);
return CONTENTS_EMPTY;
}
Host_Error("Mod_Q1BSP_Load: %s has wrong version number(%i should be %i(Quake) or 30(HalfLife))", mod->name, i, BSPVERSION);
mod->brushq1.ishlbsp = i == 30;
- mod->brushq1.FindNonSolidLocation = Mod_Q1BSP_FindNonSolidLocation;
+ mod->brush.FindNonSolidLocation = Mod_Q1BSP_FindNonSolidLocation;
+ mod->brush.PointContents = Mod_Q1BSP_PointContents;
mod->brushq1.PointInLeaf = Mod_Q1BSP_PointInLeaf;
- mod->brushq1.PointContents = Mod_Q1BSP_PointContents;
mod->brushq1.LeafPVS = Mod_Q1BSP_LeafPVS;
mod->brushq1.BuildPVSTextureChains = Mod_Q1BSP_BuildPVSTextureChains;
&& out->type != Q3FACETYPE_MESH
&& out->type != Q3FACETYPE_FLARE)
{
- Con_Printf("Mod_Q3BSP_LoadFaces: face #%i: unknown face type %i\n", i, n);
+ Con_Printf("Mod_Q3BSP_LoadFaces: face #%i: unknown face type %i\n", i, out->type);
out->type = 0; // error
continue;
}
typedef struct model_brush_s
{
- char *entities;
+ char *entities;
+ void (*FindNonSolidLocation)(struct model_s *model, const vec3_t in, vec3_t out, vec_t radius);
+ int (*PointContents)(struct model_s *model, const float *p);
+ void (*TraceBox)(struct model_s *model, const vec3_t corigin, const vec3_t cangles, void *trace, const void *cent, const vec3_t start, const vec3_t mins, const vec3_t maxs, const vec3_t end);
}
model_brush_t;
int light_scalebit;
float light_ambient;
- void (*FindNonSolidLocation)(struct model_s *model, const vec3_t in, vec3_t out, vec_t radius);
mleaf_t *(*PointInLeaf)(struct model_s *model, const float *p);
- int (*PointContents)(struct model_s *model, const float *p);
qbyte *(*LeafPVS)(struct model_s *model, mleaf_t *leaf);
void (*BuildPVSTextureChains)(struct model_s *model);
}
model_brushq1_t;
+/* MSVC can't compile empty structs, so this is commented out for now
typedef struct model_brushq2_s
{
}
model_brushq2_t;
+*/
typedef struct q3mtexture_s
{
model_sprite_t sprite;
model_brush_t brush;
model_brushq1_t brushq1;
+ /* MSVC can't handle an empty struct, so this is commented out for now
model_brushq2_t brushq2;
+ */
model_brushq3_t brushq3;
}
model_t;
*/
void PF_pointcontents (void)
{
- G_FLOAT(OFS_RETURN) = sv.worldmodel->brushq1.PointContents(sv.worldmodel, G_VECTOR(OFS_PARM0));
+ G_FLOAT(OFS_RETURN) = SV_PointContents(G_VECTOR(OFS_PARM0));
}
/*
testorigin[1] = lhrandom(entmins[1], entmaxs[1]);
testorigin[2] = lhrandom(entmins[2], entmaxs[2]);
- Collision_ClipTrace(&trace, NULL, sv.worldmodel, vec3_origin, vec3_origin, vec3_origin, testeye, vec3_origin, vec3_origin, testorigin);
+ if (sv.worldmodel && sv.worldmodel->brush.TraceBox)
+ sv.worldmodel->brush.TraceBox(sv.worldmodel, vec3_origin, vec3_origin, &trace, testeye, vec3_origin, vec3_origin, testorigin);
+ else
+ Collision_ClipTrace(&trace, NULL, sv.worldmodel, vec3_origin, vec3_origin, vec3_origin, testeye, vec3_origin, vec3_origin, testorigin);
if (trace.fraction == 1)
client->visibletime[e] = realtime + 1;
testorigin[1] = bound(entmins[1], testeye[1], entmaxs[1]);
testorigin[2] = bound(entmins[2], testeye[2], entmaxs[2]);
- Collision_ClipTrace(&trace, NULL, sv.worldmodel, vec3_origin, vec3_origin, vec3_origin, testeye, vec3_origin, vec3_origin, testorigin);
+ if (sv.worldmodel && sv.worldmodel->brush.TraceBox)
+ sv.worldmodel->brush.TraceBox(sv.worldmodel, vec3_origin, vec3_origin, &trace, testeye, vec3_origin, vec3_origin, testorigin);
+ else
+ Collision_ClipTrace(&trace, NULL, sv.worldmodel, vec3_origin, vec3_origin, vec3_origin, testeye, vec3_origin, vec3_origin, testorigin);
if (trace.fraction == 1)
client->visibletime[e] = realtime + 1;
testorigin[0] = (entmins[0] + entmaxs[0]) * 0.5f;
testorigin[1] = (entmins[1] + entmaxs[1]) * 0.5f;
testorigin[2] = (entmins[2] + entmaxs[2]) * 0.5f;
- Collision_ClipTrace(&trace, NULL, sv.worldmodel, vec3_origin, vec3_origin, vec3_origin, vec3_origin, testeye, vec3_origin, vec3_origin, testorigin);
+ if (sv.worldmodel && sv.worldmodel->brush.TraceBox)
+ sv.worldmodel->brush.TraceBox(sv.worldmodel, vec3_origin, vec3_origin, &trace, NULL, testeye, vec3_origin, vec3_origin, testorigin);
+ else
+ Collision_ClipTrace(&trace, NULL, sv.worldmodel, vec3_origin, vec3_origin, vec3_origin, vec3_origin, testeye, vec3_origin, vec3_origin, testorigin);
if (trace.fraction == 1)
client->visibletime[e] = realtime + 1;
else
testorigin[0] = lhrandom(entmins[0], entmaxs[0]);
testorigin[1] = lhrandom(entmins[1], entmaxs[1]);
testorigin[2] = lhrandom(entmins[2], entmaxs[2]);
- Collision_ClipTrace(&trace, NULL, sv.worldmodel, vec3_origin, vec3_origin, vec3_origin, vec3_origin, testeye, vec3_origin, vec3_origin, testorigin);
+ if (sv.worldmodel && sv.worldmodel->brush.TraceBox)
+ sv.worldmodel->brush.TraceBox(sv.worldmodel, vec3_origin, vec3_origin, &trace, NULL, testeye, vec3_origin, vec3_origin, testorigin);
+ else
+ Collision_ClipTrace(&trace, NULL, sv.worldmodel, vec3_origin, vec3_origin, vec3_origin, vec3_origin, testeye, vec3_origin, vec3_origin, testorigin);
if (trace.fraction == 1)
client->visibletime[e] = realtime + 1;
else
testorigin[0] = lhrandom(lightmins[0], lightmaxs[0]);
testorigin[1] = lhrandom(lightmins[1], lightmaxs[1]);
testorigin[2] = lhrandom(lightmins[2], lightmaxs[2]);
- Collision_ClipTrace(&trace, NULL, sv.worldmodel, vec3_origin, vec3_origin, vec3_origin, vec3_origin, testeye, vec3_origin, vec3_origin, testorigin);
+ if (sv.worldmodel && sv.worldmodel->brush.TraceBox)
+ sv.worldmodel->brush.TraceBox(sv.worldmodel, vec3_origin, vec3_origin, &trace, NULL, testeye, vec3_origin, vec3_origin, testorigin);
+ else
+ Collision_ClipTrace(&trace, NULL, sv.worldmodel, vec3_origin, vec3_origin, vec3_origin, vec3_origin, testeye, vec3_origin, vec3_origin, testorigin);
if (trace.fraction == 1)
client->visibletime[e] = realtime + 1;
else
{
start[0] = x ? maxs[0] : mins[0];
start[1] = y ? maxs[1] : mins[1];
- if (sv.worldmodel->brushq1.PointContents(sv.worldmodel, start) != CONTENTS_SOLID)
+ if (SV_PointContents(start) != CONTENTS_SOLID)
goto realcheck;
}
if (trace.fraction == 1)
{
VectorCopy(trace.endpos, traceendpos);
- if ( ((int)ent->v->flags & FL_SWIM) && sv.worldmodel->brushq1.PointContents(sv.worldmodel, traceendpos) == CONTENTS_EMPTY )
+ if (((int)ent->v->flags & FL_SWIM) && SV_PointContents(traceendpos) == CONTENTS_EMPTY )
return false; // swim monster left water
VectorCopy (traceendpos, ent->v->origin);
ent->v->waterlevel = 0;
ent->v->watertype = CONTENTS_EMPTY;
- cont = sv.worldmodel->brushq1.PointContents(sv.worldmodel, point);
+ cont = SV_PointContents(point);
if (cont <= CONTENTS_WATER)
{
ent->v->watertype = cont;
ent->v->waterlevel = 1;
point[2] = ent->v->origin[2] + (ent->v->mins[2] + ent->v->maxs[2])*0.5;
- cont = sv.worldmodel->brushq1.PointContents(sv.worldmodel, point);
+ cont = SV_PointContents(point);
if (cont <= CONTENTS_WATER)
{
ent->v->waterlevel = 2;
point[2] = ent->v->origin[2] + ent->v->view_ofs[2];
- cont = sv.worldmodel->brushq1.PointContents(sv.worldmodel, point);
+ cont = SV_PointContents(point);
if (cont <= CONTENTS_WATER)
ent->v->waterlevel = 3;
}
void SV_CheckWaterTransition (edict_t *ent)
{
int cont;
- cont = sv.worldmodel->brushq1.PointContents(sv.worldmodel, ent->v->origin);
+ cont = SV_PointContents(ent->v->origin);
if (!ent->v->watertype)
{
// just spawned here
Host_Error ("SV_ClipMoveToEntity: SOLID_BSP without MOVETYPE_PUSH");
}
- if (sv_polygoncollisions.integer && (mins[0] != maxs[0] || mins[1] != maxs[1] || mins[2] != maxs[2]))
+ if (model && model->brush.TraceBox)
+ model->brush.TraceBox(model, ent->v->origin, ent->v->angles, &trace, ent, start, mins, maxs, end);
+ // FIXME: these should go away
+ else if (sv_polygoncollisions.integer && (mins[0] != maxs[0] || mins[1] != maxs[1] || mins[2] != maxs[2]))
Collision_PolygonClipTrace(&trace, ent, model, ent->v->origin, ent->v->angles, ent->v->mins, ent->v->maxs, start, mins, maxs, end);
else
Collision_ClipTrace(&trace, ent, model, ent->v->origin, ent->v->angles, ent->v->mins, ent->v->maxs, start, mins, maxs, end);
return clip.trace;
}
+int SV_PointContents(const vec3_t point)
+{
+ if (sv.worldmodel && sv.worldmodel->brush.PointContents)
+ return sv.worldmodel->brush.PointContents(sv.worldmodel, point);
+ return CONTENTS_SOLID;
+}
+
// passedict is explicitly excluded from clipping checks (normally NULL)
trace_t SV_Move (vec3_t start, vec3_t mins, vec3_t maxs, vec3_t end, int type, edict_t *passedict);
+int SV_PointContents(const vec3_t point);
+
#endif