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.fraction = tr.trace.truefraction = 1;
tr.trace.surface = &(nullsurface.c); tr.trace.surface = &(nullsurface.c);
if (!model) // map not loaded if (model) // map is loaded...
VectorCopy (end, tr.trace.endpos);
else
{ {
tr.hitcontents = contents; tr.hitcontents = contents;
VectorCopy (start, tr.startpos);
VectorCopy (end, tr.endpos);
VectorCopy (mins, tr.size.min); VectorCopy (mins, tr.size.min);
VectorCopy (maxs, tr.size.max); 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++) for (i = 0; i < 3; i++)
tr.negativedir[i] = (end[i] - start[i]) < 0; tr.negativedir[i] = (tr.endpos[i] - tr.startpos[i]) < 0;
VectorSubtract(end, start, tr.totalmove); VectorSubtract(tr.endpos, tr.startpos, tr.totalmove);
if (start[0] == end[0] && start[1] == end[1] && start[2] == end[2]) if (tr.startpos[0] == tr.endpos[0] && tr.startpos[1] == tr.endpos[1] && tr.startpos[2] == tr.endpos[2])
BIH_RecursiveTest(&tr, model->cnodes); BIH_RecursiveTest(&tr, model->cnodes);
else 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); BIH_RecursiveTrace(&tr, model->cnodes, &tr.bounds, &worldsize);
} }
if (tr.trace.fraction == 1) if (tr.trace.fraction<0)
VectorCopy (end, tr.trace.endpos); tr.trace.fraction=0;
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]);
}
} }
*out_trace = tr.trace; *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) 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*/ /*not shared with client - clients get more lights*/
float *point = G_VECTOR(OFS_PARM0); float *point = G_VECTOR(OFS_PARM0);
vec3_t diffuse, ambient, dir; 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); if (cl_max_lightstyles < wm->lightmaps.maxstyle) //client's light info might not be set up yet. this sucks.
VectorMA(ambient, 0.5, diffuse, G_VECTOR(OFS_RETURN)); {
} wm->funcs.LightPointValues(wm, point, diffuse, ambient, dir);
else VectorMA(ambient, 0.5, diffuse, G_VECTOR(OFS_RETURN));
{ return;
G_FLOAT(OFS_RETURN+0) = 128; }
G_FLOAT(OFS_RETURN+1) = 128;
G_FLOAT(OFS_RETURN+2) = 128;
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 #ifdef HAVE_LEGACY