Skip to content

Commit 07ffbcd

Browse files
committed
ioq3 updates.
Qsort cannot be called with NULL. More predictable mesh normals generation.
1 parent b637b6f commit 07ffbcd

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

code/qcommon/files.c

+2-1
Original file line numberDiff line numberDiff line change
@@ -3172,7 +3172,8 @@ void FS_AddGameDirectory( const char *path, const char *dir )
31723172
// Get .pk3 files
31733173
pakfiles = Sys_ListFiles(curpath, ".pk3", NULL, &numfiles, qfalse);
31743174

3175-
qsort( pakfiles, numfiles, sizeof(char*), paksort );
3175+
if ( pakfiles )
3176+
qsort( pakfiles, numfiles, sizeof(char*), paksort );
31763177

31773178
if ( fs_numServerPaks )
31783179
{

code/renderer/tr_curve.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ static void MakeMeshNormals( int width, int height, drawVert_t ctrl[MAX_GRID_SIZ
204204

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

207-
if ( VectorNormalize2( temp, temp ) == 0 ) {
207+
if ( VectorNormalize( temp ) < 0.001f ) {
208208
continue; // degenerate edge, get more dist
209209
}
210210

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

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

230-
if ( VectorNormalize2( normal, normal ) == 0 ) {
230+
if ( VectorNormalize( normal ) < 0.001f ) {
231231
continue;
232232
}
233233

0 commit comments

Comments
 (0)