- fixed: IsVisibleToPlayer needs to be checked for the owner of owned dynamic lights.

This commit is contained in:
Christoph Oelckers 2013-11-30 13:15:22 +01:00
parent 992994239b
commit 9ac3b6aa1b
2 changed files with 36 additions and 29 deletions

View file

@ -183,6 +183,10 @@ bool gl_SetupLight(Plane & p, ADynamicLight * light, Vector & nearPt, Vector & u
{ {
return false; return false;
} }
if (light->owned && light->target != NULL && !light->target->IsVisibleToPlayer())
{
return false;
}
scale = 1.0f / ((2.f * radius) - dist); scale = 1.0f / ((2.f * radius) - dist);

View file

@ -79,10 +79,12 @@ bool gl_GetSpriteLight(AActor *self, fixed_t x, fixed_t y, fixed_t z, subsector_
while (node) while (node)
{ {
light=node->lightsource; light=node->lightsource;
if (!light->owned || light->target == NULL || light->target->IsVisibleToPlayer())
{
if (!(light->flags2&MF2_DORMANT) && if (!(light->flags2&MF2_DORMANT) &&
(!(light->flags4&MF4_DONTLIGHTSELF) || light->target != self)) (!(light->flags4&MF4_DONTLIGHTSELF) || light->target != self))
{ {
float dist = FVector3( FIXED2FLOAT(x - light->x), FIXED2FLOAT(y - light->y), FIXED2FLOAT(z - light->z) ).Length(); float dist = FVector3(FIXED2FLOAT(x - light->x), FIXED2FLOAT(y - light->y), FIXED2FLOAT(z - light->z)).Length();
radius = light->GetRadius() * gl_lights_size; radius = light->GetRadius() * gl_lights_size;
if (dist < radius) if (dist < radius)
@ -118,6 +120,7 @@ bool gl_GetSpriteLight(AActor *self, fixed_t x, fixed_t y, fixed_t z, subsector_
} }
} }
} }
}
node = node->nextLight; node = node->nextLight;
} }
} }