ref_gl: fix out-by-one when all lightstyles are used. Also fix broken in this case in vbo after previous fix

This commit is contained in:
mittorn 2023-10-16 16:28:17 +03:00 committed by Alibek Omarov
parent 96f7f5457d
commit b81f94518a
1 changed files with 3 additions and 3 deletions

View File

@ -1182,7 +1182,7 @@ dynamic:
if( is_dynamic )
{
if(( fa->styles[maps] >= 32 || fa->styles[maps] == 0 || fa->styles[maps] == 20 ) && ( fa->dlightframe != tr.framecount ))
if(( maps < MAXLIGHTMAPS ) && ( fa->styles[maps] >= 32 || fa->styles[maps] == 0 || fa->styles[maps] == 20 ) && ( fa->dlightframe != tr.framecount ))
{
byte temp[132*132*4];
mextrasurf_t *info = fa->info;
@ -2878,11 +2878,11 @@ static qboolean R_CheckLightMap( msurface_t *fa )
}
// already up to date
if( !is_dynamic && ( fa->dlightframe != tr.framecount || maps == MAXLIGHTMAPS ) )
if( !is_dynamic && ( fa->dlightframe != tr.framecount ))
return false;
// build lightmap
if(( fa->styles[maps] >= 32 || fa->styles[maps] == 0 ) && ( fa->dlightframe != tr.framecount ))
if(( maps < MAXLIGHTMAPS ) && ( fa->styles[maps] >= 32 || fa->styles[maps] == 0 ) && ( fa->dlightframe != tr.framecount ))
{
byte temp[132*132*4];
int smax, tmax;