make SURF_LIGHTBOTHSIDES work and fix a bug in Mod_PointInLeaf that was

preventing grenades from lighting up surfaces when using the vis lighting
This commit is contained in:
Bill Currie 2001-08-05 05:59:15 +00:00
parent 8883bbb369
commit dcc6a76313
3 changed files with 14 additions and 11 deletions

View file

@ -102,6 +102,9 @@ typedef struct texture_s
#define SURF_DRAWBACKGROUND 0x40
#define SURF_UNDERWATER 0x80
#define SURF_DONTWARP 0x100
#define SURF_DRAWNOALPHA 0x200
#define SURF_DRAWFULLBRIGHT 0x400
#define SURF_LIGHTBOTHSIDES 0x800
// !!! if this is changed, it must be changed in asm_draw.h too !!!
typedef struct

View file

@ -80,7 +80,7 @@ Mod_PointInLeaf (vec3_t p, model_t *model)
return (mleaf_t *) node;
plane = node->plane;
d = DotProduct (p, plane->normal) - plane->dist;
if (d > 0)
if (d >= 0)
node = node->children[0];
else
node = node->children[1];
@ -537,7 +537,9 @@ Mod_LoadFaces (lump_t *l)
if (out->texinfo->texture->name[0] == '*') // turbulent
{
out->flags |= (SURF_DRAWTURB | SURF_DRAWTILED);
out->flags |= (SURF_DRAWTURB
| SURF_DRAWTILED
| SURF_LIGHTBOTHSIDES);
for (i = 0; i < 2; i++) {
out->extents[i] = 16384;
out->texturemins[i] = -8192;

View file

@ -288,23 +288,21 @@ static void
mark_surfaces (msurface_t *surf, vec3_t lightorigin, dlight_t *light,
int bit)
{
float dist, dist2, d;
float dist;
#if 1
float dist2, d;
float maxdist = light->radius * light->radius;
vec3_t impact;
#endif
surf->dlightframe = r_framecount;
dist = PlaneDiff(lightorigin, surf->plane);
if (surf->flags & SURF_PLANEBACK)
dist = -dist;
#if 0
//FIXME SURF_LIGHTBOTHSIDES seems to be a darkplaces thing. need to investigate
if ((dist < -0.25f && !(surf->flags & SURF_LIGHTBOTHSIDES))
|| dist > radius)
|| dist > light->radius)
return;
#else
if (dist < -0.25f || dist > light->radius)
return;
#endif
#if 1
dist2 = dist * dist;
dist = -dist;
VectorMA (light->origin, dist, surf->plane->normal, impact);
@ -337,7 +335,7 @@ mark_surfaces (msurface_t *surf, vec3_t lightorigin, dlight_t *light,
return;
}
}
#endif
if (surf->dlightframe != r_framecount) {
surf->dlightbits = 0;
surf->dlightframe = r_framecount;