[dhewm3] 01/03: Imported Upstream version 1.4.1+dfsg

Tobias Frost tobi at moszumanska.debian.org
Thu Jul 7 18:11:56 UTC 2016


This is an automated email from the git hooks/post-receive script.

tobi pushed a commit to branch master
in repository dhewm3.

commit 45cf427f02d869f9f64f3a5f0e85f2f0a934bece
Author: Tobias Frost <tobi at coldtobi.de>
Date:   Thu Jul 7 17:52:04 2016 +0200

    Imported Upstream version 1.4.1+dfsg
---
 README.md                           |  13 ++-
 neo/cm/CollisionModel_load.cpp      |   4 +-
 neo/d3xp/Pvs.cpp                    |   8 +-
 neo/d3xp/SecurityCamera.cpp         |   2 +-
 neo/d3xp/Weapon.cpp                 |   9 +-
 neo/d3xp/ai/AI.cpp                  |   2 +-
 neo/d3xp/gamesys/SysCmds.cpp        |   2 +-
 neo/framework/FileSystem.cpp        |   6 +-
 neo/framework/Licensee.h            |   2 +-
 neo/game/Pvs.cpp                    |   8 +-
 neo/game/SecurityCamera.cpp         |   2 +-
 neo/game/Weapon.cpp                 |   8 +-
 neo/game/ai/AI.cpp                  |   2 +-
 neo/game/gamesys/SysCmds.cpp        |   2 +-
 neo/idlib/Lib.cpp                   |  10 ++-
 neo/idlib/math/Matrix.h             |   3 +
 neo/idlib/math/Polynomial.h         |   8 ++
 neo/idlib/math/Simd.cpp             | 160 ++++++++++++++++++------------------
 neo/renderer/Model_ma.cpp           |  13 ++-
 neo/renderer/RenderSystem_init.cpp  |  65 +++++++++++++--
 neo/sys/events.cpp                  |  40 ++++++++-
 neo/sys/posix/posix_net.cpp         |   1 +
 neo/tools/compilers/roqvq/codec.cpp |   8 +-
 neo/ui/Winvar.cpp                   |   2 +-
 neo/ui/Winvar.h                     |   2 +-
 25 files changed, 255 insertions(+), 127 deletions(-)

diff --git a/README.md b/README.md
index 4615146..2b5537c 100644
--- a/README.md
+++ b/README.md
@@ -1,6 +1,6 @@
 # ABOUT
 
-_dhewm 3_ is a _Doom 3_ GPL source modification.
+_dhewm 3_ is a _Doom 3_ GPL source port, know to work on at least Windows, Linux, Mac OS X and FreeBSD.
 
 The goal of _dhewm 3_ is bring _DOOM 3_ with the help of SDL to all suitable
 platforms.
@@ -10,6 +10,8 @@ altering the original gameplay.
 
 **The project is hosted at:** https://github.com/dhewm
 
+**Download latest Release:** https://github.com/dhewm/dhewm3/releases/latest
+
 **Consult the FAQ at:** https://github.com/dhewm/dhewm3/wiki/FAQ
 
 **Report bugs here:** https://github.com/dhewm/dhewm3/issues
@@ -22,7 +24,7 @@ Compared to the original _DOOM 3_, the changes of _dhewm 3_ worth mentioning are
 - 64bit port
 - SDL for low level OS support, OpenGL and input handling
 - OpenAL for audio output, all OS specific audio backends are gone
-- OpenAL EFX for EAX reverb effects (read: EAX on all platforms)
+- OpenAL EFX for EAX reverb effects (read: EAX-like sound effects on all platforms/hardware)
 - Better support for widescreen (and arbitrary display resolutions)
 - A portable build system based on CMake
 - (Cross-)compilation with mingw-w64
@@ -82,7 +84,7 @@ the cmake command there, pointing it at the neo/ folder from this repository:
 
 OSX users need to point cmake at OpenAL Soft (better solutions welcome):
 
-`cmake -DOPENAL_LIBRARY=/usr/local/lib/libopenal.dylib -DOPENAL_INCLUDE_DIR=/usr/local/include /path/to/repository/neo`
+`cmake -DOPENAL_LIBRARY=/usr/local/opt/openal-soft/lib/libopenal.dylib -DOPENAL_INCLUDE_DIR=/usr/local/opt/openal-soft/include /path/to/repository/neo`
 
 ## Using the provided Windows binaries
 
@@ -131,6 +133,11 @@ The Doom 3 GPL source code release does not include functionality enabling rende
 of stencil shadows via the "depth fail" method, a functionality commonly known as
 "Carmack's Reverse".
 
+***Note*** that this **does *not* change the visual appereance** of the game.
+The shadows look the same, they're just created in a slightly different way.
+In theory there might be a small performance impact, but on hardware less than
+ten years old it shouldn't make a difference.
+
 ## MayaImport
 
 The code for our Maya export plugin is included, if you are a Maya licensee
diff --git a/neo/cm/CollisionModel_load.cpp b/neo/cm/CollisionModel_load.cpp
index ef786a0..acd2a3d 100644
--- a/neo/cm/CollisionModel_load.cpp
+++ b/neo/cm/CollisionModel_load.cpp
@@ -1887,7 +1887,7 @@ static int CM_FindSplitter( const cm_node_t *node, const idBounds &bounds, int *
 						continue;
 					}
 					// find the most centered splitter
-					t = abs((bounds[1][type] - dist) - (dist - bounds[0][type]));
+					t = idMath::Fabs((bounds[1][type] - dist) - (dist - bounds[0][type]));
 					if ( t < bestt ) {
 						bestt = t;
 						*planeType = type;
@@ -1907,7 +1907,7 @@ static int CM_FindSplitter( const cm_node_t *node, const idBounds &bounds, int *
 						continue;
 					}
 					// find the most centered splitter
-					t = abs((bounds[1][type] - dist) - (dist - bounds[0][type]));
+					t = idMath::Fabs((bounds[1][type] - dist) - (dist - bounds[0][type]));
 					if ( t < bestt ) {
 						bestt = t;
 						*planeType = type;
diff --git a/neo/d3xp/Pvs.cpp b/neo/d3xp/Pvs.cpp
index 74781e7..46e16f1 100644
--- a/neo/d3xp/Pvs.cpp
+++ b/neo/d3xp/Pvs.cpp
@@ -861,20 +861,20 @@ idPVS::Shutdown
 */
 void idPVS::Shutdown( void ) {
 	if ( connectedAreas ) {
-		delete connectedAreas;
+		delete[] connectedAreas;
 		connectedAreas = NULL;
 	}
 	if ( areaQueue ) {
-		delete areaQueue;
+		delete[] areaQueue;
 		areaQueue = NULL;
 	}
 	if ( areaPVS ) {
-		delete areaPVS;
+		delete[] areaPVS;
 		areaPVS = NULL;
 	}
 	if ( currentPVS ) {
 		for ( int i = 0; i < MAX_CURRENT_PVS; i++ ) {
-			delete currentPVS[i].pvs;
+			delete[] currentPVS[i].pvs;
 			currentPVS[i].pvs = NULL;
 		}
 	}
diff --git a/neo/d3xp/SecurityCamera.cpp b/neo/d3xp/SecurityCamera.cpp
index c16405a..36a0cbe 100644
--- a/neo/d3xp/SecurityCamera.cpp
+++ b/neo/d3xp/SecurityCamera.cpp
@@ -140,7 +140,7 @@ void idSecurityCamera::Spawn( void ) {
 	}
 
 	negativeSweep = ( sweepAngle < 0 ) ? true : false;
-	sweepAngle = abs( sweepAngle );
+	sweepAngle = idMath::Fabs( sweepAngle );
 
 	scanFovCos = cos( scanFov * idMath::PI / 360.0f );
 
diff --git a/neo/d3xp/Weapon.cpp b/neo/d3xp/Weapon.cpp
index 2101381..30f8882 100644
--- a/neo/d3xp/Weapon.cpp
+++ b/neo/d3xp/Weapon.cpp
@@ -3446,7 +3446,14 @@ void idWeapon::Event_LaunchProjectiles( int num_projectiles, float spread, float
 			// make sure the projectile starts inside the bounding box of the owner
 			if ( i == 0 ) {
 				muzzle_pos = muzzleOrigin + playerViewAxis[ 0 ] * 2.0f;
-				if ( ( ownerBounds - projBounds).RayIntersection( muzzle_pos, playerViewAxis[0], distance ) ) {
+
+				// DG: sometimes the assertion in idBounds::operator-(const idBounds&) triggers
+				//     (would get bounding box with negative volume)
+				//     => check that before doing ownerBounds - projBounds (equivalent to the check in the assertion)
+				idVec3 obDiff = ownerBounds[1] - ownerBounds[0];
+				idVec3 pbDiff = projBounds[1] - projBounds[0];
+				bool boundsSubLegal =  obDiff.x > pbDiff.x && obDiff.y > pbDiff.y && obDiff.z > pbDiff.z;
+				if ( boundsSubLegal && ( ownerBounds - projBounds ).RayIntersection( muzzle_pos, playerViewAxis[0], distance ) ) {
 					start = muzzle_pos + distance * playerViewAxis[0];
 				} else {
 					start = ownerBounds.GetCenter();
diff --git a/neo/d3xp/ai/AI.cpp b/neo/d3xp/ai/AI.cpp
index 1353689..887594b 100644
--- a/neo/d3xp/ai/AI.cpp
+++ b/neo/d3xp/ai/AI.cpp
@@ -2233,7 +2233,7 @@ bool idAI::NewWanderDir( const idVec3 &dest ) {
 	}
 
 	// try other directions
-	if ( ( gameLocal.random.RandomInt() & 1 ) || abs( deltay ) > abs( deltax ) ) {
+	if ( ( gameLocal.random.RandomInt() & 1 ) || idMath::Fabs( deltay ) > idMath::Fabs( deltax ) ) {
 		tdir = d[ 1 ];
 		d[ 1 ] = d[ 2 ];
 		d[ 2 ] = tdir;
diff --git a/neo/d3xp/gamesys/SysCmds.cpp b/neo/d3xp/gamesys/SysCmds.cpp
index 8dc894a..9871fe0 100644
--- a/neo/d3xp/gamesys/SysCmds.cpp
+++ b/neo/d3xp/gamesys/SysCmds.cpp
@@ -140,7 +140,7 @@ void Cmd_ListSpawnArgs_f( const idCmdArgs &args ) {
 
 	for ( i = 0; i < ent->spawnArgs.GetNumKeyVals(); i++ ) {
 		const idKeyValue *kv = ent->spawnArgs.GetKeyVal( i );
-		gameLocal.Printf( "\"%s\"  "S_COLOR_WHITE"\"%s\"\n", kv->GetKey().c_str(), kv->GetValue().c_str() );
+		gameLocal.Printf( "\"%s\"  " S_COLOR_WHITE "\"%s\"\n", kv->GetKey().c_str(), kv->GetValue().c_str() );
 	}
 }
 
diff --git a/neo/framework/FileSystem.cpp b/neo/framework/FileSystem.cpp
index e5bab70..4800278 100644
--- a/neo/framework/FileSystem.cpp
+++ b/neo/framework/FileSystem.cpp
@@ -1344,7 +1344,7 @@ pack_t *idFileSystemLocal::LoadZipFile( const char *zipfile ) {
 			unzClose(uf);
 			delete[] buildBuffer;
 			delete pack;
-
+			Mem_Free( fs_headerLongs );
 			return NULL;
 		}
 	}
@@ -3368,7 +3368,7 @@ size_t idFileSystemLocal::CurlWriteFunction( void *ptr, size_t size, size_t nmem
 		return size * nmemb;
 	}
 	#ifdef _WIN32
-		return _write( static_cast<idFile_Permanent*>(bgl->f)->GetFilePtr()->_file, ptr, size * nmemb );
+		return _write( _fileno(static_cast<idFile_Permanent*>(bgl->f)->GetFilePtr()), ptr, size * nmemb );
 	#else
 		return fwrite( ptr, size, nmemb, static_cast<idFile_Permanent*>(bgl->f)->GetFilePtr() );
 	#endif
@@ -3416,7 +3416,7 @@ int BackgroundDownloadThread( void *pexit ) {
 		if ( bgl->opcode == DLTYPE_FILE ) {
 			// use the low level read function, because fread may allocate memory
 			#if defined(WIN32)
-				_read( static_cast<idFile_Permanent*>(bgl->f)->GetFilePtr()->_file, bgl->file.buffer, bgl->file.length );
+				_read( _fileno(static_cast<idFile_Permanent*>(bgl->f)->GetFilePtr()), bgl->file.buffer, bgl->file.length );
 			#else
 				fread(  bgl->file.buffer, bgl->file.length, 1, static_cast<idFile_Permanent*>(bgl->f)->GetFilePtr() );
 			#endif
diff --git a/neo/framework/Licensee.h b/neo/framework/Licensee.h
index 991c929..1225127 100644
--- a/neo/framework/Licensee.h
+++ b/neo/framework/Licensee.h
@@ -36,7 +36,7 @@ If you have questions concerning this license or the applicable additional terms
 
 #define GAME_NAME						"dhewm 3"		// appears on window titles and errors
 
-#define ENGINE_VERSION					"dhewm 3 1.4.0"	// printed in console
+#define ENGINE_VERSION					"dhewm 3 1.4.1"	// printed in console
 
 // paths
 #define	BASE_GAMEDIR					"base"
diff --git a/neo/game/Pvs.cpp b/neo/game/Pvs.cpp
index 5c189e0..16e845a 100644
--- a/neo/game/Pvs.cpp
+++ b/neo/game/Pvs.cpp
@@ -861,20 +861,20 @@ idPVS::Shutdown
 */
 void idPVS::Shutdown( void ) {
 	if ( connectedAreas ) {
-		delete connectedAreas;
+		delete[] connectedAreas;
 		connectedAreas = NULL;
 	}
 	if ( areaQueue ) {
-		delete areaQueue;
+		delete[] areaQueue;
 		areaQueue = NULL;
 	}
 	if ( areaPVS ) {
-		delete areaPVS;
+		delete[] areaPVS;
 		areaPVS = NULL;
 	}
 	if ( currentPVS ) {
 		for ( int i = 0; i < MAX_CURRENT_PVS; i++ ) {
-			delete currentPVS[i].pvs;
+			delete[] currentPVS[i].pvs;
 			currentPVS[i].pvs = NULL;
 		}
 	}
diff --git a/neo/game/SecurityCamera.cpp b/neo/game/SecurityCamera.cpp
index c16405a..36a0cbe 100644
--- a/neo/game/SecurityCamera.cpp
+++ b/neo/game/SecurityCamera.cpp
@@ -140,7 +140,7 @@ void idSecurityCamera::Spawn( void ) {
 	}
 
 	negativeSweep = ( sweepAngle < 0 ) ? true : false;
-	sweepAngle = abs( sweepAngle );
+	sweepAngle = idMath::Fabs( sweepAngle );
 
 	scanFovCos = cos( scanFov * idMath::PI / 360.0f );
 
diff --git a/neo/game/Weapon.cpp b/neo/game/Weapon.cpp
index d889c68..a381ae2 100644
--- a/neo/game/Weapon.cpp
+++ b/neo/game/Weapon.cpp
@@ -2941,7 +2941,13 @@ void idWeapon::Event_LaunchProjectiles( int num_projectiles, float spread, float
 			// make sure the projectile starts inside the bounding box of the owner
 			if ( i == 0 ) {
 				muzzle_pos = muzzleOrigin + playerViewAxis[ 0 ] * 2.0f;
-				if ( ( ownerBounds - projBounds).RayIntersection( muzzle_pos, playerViewAxis[0], distance ) ) {
+				// DG: sometimes the assertion in idBounds::operator-(const idBounds&) triggers
+				//     (would get bounding box with negative volume)
+				//     => check that before doing ownerBounds - projBounds (equivalent to the check in the assertion)
+				idVec3 obDiff = ownerBounds[1] - ownerBounds[0];
+				idVec3 pbDiff = projBounds[1] - projBounds[0];
+				bool boundsSubLegal =  obDiff.x > pbDiff.x && obDiff.y > pbDiff.y && obDiff.z > pbDiff.z;
+				if ( boundsSubLegal && ( ownerBounds - projBounds ).RayIntersection( muzzle_pos, playerViewAxis[0], distance ) ) {
 					start = muzzle_pos + distance * playerViewAxis[0];
 				} else {
 					start = ownerBounds.GetCenter();
diff --git a/neo/game/ai/AI.cpp b/neo/game/ai/AI.cpp
index cc99b87..2ac9948 100644
--- a/neo/game/ai/AI.cpp
+++ b/neo/game/ai/AI.cpp
@@ -2148,7 +2148,7 @@ bool idAI::NewWanderDir( const idVec3 &dest ) {
 	}
 
 	// try other directions
-	if ( ( gameLocal.random.RandomInt() & 1 ) || abs( deltay ) > abs( deltax ) ) {
+	if ( ( gameLocal.random.RandomInt() & 1 ) || idMath::Fabs( deltay ) > idMath::Fabs( deltax ) ) {
 		tdir = d[ 1 ];
 		d[ 1 ] = d[ 2 ];
 		d[ 2 ] = tdir;
diff --git a/neo/game/gamesys/SysCmds.cpp b/neo/game/gamesys/SysCmds.cpp
index 670a90c..732d506 100644
--- a/neo/game/gamesys/SysCmds.cpp
+++ b/neo/game/gamesys/SysCmds.cpp
@@ -140,7 +140,7 @@ void Cmd_ListSpawnArgs_f( const idCmdArgs &args ) {
 
 	for ( i = 0; i < ent->spawnArgs.GetNumKeyVals(); i++ ) {
 		const idKeyValue *kv = ent->spawnArgs.GetKeyVal( i );
-		gameLocal.Printf( "\"%s\"  "S_COLOR_WHITE"\"%s\"\n", kv->GetKey().c_str(), kv->GetValue().c_str() );
+		gameLocal.Printf( "\"%s\"  " S_COLOR_WHITE "\"%s\"\n", kv->GetKey().c_str(), kv->GetValue().c_str() );
 	}
 }
 
diff --git a/neo/idlib/Lib.cpp b/neo/idlib/Lib.cpp
index 954adc5..0976c85 100644
--- a/neo/idlib/Lib.cpp
+++ b/neo/idlib/Lib.cpp
@@ -26,7 +26,7 @@ If you have questions concerning this license or the applicable additional terms
 ===========================================================================
 */
 
-#if defined( MACOS_X )
+#if defined( MACOS_X ) || defined(__unix__)
 #include <signal.h>
 #include <sys/types.h>
 #endif
@@ -514,8 +514,14 @@ void AssertFailed( const char *file, int line, const char *expression ) {
 	idLib::sys->DebugPrintf( "\n\nASSERTION FAILED!\n%s(%d): '%s'\n", file, line, expression );
 #ifdef _MSC_VER
 	__debugbreak();
+	_exit(1);
+#elif defined(__unix__)
+	// __builtin_trap() causes an illegal instruction which is kinda ugly.
+	// especially if you'd like to be able to continue after the assertion during debugging
+	raise(SIGTRAP); // this will break into the debugger.
 #elif defined( __GNUC__ )
 	__builtin_trap();
-#endif
 	_exit(1);
+#endif
+
 }
diff --git a/neo/idlib/math/Matrix.h b/neo/idlib/math/Matrix.h
index 24ed20f..785ac8f 100644
--- a/neo/idlib/math/Matrix.h
+++ b/neo/idlib/math/Matrix.h
@@ -30,6 +30,9 @@ If you have questions concerning this license or the applicable additional terms
 #define __MATH_MATRIX_H__
 
 #include "idlib/math/Vector.h"
+#ifdef _WIN32
+ #include <malloc.h>
+#endif
 
 /*
 ===============================================================================
diff --git a/neo/idlib/math/Polynomial.h b/neo/idlib/math/Polynomial.h
index 840d098..a2ce875 100644
--- a/neo/idlib/math/Polynomial.h
+++ b/neo/idlib/math/Polynomial.h
@@ -31,6 +31,9 @@ If you have questions concerning this license or the applicable additional terms
 
 #include "idlib/math/Complex.h"
 #include "idlib/Heap.h"
+#ifdef _WIN32
+ #include <malloc.h>
+#endif
 
 /*
 ===============================================================================
@@ -50,6 +53,11 @@ public:
 					explicit idPolynomial( float a, float b, float c, float d );
 					explicit idPolynomial( float a, float b, float c, float d, float e );
 
+					~idPolynomial() // DG: don't leak coefficient's memory!
+					{
+						Mem_Free16( coefficient );
+					}
+
 	float			operator[]( int index ) const;
 	float &			operator[]( int index );
 
diff --git a/neo/idlib/math/Simd.cpp b/neo/idlib/math/Simd.cpp
index 8caf5b2..7fbad1e 100644
--- a/neo/idlib/math/Simd.cpp
+++ b/neo/idlib/math/Simd.cpp
@@ -289,7 +289,7 @@ void TestAdd( void ) {
 			break;
 		}
 	}
-	result = ( i >= COUNT ) ? "ok" : S_COLOR_RED"X";
+	result = ( i >= COUNT ) ? "ok" :  S_COLOR_RED "X";
 	PrintClocks( va( "   simd->Add( float + float[] ) %s", result ), COUNT, bestClocksSIMD, bestClocksGeneric );
 
 	bestClocksGeneric = 0;
@@ -314,7 +314,7 @@ void TestAdd( void ) {
 			break;
 		}
 	}
-	result = ( i >= COUNT ) ? "ok" : S_COLOR_RED"X";
+	result = ( i >= COUNT ) ? "ok" :  S_COLOR_RED "X";
 	PrintClocks( va( "   simd->Add( float[] + float[] ) %s", result ), COUNT, bestClocksSIMD, bestClocksGeneric );
 }
 
@@ -363,7 +363,7 @@ void TestSub( void ) {
 			break;
 		}
 	}
-	result = ( i >= COUNT ) ? "ok" : S_COLOR_RED"X";
+	result = ( i >= COUNT ) ? "ok" :  S_COLOR_RED "X";
 	PrintClocks( va( "   simd->Sub( float + float[] ) %s", result ), COUNT, bestClocksSIMD, bestClocksGeneric );
 
 	bestClocksGeneric = 0;
@@ -388,7 +388,7 @@ void TestSub( void ) {
 			break;
 		}
 	}
-	result = ( i >= COUNT ) ? "ok" : S_COLOR_RED"X";
+	result = ( i >= COUNT ) ? "ok" :  S_COLOR_RED "X";
 	PrintClocks( va( "   simd->Sub( float[] + float[] ) %s", result ), COUNT, bestClocksSIMD, bestClocksGeneric );
 }
 
@@ -437,7 +437,7 @@ void TestMul( void ) {
 			break;
 		}
 	}
-	result = ( i >= COUNT ) ? "ok" : S_COLOR_RED"X";
+	result = ( i >= COUNT ) ? "ok" :  S_COLOR_RED "X";
 	PrintClocks( va( "   simd->Mul( float * float[] ) %s", result ), COUNT, bestClocksSIMD, bestClocksGeneric );
 
 
@@ -463,7 +463,7 @@ void TestMul( void ) {
 			break;
 		}
 	}
-	result = ( i >= COUNT ) ? "ok" : S_COLOR_RED"X";
+	result = ( i >= COUNT ) ? "ok" :  S_COLOR_RED "X";
 	PrintClocks( va( "   simd->Mul( float[] * float[] ) %s", result ), COUNT, bestClocksSIMD, bestClocksGeneric );
 }
 
@@ -515,7 +515,7 @@ void TestDiv( void ) {
 			break;
 		}
 	}
-	result = ( i >= COUNT ) ? "ok" : S_COLOR_RED"X";
+	result = ( i >= COUNT ) ? "ok" :  S_COLOR_RED "X";
 	PrintClocks( va( "   simd->Div( float * float[] ) %s", result ), COUNT, bestClocksSIMD, bestClocksGeneric );
 
 
@@ -541,7 +541,7 @@ void TestDiv( void ) {
 			break;
 		}
 	}
-	result = ( i >= COUNT ) ? "ok" : S_COLOR_RED"X";
+	result = ( i >= COUNT ) ? "ok" :  S_COLOR_RED "X";
 	PrintClocks( va( "   simd->Div( float[] * float[] ) %s", result ), COUNT, bestClocksSIMD, bestClocksGeneric );
 }
 
@@ -596,7 +596,7 @@ void TestMulAdd( void ) {
 				break;
 			}
 		}
-		result = ( i >= COUNT ) ? "ok" : S_COLOR_RED"X";
+		result = ( i >= COUNT ) ? "ok" :  S_COLOR_RED "X";
 		PrintClocks( va( "   simd->MulAdd( float * float[%2d] ) %s", j, result ), 1, bestClocksSIMD, bestClocksGeneric );
 	}
 }
@@ -652,7 +652,7 @@ void TestMulSub( void ) {
 				break;
 			}
 		}
-		result = ( i >= COUNT ) ? "ok" : S_COLOR_RED"X";
+		result = ( i >= COUNT ) ? "ok" :  S_COLOR_RED "X";
 		PrintClocks( va( "   simd->MulSub( float * float[%2d] ) %s", j, result ), 1, bestClocksSIMD, bestClocksGeneric );
 	}
 }
@@ -718,7 +718,7 @@ void TestDot( void ) {
 			break;
 		}
 	}
-	result = ( i >= COUNT ) ? "ok" : S_COLOR_RED"X";
+	result = ( i >= COUNT ) ? "ok" :  S_COLOR_RED "X";
 	PrintClocks( va( "   simd->Dot( idVec3 * idVec3[] ) %s", result ), COUNT, bestClocksSIMD, bestClocksGeneric );
 
 
@@ -744,7 +744,7 @@ void TestDot( void ) {
 			break;
 		}
 	}
-	result = ( i >= COUNT ) ? "ok" : S_COLOR_RED"X";
+	result = ( i >= COUNT ) ? "ok" :  S_COLOR_RED "X";
 	PrintClocks( va( "   simd->Dot( idVec3 * idPlane[] ) %s", result ), COUNT, bestClocksSIMD, bestClocksGeneric );
 
 
@@ -770,7 +770,7 @@ void TestDot( void ) {
 			break;
 		}
 	}
-	result = ( i >= COUNT ) ? "ok" : S_COLOR_RED"X";
+	result = ( i >= COUNT ) ? "ok" :  S_COLOR_RED "X";
 	PrintClocks( va( "   simd->Dot( idVec3 * idDrawVert[] ) %s", result ), COUNT, bestClocksSIMD, bestClocksGeneric );
 
 
@@ -796,7 +796,7 @@ void TestDot( void ) {
 			break;
 		}
 	}
-	result = ( i >= COUNT ) ? "ok" : S_COLOR_RED"X";
+	result = ( i >= COUNT ) ? "ok" :  S_COLOR_RED "X";
 	PrintClocks( va( "   simd->Dot( idPlane * idVec3[] ) %s", result ), COUNT, bestClocksSIMD, bestClocksGeneric );
 
 
@@ -822,7 +822,7 @@ void TestDot( void ) {
 			break;
 		}
 	}
-	result = ( i >= COUNT ) ? "ok" : S_COLOR_RED"X";
+	result = ( i >= COUNT ) ? "ok" :  S_COLOR_RED "X";
 	PrintClocks( va( "   simd->Dot( idPlane * idPlane[] ) %s", result ), COUNT, bestClocksSIMD, bestClocksGeneric );
 
 
@@ -848,7 +848,7 @@ void TestDot( void ) {
 			break;
 		}
 	}
-	result = ( i >= COUNT ) ? "ok" : S_COLOR_RED"X";
+	result = ( i >= COUNT ) ? "ok" :  S_COLOR_RED "X";
 	PrintClocks( va( "   simd->Dot( idPlane * idDrawVert[] ) %s", result ), COUNT, bestClocksSIMD, bestClocksGeneric );
 
 
@@ -874,7 +874,7 @@ void TestDot( void ) {
 			break;
 		}
 	}
-	result = ( i >= COUNT ) ? "ok" : S_COLOR_RED"X";
+	result = ( i >= COUNT ) ? "ok" :  S_COLOR_RED "X";
 	PrintClocks( va( "   simd->Dot( idVec3[] * idVec3[] ) %s", result ), COUNT, bestClocksSIMD, bestClocksGeneric );
 
 
@@ -899,7 +899,7 @@ void TestDot( void ) {
 			StopRecordTime( end );
 			GetBest( start, end, bestClocksSIMD );
 		}
-		result = idMath::Fabs( dot1 - dot2 ) < 1e-4f ? "ok" : S_COLOR_RED"X";
+		result = idMath::Fabs( dot1 - dot2 ) < 1e-4f ? "ok" :  S_COLOR_RED "X";
 		PrintClocks( va( "   simd->Dot( float[%2d] * float[%2d] ) %s", j, j, result ), 1, bestClocksSIMD, bestClocksGeneric );
 	}
 }
@@ -947,7 +947,7 @@ void TestCompare( void ) {
 			break;
 		}
 	}
-	result = ( i >= COUNT ) ? "ok" : S_COLOR_RED"X";
+	result = ( i >= COUNT ) ? "ok" :  S_COLOR_RED "X";
 	PrintClocks( va( "   simd->CmpGT( float[] >= float ) %s", result ), COUNT, bestClocksSIMD, bestClocksGeneric );
 
 	bestClocksGeneric = 0;
@@ -974,7 +974,7 @@ void TestCompare( void ) {
 			break;
 		}
 	}
-	result = ( i >= COUNT ) ? "ok" : S_COLOR_RED"X";
+	result = ( i >= COUNT ) ? "ok" :  S_COLOR_RED "X";
 	PrintClocks( va( "   simd->CmpGT( 2, float[] >= float ) %s", result ), COUNT, bestClocksSIMD, bestClocksGeneric );
 
 	// ======================
@@ -1001,7 +1001,7 @@ void TestCompare( void ) {
 			break;
 		}
 	}
-	result = ( i >= COUNT ) ? "ok" : S_COLOR_RED"X";
+	result = ( i >= COUNT ) ? "ok" :  S_COLOR_RED "X";
 	PrintClocks( va( "   simd->CmpGE( float[] >= float ) %s", result ), COUNT, bestClocksSIMD, bestClocksGeneric );
 
 	bestClocksGeneric = 0;
@@ -1028,7 +1028,7 @@ void TestCompare( void ) {
 			break;
 		}
 	}
-	result = ( i >= COUNT ) ? "ok" : S_COLOR_RED"X";
+	result = ( i >= COUNT ) ? "ok" :  S_COLOR_RED "X";
 	PrintClocks( va( "   simd->CmpGE( 2, float[] >= float ) %s", result ), COUNT, bestClocksSIMD, bestClocksGeneric );
 
 	// ======================
@@ -1055,7 +1055,7 @@ void TestCompare( void ) {
 			break;
 		}
 	}
-	result = ( i >= COUNT ) ? "ok" : S_COLOR_RED"X";
+	result = ( i >= COUNT ) ? "ok" :  S_COLOR_RED "X";
 	PrintClocks( va( "   simd->CmpLT( float[] >= float ) %s", result ), COUNT, bestClocksSIMD, bestClocksGeneric );
 
 	bestClocksGeneric = 0;
@@ -1082,7 +1082,7 @@ void TestCompare( void ) {
 			break;
 		}
 	}
-	result = ( i >= COUNT ) ? "ok" : S_COLOR_RED"X";
+	result = ( i >= COUNT ) ? "ok" :  S_COLOR_RED "X";
 	PrintClocks( va( "   simd->CmpLT( 2, float[] >= float ) %s", result ), COUNT, bestClocksSIMD, bestClocksGeneric );
 
 	// ======================
@@ -1109,7 +1109,7 @@ void TestCompare( void ) {
 			break;
 		}
 	}
-	result = ( i >= COUNT ) ? "ok" : S_COLOR_RED"X";
+	result = ( i >= COUNT ) ? "ok" :  S_COLOR_RED "X";
 	PrintClocks( va( "   simd->CmpLE( float[] >= float ) %s", result ), COUNT, bestClocksSIMD, bestClocksGeneric );
 
 	bestClocksGeneric = 0;
@@ -1136,7 +1136,7 @@ void TestCompare( void ) {
 			break;
 		}
 	}
-	result = ( i >= COUNT ) ? "ok" : S_COLOR_RED"X";
+	result = ( i >= COUNT ) ? "ok" :  S_COLOR_RED "X";
 	PrintClocks( va( "   simd->CmpLE( 2, float[] >= float ) %s", result ), COUNT, bestClocksSIMD, bestClocksGeneric );
 }
 
@@ -1192,7 +1192,7 @@ void TestMinMax( void ) {
 		GetBest( start, end, bestClocksSIMD );
 	}
 
-	result = ( min == min2 && max == max2 ) ? "ok" : S_COLOR_RED"X";
+	result = ( min == min2 && max == max2 ) ? "ok" :  S_COLOR_RED "X";
 	PrintClocks( va( "   simd->MinMax( float[] ) %s", result ), COUNT, bestClocksSIMD, bestClocksGeneric );
 
 	bestClocksGeneric = 0;
@@ -1212,7 +1212,7 @@ void TestMinMax( void ) {
 		GetBest( start, end, bestClocksSIMD );
 	}
 
-	result = ( v2min == v2min2 && v2max == v2max2 ) ? "ok" : S_COLOR_RED"X";
+	result = ( v2min == v2min2 && v2max == v2max2 ) ? "ok" :  S_COLOR_RED "X";
 	PrintClocks( va( "   simd->MinMax( idVec2[] ) %s", result ), COUNT, bestClocksSIMD, bestClocksGeneric );
 
 	bestClocksGeneric = 0;
@@ -1232,7 +1232,7 @@ void TestMinMax( void ) {
 		GetBest( start, end, bestClocksSIMD );
 	}
 
-	result = ( vmin == vmin2 && vmax == vmax2 ) ? "ok" : S_COLOR_RED"X";
+	result = ( vmin == vmin2 && vmax == vmax2 ) ? "ok" :  S_COLOR_RED "X";
 	PrintClocks( va( "   simd->MinMax( idVec3[] ) %s", result ), COUNT, bestClocksSIMD, bestClocksGeneric );
 
 	bestClocksGeneric = 0;
@@ -1252,7 +1252,7 @@ void TestMinMax( void ) {
 		GetBest( start, end, bestClocksSIMD );
 	}
 
-	result = ( vmin == vmin2 && vmax == vmax2 ) ? "ok" : S_COLOR_RED"X";
+	result = ( vmin == vmin2 && vmax == vmax2 ) ? "ok" :  S_COLOR_RED "X";
 	PrintClocks( va( "   simd->MinMax( idDrawVert[] ) %s", result ), COUNT, bestClocksSIMD, bestClocksGeneric );
 
 	bestClocksGeneric = 0;
@@ -1272,7 +1272,7 @@ void TestMinMax( void ) {
 		GetBest( start, end, bestClocksSIMD );
 	}
 
-	result = ( vmin == vmin2 && vmax == vmax2 ) ? "ok" : S_COLOR_RED"X";
+	result = ( vmin == vmin2 && vmax == vmax2 ) ? "ok" :  S_COLOR_RED "X";
 	PrintClocks( va( "   simd->MinMax( idDrawVert[], indexes[] ) %s", result ), COUNT, bestClocksSIMD, bestClocksGeneric );
 }
 
@@ -1319,7 +1319,7 @@ void TestClamp( void ) {
 			break;
 		}
 	}
-	result = ( i >= COUNT ) ? "ok" : S_COLOR_RED"X";
+	result = ( i >= COUNT ) ? "ok" :  S_COLOR_RED "X";
 	PrintClocks( va( "   simd->Clamp( float[] ) %s", result ), COUNT, bestClocksSIMD, bestClocksGeneric );
 
 
@@ -1345,7 +1345,7 @@ void TestClamp( void ) {
 			break;
 		}
 	}
-	result = ( i >= COUNT ) ? "ok" : S_COLOR_RED"X";
+	result = ( i >= COUNT ) ? "ok" :  S_COLOR_RED "X";
 	PrintClocks( va( "   simd->ClampMin( float[] ) %s", result ), COUNT, bestClocksSIMD, bestClocksGeneric );
 
 
@@ -1371,7 +1371,7 @@ void TestClamp( void ) {
 			break;
 		}
 	}
-	result = ( i >= COUNT ) ? "ok" : S_COLOR_RED"X";
+	result = ( i >= COUNT ) ? "ok" :  S_COLOR_RED "X";
 	PrintClocks( va( "   simd->ClampMax( float[] ) %s", result ), COUNT, bestClocksSIMD, bestClocksGeneric );
 }
 
@@ -1396,7 +1396,7 @@ void TestMemcpy( void ) {
 		p_simd->Memcpy( test1, test0, 8192 );
 		for ( j = 0; j < i; j++ ) {
 			if ( test1[j] != test0[j] ) {
-				idLib::common->Printf( "   simd->Memcpy() "S_COLOR_RED"X\n" );
+				idLib::common->Printf( "   simd->Memcpy() " S_COLOR_RED "X\n" );
 				return;
 			}
 		}
@@ -1422,7 +1422,7 @@ void TestMemset( void ) {
 			p_simd->Memset( test, j, i );
 			for ( k = 0; k < i; k++ ) {
 				if ( test[k] != (byte)j ) {
-					idLib::common->Printf( "   simd->Memset() "S_COLOR_RED"X\n" );
+					idLib::common->Printf( "   simd->Memset() " S_COLOR_RED "X\n" );
 					return;
 				}
 			}
@@ -1480,7 +1480,7 @@ void TestMatXMultiplyVecX( void ) {
 			GetBest( start, end, bestClocksSIMD );
 		}
 
-		result = dst.Compare( tst, MATX_SIMD_EPSILON ) ? "ok" : S_COLOR_RED"X";
+		result = dst.Compare( tst, MATX_SIMD_EPSILON ) ? "ok" :  S_COLOR_RED "X";
 		PrintClocks( va( "   simd->MatX_MultiplyVecX %dx%d*%dx1 %s", i, i, i, result ), 1, bestClocksSIMD, bestClocksGeneric );
 	}
 
@@ -1510,7 +1510,7 @@ void TestMatXMultiplyVecX( void ) {
 			GetBest( start, end, bestClocksSIMD );
 		}
 
-		result = dst.Compare( tst, MATX_SIMD_EPSILON ) ? "ok" : S_COLOR_RED"X";
+		result = dst.Compare( tst, MATX_SIMD_EPSILON ) ? "ok" :  S_COLOR_RED "X";
 		PrintClocks( va( "   simd->MatX_MultiplyVecX %dx6*6x1 %s", i, result ), 1, bestClocksSIMD, bestClocksGeneric );
 	}
 
@@ -1539,7 +1539,7 @@ void TestMatXMultiplyVecX( void ) {
 			GetBest( start, end, bestClocksSIMD );
 		}
 
-		result = dst.Compare( tst, MATX_SIMD_EPSILON ) ? "ok" : S_COLOR_RED"X";
+		result = dst.Compare( tst, MATX_SIMD_EPSILON ) ? "ok" :  S_COLOR_RED "X";
 		PrintClocks( va( "   simd->MatX_MultiplyVecX 6x%d*%dx1 %s", i, i, result ), 1, bestClocksSIMD, bestClocksGeneric );
 	}
 }
@@ -1591,7 +1591,7 @@ void TestMatXMultiplyAddVecX( void ) {
 			GetBest( start, end, bestClocksSIMD );
 		}
 
-		result = dst.Compare( tst, MATX_SIMD_EPSILON ) ? "ok" : S_COLOR_RED"X";
+		result = dst.Compare( tst, MATX_SIMD_EPSILON ) ? "ok" :  S_COLOR_RED "X";
 		PrintClocks( va( "   simd->MatX_MultiplyAddVecX %dx%d*%dx1 %s", i, i, i, result ), 1, bestClocksSIMD, bestClocksGeneric );
 	}
 
@@ -1621,7 +1621,7 @@ void TestMatXMultiplyAddVecX( void ) {
 			GetBest( start, end, bestClocksSIMD );
 		}
 
-		result = dst.Compare( tst, MATX_SIMD_EPSILON ) ? "ok" : S_COLOR_RED"X";
+		result = dst.Compare( tst, MATX_SIMD_EPSILON ) ? "ok" :  S_COLOR_RED "X";
 		PrintClocks( va( "   simd->MatX_MultiplyAddVecX %dx6*6x1 %s", i, result ), 1, bestClocksSIMD, bestClocksGeneric );
 	}
 
@@ -1651,7 +1651,7 @@ void TestMatXMultiplyAddVecX( void ) {
 			GetBest( start, end, bestClocksSIMD );
 		}
 
-		result = dst.Compare( tst, MATX_SIMD_EPSILON ) ? "ok" : S_COLOR_RED"X";
+		result = dst.Compare( tst, MATX_SIMD_EPSILON ) ? "ok" :  S_COLOR_RED "X";
 		PrintClocks( va( "   simd->MatX_MultiplyAddVecX 6x%d*%dx1 %s", i, i, result ), 1, bestClocksSIMD, bestClocksGeneric );
 	}
 }
@@ -1703,7 +1703,7 @@ void TestMatXTransposeMultiplyVecX( void ) {
 			GetBest( start, end, bestClocksSIMD );
 		}
 
-		result = dst.Compare( tst, MATX_SIMD_EPSILON ) ? "ok" : S_COLOR_RED"X";
+		result = dst.Compare( tst, MATX_SIMD_EPSILON ) ? "ok" :  S_COLOR_RED "X";
 		PrintClocks( va( "   simd->MatX_TransposeMulVecX %dx6*%dx1 %s", i, i, result ), 1, bestClocksSIMD, bestClocksGeneric );
 	}
 
@@ -1733,7 +1733,7 @@ void TestMatXTransposeMultiplyVecX( void ) {
 			GetBest( start, end, bestClocksSIMD );
 		}
 
-		result = dst.Compare( tst, MATX_SIMD_EPSILON ) ? "ok" : S_COLOR_RED"X";
+		result = dst.Compare( tst, MATX_SIMD_EPSILON ) ? "ok" :  S_COLOR_RED "X";
 		PrintClocks( va( "   simd->MatX_TransposeMulVecX 6x%d*6x1 %s", i, result ), 1, bestClocksSIMD, bestClocksGeneric );
 	}
 }
@@ -1785,7 +1785,7 @@ void TestMatXTransposeMultiplyAddVecX( void ) {
 			GetBest( start, end, bestClocksSIMD );
 		}
 
-		result = dst.Compare( tst, MATX_SIMD_EPSILON ) ? "ok" : S_COLOR_RED"X";
+		result = dst.Compare( tst, MATX_SIMD_EPSILON ) ? "ok" :  S_COLOR_RED "X";
 		PrintClocks( va( "   simd->MatX_TransposeMulAddVecX %dx6*%dx1 %s", i, i, result ), 1, bestClocksSIMD, bestClocksGeneric );
 	}
 
@@ -1815,7 +1815,7 @@ void TestMatXTransposeMultiplyAddVecX( void ) {
 			GetBest( start, end, bestClocksSIMD );
 		}
 
-		result = dst.Compare( tst, MATX_SIMD_EPSILON ) ? "ok" : S_COLOR_RED"X";
+		result = dst.Compare( tst, MATX_SIMD_EPSILON ) ? "ok" :  S_COLOR_RED "X";
 		PrintClocks( va( "   simd->MatX_TransposeMulAddVecX 6x%d*6x1 %s", i, result ), 1, bestClocksSIMD, bestClocksGeneric );
 	}
 }
@@ -1861,7 +1861,7 @@ void TestMatXMultiplyMatX( void ) {
 			GetBest( start, end, bestClocksSIMD );
 		}
 
-		result = dst.Compare( tst, MATX_MATX_SIMD_EPSILON ) ? "ok" : S_COLOR_RED"X";
+		result = dst.Compare( tst, MATX_MATX_SIMD_EPSILON ) ? "ok" :  S_COLOR_RED "X";
 		PrintClocks( va( "   simd->MatX_MultiplyMatX %dx%d*%dx6 %s", i, i, i, result ), 1, bestClocksSIMD, bestClocksGeneric );
 	}
 
@@ -1892,7 +1892,7 @@ void TestMatXMultiplyMatX( void ) {
 			GetBest( start, end, bestClocksSIMD );
 		}
 
-		result = dst.Compare( tst, MATX_MATX_SIMD_EPSILON ) ? "ok" : S_COLOR_RED"X";
+		result = dst.Compare( tst, MATX_MATX_SIMD_EPSILON ) ? "ok" :  S_COLOR_RED "X";
 		PrintClocks( va( "   simd->MatX_MultiplyMatX 6x%d*%dx6 %s", i, i, result ), 1, bestClocksSIMD, bestClocksGeneric );
 	}
 
@@ -1923,7 +1923,7 @@ void TestMatXMultiplyMatX( void ) {
 			GetBest( start, end, bestClocksSIMD );
 		}
 
-		result = dst.Compare( tst, MATX_MATX_SIMD_EPSILON ) ? "ok" : S_COLOR_RED"X";
+		result = dst.Compare( tst, MATX_MATX_SIMD_EPSILON ) ? "ok" :  S_COLOR_RED "X";
 		PrintClocks( va( "   simd->MatX_MultiplyMatX %dx6*6x%d %s", i, i, result ), 1, bestClocksSIMD, bestClocksGeneric );
 	}
 
@@ -1954,7 +1954,7 @@ void TestMatXMultiplyMatX( void ) {
 			GetBest( start, end, bestClocksSIMD );
 		}
 
-		result = dst.Compare( tst, MATX_MATX_SIMD_EPSILON ) ? "ok" : S_COLOR_RED"X";
+		result = dst.Compare( tst, MATX_MATX_SIMD_EPSILON ) ? "ok" :  S_COLOR_RED "X";
 		PrintClocks( va( "   simd->MatX_MultiplyMatX 6x6*6x%d %s", i, result ), 1, bestClocksSIMD, bestClocksGeneric );
 	}
 }
@@ -1997,7 +1997,7 @@ void TestMatXTransposeMultiplyMatX( void ) {
 			GetBest( start, end, bestClocksSIMD );
 		}
 
-		result = dst.Compare( tst, MATX_MATX_SIMD_EPSILON ) ? "ok" : S_COLOR_RED"X";
+		result = dst.Compare( tst, MATX_MATX_SIMD_EPSILON ) ? "ok" :  S_COLOR_RED "X";
 		PrintClocks( va( "   simd->MatX_TransMultiplyMatX %dx6*%dx%d %s", i, i, i, result ), 1, bestClocksSIMD, bestClocksGeneric );
 	}
 
@@ -2028,7 +2028,7 @@ void TestMatXTransposeMultiplyMatX( void ) {
 			GetBest( start, end, bestClocksSIMD );
 		}
 
-		result = dst.Compare( tst, MATX_MATX_SIMD_EPSILON ) ? "ok" : S_COLOR_RED"X";
+		result = dst.Compare( tst, MATX_MATX_SIMD_EPSILON ) ? "ok" :  S_COLOR_RED "X";
 		PrintClocks( va( "   simd->MatX_TransMultiplyMatX 6x%d*6x6 %s", i, result ), 1, bestClocksSIMD, bestClocksGeneric );
 	}
 }
@@ -2078,7 +2078,7 @@ void TestMatXLowerTriangularSolve( void ) {
 			GetBest( start, end, bestClocksSIMD );
 		}
 
-		result = x.Compare( tst, MATX_LTS_SIMD_EPSILON ) ? "ok" : S_COLOR_RED"X";
+		result = x.Compare( tst, MATX_LTS_SIMD_EPSILON ) ? "ok" :  S_COLOR_RED "X";
 		PrintClocks( va( "   simd->MatX_LowerTriangularSolve %dx%d %s", i, i, result ), 1, bestClocksSIMD, bestClocksGeneric );
 	}
 }
@@ -2125,7 +2125,7 @@ void TestMatXLowerTriangularSolveTranspose( void ) {
 			GetBest( start, end, bestClocksSIMD );
 		}
 
-		result = x.Compare( tst, MATX_LTS_SIMD_EPSILON ) ? "ok" : S_COLOR_RED"X";
+		result = x.Compare( tst, MATX_LTS_SIMD_EPSILON ) ? "ok" :  S_COLOR_RED "X";
 		PrintClocks( va( "   simd->MatX_LowerTriangularSolveT %dx%d %s", i, i, result ), 1, bestClocksSIMD, bestClocksGeneric );
 	}
 }
@@ -2175,7 +2175,7 @@ void TestMatXLDLTFactor( void ) {
 			GetBest( start, end, bestClocksSIMD );
 		}
 
-		result = mat1.Compare( mat2, MATX_LDLT_SIMD_EPSILON ) && invDiag1.Compare( invDiag2, MATX_LDLT_SIMD_EPSILON ) ? "ok" : S_COLOR_RED"X";
+		result = mat1.Compare( mat2, MATX_LDLT_SIMD_EPSILON ) && invDiag1.Compare( invDiag2, MATX_LDLT_SIMD_EPSILON ) ? "ok" :  S_COLOR_RED "X";
 		PrintClocks( va( "   simd->MatX_LDLTFactor %dx%d %s", i, i, result ), 1, bestClocksSIMD, bestClocksGeneric );
 	}
 }
@@ -2248,7 +2248,7 @@ void TestBlendJoints( void ) {
 			break;
 		}
 	}
-	result = ( i >= COUNT ) ? "ok" : S_COLOR_RED"X";
+	result = ( i >= COUNT ) ? "ok" :  S_COLOR_RED "X";
 	PrintClocks( va( "   simd->BlendJoints() %s", result ), COUNT, bestClocksSIMD, bestClocksGeneric );
 }
 
@@ -2300,7 +2300,7 @@ void TestConvertJointQuatsToJointMats( void ) {
 			break;
 		}
 	}
-	result = ( i >= COUNT ) ? "ok" : S_COLOR_RED"X";
+	result = ( i >= COUNT ) ? "ok" :  S_COLOR_RED "X";
 	PrintClocks( va( "   simd->ConvertJointQuatsToJointMats() %s", result ), COUNT, bestClocksSIMD, bestClocksGeneric );
 }
 
@@ -2359,7 +2359,7 @@ void TestConvertJointMatsToJointQuats( void ) {
 			break;
 		}
 	}
-	result = ( i >= COUNT ) ? "ok" : S_COLOR_RED"X";
+	result = ( i >= COUNT ) ? "ok" :  S_COLOR_RED "X";
 	PrintClocks( va( "   simd->ConvertJointMatsToJointQuats() %s", result ), COUNT, bestClocksSIMD, bestClocksGeneric );
 }
 
@@ -2421,7 +2421,7 @@ void TestTransformJoints( void ) {
 			break;
 		}
 	}
-	result = ( i >= COUNT ) ? "ok" : S_COLOR_RED"X";
+	result = ( i >= COUNT ) ? "ok" :  S_COLOR_RED "X";
 	PrintClocks( va( "   simd->TransformJoints() %s", result ), COUNT, bestClocksSIMD, bestClocksGeneric );
 }
 
@@ -2483,7 +2483,7 @@ void TestUntransformJoints( void ) {
 			break;
 		}
 	}
-	result = ( i >= COUNT ) ? "ok" : S_COLOR_RED"X";
+	result = ( i >= COUNT ) ? "ok" :  S_COLOR_RED "X";
 	PrintClocks( va( "   simd->UntransformJoints() %s", result ), COUNT, bestClocksSIMD, bestClocksGeneric );
 }
 
@@ -2550,7 +2550,7 @@ void TestTransformVerts( void ) {
 			break;
 		}
 	}
-	result = ( i >= NUMVERTS ) ? "ok" : S_COLOR_RED"X";
+	result = ( i >= NUMVERTS ) ? "ok" :  S_COLOR_RED "X";
 	PrintClocks( va( "   simd->TransformVerts() %s", result ), COUNT, bestClocksSIMD, bestClocksGeneric );
 }
 
@@ -2608,7 +2608,7 @@ void TestTracePointCull( void ) {
 			break;
 		}
 	}
-	result = ( i >= COUNT && totalOr1 == totalOr2 ) ? "ok" : S_COLOR_RED"X";
+	result = ( i >= COUNT && totalOr1 == totalOr2 ) ? "ok" :  S_COLOR_RED "X";
 	PrintClocks( va( "   simd->TracePointCull() %s", result ), COUNT, bestClocksSIMD, bestClocksGeneric );
 }
 
@@ -2669,7 +2669,7 @@ void TestDecalPointCull( void ) {
 			break;
 		}
 	}
-	result = ( i >= COUNT ) ? "ok" : S_COLOR_RED"X";
+	result = ( i >= COUNT ) ? "ok" :  S_COLOR_RED "X";
 	PrintClocks( va( "   simd->DecalPointCull() %s", result ), COUNT, bestClocksSIMD, bestClocksGeneric );
 }
 
@@ -2727,7 +2727,7 @@ void TestOverlayPointCull( void ) {
 			break;
 		}
 	}
-	result = ( i >= COUNT ) ? "ok" : S_COLOR_RED"X";
+	result = ( i >= COUNT ) ? "ok" :  S_COLOR_RED "X";
 	PrintClocks( va( "   simd->OverlayPointCull() %s", result ), COUNT, bestClocksSIMD, bestClocksGeneric );
 }
 
@@ -2786,7 +2786,7 @@ void TestDeriveTriPlanes( void ) {
 			break;
 		}
 	}
-	result = ( i >= COUNT ) ? "ok" : S_COLOR_RED"X";
+	result = ( i >= COUNT ) ? "ok" :  S_COLOR_RED "X";
 	PrintClocks( va( "   simd->DeriveTriPlanes() %s", result ), COUNT, bestClocksSIMD, bestClocksGeneric );
 }
 
@@ -2871,7 +2871,7 @@ void TestDeriveTangents( void ) {
 			break;
 		}
 	}
-	result = ( i >= COUNT ) ? "ok" : S_COLOR_RED"X";
+	result = ( i >= COUNT ) ? "ok" :  S_COLOR_RED "X";
 	PrintClocks( va( "   simd->DeriveTangents() %s", result ), COUNT, bestClocksSIMD, bestClocksGeneric );
 }
 
@@ -2948,7 +2948,7 @@ void TestDeriveUnsmoothedTangents( void ) {
 			break;
 		}
 	}
-	result = ( i >= COUNT ) ? "ok" : S_COLOR_RED"X";
+	result = ( i >= COUNT ) ? "ok" :  S_COLOR_RED "X";
 	PrintClocks( va( "   simd->DeriveUnsmoothedTangents() %s", result ), COUNT, bestClocksSIMD, bestClocksGeneric );
 }
 
@@ -3009,7 +3009,7 @@ void TestNormalizeTangents( void ) {
 			break;
 		}
 	}
-	result = ( i >= COUNT ) ? "ok" : S_COLOR_RED"X";
+	result = ( i >= COUNT ) ? "ok" :  S_COLOR_RED "X";
 	PrintClocks( va( "   simd->NormalizeTangents() %s", result ), COUNT, bestClocksSIMD, bestClocksGeneric );
 }
 
@@ -3071,7 +3071,7 @@ void TestGetTextureSpaceLightVectors( void ) {
 			break;
 		}
 	}
-	result = ( i >= COUNT ) ? "ok" : S_COLOR_RED"X";
+	result = ( i >= COUNT ) ? "ok" :  S_COLOR_RED "X";
 	PrintClocks( va( "   simd->CreateTextureSpaceLightVectors() %s", result ), COUNT, bestClocksSIMD, bestClocksGeneric );
 }
 
@@ -3136,7 +3136,7 @@ void TestGetSpecularTextureCoords( void ) {
 			break;
 		}
 	}
-	result = ( i >= COUNT ) ? "ok" : S_COLOR_RED"X";
+	result = ( i >= COUNT ) ? "ok" :  S_COLOR_RED "X";
 	PrintClocks( va( "   simd->CreateSpecularTextureCoords() %s", result ), COUNT, bestClocksSIMD, bestClocksGeneric );
 }
 
@@ -3207,7 +3207,7 @@ void TestCreateShadowCache( void ) {
 		}
 	}
 
-	result = ( i >= COUNT && numVerts1 == numVerts2 ) ? "ok" : S_COLOR_RED"X";
+	result = ( i >= COUNT && numVerts1 == numVerts2 ) ? "ok" :  S_COLOR_RED "X";
 	PrintClocks( va( "   simd->CreateShadowCache() %s", result ), COUNT, bestClocksSIMD, bestClocksGeneric );
 
 	bestClocksGeneric = 0;
@@ -3235,7 +3235,7 @@ void TestCreateShadowCache( void ) {
 			break;
 		}
 	}
-	result = ( i >= COUNT ) ? "ok" : S_COLOR_RED"X";
+	result = ( i >= COUNT ) ? "ok" :  S_COLOR_RED "X";
 	PrintClocks( va( "   simd->CreateVertexProgramShadowCache() %s", result ), COUNT, bestClocksSIMD, bestClocksGeneric );
 }
 
@@ -3294,7 +3294,7 @@ void TestSoundUpSampling( void ) {
 					break;
 				}
 			}
-			result = ( i >= MIXBUFFER_SAMPLES*numSpeakers ) ? "ok" : S_COLOR_RED"X";
+			result = ( i >= MIXBUFFER_SAMPLES*numSpeakers ) ? "ok" :  S_COLOR_RED "X";
 			PrintClocks( va( "   simd->UpSamplePCMTo44kHz( %d, %d ) %s", kHz, numSpeakers, result ), MIXBUFFER_SAMPLES*numSpeakers*kHz/44100, bestClocksSIMD, bestClocksGeneric );
 		}
 	}
@@ -3324,7 +3324,7 @@ void TestSoundUpSampling( void ) {
 					break;
 				}
 			}
-			result = ( i >= MIXBUFFER_SAMPLES ) ? "ok" : S_COLOR_RED"X";
+			result = ( i >= MIXBUFFER_SAMPLES ) ? "ok" :  S_COLOR_RED "X";
 			PrintClocks( va( "   simd->UpSampleOGGTo44kHz( %d, %d ) %s", kHz, numSpeakers, result ), MIXBUFFER_SAMPLES*numSpeakers*kHz/44100, bestClocksSIMD, bestClocksGeneric );
 		}
 	}
@@ -3391,7 +3391,7 @@ void TestSoundMixing( void ) {
 			break;
 		}
 	}
-	result = ( i >= MIXBUFFER_SAMPLES*6 ) ? "ok" : S_COLOR_RED"X";
+	result = ( i >= MIXBUFFER_SAMPLES*6 ) ? "ok" :  S_COLOR_RED "X";
 	PrintClocks( va( "   simd->MixSoundTwoSpeakerMono() %s", result ), MIXBUFFER_SAMPLES, bestClocksSIMD, bestClocksGeneric );
 
 	bestClocksGeneric = 0;
@@ -3423,7 +3423,7 @@ void TestSoundMixing( void ) {
 			break;
 		}
 	}
-	result = ( i >= MIXBUFFER_SAMPLES*6 ) ? "ok" : S_COLOR_RED"X";
+	result = ( i >= MIXBUFFER_SAMPLES*6 ) ? "ok" :  S_COLOR_RED "X";
 	PrintClocks( va( "   simd->MixSoundTwoSpeakerStereo() %s", result ), MIXBUFFER_SAMPLES, bestClocksSIMD, bestClocksGeneric );
 
 
@@ -3456,7 +3456,7 @@ void TestSoundMixing( void ) {
 			break;
 		}
 	}
-	result = ( i >= MIXBUFFER_SAMPLES*6 ) ? "ok" : S_COLOR_RED"X";
+	result = ( i >= MIXBUFFER_SAMPLES*6 ) ? "ok" :  S_COLOR_RED "X";
 	PrintClocks( va( "   simd->MixSoundSixSpeakerMono() %s", result ), MIXBUFFER_SAMPLES, bestClocksSIMD, bestClocksGeneric );
 
 	bestClocksGeneric = 0;
@@ -3488,7 +3488,7 @@ void TestSoundMixing( void ) {
 			break;
 		}
 	}
-	result = ( i >= MIXBUFFER_SAMPLES*6 ) ? "ok" : S_COLOR_RED"X";
+	result = ( i >= MIXBUFFER_SAMPLES*6 ) ? "ok" :  S_COLOR_RED "X";
 	PrintClocks( va( "   simd->MixSoundSixSpeakerStereo() %s", result ), MIXBUFFER_SAMPLES, bestClocksSIMD, bestClocksGeneric );
 
 
@@ -3524,7 +3524,7 @@ void TestSoundMixing( void ) {
 			break;
 		}
 	}
-	result = ( i >= MIXBUFFER_SAMPLES*6 ) ? "ok" : S_COLOR_RED"X";
+	result = ( i >= MIXBUFFER_SAMPLES*6 ) ? "ok" :  S_COLOR_RED "X";
 	PrintClocks( va( "   simd->MixedSoundToSamples() %s", result ), MIXBUFFER_SAMPLES, bestClocksSIMD, bestClocksGeneric );
 }
 
@@ -3983,7 +3983,7 @@ void TestNegate( void ) {
 			break;
 		}
 	}
-	result = ( i >= COUNT ) ? "ok" : S_COLOR_RED"X";
+	result = ( i >= COUNT ) ? "ok" :  S_COLOR_RED "X";
 	PrintClocks( va( "   simd->Negate16( float[] ) %s", result ), COUNT, bestClocksSIMD, bestClocksGeneric );
 }
 
diff --git a/neo/renderer/Model_ma.cpp b/neo/renderer/Model_ma.cpp
index e31ca40..1cd672a 100644
--- a/neo/renderer/Model_ma.cpp
+++ b/neo/renderer/Model_ma.cpp
@@ -203,7 +203,7 @@ bool MA_ParseVertex(idParser& parser, maAttribHeader_t* header) {
 
 	//Allocate enough space for all the verts if this is the first attribute for verticies
 	if(!pMesh->vertexes) {
-		pMesh->numVertexes = header->size;
+		pMesh->numVertexes = header->size; // XXX: +1?
 		pMesh->vertexes = (idVec3 *)Mem_Alloc( sizeof( idVec3 ) * pMesh->numVertexes );
 	}
 
@@ -692,7 +692,16 @@ void MA_ParseMesh(idParser& parser) {
 
 	//Now apply the pt transformations
 	for(int i = 0; i < pMesh->numVertTransforms; i++) {
-		pMesh->vertexes[(int)pMesh->vertTransforms[i].w] +=  pMesh->vertTransforms[i].ToVec3();
+		int idx = (int)pMesh->vertTransforms[i].w;
+		if(idx < 0 || idx >= pMesh->numVertexes)
+		{
+			// this happens with d3xp/models/david/hell_h7.ma in the d3xp hell level
+			// TODO: if it happens for other models, too, maybe it's intended and the .ma parsing is broken
+			common->Warning( "Model %s tried to set an out-of-bounds vertex transform (%d, but max vert. index is %d)!",
+							 parser.GetFileName(), idx, pMesh->numVertexes-1 );
+			continue;
+		}
+		pMesh->vertexes[idx] +=  pMesh->vertTransforms[i].ToVec3();
 	}
 
 	MA_VERBOSE((va("MESH %s - parent %s\n", header.name, header.parent)));
diff --git a/neo/renderer/RenderSystem_init.cpp b/neo/renderer/RenderSystem_init.cpp
index 9c7d575..ffd60f3 100644
--- a/neo/renderer/RenderSystem_init.cpp
+++ b/neo/renderer/RenderSystem_init.cpp
@@ -482,8 +482,10 @@ vidmode_t r_vidModes[] = {
 	{ "Mode 19: 3200x2400",		3200,	2400 },
 	{ "Mode 20: 3840x2160",		3840,   2160 },
 	{ "Mode 21: 4096x2304",		4096,   2304 },
+	{ "Mode 22: 2880x1800",		2880,   1800 },
 };
-static int	s_numVidModes = ( sizeof( r_vidModes ) / sizeof( r_vidModes[0] ) );
+// DG: made this an enum so even stupid compilers accept it as array length below
+enum {	s_numVidModes = sizeof( r_vidModes ) / sizeof( r_vidModes[0] ) };
 
 static bool R_GetModeInfo( int *width, int *height, int mode ) {
 	vidmode_t	*vm;
@@ -513,6 +515,45 @@ static bool R_GetModeInfo( int *width, int *height, int mode ) {
 	return true;
 }
 
+// DG: I added all this vidModeInfoPtr stuff, so I can have a second list of vidmodes
+//     that are sorted (by width, height), instead of just r_mode index.
+//     That way I can add modes without breaking r_mode, but still display them
+//     sorted in the menu.
+
+struct vidModePtr {
+	vidmode_t* vidMode;
+	int modeIndex;
+};
+
+static vidModePtr sortedVidModes[s_numVidModes];
+
+static int vidModeCmp(const void* vm1, const void* vm2)
+{
+	const vidModePtr* v1 = static_cast<const vidModePtr*>(vm1);
+	const vidModePtr* v2 = static_cast<const vidModePtr*>(vm2);
+
+	// sort primarily by width, secondarily by height
+	int wdiff = v1->vidMode->width - v2->vidMode->width;
+	return (wdiff != 0) ? wdiff : (v1->vidMode->height - v2->vidMode->height);
+}
+
+static void initSortedVidModes()
+{
+	if(sortedVidModes[0].vidMode != NULL)
+	{
+		// already initialized
+		return;
+	}
+
+	for(int i=0; i<s_numVidModes; ++i)
+	{
+		sortedVidModes[i].modeIndex = i;
+		sortedVidModes[i].vidMode = &r_vidModes[i];
+	}
+
+	qsort(sortedVidModes, s_numVidModes, sizeof(vidModePtr), vidModeCmp);
+}
+
 // DG: the following two functions are part of a horrible hack in ChoiceWindow.cpp
 //     to overwrite the default resolution list in the system options menu
 
@@ -520,14 +561,14 @@ static bool R_GetModeInfo( int *width, int *height, int mode ) {
 idStr R_GetVidModeListString()
 {
 	idStr ret = "r_custom*";
-	// for some reason, modes 0-2 are not used. maybe too small for GUI?
-	for(int mode=3; mode<s_numVidModes; ++mode)
+
+	for(int i=0; i<s_numVidModes; ++i)
 	{
-		int w, h;
-		if(R_GetModeInfo(&w, &h, mode))
+		// for some reason, modes 0-2 are not used. maybe too small for GUI?
+		if(sortedVidModes[i].modeIndex >= 3 && sortedVidModes[i].vidMode != NULL)
 		{
 			idStr modeStr;
-			sprintf(modeStr, ";%dx%d", w, h);
+			sprintf(modeStr, ";%dx%d", sortedVidModes[i].vidMode->width, sortedVidModes[i].vidMode->height);
 			ret += modeStr;
 		}
 	}
@@ -538,10 +579,14 @@ idStr R_GetVidModeListString()
 idStr R_GetVidModeValsString()
 {
 	idStr ret =  "-1"; // for custom resolutions using r_customWidth/r_customHeight
-	for(int mode=3; mode<s_numVidModes; ++mode)
+	for(int i=0; i<s_numVidModes; ++i)
 	{
-		ret += ";";
-		ret += mode;
+		// for some reason, modes 0-2 are not used. maybe too small for GUI?
+		if(sortedVidModes[i].modeIndex >= 3 && sortedVidModes[i].vidMode != NULL)
+		{
+			ret += ";";
+			ret += sortedVidModes[i].modeIndex;
+		}
 	}
 	return ret;
 }
@@ -579,6 +624,8 @@ void R_InitOpenGL( void ) {
 	tr.viewportOffset[0] = 0;
 	tr.viewportOffset[1] = 0;
 
+	initSortedVidModes();
+
 	//
 	// initialize OS specific portions of the renderSystem
 	//
diff --git a/neo/sys/events.cpp b/neo/sys/events.cpp
index ff9bb09..92b175d 100644
--- a/neo/sys/events.cpp
+++ b/neo/sys/events.cpp
@@ -484,8 +484,8 @@ sysEvent_t Sys_GetEvent() {
 
 			// fall through
 		case SDL_KEYUP:
-			key = mapkey(ev.key.keysym.sym);
 #if !SDL_VERSION_ATLEAST(2, 0, 0)
+			key = mapkey(ev.key.keysym.sym);
 			if (!key) {
 				unsigned char c;
 				// check if its an unmapped console key
@@ -500,6 +500,27 @@ sysEvent_t Sys_GetEvent() {
 				}
 			}
 #else
+		{
+			// workaround for AZERTY-keyboards, which don't have 1, 2, ..., 9, 0 in first row:
+			// always map those physical keys (scancodes) to those keycodes anyway
+			// see also https://bugzilla.libsdl.org/show_bug.cgi?id=3188
+			SDL_Scancode sc = ev.key.keysym.scancode;
+			if(sc == SDL_SCANCODE_0)
+			{
+				key = '0';
+			}
+			else if(sc >= SDL_SCANCODE_1 && sc <= SDL_SCANCODE_9)
+			{
+				// note that the SDL_SCANCODEs are SDL_SCANCODE_1, _2, ..., _9, SDL_SCANCODE_0
+				// while in ASCII it's '0', '1', ..., '9' => handle 0 and 1-9 separately
+				// (doom3 uses the ASCII values for those keys)
+				key = '1' + (sc - SDL_SCANCODE_1);
+			}
+			else
+			{
+				key = mapkey(ev.key.keysym.sym);
+			}
+
 			if(!key) {
 				if (ev.key.keysym.scancode == SDL_SCANCODE_GRAVE) { // TODO: always do this check?
 					key = Sys_GetConsoleKey(true);
@@ -510,7 +531,7 @@ sysEvent_t Sys_GetEvent() {
 					continue; // handle next event
 				}
 			}
-
+		}
 #endif
 
 			res.evType = SE_KEY;
@@ -607,6 +628,18 @@ sysEvent_t Sys_GetEvent() {
 					mouse_polls.Append(mouse_poll_t(M_DELTAZ, -1));
 				break;
 #endif
+			default:
+#if SDL_VERSION_ATLEAST(2, 0, 0)
+				// handle X1 button and above
+				if( ev.button.button < SDL_BUTTON_LEFT + 8 ) // doesn't support more than 8 mouse buttons
+				{
+					int buttonIndex = ev.button.button - SDL_BUTTON_LEFT;
+					res.evValue = K_MOUSE1 + buttonIndex;
+					mouse_polls.Append( mouse_poll_t( M_ACTION1 + buttonIndex, ev.button.state == SDL_PRESSED ? 1 : 0 ) );
+				}
+				else
+#endif
+				continue; // handle next event
 			}
 
 			res.evValue2 = ev.button.state == SDL_PRESSED ? 1 : 0;
@@ -629,7 +662,8 @@ sysEvent_t Sys_GetEvent() {
 				continue; // handle next event
 			}
 		default:
-			common->Warning("unknown SDL event 0x%x", ev.type);
+			// ok, I don't /really/ care about unknown SDL events. only uncomment this for debugging.
+			// common->Warning("unknown SDL event 0x%x", ev.type);
 			continue; // handle next event
 		}
 	}
diff --git a/neo/sys/posix/posix_net.cpp b/neo/sys/posix/posix_net.cpp
index 1ff3451..db83fa9 100644
--- a/neo/sys/posix/posix_net.cpp
+++ b/neo/sys/posix/posix_net.cpp
@@ -318,6 +318,7 @@ void Sys_InitNetworking(void)
 		if (num_interfaces >= MAX_INTERFACES)
 			break;
 	}
+	freeifaddrs(ifap);
 }
 
 /*
diff --git a/neo/tools/compilers/roqvq/codec.cpp b/neo/tools/compilers/roqvq/codec.cpp
index 344232f..612d088 100644
--- a/neo/tools/compilers/roqvq/codec.cpp
+++ b/neo/tools/compilers/roqvq/codec.cpp
@@ -322,7 +322,7 @@ void codec::Segment( int *alist, float *flist, int numElements, float rmse)
 int	codec::BestCodeword( unsigned char *tempvector, int dimension, VQDATA **codebook )
 {
 	VQDATA dist;
-	VQDATA bestDist = HUGE_VAL;
+	VQDATA bestDist = idMath::INFINITY;
 	VQDATA tempvq[64];
 	int bestIndex = -1;
 
@@ -1505,7 +1505,7 @@ void codec::VQ( const int numEntries, const int dimension, const unsigned char *
 		//
 		// find the closest two and eliminate one
 		//
-		double bestDist = HUGE_VAL;
+		double bestDist = idMath::INFINITY;
 		double dist, simport;
 		int bestIndex = -1;
 		int bestOtherIndex = 0;
@@ -1571,7 +1571,7 @@ void codec::VQ( const int numEntries, const int dimension, const unsigned char *
 		// until we have reduced it to 256 entries, find one to toss
 		//
 		do {
-			bestDist = HUGE_VAL;
+			bestDist = idMath::INFINITY;
 			bestIndex = -1;
 			bestOtherIndex = -1;
 			if (optimize) {
@@ -1586,7 +1586,7 @@ void codec::VQ( const int numEntries, const int dimension, const unsigned char *
 				}
 			}
 			if (bestIndex == -1 || !optimize) {
-				bestDist = HUGE_VAL;
+				bestDist = idMath::INFINITY;
 				bestIndex = -1;
 				bestOtherIndex = 0;
 				aentries = 0;
diff --git a/neo/ui/Winvar.cpp b/neo/ui/Winvar.cpp
index 1d20770..db726c3 100644
--- a/neo/ui/Winvar.cpp
+++ b/neo/ui/Winvar.cpp
@@ -42,7 +42,7 @@ idWinVar::idWinVar() {
 }
 
 idWinVar::~idWinVar() {
-	delete name;
+	delete[] name;
 	name = NULL;
 }
 
diff --git a/neo/ui/Winvar.h b/neo/ui/Winvar.h
index 8ab296f..856fed3 100644
--- a/neo/ui/Winvar.h
+++ b/neo/ui/Winvar.h
@@ -51,7 +51,7 @@ public:
 		return "";
 	}
 	void SetName(const char *_name) {
-		delete []name;
+		delete[] name;
 		name = NULL;
 		if (_name) {
 			name = new char[strlen(_name)+1];

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/dhewm3.git



More information about the Pkg-games-commits mailing list