[iortcw] 57/89: All: Improve warning for too many skin surfaces
Simon McVittie
smcv at debian.org
Fri Sep 8 10:44:27 UTC 2017
This is an automated email from the git hooks/post-receive script.
smcv pushed a commit to tag 1.51b
in repository iortcw.
commit b784296dabaf06598ccc545694e8c836f6507795
Author: MAN-AT-ARMS <M4N4T4RMS at gmail.com>
Date: Thu Jul 20 11:11:00 2017 -0400
All: Improve warning for too many skin surfaces
---
MP/code/rend2/tr_animation.c | 1 -
MP/code/rend2/tr_image.c | 20 ++++++++++++--------
MP/code/renderer/tr_animation.c | 1 -
MP/code/renderer/tr_cmesh.c | 1 -
MP/code/renderer/tr_image.c | 20 ++++++++++++--------
SP/code/rend2/tr_image.c | 20 ++++++++++++--------
SP/code/renderer/tr_image.c | 20 ++++++++++++--------
7 files changed, 48 insertions(+), 35 deletions(-)
diff --git a/MP/code/rend2/tr_animation.c b/MP/code/rend2/tr_animation.c
index 7cfd936..170b843 100644
--- a/MP/code/rend2/tr_animation.c
+++ b/MP/code/rend2/tr_animation.c
@@ -365,7 +365,6 @@ void R_AddAnimSurfaces( trRefEntity_t *ent ) {
if ( shader == tr.defaultShader ) { // blink reference in skin was not found
for ( j = 0 ; j < skin->numSurfaces ; j++ ) {
// the names have both been lowercased
-
if ( !strcmp( skin->surfaces[j].name, surface->name ) ) {
shader = skin->surfaces[j].shader;
break;
diff --git a/MP/code/rend2/tr_image.c b/MP/code/rend2/tr_image.c
index 834dc2a..272b014 100644
--- a/MP/code/rend2/tr_image.c
+++ b/MP/code/rend2/tr_image.c
@@ -3235,6 +3235,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" );
@@ -3300,6 +3301,7 @@ qhandle_t RE_RegisterSkin( const char *name ) {
//----(SA) end
+ totalSurfaces = 0;
text_p = text.c;
while ( text_p && *text_p ) {
// get surface name
@@ -3351,22 +3353,24 @@ 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
-
//----(SA) allow this for the (current) special case of the loper's upper body
// (it's upper body has no surfaces, only tags)
if ( skin->numSurfaces == 0 ) {
diff --git a/MP/code/renderer/tr_animation.c b/MP/code/renderer/tr_animation.c
index 2dc73b8..2aa751a 100644
--- a/MP/code/renderer/tr_animation.c
+++ b/MP/code/renderer/tr_animation.c
@@ -363,7 +363,6 @@ void R_AddAnimSurfaces( trRefEntity_t *ent ) {
if ( shader == tr.defaultShader ) { // blink reference in skin was not found
for ( j = 0 ; j < skin->numSurfaces ; j++ ) {
// the names have both been lowercased
-
if ( !strcmp( skin->surfaces[j].name, surface->name ) ) {
shader = skin->surfaces[j].shader;
break;
diff --git a/MP/code/renderer/tr_cmesh.c b/MP/code/renderer/tr_cmesh.c
index 365e461..de5d24b 100644
--- a/MP/code/renderer/tr_cmesh.c
+++ b/MP/code/renderer/tr_cmesh.c
@@ -386,7 +386,6 @@ void R_AddMDCSurfaces( trRefEntity_t *ent ) {
if ( shader == tr.defaultShader ) { // blink reference in skin was not found
for ( j = 0 ; j < skin->numSurfaces ; j++ ) {
// the names have both been lowercased
-
if ( !strcmp( skin->surfaces[j].name, surface->name ) ) {
shader = skin->surfaces[j].shader;
break;
diff --git a/MP/code/renderer/tr_image.c b/MP/code/renderer/tr_image.c
index 402f117..278fdf6 100644
--- a/MP/code/renderer/tr_image.c
+++ b/MP/code/renderer/tr_image.c
@@ -1891,6 +1891,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" );
@@ -1956,6 +1957,7 @@ qhandle_t RE_RegisterSkin( const char *name ) {
//----(SA) end
+ totalSurfaces = 0;
text_p = text.c;
while ( text_p && *text_p ) {
// get surface name
@@ -2007,22 +2009,24 @@ 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
-
//----(SA) allow this for the (current) special case of the loper's upper body
// (it's upper body has no surfaces, only tags)
if ( skin->numSurfaces == 0 ) {
diff --git a/SP/code/rend2/tr_image.c b/SP/code/rend2/tr_image.c
index 32b9c83..5a02fe9 100644
--- a/SP/code/rend2/tr_image.c
+++ b/SP/code/rend2/tr_image.c
@@ -3240,6 +3240,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" );
@@ -3305,6 +3306,7 @@ qhandle_t RE_RegisterSkin( const char *name ) {
//----(SA) end
+ totalSurfaces = 0;
text_p = text.c;
while ( text_p && *text_p ) {
// get surface name
@@ -3356,22 +3358,24 @@ 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
-
//----(SA) allow this for the (current) special case of the loper's upper body
// (it's upper body has no surfaces, only tags)
if ( skin->numSurfaces == 0 ) {
diff --git a/SP/code/renderer/tr_image.c b/SP/code/renderer/tr_image.c
index 2ce4d6d..ef166e7 100644
--- a/SP/code/renderer/tr_image.c
+++ b/SP/code/renderer/tr_image.c
@@ -1962,6 +1962,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" );
@@ -2027,6 +2028,7 @@ qhandle_t RE_RegisterSkin( const char *name ) {
//----(SA) end
+ totalSurfaces = 0;
text_p = text.c;
while ( text_p && *text_p ) {
// get surface name
@@ -2078,22 +2080,24 @@ 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
-
//----(SA) allow this for the (current) special case of the loper's upper body
// (it's upper body has no surfaces, only tags)
if ( skin->numSurfaces == 0 ) {
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/iortcw.git
More information about the Pkg-games-commits
mailing list