mirror of
https://github.com/ioquake/ioq3.git
synced 2024-11-10 07:11:46 +00:00
Improve warning for too many skin surfaces
This commit is contained in:
parent
904bbc1a8f
commit
dd73e19546
2 changed files with 24 additions and 14 deletions
|
@ -1519,6 +1519,7 @@ qhandle_t RE_RegisterSkin( const char *name ) {
|
|||
char *text_p;
|
||||
char *token;
|
||||
char surfName[MAX_QPATH];
|
||||
int totalSurfaces;
|
||||
|
||||
if ( !name || !name[0] ) {
|
||||
ri.Printf( PRINT_DEVELOPER, "Empty name passed to RE_RegisterSkin\n" );
|
||||
|
@ -1569,6 +1570,7 @@ qhandle_t RE_RegisterSkin( const char *name ) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
totalSurfaces = 0;
|
||||
text_p = text.c;
|
||||
while ( text_p && *text_p ) {
|
||||
// get surface name
|
||||
|
@ -1592,19 +1594,22 @@ qhandle_t RE_RegisterSkin( const char *name ) {
|
|||
// parse the shader name
|
||||
token = CommaParse( &text_p );
|
||||
|
||||
if ( skin->numSurfaces >= MAX_SKIN_SURFACES ) {
|
||||
ri.Printf( PRINT_WARNING, "WARNING: Ignoring surfaces in '%s', the max is %d surfaces!\n", name, MAX_SKIN_SURFACES );
|
||||
break;
|
||||
if ( skin->numSurfaces < MAX_SKIN_SURFACES ) {
|
||||
surf = &parseSurfaces[skin->numSurfaces];
|
||||
Q_strncpyz( surf->name, surfName, sizeof( surf->name ) );
|
||||
surf->shader = R_FindShader( token, LIGHTMAP_NONE, qtrue );
|
||||
skin->numSurfaces++;
|
||||
}
|
||||
|
||||
surf = &parseSurfaces[skin->numSurfaces];
|
||||
Q_strncpyz( surf->name, surfName, sizeof( surf->name ) );
|
||||
surf->shader = R_FindShader( token, LIGHTMAP_NONE, qtrue );
|
||||
skin->numSurfaces++;
|
||||
totalSurfaces++;
|
||||
}
|
||||
|
||||
ri.FS_FreeFile( text.v );
|
||||
|
||||
if ( totalSurfaces > MAX_SKIN_SURFACES ) {
|
||||
ri.Printf( PRINT_WARNING, "WARNING: Ignoring excess surfaces (found %d, max is %d) in skin '%s'!\n",
|
||||
totalSurfaces, MAX_SKIN_SURFACES, name );
|
||||
}
|
||||
|
||||
// never let a skin have 0 shaders
|
||||
if ( skin->numSurfaces == 0 ) {
|
||||
|
|
|
@ -3071,6 +3071,7 @@ qhandle_t RE_RegisterSkin( const char *name ) {
|
|||
char *text_p;
|
||||
char *token;
|
||||
char surfName[MAX_QPATH];
|
||||
int totalSurfaces;
|
||||
|
||||
if ( !name || !name[0] ) {
|
||||
ri.Printf( PRINT_DEVELOPER, "Empty name passed to RE_RegisterSkin\n" );
|
||||
|
@ -3121,6 +3122,7 @@ qhandle_t RE_RegisterSkin( const char *name ) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
totalSurfaces = 0;
|
||||
text_p = text.c;
|
||||
while ( text_p && *text_p ) {
|
||||
// get surface name
|
||||
|
@ -3144,19 +3146,22 @@ qhandle_t RE_RegisterSkin( const char *name ) {
|
|||
// parse the shader name
|
||||
token = CommaParse( &text_p );
|
||||
|
||||
if ( skin->numSurfaces >= MAX_SKIN_SURFACES ) {
|
||||
ri.Printf( PRINT_WARNING, "WARNING: Ignoring surfaces in '%s', the max is %d surfaces!\n", name, MAX_SKIN_SURFACES );
|
||||
break;
|
||||
if ( skin->numSurfaces < MAX_SKIN_SURFACES ) {
|
||||
surf = &parseSurfaces[skin->numSurfaces];
|
||||
Q_strncpyz( surf->name, surfName, sizeof( surf->name ) );
|
||||
surf->shader = R_FindShader( token, LIGHTMAP_NONE, qtrue );
|
||||
skin->numSurfaces++;
|
||||
}
|
||||
|
||||
surf = &parseSurfaces[skin->numSurfaces];
|
||||
Q_strncpyz( surf->name, surfName, sizeof( surf->name ) );
|
||||
surf->shader = R_FindShader( token, LIGHTMAP_NONE, qtrue );
|
||||
skin->numSurfaces++;
|
||||
totalSurfaces++;
|
||||
}
|
||||
|
||||
ri.FS_FreeFile( text.v );
|
||||
|
||||
if ( totalSurfaces > MAX_SKIN_SURFACES ) {
|
||||
ri.Printf( PRINT_WARNING, "WARNING: Ignoring excess surfaces (found %d, max is %d) in skin '%s'!\n",
|
||||
totalSurfaces, MAX_SKIN_SURFACES, name );
|
||||
}
|
||||
|
||||
// never let a skin have 0 shaders
|
||||
if ( skin->numSurfaces == 0 ) {
|
||||
|
|
Loading…
Reference in a new issue