ent_nextlight (ENTITY*,var num);

A7.20 Returns a pointer to the next light emitting entity in range of the given entity. A7.82 Copies light data into the hit struct.


ENTITY* - Entity pointer
- Number of the light (1..7), with 1 the closest and 7 the furthest light in range.


ENTITY* - Pointer to the light emitting entity, or A7.82 level_ent for a level-placed dynamic light or the sun, or NULL when no more light was in range.



Modifies: A7.82

hit.x y z - set to the light position.
hit.nx ny nz - set to the light direction.
hit.blue green red - set to the light color.
hit.entity - set to the light emitting entity, or to NULL if it's a light placed in the level.
hit.model - pointer to the D3DLIGHT9 struct of the light.


Example (lite-C):

function extinguish_closest_light()
   int i;
   for (i=1; i<8; i++) {   
     ENTITY* light = ent_nextlight(my,i); // find closest light that is not WED-placed...
     if (light == level_ent) continue;
     if (!light) break;
   if (light && light != level_ent) 
     light.lightrange = 0; // and extinguish it 

See also:

ent_next, ent_pvs, lightrange, vecLightPos, view_to_light

► latest version online