Fix a crash/oversight with CSQCs getlight() and fix GLQ3_LightGrid from

using a global that may not even be set. 


git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5957 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
Eukara 2021-07-06 16:32:59 +00:00
parent 07365c6428
commit a6b33d25f2
2 changed files with 7 additions and 1 deletions

View File

@ -5417,6 +5417,12 @@ static void QCBUILTIN PF_cs_droptofloor (pubprogfuncs_t *prinst, struct globalva
static void QCBUILTIN PF_cl_getlight (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals)
{
vec3_t ambient, diffuse, dir;
if (cl_max_lightstyles < csqc_world.worldmodel->lightmaps.maxstyle) {
VectorSet(G_VECTOR(OFS_RETURN), 0, 0, 0);
return;
}
if (!csqc_world.worldmodel || csqc_world.worldmodel->loadstate != MLS_LOADED || !csqc_world.worldmodel->funcs.LightPointValues)
VectorSet(G_VECTOR(OFS_RETURN), 0, 0, 0);
else

View File

@ -2348,7 +2348,7 @@ static void GLQ3_AddLatLong(const qbyte latlong[2], vec3_t dir, float mag)
void GLQ3_LightGrid(model_t *mod, const vec3_t point, vec3_t res_diffuse, vec3_t res_ambient, vec3_t res_dir)
{
q3lightgridinfo_t *lg = (q3lightgridinfo_t *)cl.worldmodel->lightgrid;
q3lightgridinfo_t *lg = (q3lightgridinfo_t *)mod->lightgrid;
int index[8];
int vi[3];
int i, j;