Skip to content

Commit

Permalink
Move some early returns before we actually access data
Browse files Browse the repository at this point in the history
  • Loading branch information
VReaperV committed Jan 28, 2025
1 parent dc1cda7 commit 6f385f6
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/engine/renderer/tr_scene.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -299,14 +299,6 @@ void RE_AddDynamicLightToScene( const vec3_t org, float radius, float intensity,
return;
}

// set last lights restrictInteractionEnd if needed
if ( r_numLights > r_firstSceneLight ) {
light = &backEndData[ tr.smpFrame ]->lights[ r_numLights - 1 ];
if( light->restrictInteractionFirst >= 0 ) {
light->restrictInteractionLast = r_numEntities - r_firstSceneEntity - 1;
}
}

if ( r_numLights >= MAX_REF_LIGHTS )
{
return;
Expand All @@ -317,6 +309,14 @@ void RE_AddDynamicLightToScene( const vec3_t org, float radius, float intensity,
return;
}

// set last lights restrictInteractionEnd if needed
if ( r_numLights > r_firstSceneLight ) {
light = &backEndData[ tr.smpFrame ]->lights[ r_numLights - 1 ];
if( light->restrictInteractionFirst >= 0 ) {
light->restrictInteractionLast = r_numEntities - r_firstSceneEntity - 1;
}
}

light = &backEndData[ tr.smpFrame ]->lights[ r_numLights++ ];

light->l.rlType = refLightType_t::RL_OMNI;
Expand Down

0 comments on commit 6f385f6

Please sign in to comment.