Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

client: render: fix wrong checks. #195

Merged
merged 1 commit into from
Nov 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
20 changes: 15 additions & 5 deletions client/render/gl_grass.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1109,13 +1109,20 @@ R_GrassTextureForName
find or add unique texture for grass
================
*/
byte R_GrassTextureForName( const char *name )
int R_GrassTextureForName( const char *name, byte *tex )
{
byte i;
size_t i;

for( i = 0; i < GRASS_TEXTURES && grasstexs[i].name[0]; i++ )
nekonomicon marked this conversation as resolved.
Show resolved Hide resolved
{
if( !Q_stricmp( grasstexs[i].name, name ))
return i; // found
goto end; // found
SNMetamorph marked this conversation as resolved.
Show resolved Hide resolved
}

if( i == GRASS_TEXTURES )
{
ALERT( at_warning, "limit of grass textures was exceeded %d\n", GRASS_TEXTURES );
return 1;
}

// allocate a new one
Expand All @@ -1128,7 +1135,9 @@ byte R_GrassTextureForName( const char *name )
grasstexs[i].gl_texturenum = tr.defaultTexture;
}

return i;
end:
*tex = (byte)i;
return 0;
}

/*
Expand Down Expand Up @@ -1692,7 +1701,8 @@ void R_GrassInit( void )
continue;
}

entry.texture = R_GrassTextureForName( token );
if( R_GrassTextureForName( token, &entry.texture ))
break;

pfile = COM_ParseLine( pfile, token );
if( !pfile )
Expand Down
2 changes: 1 addition & 1 deletion client/render/gl_lightmap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -753,4 +753,4 @@ void R_UpdateSurfaceParams( mstudiosurface_t *surf )
// check for lightmap modification
if( FBitSet( surf->flags, SURF_LM_UPDATE|SURF_DM_UPDATE ))
R_UpdateLightMap( surf );
}
}
2 changes: 1 addition & 1 deletion client/render/gl_local.h
Original file line number Diff line number Diff line change
Expand Up @@ -519,7 +519,7 @@ typedef struct
CUtlArray<gl_state_t> cached_state;

gl_lightmap_t lightmaps[MAX_LIGHTMAPS];
byte current_lightmap_texture;
uint32_t current_lightmap_texture;
TextureHandle packed_lights_texture;
TextureHandle packed_planes_texture;
TextureHandle packed_nodes_texture;
Expand Down