Skip to content

Commit

Permalink
client: fix wrong checks.
Browse files Browse the repository at this point in the history
  • Loading branch information
nekonomicon committed Oct 30, 2023
1 parent f950005 commit 77fa815
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion client/render/gl_deferred.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -554,7 +554,7 @@ void GL_SetupWorldScenePass( void )

void GL_DrawDeferredPass( void )
{
if( !tr.defSceneShader || !tr.defLightShader )
if( !tr.defSceneShader[0] || !tr.defSceneShader[1] || !tr.defLightShader )
return; // oops!

GL_DEBUG_SCOPE();
Expand Down
2 changes: 1 addition & 1 deletion client/render/gl_grass.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1112,7 +1112,7 @@ find or add unique texture for grass
byte R_GrassTextureForName( const char *name )
{
byte i;
for( i = 0; i < GRASS_TEXTURES && grasstexs[i].name[0]; i++ )
for( i = 0; i <= GRASS_TEXTURES - 1 && grasstexs[i].name[0]; i++ )
{
if( !Q_stricmp( grasstexs[i].name, name ))
return i; // found
Expand Down
5 changes: 3 additions & 2 deletions client/render/gl_lightmap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,8 @@ static void LM_GoToNextPage( void )

if( lms->state != LM_DONE ) return; // current atlas not completed

if( ++tr.current_lightmap_texture == MAX_LIGHTMAPS )
// There may be overflow because type of current_lightmap_texture is byte(uint8_t).
if( ++tr.current_lightmap_texture == 0 ) // MAX_LIGHTMAPS
HOST_ERROR( "MAX_LIGHTMAPS limit exceded\n" );
}

Expand Down Expand Up @@ -753,4 +754,4 @@ void R_UpdateSurfaceParams( mstudiosurface_t *surf )
// check for lightmap modification
if( FBitSet( surf->flags, SURF_LM_UPDATE|SURF_DM_UPDATE ))
R_UpdateLightMap( surf );
}
}

0 comments on commit 77fa815

Please sign in to comment.