Fix some bugs that are exhibited in taov.

git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5949 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
Spoike 2021-07-06 00:04:41 +00:00
parent 5d75f6fa50
commit e7822ff2bf
2 changed files with 22 additions and 27 deletions

View File

@ -1231,13 +1231,9 @@ static qboolean BIH_Trace(model_t *model, int forcehullnum, const framestate_t *
tr.trace.fraction = tr.trace.truefraction = 1;
tr.trace.surface = &(nullsurface.c);
if (!model) // map not loaded
VectorCopy (end, tr.trace.endpos);
else
if (model) // map is loaded...
{
tr.hitcontents = contents;
VectorCopy (start, tr.startpos);
VectorCopy (end, tr.endpos);
VectorCopy (mins, tr.size.min);
VectorCopy (maxs, tr.size.max);
@ -1320,9 +1316,9 @@ static qboolean BIH_Trace(model_t *model, int forcehullnum, const framestate_t *
for (i = 0; i < 3; i++)
tr.negativedir[i] = (end[i] - start[i]) < 0;
VectorSubtract(end, start, tr.totalmove);
if (start[0] == end[0] && start[1] == end[1] && start[2] == end[2])
tr.negativedir[i] = (tr.endpos[i] - tr.startpos[i]) < 0;
VectorSubtract(tr.endpos, tr.startpos, tr.totalmove);
if (tr.startpos[0] == tr.endpos[0] && tr.startpos[1] == tr.endpos[1] && tr.startpos[2] == tr.endpos[2])
BIH_RecursiveTest(&tr, model->cnodes);
else
{
@ -1332,15 +1328,8 @@ static qboolean BIH_Trace(model_t *model, int forcehullnum, const framestate_t *
BIH_RecursiveTrace(&tr, model->cnodes, &tr.bounds, &worldsize);
}
if (tr.trace.fraction == 1)
VectorCopy (end, tr.trace.endpos);
else
{
if (tr.trace.fraction<0)
tr.trace.fraction=0;
for (i=0 ; i<3 ; i++)
tr.trace.endpos[i] = start[i] + tr.trace.fraction * (end[i] - start[i]);
}
if (tr.trace.fraction<0)
tr.trace.fraction=0;
}
*out_trace = tr.trace;

View File

@ -4231,21 +4231,27 @@ static void QCBUILTIN PF_cvar (pubprogfuncs_t *prinst, struct globalvars_s *pr_g
static void QCBUILTIN PF_sv_getlight (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals)
{
#ifdef HAVE_CLIENT
/*not shared with client - clients get more lights*/
float *point = G_VECTOR(OFS_PARM0);
vec3_t diffuse, ambient, dir;
if (sv.world.worldmodel && sv.world.worldmodel->funcs.LightPointValues)
model_t *wm = sv.world.worldmodel;
if (wm && wm->loadstate == MLS_LOADED && wm->funcs.LightPointValues)
{
sv.world.worldmodel->funcs.LightPointValues(sv.world.worldmodel, point, diffuse, ambient, dir);
VectorMA(ambient, 0.5, diffuse, G_VECTOR(OFS_RETURN));
}
else
{
G_FLOAT(OFS_RETURN+0) = 128;
G_FLOAT(OFS_RETURN+1) = 128;
G_FLOAT(OFS_RETURN+2) = 128;
return;
if (cl_max_lightstyles < wm->lightmaps.maxstyle) //client's light info might not be set up yet. this sucks.
{
wm->funcs.LightPointValues(wm, point, diffuse, ambient, dir);
VectorMA(ambient, 0.5, diffuse, G_VECTOR(OFS_RETURN));
return;
}
}
#endif
//something failed.
G_FLOAT(OFS_RETURN+0) = 128;
G_FLOAT(OFS_RETURN+1) = 128;
G_FLOAT(OFS_RETURN+2) = 128;
}
#ifdef HAVE_LEGACY