mirror of
https://github.com/nzp-team/fteqw.git
synced 2025-01-31 04:30:38 +00:00
csqc traces against ssqc bmodels should support rotation like the ssqc does.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5842 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
parent
f98486687b
commit
b4b4653b68
1 changed files with 47 additions and 25 deletions
|
@ -2428,6 +2428,7 @@ static void World_ClipToNetwork (world_t *w, moveclip_t *clip)
|
|||
unsigned int touchcontents;
|
||||
model_t *model;
|
||||
vec3_t bmins, bmaxs;
|
||||
float *ang;
|
||||
trace_t trace;
|
||||
static framestate_t framestate; //meh
|
||||
|
||||
|
@ -2440,22 +2441,54 @@ static void World_ClipToNetwork (world_t *w, moveclip_t *clip)
|
|||
|
||||
if (touch->solidsize == ES_SOLID_BSP)
|
||||
{
|
||||
switch(touch->skinnum)
|
||||
if (touch->modelindex <= 0 || touch->modelindex >= MAX_PRECACHE_MODELS)
|
||||
continue; //erk
|
||||
model = cl.model_precache[touch->modelindex];
|
||||
if (!model || model->loadstate != MLS_LOADED || !model->funcs.NativeTrace)
|
||||
continue;
|
||||
VectorCopy(model->mins, bmins);
|
||||
VectorCopy(model->maxs, bmaxs);
|
||||
ang = touch->angles;
|
||||
|
||||
if (ang[0] || ang[1] || ang[2])
|
||||
{ //expand the size to deal with rotations. lazy method.
|
||||
int i;
|
||||
float v;
|
||||
float max = 0;
|
||||
for (i=0 ; i<3 ; i++)
|
||||
{
|
||||
v = fabs( bmins[i]);
|
||||
if (v > max)
|
||||
max = v;
|
||||
v = fabs( bmaxs[i]);
|
||||
if (v > max)
|
||||
max = v;
|
||||
}
|
||||
VectorSet(bmins, -max,-max,-max);
|
||||
VectorSet(bmaxs, max, max, max);
|
||||
}
|
||||
|
||||
safeswitch((enum q1contents_e)touch->skinnum)
|
||||
{
|
||||
case Q1CONTENTS_EMPTY: touchcontents = 0; break;
|
||||
case Q1CONTENTS_SOLID: touchcontents = FTECONTENTS_SOLID; break;
|
||||
case Q1CONTENTS_LADDER: touchcontents = FTECONTENTS_LADDER; break;
|
||||
case Q1CONTENTS_SKY: touchcontents = FTECONTENTS_SKY; break;
|
||||
case Q1CONTENTS_LAVA: touchcontents = FTECONTENTS_LAVA; break;
|
||||
case Q1CONTENTS_SLIME: touchcontents = FTECONTENTS_SLIME; break;
|
||||
case Q1CONTENTS_WATER: touchcontents = FTECONTENTS_WATER; break;
|
||||
default: touchcontents = ~0; break; //could be anything... :(
|
||||
case Q1CONTENTS_PLAYERCLIP: touchcontents = FTECONTENTS_PLAYERCLIP; break;
|
||||
case Q1CONTENTS_MONSTERCLIP: touchcontents = FTECONTENTS_MONSTERCLIP; break;
|
||||
case Q1CONTENTS_CLIP: touchcontents = FTECONTENTS_PLAYERCLIP|FTECONTENTS_MONSTERCLIP; break;
|
||||
case Q1CONTENTS_TRANS: touchcontents = FTECONTENTS_WINDOW; break;
|
||||
case Q1CONTENTS_CURRENT_0: touchcontents = FTECONTENTS_WATER|Q2CONTENTS_CURRENT_0; break;
|
||||
case Q1CONTENTS_CURRENT_90: touchcontents = FTECONTENTS_WATER|Q2CONTENTS_CURRENT_90; break;
|
||||
case Q1CONTENTS_CURRENT_180: touchcontents = FTECONTENTS_WATER|Q2CONTENTS_CURRENT_180; break;
|
||||
case Q1CONTENTS_CURRENT_270: touchcontents = FTECONTENTS_WATER|Q2CONTENTS_CURRENT_270; break;
|
||||
case Q1CONTENTS_CURRENT_UP: touchcontents = FTECONTENTS_WATER|Q2CONTENTS_CURRENT_UP; break;
|
||||
case Q1CONTENTS_CURRENT_DOWN: touchcontents = FTECONTENTS_WATER|Q2CONTENTS_CURRENT_DOWN; break;
|
||||
safedefault: touchcontents = ~0; break; //could be anything... :(
|
||||
}
|
||||
if (touch->modelindex <= 0 || touch->modelindex >= MAX_PRECACHE_MODELS)
|
||||
continue; //erk
|
||||
model = cl.model_precache[touch->modelindex];
|
||||
if (!model)
|
||||
continue;
|
||||
VectorCopy(model->mins, bmins);
|
||||
VectorCopy(model->maxs, bmaxs);
|
||||
}
|
||||
#if 1
|
||||
else
|
||||
|
@ -2470,12 +2503,13 @@ static void World_ClipToNetwork (world_t *w, moveclip_t *clip)
|
|||
touchcontents = FTECONTENTS_BODY;
|
||||
model = NULL;
|
||||
COM_DecodeSize(touch->solidsize, bmins, bmaxs);
|
||||
World_HullForBox(bmins, bmaxs);
|
||||
ang = vec3_origin;
|
||||
}
|
||||
#endif
|
||||
if (!(clip->hitcontentsmask & touchcontents))
|
||||
continue;
|
||||
|
||||
//FIXME: this doesn't handle rotations.
|
||||
if ( clip->boxmins[0] > touch->origin[0]+bmaxs[0]
|
||||
|| clip->boxmins[1] > touch->origin[1]+bmaxs[1]
|
||||
|| clip->boxmins[2] > touch->origin[2]+bmaxs[2]
|
||||
|
@ -2488,22 +2522,10 @@ static void World_ClipToNetwork (world_t *w, moveclip_t *clip)
|
|||
if (!((int)clip->passedict->xv->dimension_hit & 1))
|
||||
continue;
|
||||
|
||||
if (!model || model->loadstate != MLS_LOADED || !model->funcs.NativeTrace)
|
||||
{
|
||||
model = NULL;
|
||||
|
||||
if (clip->hitcontentsmask & FTECONTENTS_BODY)
|
||||
touchcontents = FTECONTENTS_CORPSE|FTECONTENTS_BODY;
|
||||
else
|
||||
touchcontents = 0;
|
||||
|
||||
World_HullForBox(bmins, bmaxs);
|
||||
}
|
||||
|
||||
framestate.g[FS_REG].frame[0] = touch->frame;
|
||||
framestate.g[FS_REG].lerpweight[0] = 1;
|
||||
|
||||
if (World_TransformedTrace(model, 0, &framestate, clip->start, clip->end, clip->mins, clip->maxs, clip->capsule, &trace, touch->origin, vec3_origin, clip->hitcontentsmask))
|
||||
if (World_TransformedTrace(model, 0, &framestate, clip->start, clip->end, clip->mins, clip->maxs, clip->capsule, &trace, touch->origin, ang, clip->hitcontentsmask))
|
||||
{
|
||||
// if using hitmodel, we know it hit the bounding box, so try a proper trace now.
|
||||
/*if (clip->type & MOVE_HITMODEL && (trace.fraction != 1 || trace.startsolid) && !model)
|
||||
|
@ -2519,7 +2541,7 @@ static void World_ClipToNetwork (world_t *w, moveclip_t *clip)
|
|||
}*/
|
||||
}
|
||||
|
||||
if (model && touchcontents != ~0)
|
||||
if (touchcontents != ~0)
|
||||
trace.contents = touchcontents;
|
||||
|
||||
if (trace.fraction < clip->trace.fraction)
|
||||
|
|
Loading…
Reference in a new issue