Skip to content

Commit f19588e

Browse files
committed
Make surface parse error messages more meaningful
1 parent 83dffb2 commit f19588e

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/engine/renderer/tr_bsp.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -931,8 +931,9 @@ static void ParseTriangleSurface( dsurface_t* ds, drawVert_t* verts, bspSurface_
931931
for ( int j = 0; j < 3; j++ ) {
932932
tri->indexes[ j ] = LittleLong( indexes[ i * 3 + j ] );
933933

934-
if ( tri->indexes[ j ] < 0 || tri->indexes[ j ] >= cv->numVerts ) {
935-
Sys::Drop( "Bad index in face surface" );
934+
if ( tri->indexes[j] < 0 || tri->indexes[j] >= cv->numVerts ) {
935+
Sys::Drop( "Index out of range in surface: %i not in [0, %i] (index in BSP: %i, surface: indexes: %i-%i, shader: %s)",
936+
tri->indexes[j], cv->numVerts, i * 3 + j, ds->firstIndex, ds->firstIndex + ds->numIndexes, surf->shader->name );
936937
}
937938
}
938939
}
@@ -1113,7 +1114,8 @@ static void ParseMesh( dsurface_t *ds, drawVert_t *verts, bspSurface_t *surf )
11131114

11141115
if ( width < 0 || width > MAX_PATCH_SIZE || height < 0 || height > MAX_PATCH_SIZE )
11151116
{
1116-
Sys::Drop( "ParseMesh: bad size" );
1117+
Sys::Drop( "ParseMesh: bad size: width: %i (range: [0, %i]), height: %i (range: [0, %i]), surface: firstVertex: %i,"
1118+
" shader: %s", width, MAX_PATCH_SIZE, height, MAX_PATCH_SIZE, ds->firstVert, surf->shader->name );
11171119
}
11181120

11191121
verts += LittleLong( ds->firstVert );

0 commit comments

Comments
 (0)