diff --git a/d3xp/Weapon.cpp b/d3xp/Weapon.cpp index 2101381..30f8882 100644 --- a/d3xp/Weapon.cpp +++ b/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/game/Weapon.cpp b/game/Weapon.cpp index d889c68..a381ae2 100644 --- a/game/Weapon.cpp +++ b/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();