fix some q2+q3 gamecode bugs.

fix q3bsp optimisation that was making too much invisible.

git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4840 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
Spoike 2015-02-09 03:37:41 +00:00
parent 8d81ed4a49
commit 02ab57490e
8 changed files with 41 additions and 36 deletions

View file

@ -75,7 +75,7 @@ unsigned int SV_Q2BSP_FatPVS (model_t *mod, vec3_t org, qbyte *resultbuf, unsig
if (count < 1)
Sys_Error ("SV_Q2FatPVS: count < 1");
if (sv.world.worldmodel->fromgame == fg_quake3)
if (mod->fromgame == fg_quake3)
longs = CM_ClusterSize(mod);
else
longs = (CM_NumClusters(mod)+7)/8;

View file

@ -481,7 +481,7 @@ static void SVQ3_Trace(q3trace_t *result, vec3_t start, vec3_t mins, vec3_t maxs
mod = Q3G_GetCModel(es->s.modelindex);
if (!mod)
continue;
tr = CM_TransformedBoxTrace(mod, start, end, mins, maxs, contentmask, es->r.currentOrigin, vec3_origin);
World_TransformedTrace(mod, 0, 0, start, end, mins, maxs, capsule, &tr, es->r.currentOrigin, es->r.currentAngles, contentmask);
}
else
{
@ -489,7 +489,7 @@ static void SVQ3_Trace(q3trace_t *result, vec3_t start, vec3_t mins, vec3_t maxs
mod = CM_TempBoxModel(es->r.mins, es->r.maxs);
else
mod = CM_TempBoxModel(es->r.mins, es->r.maxs);
tr = CM_TransformedBoxTrace(mod, start, end, mins, maxs, contentmask, es->r.currentOrigin, es->r.currentAngles);
World_TransformedTrace(mod, 0, 0, start, end, mins, maxs, capsule, &tr, es->r.currentOrigin, vec3_origin, contentmask);
}
if (tr.fraction < result->fraction)
{
@ -557,13 +557,12 @@ static int SVQ3_PointContents(vec3_t pos, int entnum)
mod = Q3G_GetCModel(es->s.modelindex);
if (!mod)
continue;
tr = CM_TransformedBoxTrace(mod, pos, pos, vec3_origin, vec3_origin, 0xffffffff, es->r.currentOrigin, vec3_origin);
World_TransformedTrace(mod, 0, 0, pos, pos, vec3_origin, vec3_origin, false, &tr, es->r.currentOrigin, es->r.currentAngles, 0xffffffff);
}
else
{
mod = CM_TempBoxModel(es->r.mins, es->r.maxs);
tr = CM_TransformedBoxTrace(mod, pos, pos, vec3_origin, vec3_origin, 0xffffffff, es->r.currentOrigin, es->r.currentAngles);
// mod->funcs.Trace(mod, 0, 0, start, end, mins, maxs, &tr);
World_TransformedTrace(mod, 0, 0, pos, pos, vec3_origin, vec3_origin, false, &tr, es->r.currentOrigin, vec3_origin, 0xffffffff);
}
cont |= tr.contents;

View file

@ -406,7 +406,7 @@ void Q2BSP_FindTouchedLeafs(model_t *model, struct pvscache_s *ent, float *mins,
if (area != nullarea)
{ // doors may legally straggle two areas,
// but nothing should ever need more than that
if (ent->areanum && ent->areanum != area)
if (ent->areanum != nullarea && ent->areanum != area)
ent->areanum2 = area;
else
ent->areanum = area;
@ -1029,14 +1029,10 @@ qboolean World_TransformedTrace (struct model_s *model, int hulloverride, int fr
VectorAdd (trace->endpos, origin, trace->endpos);
}
else
else if (hitcontentsmask & FTECONTENTS_BODY)
{
hull_t *hull = &box_hull;
memset (trace, 0, sizeof(trace_t));
trace->fraction = 1;
trace->allsolid = true;
VectorSubtract (start, origin, start_l);
VectorSubtract (end, origin, end_l);
VectorCopy (end_l, trace->endpos);
@ -1383,13 +1379,9 @@ void WorldQ2_ClipMoveToEntities (world_t *w, moveclip_t *clip )
angles = vec3_origin; // boxes don't rotate
if (touch->svflags & SVF_MONSTER)
trace = CM_TransformedBoxTrace (model, clip->start, clip->end,
clip->mins2, clip->maxs2, clip->hitcontentsmask,
touch->s.origin, angles);
World_TransformedTrace (model, 0, 0, clip->start, clip->end, clip->mins2, clip->maxs2, false, &trace, touch->s.origin, angles, clip->hitcontentsmask);
else
trace = CM_TransformedBoxTrace (model, clip->start, clip->end,
clip->mins, clip->maxs, clip->hitcontentsmask,
touch->s.origin, angles);
World_TransformedTrace (model, 0, 0, clip->start, clip->end, clip->mins, clip->maxs, false, &trace, touch->s.origin, angles, clip->hitcontentsmask);
if (trace.allsolid || trace.startsolid ||
trace.fraction < clip->trace.fraction)
@ -2066,6 +2058,7 @@ trace_t WorldQ2_Move (world_t *w, vec3_t start, vec3_t mins, vec3_t maxs, vec3_t
VectorCopy (maxs, clip.maxs2);
// create the bounding box of the entire move
//FIXME: should we use clip.trace.endpos here?
World_MoveBounds ( start, clip.mins2, clip.maxs2, end, clip.boxmins, clip.boxmaxs );
// clip to entities