Skip to content

Commit

Permalink
Add warnings for animMap and videoMap shader keywords
Browse files Browse the repository at this point in the history
  • Loading branch information
zturtleman committed Jul 2, 2017
1 parent 5aa7fb3 commit 4dffc52
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
10 changes: 10 additions & 0 deletions code/renderergl1/tr_shader.c
Expand Up @@ -687,6 +687,8 @@ static qboolean ParseStage( shaderStage_t *stage, char **text )
//
else if ( !Q_stricmp( token, "animMap" ) )
{
int totalImages = 0;

token = COM_ParseExt( text, qfalse );
if ( !token[0] )
{
Expand Down Expand Up @@ -721,6 +723,12 @@ static qboolean ParseStage( shaderStage_t *stage, char **text )
}
stage->bundle[0].numImageAnimations++;
}
totalImages++;
}

if ( totalImages > MAX_IMAGE_ANIMATIONS ) {
ri.Printf( PRINT_WARNING, "WARNING: ignoring excess images for 'animMap' (found %d, max is %d) in shader '%s'\n",
totalImages, MAX_IMAGE_ANIMATIONS, shader.name );
}
}
else if ( !Q_stricmp( token, "videoMap" ) )
Expand All @@ -735,6 +743,8 @@ static qboolean ParseStage( shaderStage_t *stage, char **text )
if (stage->bundle[0].videoMapHandle != -1) {
stage->bundle[0].isVideoMap = qtrue;
stage->bundle[0].image[0] = tr.scratchImage[stage->bundle[0].videoMapHandle];
} else {
ri.Printf( PRINT_WARNING, "WARNING: could not load '%s' for 'videoMap' keyword in shader '%s'\n", token, shader.name );
}
}
//
Expand Down
10 changes: 10 additions & 0 deletions code/renderergl2/tr_shader.c
Expand Up @@ -744,6 +744,8 @@ static qboolean ParseStage( shaderStage_t *stage, char **text )
//
else if ( !Q_stricmp( token, "animMap" ) )
{
int totalImages = 0;

token = COM_ParseExt( text, qfalse );
if ( !token[0] )
{
Expand Down Expand Up @@ -778,6 +780,12 @@ static qboolean ParseStage( shaderStage_t *stage, char **text )
}
stage->bundle[0].numImageAnimations++;
}
totalImages++;
}

if ( totalImages > MAX_IMAGE_ANIMATIONS ) {
ri.Printf( PRINT_WARNING, "WARNING: ignoring excess images for 'animMap' (found %d, max is %d) in shader '%s'\n",
totalImages, MAX_IMAGE_ANIMATIONS, shader.name );
}
}
else if ( !Q_stricmp( token, "videoMap" ) )
Expand All @@ -792,6 +800,8 @@ static qboolean ParseStage( shaderStage_t *stage, char **text )
if (stage->bundle[0].videoMapHandle != -1) {
stage->bundle[0].isVideoMap = qtrue;
stage->bundle[0].image[0] = tr.scratchImage[stage->bundle[0].videoMapHandle];
} else {
ri.Printf( PRINT_WARNING, "WARNING: could not load '%s' for 'videoMap' keyword in shader '%s'\n", token, shader.name );
}
}
//
Expand Down

0 comments on commit 4dffc52

Please sign in to comment.