Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do more checks before flagging a model to be lit #206

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions cl_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -1306,7 +1306,7 @@ static void CL_UpdateNetworkEntity(entity_t *e, int recursionlimit, qbool interp
if (e->state_current.number == cl.viewentity)
e->render.flags |= RENDER_EXTERIORMODEL;
// either fullbright or lit
if(!r_fullbright.integer)
if(!r_fullbright.integer && (e->render.model && e->render.model->lit))
{
if (!(e->render.effects & EF_FULLBRIGHT))
e->render.flags |= RENDER_LIGHT;
Expand Down Expand Up @@ -1720,7 +1720,7 @@ static void CL_RelinkWorld(void)
// FIXME: this should be done at load
ent->render.matrix = identitymatrix;
ent->render.flags = RENDER_SHADOW;
if (!r_fullbright.integer)
if (!r_fullbright.integer && (ent->render.model && ent->render.model->lit))
ent->render.flags |= RENDER_LIGHT;
VectorSet(ent->render.colormod, 1, 1, 1);
VectorSet(ent->render.glowmod, 1, 1, 1);
Expand All @@ -1745,7 +1745,7 @@ static void CL_RelinkStaticEntities(void)
// need to re-fetch the model pointer
e->render.model = CL_GetModelByIndex(e->state_baseline.modelindex);
// either fullbright or lit
if(!r_fullbright.integer)
if(!r_fullbright.integer && (e->render.model && e->render.model->lit))
{
if (!(e->render.effects & EF_FULLBRIGHT))
e->render.flags |= RENDER_LIGHT;
Expand Down
4 changes: 1 addition & 3 deletions model_brush.c
Original file line number Diff line number Diff line change
Expand Up @@ -2714,15 +2714,13 @@ static void Mod_Q1BSP_LoadFaces(sizebuf_t *sb)
if (lightmapoffset == -1)
{
surface->lightmapinfo->samples = NULL;
#if 1
// give non-lightmapped water a 1x white lightmap
if (!loadmodel->brush.isq2bsp && surface->texture->name[0] == '*' && (surface->lightmapinfo->texinfo->q1flags & TEX_SPECIAL) && ssize <= 256 && tsize <= 256)
{
surface->lightmapinfo->samples = (unsigned char *)Mem_Alloc(loadmodel->mempool, ssize * tsize * 3);
surface->lightmapinfo->styles[0] = 0;
memset(surface->lightmapinfo->samples, 128, ssize * tsize * 3);
}
#endif
}
else if (loadmodel->brush.ishlbsp || loadmodel->brush.isq2bsp) // LadyHavoc: HalfLife map (bsp version 30)
surface->lightmapinfo->samples = loadmodel->brushq1.lightdata + lightmapoffset;
Expand All @@ -2734,7 +2732,7 @@ static void Mod_Q1BSP_LoadFaces(sizebuf_t *sb)
}

// check if we should apply a lightmap to this
if (!(surface->lightmapinfo->texinfo->q1flags & TEX_SPECIAL) || surface->lightmapinfo->samples)
if ((!(surface->lightmapinfo->texinfo->q1flags & TEX_SPECIAL) || surface->lightmapinfo->samples) && loadmodel->brushq1.lightdata)
{
if (ssize > 256 || tsize > 256)
Host_Error("Bad surface extents");
Expand Down
Loading