diff --git a/code/game/NPC_senses.cpp b/code/game/NPC_senses.cpp index 67afb17..7dd9fd0 100644 --- a/code/game/NPC_senses.cpp +++ b/code/game/NPC_senses.cpp @@ -762,7 +762,7 @@ void AddSoundEvent( gentity_t *owner, vec3_t position, float radius, alertEventL // react to enemy alert events in some way? #ifdef _DEBUG - assert( !_isnan(position[0]) && !_isnan(position[1]) && !_isnan(position[2]) ); + assert( !Q_isnan(position[0]) && !Q_isnan(position[1]) && !Q_isnan(position[2]) ); #endif VectorCopy( position, level.alertEvents[ level.numAlertEvents ].position ); @@ -810,7 +810,7 @@ void AddSightEvent( gentity_t *owner, vec3_t position, float radius, alertEventL // react to enemy alert events in some way? #ifdef _DEBUG - assert( !_isnan(position[0]) && !_isnan(position[1]) && !_isnan(position[2]) ); + assert( !Q_isnan(position[0]) && !Q_isnan(position[1]) && !Q_isnan(position[2]) ); #endif VectorCopy( position, level.alertEvents[ level.numAlertEvents ].position ); diff --git a/code/game/bg_pmove.cpp b/code/game/bg_pmove.cpp index 468be66..b8e6694 100644 --- a/code/game/bg_pmove.cpp +++ b/code/game/bg_pmove.cpp @@ -7321,8 +7321,8 @@ void PM_FootSlopeTrace( float *pDiff, float *pInterval ) #if 1 for ( int i = 0; i < 3; i++ ) { - if ( _isnan( pm->gent->client->renderInfo.footLPoint[i] ) - || _isnan( pm->gent->client->renderInfo.footRPoint[i] ) ) + if ( Q_isnan( pm->gent->client->renderInfo.footLPoint[i] ) + || Q_isnan( pm->gent->client->renderInfo.footRPoint[i] ) ) { if ( pDiff != NULL ) { @@ -15342,4 +15342,4 @@ void Pmove( pmove_t *pmove ) {//half grav pm->ps->gravity *= 2; } -} \ No newline at end of file +} diff --git a/code/game/g_active.cpp b/code/game/g_active.cpp index 8969d52..c79e64c 100644 --- a/code/game/g_active.cpp +++ b/code/game/g_active.cpp @@ -1381,8 +1381,8 @@ void G_TouchTriggersLerped( gentity_t *ent ) { #ifdef _DEBUG for ( int j = 0; j < 3; j++ ) { - assert( !_isnan(ent->currentOrigin[j])); - assert( !_isnan(ent->lastOrigin[j])); + assert( !Q_isnan(ent->currentOrigin[j])); + assert( !Q_isnan(ent->lastOrigin[j])); } #endif// _DEBUG VectorSubtract( ent->currentOrigin, ent->lastOrigin, diff ); diff --git a/code/game/g_missile.cpp b/code/game/g_missile.cpp index 431dfb1..39a0105 100644 --- a/code/game/g_missile.cpp +++ b/code/game/g_missile.cpp @@ -295,7 +295,7 @@ void G_ReflectMissile( gentity_t *ent, gentity_t *missile, vec3_t forward ) VectorNormalize( bounce_dir ); VectorScale( bounce_dir, speed, missile->s.pos.trDelta ); #ifdef _DEBUG - assert( !_isnan(missile->s.pos.trDelta[0])&&!_isnan(missile->s.pos.trDelta[1])&&!_isnan(missile->s.pos.trDelta[2])); + assert( !Q_isnan(missile->s.pos.trDelta[0])&&!Q_isnan(missile->s.pos.trDelta[1])&&!Q_isnan(missile->s.pos.trDelta[2])); #endif// _DEBUG missile->s.pos.trTime = level.time - 10; // move a bit on the very first frame VectorCopy( missile->currentOrigin, missile->s.pos.trBase ); @@ -1531,4 +1531,4 @@ void G_RunMissile( gentity_t *ent ) } G_MissileImpact( ent, &tr, trHitLoc ); -} \ No newline at end of file +} diff --git a/code/game/q_shared.h b/code/game/q_shared.h index 78db3d0..20b4b5e 100644 --- a/code/game/q_shared.h +++ b/code/game/q_shared.h @@ -509,6 +509,8 @@ extern const vec3_t axisDefault[3]; #define IS_NAN(x) (((*(int *)&x)&nanmask)==nanmask) +#define Q_isnan(x) (isnan(x)) + #ifdef _XBOX inline void Q_CastShort2Float(float *f, const short *s) { diff --git a/code/ghoul2/G2_API.cpp b/code/ghoul2/G2_API.cpp index 4374f1a..13b55dc 100644 --- a/code/ghoul2/G2_API.cpp +++ b/code/ghoul2/G2_API.cpp @@ -1580,7 +1580,7 @@ qboolean G2API_GetBoltMatrix(CGhoul2Info_v &ghoul2, const int modelIndex, const { for ( int j = 0; j < 4; j++ ) { - assert( !_isnan(matrix->matrix[i][j])); + assert( !Q_isnan(matrix->matrix[i][j])); } } #endif// _DEBUG diff --git a/code/ghoul2/G2_bones.cpp b/code/ghoul2/G2_bones.cpp index 96ca6a8..d251e9a 100644 --- a/code/ghoul2/G2_bones.cpp +++ b/code/ghoul2/G2_bones.cpp @@ -1134,7 +1134,7 @@ static void G2_Generate_MatrixRag( { for (j = 0; j < 4; j++ ) { - assert( !_isnan(bone.matrix.matrix[i][j])); + assert( !Q_isnan(bone.matrix.matrix[i][j])); } } #endif// _DEBUG @@ -1214,8 +1214,8 @@ static int G2_Set_Bone_Rag(const mdxaHeader_t *mod_a, G2_GetBoneMatrixLow(ghoul2,bone.boneNumber,scale,bone.originalTrueBoneMatrix,bone.basepose,bone.baseposeInv); // bone.parentRawBoneIndex=G2_GetParentBoneMatrixLow(ghoul2,bone.boneNumber,scale,bone.parentTrueBoneMatrix,bone.baseposeParent,bone.baseposeInvParent); - assert( !_isnan(bone.originalTrueBoneMatrix.matrix[1][1])); - assert( !_isnan(bone.originalTrueBoneMatrix.matrix[1][3])); + assert( !Q_isnan(bone.originalTrueBoneMatrix.matrix[1][1])); + assert( !Q_isnan(bone.originalTrueBoneMatrix.matrix[1][3])); bone.originalOrigin[0]=bone.originalTrueBoneMatrix.matrix[0][3]; bone.originalOrigin[1]=bone.originalTrueBoneMatrix.matrix[1][3]; bone.originalOrigin[2]=bone.originalTrueBoneMatrix.matrix[2][3]; @@ -1625,7 +1625,7 @@ void G2_SetRagDoll(CGhoul2Info_v &ghoul2V,CRagDollParams *parms) //I am just leaving it whatever it is for now, because my velocity scaling //only works on x and y and the gravity stuff for NPCs is a bit unpleasent //trying to change/work with - assert( !_isnan(bone.lastShotDir[1])); + assert( !Q_isnan(bone.lastShotDir[1])); */ } } @@ -2091,7 +2091,7 @@ void G2_SetRagDollBullet(CGhoul2Info &ghoul2,const vec3_t rayStart,const vec3_t // bone.velocityEffector[0]=shotDir[0]*(effect+flrand(0.0f,0.05f))*flrand(-0.1f,3.0f); // bone.velocityEffector[1]=shotDir[1]*(effect+flrand(0.0f,0.05f))*flrand(-0.1f,3.0f); // bone.velocityEffector[2]=fabs(shotDir[2])*(effect+flrand(0.0f,0.05f))*flrand(-0.1f,3.0f); - assert( !_isnan(shotDir[2])); + assert( !Q_isnan(shotDir[2])); // bone.currentAngles[0]+=flrand(-10.0f*lenr,10.0f*lenr); // bone.currentAngles[1]+=flrand(-10.0f*lenr,10.0f*lenr); // bone.currentAngles[2]+=flrand(-10.0f*lenr,10.0f*lenr); @@ -2594,7 +2594,7 @@ static void G2_RagDollCurrentPosition(CGhoul2Info_v &ghoul2V,int g2Index,int fra for (k=0;k<3;k++) { ragEffectors[i].currentOrigin[k]=ragBones[i].matrix[k][3]; - assert( !_isnan(ragEffectors[i].currentOrigin[k])); + assert( !Q_isnan(ragEffectors[i].currentOrigin[k])); if (!i) { // set mins, maxs and cm @@ -2870,10 +2870,10 @@ static bool G2_RagDollSettlePositionNumeroTrois(CGhoul2Info_v &ghoul2V, const ve { trace_t tr; - assert( !_isnan(testStart[1])); - assert( !_isnan(testEnd[1])); - assert( !_isnan(testMins[1])); - assert( !_isnan(testMaxs[1])); + assert( !Q_isnan(testStart[1])); + assert( !Q_isnan(testEnd[1])); + assert( !Q_isnan(testMins[1])); + assert( !Q_isnan(testMaxs[1])); Rag_Trace(&tr,testStart,testMins,testMaxs,testEnd,ignoreNum,RAG_MASK,G2_NOCOLLIDE,0/*SV_TRACE_NO_PLAYER*/); if (tr.entityNum==0) { @@ -2931,10 +2931,10 @@ static bool G2_RagDollSettlePositionNumeroTrois(CGhoul2Info_v &ghoul2V, const ve vec3_t testEnd; VectorCopy(testStart,testEnd); //last arg is dest testEnd[2]-=8.0f; - assert( !_isnan(testStart[1])); - assert( !_isnan(testEnd[1])); - assert( !_isnan(testMins[1])); - assert( !_isnan(testMaxs[1])); + assert( !Q_isnan(testStart[1])); + assert( !Q_isnan(testEnd[1])); + assert( !Q_isnan(testMins[1])); + assert( !Q_isnan(testMaxs[1])); float vertEffectorTraceFraction=0.0f; { trace_t tr; @@ -3010,10 +3010,10 @@ static bool G2_RagDollSettlePositionNumeroTrois(CGhoul2Info_v &ghoul2V, const ve VectorCopy(effectorGroundSpot,testEnd); //last arg is dest bone.solidCount = 0; } - assert( !_isnan(testStart[1])); - assert( !_isnan(testEnd[1])); - assert( !_isnan(testMins[1])); - assert( !_isnan(testMaxs[1])); + assert( !Q_isnan(testStart[1])); + assert( !Q_isnan(testEnd[1])); + assert( !Q_isnan(testMins[1])); + assert( !Q_isnan(testMaxs[1])); float ztest; @@ -3240,7 +3240,7 @@ static inline void G2_RagGetWorldAnimMatrix(CGhoul2Info &ghoul2, boneInfo_t &bon //bone matrix and give us a useable world position Multiply_3x4Matrix(&retMatrix, &worldMatrix, &baseBoneMatrix); - assert(!_isnan(retMatrix.matrix[2][3])); + assert(!Q_isnan(retMatrix.matrix[2][3])); } //get the current pelvis Z direction and the base anim matrix Z direction @@ -3924,7 +3924,7 @@ static void G2_RagDollSolve(CGhoul2Info_v &ghoul2V,int g2Index,float decay,int f } */ - assert( !_isnan(bone.ragOverrideMatrix.matrix[2][3])); + assert( !Q_isnan(bone.ragOverrideMatrix.matrix[2][3])); vec3_t deltaInEntitySpace; TransformPoint(desiredPelvisOffset,deltaInEntitySpace,&N); // dest middle arg for (k=0;k<3;k++) @@ -3993,10 +3993,10 @@ static void G2_RagDollSolve(CGhoul2Info_v &ghoul2V,int g2Index,float decay,int f vec3_t change; VectorSubtract(tPosition,ragEffectors[depIndex].currentOrigin,change); // dest is last arg float goodness=DotProduct(change,ragEffectors[depIndex].desiredDirection); - assert( !_isnan(goodness)); + assert( !Q_isnan(goodness)); goodness*=depBone.weight; delAngles[k]+=goodness; // keep bigger stuff more out of wall or something - assert( !_isnan(delAngles[k])); + assert( !Q_isnan(delAngles[k])); } allSolidCount += depBone.solidCount; } @@ -4102,7 +4102,7 @@ static void G2_RagDollSolve(CGhoul2Info_v &ghoul2V,int g2Index,float decay,int f Create_Matrix(bone.currentAngles,&temp1); Multiply_3x4Matrix(&temp2,&temp1,bone.baseposeInv); Multiply_3x4Matrix(&bone.ragOverrideMatrix,bone.basepose, &temp2); - assert( !_isnan(bone.ragOverrideMatrix.matrix[2][3])); + assert( !Q_isnan(bone.ragOverrideMatrix.matrix[2][3])); } G2_Generate_MatrixRag(blist,ragBlistIndex[bone.boneNumber]); } @@ -4238,10 +4238,10 @@ static void G2_IKSolve(CGhoul2Info_v &ghoul2V,int g2Index,float decay,int frameN vec3_t change; VectorSubtract(tPosition,ragEffectors[depIndex].currentOrigin,change); // dest is last arg float goodness=DotProduct(change,ragEffectors[depIndex].desiredDirection); - assert( !_isnan(goodness)); + assert( !Q_isnan(goodness)); goodness*=depBone.weight; delAngles[k]+=goodness; // keep bigger stuff more out of wall or something - assert( !_isnan(delAngles[k])); + assert( !Q_isnan(delAngles[k])); } } } @@ -4298,7 +4298,7 @@ static void G2_IKSolve(CGhoul2Info_v &ghoul2V,int g2Index,float decay,int frameN Create_Matrix(bone.currentAngles, &temp1); Multiply_3x4Matrix(&temp2, &temp1, bone.baseposeInv); Multiply_3x4Matrix(&bone.ragOverrideMatrix, bone.basepose, &temp2); - assert( !_isnan(bone.ragOverrideMatrix.matrix[2][3])); + assert( !Q_isnan(bone.ragOverrideMatrix.matrix[2][3])); G2_Generate_MatrixRag(blist, ragBlistIndex[bone.boneNumber]); } diff --git a/code/ghoul2/G2_misc.cpp b/code/ghoul2/G2_misc.cpp index 4eb65f4..2d562ae 100644 --- a/code/ghoul2/G2_misc.cpp +++ b/code/ghoul2/G2_misc.cpp @@ -1142,7 +1142,7 @@ static bool G2_TracePolys(const mdxmSurface_t *surface, const mdxmSurfHierarchy_ VectorSubtract(hitPoint, TS.rayStart, distVect); newCol.mDistance = VectorLength(distVect); - assert( !_isnan(newCol.mDistance) ); + assert( !Q_isnan(newCol.mDistance) ); // put the hit point back into world space TransformAndTranslatePoint(hitPoint, newCol.mCollisionPosition, &worldMatrix); @@ -1424,7 +1424,7 @@ static bool G2_RadiusTracePolys( VectorSubtract(hitPoint, TS.rayStart, distVect); newCol.mDistance = VectorLength(distVect); - assert( !_isnan(newCol.mDistance) ); + assert( !Q_isnan(newCol.mDistance) ); // put the hit point back into world space TransformAndTranslatePoint(hitPoint, newCol.mCollisionPosition, &worldMatrix); diff --git a/code/server/sv_world.cpp b/code/server/sv_world.cpp index d011cd4..1824283 100644 --- a/code/server/sv_world.cpp +++ b/code/server/sv_world.cpp @@ -834,7 +834,7 @@ void SV_Trace( trace_t *results, const vec3_t start, const vec3_t mins, const ve Ghoul2 Insert End */ #ifdef _DEBUG - assert( !_isnan(start[0])&&!_isnan(start[1])&&!_isnan(start[2])&&!_isnan(end[0])&&!_isnan(end[1])&&!_isnan(end[2])); + assert( !Q_isnan(start[0])&&!Q_isnan(start[1])&&!Q_isnan(start[2])&&!Q_isnan(end[0])&&!Q_isnan(end[1])&&!Q_isnan(end[2])); #endif// _DEBUG #if SV_TRACE_PROFILE