fix brushlist clipping issue with submodels.

git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4845 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
Spoike 2015-03-06 03:20:59 +00:00
parent 1ba434bb17
commit 8dc525e53f

View file

@ -757,12 +757,11 @@ void Q1BSP_LoadBrushes(model_t *model)
if (permodel->ver != 1 || lumpsizeremaining < sizeof(*permodel) + permodel->numbrushes*sizeof(*perbrush) + permodel->numplanes*sizeof(*perplane)) if (permodel->ver != 1 || lumpsizeremaining < sizeof(*permodel) + permodel->numbrushes*sizeof(*perbrush) + permodel->numplanes*sizeof(*perplane))
return; return;
//find the correct rootnode for the model //find the correct rootnode for the submodel (submodels are not set up yet).
rootnode = model->nodes; rootnode = model->nodes;
if (permodel->modelnum > model->numsubmodels) if (permodel->modelnum > model->numsubmodels)
return; return;
if (permodel->modelnum) rootnode += model->submodels[permodel->modelnum].headnode[0];
rootnode += model->submodels[permodel->modelnum-1].headnode[0];
brush = ZG_Malloc(&model->memgroup, (sizeof(*brush) - sizeof(brush->planes[0]))*permodel->numbrushes + sizeof(brush->planes[0])*(permodel->numbrushes*6+permodel->numplanes)); brush = ZG_Malloc(&model->memgroup, (sizeof(*brush) - sizeof(brush->planes[0]))*permodel->numbrushes + sizeof(brush->planes[0])*(permodel->numbrushes*6+permodel->numplanes));
remainingplanes = permodel->numplanes; remainingplanes = permodel->numplanes;
@ -909,7 +908,7 @@ qboolean Q1BSP_Trace(model_t *model, int forcehullnum, int frame, vec3_t axis[3]
traceinfo.maxs[2] = traceinfo.radius; traceinfo.maxs[2] = traceinfo.radius;
*/ */
traceinfo.solidcontents = hitcontentsmask; traceinfo.solidcontents = hitcontentsmask;
Q1BSP_RecursiveBrushCheck(&traceinfo, model->nodes, 0, 1, start, end); Q1BSP_RecursiveBrushCheck(&traceinfo, model->rootnode, 0, 1, start, end);
memcpy(trace, &traceinfo.trace, sizeof(trace_t)); memcpy(trace, &traceinfo.trace, sizeof(trace_t));
if (trace->fraction < 1) if (trace->fraction < 1)
{ {