Skip to content

Commit

Permalink
ioq3 updates.
Browse files Browse the repository at this point in the history
Qsort cannot be called with NULL.

More predictable mesh normals generation.
  • Loading branch information
Cowcat5150 committed Nov 17, 2022
1 parent b637b6f commit 07ffbcd
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
3 changes: 2 additions & 1 deletion code/qcommon/files.c
Original file line number Diff line number Diff line change
Expand Up @@ -3172,7 +3172,8 @@ void FS_AddGameDirectory( const char *path, const char *dir )
// Get .pk3 files
pakfiles = Sys_ListFiles(curpath, ".pk3", NULL, &numfiles, qfalse);

qsort( pakfiles, numfiles, sizeof(char*), paksort );
if ( pakfiles )
qsort( pakfiles, numfiles, sizeof(char*), paksort );

if ( fs_numServerPaks )
{
Expand Down
4 changes: 2 additions & 2 deletions code/renderer/tr_curve.c
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ static void MakeMeshNormals( int width, int height, drawVert_t ctrl[MAX_GRID_SIZ

VectorSubtract( ctrl[y][x].xyz, base, temp );

if ( VectorNormalize2( temp, temp ) == 0 ) {
if ( VectorNormalize( temp ) < 0.001f ) {
continue; // degenerate edge, get more dist
}

Expand All @@ -227,7 +227,7 @@ static void MakeMeshNormals( int width, int height, drawVert_t ctrl[MAX_GRID_SIZ

CrossProduct( around[(k+1)&7], around[k], normal );

if ( VectorNormalize2( normal, normal ) == 0 ) {
if ( VectorNormalize( normal ) < 0.001f ) {
continue;
}

Expand Down

0 comments on commit 07ffbcd

Please sign in to comment.