Skip to content

Instantly share code, notes, and snippets.

@LuxXx
Created December 28, 2016 17:05
Show Gist options
  • Save LuxXx/6a9370ea9120e82dd8c170d77f68782c to your computer and use it in GitHub Desktop.
Save LuxXx/6a9370ea9120e82dd8c170d77f68782c to your computer and use it in GitHub Desktop.
Urban Terror 4.1 Scope Removal - Add r_ScopeRemoval to cvars - RE_RegisterShader in tr_shader.c - Written in 2012
/*
====================
RE_RegisterShader
This is the exported shader entry point for the rest of the system
It will always return an index that will be valid.
This should really only be used for explicit shaders, because there is no
way to ask for different implicit lighting modes (vertex, lightmap, etc)
====================
*/
qhandle_t RE_RegisterShader( const char *name ) {
shader_t *sh;
if ( strlen( name ) >= MAX_QPATH ) {
Com_Printf( "Shader name exceeds MAX_QPATH\n" );
return 0;
}
sh = R_FindShader( name, LIGHTMAP_2D, qtrue );
// we want to return 0 if the shader failed to
// load for some reason, but R_FindShader should
// still keep a name allocated for it, so if
// something calls RE_RegisterShader again with
// the same name, we don't try looking for it again
if ( sh->defaultShader ) {
return 0;
}
if (r_ScopeRemoval->integer > 0) {
if ( !strcmp(name,"gfx/crosshairs/scopes/scope") ) {
return 0;
}
}
return sh->index;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment