diff --git a/Demos/EPAPenDepthDemo/PenetrationTestBullet.cpp b/Demos/EPAPenDepthDemo/PenetrationTestBullet.cpp index 9c4302ee8..e83d53cbb 100644 --- a/Demos/EPAPenDepthDemo/PenetrationTestBullet.cpp +++ b/Demos/EPAPenDepthDemo/PenetrationTestBullet.cpp @@ -385,9 +385,9 @@ static bool TestSepAxis(const btVector3& sep_axis, const MyConvex& hull0, const return false; float d0 = Max0 - Min1; - assert(d0>=0.0f); + btAssert(d0>=0.0f); float d1 = Max1 - Min0; - assert(d1>=0.0f); + btAssert(d1>=0.0f); depth = d0=0.0f); + btAssert(d0>=0.0f); btScalar d1 = Max1 - Min0; - assert(d1>=0.0f); + btAssert(d1>=0.0f); depth = d0 #ifdef BT_DEBUG + #ifdef _MSC_VER + #include + #define btAssert(x) { if(!(x)){printf("Assert "__FILE__ ":%u ("#x")\n", __LINE__);__debugbreak(); }} + #else//_MSC_VER + #include #define btAssert assert + #endif//_MSC_VER #else #define btAssert(x) #endif @@ -190,10 +195,23 @@ inline int btGetVersion() #endif #if defined(DEBUG) || defined (_DEBUG) + #if defined (__i386__) || defined (__x86_64__) + #include + #define btAssert(x)\ + {\ + if(!(x))\ + {\ + printf("Assert %s in line %d, file %s\n",#x, __LINE__, __FILE__);\ + asm volatile ("int3");\ + }\ + } + #else//defined (__i386__) || defined (__x86_64__) #define btAssert assert - #else - #define btAssert(x) + #end//defined (__i386__) || defined (__x86_64__) #endif + #else//defined(DEBUG) || defined (_DEBUG) + #define btAssert(x) + #endif//defined(DEBUG) || defined (_DEBUG) //btFullAssert is optional, slows down a lot #define btFullAssert(x) diff --git a/src/LinearMath/btSerializer.h b/src/LinearMath/btSerializer.h index 7d90ad20a..b3dbd28f2 100644 --- a/src/LinearMath/btSerializer.h +++ b/src/LinearMath/btSerializer.h @@ -256,7 +256,7 @@ protected: */ intPtr = (int*)cp; - assert(strncmp(cp, "TYPE", 4)==0); intPtr++; + btAssert(strncmp(cp, "TYPE", 4)==0); intPtr++; if (!littleEndian) *intPtr = btSwapEndian(*intPtr); @@ -284,7 +284,7 @@ protected: // Parse type lens intPtr = (int*)cp; - assert(strncmp(cp, "TLEN", 4)==0); intPtr++; + btAssert(strncmp(cp, "TLEN", 4)==0); intPtr++; dataLen = (int)mTypes.size(); @@ -311,7 +311,7 @@ protected: intPtr = (int*)shtPtr; cp = (char*)intPtr; - assert(strncmp(cp, "STRC", 4)==0); intPtr++; + btAssert(strncmp(cp, "STRC", 4)==0); intPtr++; if (!littleEndian) *intPtr = btSwapEndian(*intPtr);