diff --git a/code/renderergl1/tr_model.c b/code/renderergl1/tr_model.c index 5565de83..bbac11ee 100644 --- a/code/renderergl1/tr_model.c +++ b/code/renderergl1/tr_model.c @@ -459,13 +459,15 @@ static qboolean R_LoadMD3 (model_t *mod, int lod, void *buffer, const char *mod_ LL(surf->ofsEnd); if ( surf->numVerts > SHADER_MAX_VERTEXES ) { - ri.Printf(PRINT_WARNING, "R_LoadMD3: %s has more than %i verts on a surface (%i).\n", - mod_name, SHADER_MAX_VERTEXES, surf->numVerts ); + ri.Printf(PRINT_WARNING, "R_LoadMD3: %s has more than %i verts on %s (%i).\n", + mod_name, SHADER_MAX_VERTEXES, surf->name[0] ? surf->name : "a surface", + surf->numVerts ); return qfalse; } if ( surf->numTriangles*3 > SHADER_MAX_INDEXES ) { - ri.Printf(PRINT_WARNING, "R_LoadMD3: %s has more than %i triangles on a surface (%i).\n", - mod_name, SHADER_MAX_INDEXES / 3, surf->numTriangles ); + ri.Printf(PRINT_WARNING, "R_LoadMD3: %s has more than %i triangles on %s (%i).\n", + mod_name, SHADER_MAX_INDEXES / 3, surf->name[0] ? surf->name : "a surface", + surf->numTriangles ); return qfalse; } @@ -736,14 +738,16 @@ static qboolean R_LoadMDR( model_t *mod, void *buffer, int filesize, const char // now do the checks that may fail. if ( surf->numVerts > SHADER_MAX_VERTEXES ) { - ri.Printf(PRINT_WARNING, "R_LoadMDR: %s has more than %i verts on a surface (%i).\n", - mod_name, SHADER_MAX_VERTEXES, surf->numVerts ); + ri.Printf(PRINT_WARNING, "R_LoadMDR: %s has more than %i verts on %s (%i).\n", + mod_name, SHADER_MAX_VERTEXES, surf->name[0] ? surf->name : "a surface", + surf->numVerts ); return qfalse; } if ( surf->numTriangles*3 > SHADER_MAX_INDEXES ) { - ri.Printf(PRINT_WARNING, "R_LoadMDR: %s has more than %i triangles on a surface (%i).\n", - mod_name, SHADER_MAX_INDEXES / 3, surf->numTriangles ); + ri.Printf(PRINT_WARNING, "R_LoadMDR: %s has more than %i triangles on %s (%i).\n", + mod_name, SHADER_MAX_INDEXES / 3, surf->name[0] ? surf->name : "a surface", + surf->numTriangles ); return qfalse; } // lowercase the surface name so skin compares are faster @@ -950,13 +954,15 @@ static qboolean R_LoadMD4( model_t *mod, void *buffer, const char *mod_name ) { LL(surf->ofsEnd); if ( surf->numVerts > SHADER_MAX_VERTEXES ) { - ri.Printf(PRINT_WARNING, "R_LoadMD4: %s has more than %i verts on a surface (%i).\n", - mod_name, SHADER_MAX_VERTEXES, surf->numVerts ); + ri.Printf(PRINT_WARNING, "R_LoadMD4: %s has more than %i verts on %s (%i).\n", + mod_name, SHADER_MAX_VERTEXES, surf->name[0] ? surf->name : "a surface", + surf->numVerts ); return qfalse; } if ( surf->numTriangles*3 > SHADER_MAX_INDEXES ) { - ri.Printf(PRINT_WARNING, "R_LoadMD4: %s has more than %i triangles on a surface (%i).\n", - mod_name, SHADER_MAX_INDEXES / 3, surf->numTriangles ); + ri.Printf(PRINT_WARNING, "R_LoadMD4: %s has more than %i triangles on %s (%i).\n", + mod_name, SHADER_MAX_INDEXES / 3, surf->name[0] ? surf->name : "a surface", + surf->numTriangles ); return qfalse; } diff --git a/code/renderergl1/tr_model_iqm.c b/code/renderergl1/tr_model_iqm.c index db089da7..3d2ca3e2 100644 --- a/code/renderergl1/tr_model_iqm.c +++ b/code/renderergl1/tr_model_iqm.c @@ -142,6 +142,7 @@ qboolean R_LoadIQM( model_t *mod, void *buffer, int filesize, const char *mod_na size_t size, joint_names; iqmData_t *iqmData; srfIQModel_t *surface; + char meshName[MAX_QPATH]; if( filesize < sizeof(iqmHeader_t) ) { return qfalse; @@ -310,17 +311,25 @@ qboolean R_LoadIQM( model_t *mod, void *buffer, int filesize, const char *mod_na LL( mesh->first_triangle ); LL( mesh->num_triangles ); + if ( mesh->name < header->num_text ) { + Q_strncpyz( meshName, (char*)header + header->ofs_text + mesh->name, sizeof (meshName) ); + } else { + meshName[0] = '\0'; + } + // check ioq3 limits if ( mesh->num_vertexes > SHADER_MAX_VERTEXES ) { - ri.Printf(PRINT_WARNING, "R_LoadIQM: %s has more than %i verts on a surface (%i).\n", - mod_name, SHADER_MAX_VERTEXES, mesh->num_vertexes ); + ri.Printf(PRINT_WARNING, "R_LoadIQM: %s has more than %i verts on %s (%i).\n", + mod_name, SHADER_MAX_VERTEXES, meshName[0] ? meshName : "a surface", + mesh->num_vertexes ); return qfalse; } if ( mesh->num_triangles*3 > SHADER_MAX_INDEXES ) { - ri.Printf(PRINT_WARNING, "R_LoadIQM: %s has more than %i triangles on a surface (%i).\n", - mod_name, SHADER_MAX_INDEXES / 3, mesh->num_triangles ); + ri.Printf(PRINT_WARNING, "R_LoadIQM: %s has more than %i triangles on %s (%i).\n", + mod_name, SHADER_MAX_INDEXES / 3, meshName[0] ? meshName : "a surface", + mesh->num_triangles ); return qfalse; } diff --git a/code/renderergl2/tr_model.c b/code/renderergl2/tr_model.c index 37c12d4e..2c567afc 100644 --- a/code/renderergl2/tr_model.c +++ b/code/renderergl2/tr_model.c @@ -497,14 +497,16 @@ static qboolean R_LoadMD3(model_t * mod, int lod, void *buffer, int bufferSize, if(md3Surf->numVerts > SHADER_MAX_VERTEXES) { - ri.Printf(PRINT_WARNING, "R_LoadMD3: %s has more than %i verts on a surface (%i)", - modName, SHADER_MAX_VERTEXES, md3Surf->numVerts); + ri.Printf(PRINT_WARNING, "R_LoadMD3: %s has more than %i verts on %s (%i).\n", + modName, SHADER_MAX_VERTEXES, md3Surf->name[0] ? md3Surf->name : "a surface", + md3Surf->numVerts ); return qfalse; } if(md3Surf->numTriangles * 3 > SHADER_MAX_INDEXES) { - ri.Printf(PRINT_WARNING, "R_LoadMD3: %s has more than %i triangles on a surface (%i)", - modName, SHADER_MAX_INDEXES / 3, md3Surf->numTriangles); + ri.Printf(PRINT_WARNING, "R_LoadMD3: %s has more than %i triangles on %s (%i).\n", + modName, SHADER_MAX_INDEXES / 3, md3Surf->name[0] ? md3Surf->name : "a surface", + md3Surf->numTriangles ); return qfalse; } @@ -996,14 +998,16 @@ static qboolean R_LoadMDR( model_t *mod, void *buffer, int filesize, const char // now do the checks that may fail. if ( surf->numVerts > SHADER_MAX_VERTEXES ) { - ri.Printf(PRINT_WARNING, "R_LoadMDR: %s has more than %i verts on a surface (%i).\n", - mod_name, SHADER_MAX_VERTEXES, surf->numVerts ); + ri.Printf(PRINT_WARNING, "R_LoadMDR: %s has more than %i verts on %s (%i).\n", + mod_name, SHADER_MAX_VERTEXES, surf->name[0] ? surf->name : "a surface", + surf->numVerts ); return qfalse; } if ( surf->numTriangles*3 > SHADER_MAX_INDEXES ) { - ri.Printf(PRINT_WARNING, "R_LoadMDR: %s has more than %i triangles on a surface (%i).\n", - mod_name, SHADER_MAX_INDEXES / 3, surf->numTriangles ); + ri.Printf(PRINT_WARNING, "R_LoadMDR: %s has more than %i triangles on %s (%i).\n", + mod_name, SHADER_MAX_INDEXES / 3, surf->name[0] ? surf->name : "a surface", + surf->numTriangles ); return qfalse; } // lowercase the surface name so skin compares are faster @@ -1210,13 +1214,15 @@ static qboolean R_LoadMD4( model_t *mod, void *buffer, const char *mod_name ) { LL(surf->ofsEnd); if ( surf->numVerts > SHADER_MAX_VERTEXES ) { - ri.Printf(PRINT_WARNING, "R_LoadMD4: %s has more than %i verts on a surface (%i).\n", - mod_name, SHADER_MAX_VERTEXES, surf->numVerts ); + ri.Printf(PRINT_WARNING, "R_LoadMD4: %s has more than %i verts on %s (%i).\n", + mod_name, SHADER_MAX_VERTEXES, surf->name[0] ? surf->name : "a surface", + surf->numVerts ); return qfalse; } if ( surf->numTriangles*3 > SHADER_MAX_INDEXES ) { - ri.Printf(PRINT_WARNING, "R_LoadMD4: %s has more than %i triangles on a surface (%i).\n", - mod_name, SHADER_MAX_INDEXES / 3, surf->numTriangles ); + ri.Printf(PRINT_WARNING, "R_LoadMD4: %s has more than %i triangles on %s (%i).\n", + mod_name, SHADER_MAX_INDEXES / 3, surf->name[0] ? surf->name : "a surface", + surf->numTriangles ); return qfalse; } diff --git a/code/renderergl2/tr_model_iqm.c b/code/renderergl2/tr_model_iqm.c index cee51a18..2e6b7655 100644 --- a/code/renderergl2/tr_model_iqm.c +++ b/code/renderergl2/tr_model_iqm.c @@ -142,6 +142,7 @@ qboolean R_LoadIQM( model_t *mod, void *buffer, int filesize, const char *mod_na size_t size, joint_names; iqmData_t *iqmData; srfIQModel_t *surface; + char meshName[MAX_QPATH]; if( filesize < sizeof(iqmHeader_t) ) { return qfalse; @@ -310,17 +311,25 @@ qboolean R_LoadIQM( model_t *mod, void *buffer, int filesize, const char *mod_na LL( mesh->first_triangle ); LL( mesh->num_triangles ); + if ( mesh->name < header->num_text ) { + Q_strncpyz( meshName, (char*)header + header->ofs_text + mesh->name, sizeof (meshName) ); + } else { + meshName[0] = '\0'; + } + // check ioq3 limits if ( mesh->num_vertexes > SHADER_MAX_VERTEXES ) { - ri.Printf(PRINT_WARNING, "R_LoadIQM: %s has more than %i verts on a surface (%i).\n", - mod_name, SHADER_MAX_VERTEXES, mesh->num_vertexes ); + ri.Printf(PRINT_WARNING, "R_LoadIQM: %s has more than %i verts on %s (%i).\n", + mod_name, SHADER_MAX_VERTEXES, meshName[0] ? meshName : "a surface", + mesh->num_vertexes ); return qfalse; } if ( mesh->num_triangles*3 > SHADER_MAX_INDEXES ) { - ri.Printf(PRINT_WARNING, "R_LoadIQM: %s has more than %i triangles on a surface (%i).\n", - mod_name, SHADER_MAX_INDEXES / 3, mesh->num_triangles ); + ri.Printf(PRINT_WARNING, "R_LoadIQM: %s has more than %i triangles on %s (%i).\n", + mod_name, SHADER_MAX_INDEXES / 3, meshName[0] ? meshName : "a surface", + mesh->num_triangles ); return qfalse; }