mirror of
https://github.com/openmoh/openmohaa.git
synced 2025-04-28 13:47:58 +03:00
Prevent lightmapIndex from going below LIGHTMAP_2D
This commit is contained in:
parent
47cd8ccfc8
commit
c2bac6d1ef
1 changed files with 4 additions and 0 deletions
|
@ -3362,6 +3362,10 @@ shader_t* R_FindShader(const char* name, int lightmapIndex, qboolean mipRawImage
|
||||||
// lightmaps
|
// lightmaps
|
||||||
if ( lightmapIndex >= 0 && lightmapIndex >= tr.numLightmaps ) {
|
if ( lightmapIndex >= 0 && lightmapIndex >= tr.numLightmaps ) {
|
||||||
lightmapIndex = LIGHTMAP_BY_VERTEX;
|
lightmapIndex = LIGHTMAP_BY_VERTEX;
|
||||||
|
} else if ( lightmapIndex < LIGHTMAP_2D ) {
|
||||||
|
// negative lightmap indexes cause stray pointers (think tr.lightmaps[lightmapIndex])
|
||||||
|
ri.Printf( PRINT_WARNING, "WARNING: shader '%s' has invalid lightmap index of %d\n", name, lightmapIndex );
|
||||||
|
lightmapIndex = LIGHTMAP_BY_VERTEX;
|
||||||
}
|
}
|
||||||
|
|
||||||
COM_StripExtension( name, strippedName, sizeof(strippedName));
|
COM_StripExtension( name, strippedName, sizeof(strippedName));
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue