Browse Source

Replace 1e24 with 1e16 to avoid float overflow

pull/26/head
nillerusr 3 years ago
parent
commit
cb04a1e451
  1. 2
      engine/cmodel.cpp
  2. 4
      engine/disp.cpp
  3. 4
      engine/disp_mapload.cpp
  4. 4
      engine/r_areaportal.cpp
  5. 4
      game/client/c_steamjet.cpp
  6. 4
      game/client/particle_iterators.h
  7. 2
      game/client/tf2/c_obj_mcv_selection_panel.cpp
  8. 2
      game/client/tf2/c_ragdoll_shadow.cpp
  9. 2
      game/server/player.cpp
  10. 2
      game/server/tf2/order_heal.cpp
  11. 2
      game/server/tf2/order_helpers.cpp
  12. 2
      game/server/tf2/order_killmortarguy.cpp
  13. 2
      game/server/tf2/order_mortar_attack.cpp
  14. 4
      game/server/tf2/order_repair.cpp
  15. 2
      game/server/tf2/tf_obj_barbed_wire.cpp
  16. 2
      game/server/tf2/tf_playerclass.cpp
  17. 2
      game/server/tf2/tf_team.h
  18. 2
      game/shared/physics_shared.cpp
  19. 4
      public/disp_common.cpp
  20. 2
      public/keyframe/keyframe.cpp
  21. 2
      vphysics/ledgewriter.cpp
  22. 6
      vphysics/trace.cpp

2
engine/cmodel.cpp

@ -2788,7 +2788,7 @@ int CFastPointLeafNum::GetLeaf( const Vector &vPos ) @@ -2788,7 +2788,7 @@ int CFastPointLeafNum::GetLeaf( const Vector &vPos )
m_vCachedPos = vPos;
CCollisionBSPData *pBSPData = GetCollisionBSPData();
m_flDistToExitLeafSqr = 1e24;
m_flDistToExitLeafSqr = 1e16;
m_iCachedLeaf = CM_PointLeafnumMinDistSqr_r( pBSPData, vPos, 0, m_flDistToExitLeafSqr );
}

4
engine/disp.cpp

@ -102,8 +102,8 @@ inline CVertIndex CDispInfo::IndexToVert( int index ) const @@ -102,8 +102,8 @@ inline CVertIndex CDispInfo::IndexToVert( int index ) const
void CDispInfo::UpdateBoundingBox()
{
m_BBoxMin.Init( 1e24, 1e24, 1e24 );
m_BBoxMax.Init( -1e24, -1e24, -1e24 );
m_BBoxMin.Init( 1e16, 1e16, 1e16 );
m_BBoxMax.Init( -1e16, -1e16, -1e16 );
for( int i=0; i < NumVerts(); i++ )
{

4
engine/disp_mapload.cpp

@ -793,7 +793,7 @@ CDispInfo::CDispInfo() @@ -793,7 +793,7 @@ CDispInfo::CDispInfo()
m_pPowerInfo = NULL;
m_ViewerSphereCenter.Init( 1e24, 1e24, 1e24 );
m_ViewerSphereCenter.Init( 1e16, 1e16, 1e16 );
m_bInUse = false;
@ -995,7 +995,7 @@ int FindNeighborCornerVert( CCoreDispInfo *pDisp, const Vector &vecPoint ) @@ -995,7 +995,7 @@ int FindNeighborCornerVert( CCoreDispInfo *pDisp, const Vector &vecPoint )
CDispUtilsHelper *pDispHelper = pDisp;
int iClosest = 0;
float flClosest = 1e24;
float flClosest = 1e16;
for ( int iCorner = 0; iCorner < 4; ++iCorner )
{

4
engine/r_areaportal.cpp

@ -122,8 +122,8 @@ struct portalclip_t @@ -122,8 +122,8 @@ struct portalclip_t
static inline bool GetPortalScreenExtents( dareaportal_t *pPortal,
portalclip_t * RESTRICT clip, CPortalRect &portalRect , float *pReflectionWaterHeight )
{
portalRect.left = portalRect.bottom = 1e24;
portalRect.right = portalRect.top = -1e24;
portalRect.left = portalRect.bottom = 1e16;
portalRect.right = portalRect.top = -1e16;
bool bValidExtents = false;
worldbrushdata_t *pBrushData = host_state.worldbrush;

4
game/client/c_steamjet.cpp

@ -150,8 +150,8 @@ C_SteamJet::C_SteamJet() @@ -150,8 +150,8 @@ C_SteamJet::C_SteamJet()
m_bFaceLeft = false;
m_ParticleEffect.SetAlwaysSimulate( false ); // Don't simulate outside the PVS or frustum.
m_vLastRampUpdatePos.Init( 1e24, 1e24, 1e24 );
m_vLastRampUpdateAngles.Init( 1e24, 1e24, 1e24 );
m_vLastRampUpdatePos.Init( 1e16, 1e16, 1e16 );
m_vLastRampUpdateAngles.Init( 1e16, 1e16, 1e16 );
}

4
game/client/particle_iterators.h

@ -125,8 +125,8 @@ inline CParticleRenderIterator::CParticleRenderIterator() @@ -125,8 +125,8 @@ inline CParticleRenderIterator::CParticleRenderIterator()
m_bGotFirst = false;
m_flPrevZ = 0;
m_nParticlesInCurrentBatch = 0;
m_MinZ = 1e24;
m_MaxZ = -1e24;
m_MinZ = 1e16;
m_MaxZ = -1e16;
m_nZCoords = 0;
}

2
game/client/tf2/c_obj_mcv_selection_panel.cpp

@ -173,7 +173,7 @@ void CMCVMinimapPanel::OnMousePressed( vgui::MouseCode code ) @@ -173,7 +173,7 @@ void CMCVMinimapPanel::OnMousePressed( vgui::MouseCode code )
// Find the closest MCV to their mouse press.
int iClosest = -1;
float flClosest = 1e24;
float flClosest = 1e16;
Vector2D curMousePos( m_LastX, m_LastY );
for ( int i=0; i < pPanel->m_DeployedTeleportStations.Count(); i++ )

2
game/client/tf2/c_ragdoll_shadow.cpp

@ -79,7 +79,7 @@ IPhysicsObject *PhysModelCreateCustom( C_BaseEntity *pEntity, const CPhysCollide @@ -79,7 +79,7 @@ IPhysicsObject *PhysModelCreateCustom( C_BaseEntity *pEntity, const CPhysCollide
solid_t solid;
solid.params = g_PhysDefaultObjectParams;
solid.params.mass = 85.0f;
solid.params.inertia = 1e24f;
solid.params.inertia = 1e16f;
int surfaceProp = -1;
if ( props && props[0] )
{

2
game/server/player.cpp

@ -8014,7 +8014,7 @@ void CBasePlayer::SetupVPhysicsShadow( const Vector &vecAbsOrigin, const Vector @@ -8014,7 +8014,7 @@ void CBasePlayer::SetupVPhysicsShadow( const Vector &vecAbsOrigin, const Vector
Q_strncpy( solid.surfaceprop, "player", sizeof(solid.surfaceprop) );
solid.params = g_PhysDefaultObjectParams;
solid.params.mass = 85.0f;
solid.params.inertia = 1e24f;
solid.params.inertia = 1e16f;
solid.params.enableCollisions = false;
//disable drag
solid.params.dragCoefficient = 0;

2
game/server/tf2/order_heal.cpp

@ -74,7 +74,7 @@ bool COrderHeal::CreateOrder( CPlayerClass *pClass ) @@ -74,7 +74,7 @@ bool COrderHeal::CreateOrder( CPlayerClass *pClass )
ORDER_HEAL,
pTeam->GetPlayer( sorted[0] ),
pClass->GetPlayer(),
1e24,
1e16,
60,
pOrder );

2
game/server/tf2/order_helpers.cpp

@ -157,7 +157,7 @@ bool OrderCreator_ResourceZoneObject( @@ -157,7 +157,7 @@ bool OrderCreator_ResourceZoneObject(
ORDER_BUILD,
pClosest,
pPlayer,
1e24,
1e16,
60,
pOrder
);

2
game/server/tf2/order_killmortarguy.cpp

@ -95,7 +95,7 @@ bool COrderKillMortarGuy::CreateOrder( CPlayerClass *pClass ) @@ -95,7 +95,7 @@ bool COrderKillMortarGuy::CreateOrder( CPlayerClass *pClass )
ORDER_KILL,
pBrian,
pClass->GetPlayer(),
1e24,
1e16,
60,
pOrder
);

2
game/server/tf2/order_mortar_attack.cpp

@ -61,7 +61,7 @@ bool COrderMortarAttack::CreateOrder( CPlayerClass *pClass ) @@ -61,7 +61,7 @@ bool COrderMortarAttack::CreateOrder( CPlayerClass *pClass )
ORDER_MORTAR_ATTACK,
pEnt,
pPlayer,
1e24,
1e16,
40,
pOrder
);

4
game/server/tf2/order_repair.cpp

@ -91,7 +91,7 @@ bool COrderRepair::CreateOrder_RepairFriendlyObjects( CPlayerClassDefender *pCla @@ -91,7 +91,7 @@ bool COrderRepair::CreateOrder_RepairFriendlyObjects( CPlayerClassDefender *pCla
ORDER_REPAIR,
pObjToHeal,
pPlayer,
1e24,
1e16,
60,
pOrder
);
@ -130,7 +130,7 @@ bool COrderRepair::CreateOrder_RepairOwnObjects( CPlayerClass *pClass ) @@ -130,7 +130,7 @@ bool COrderRepair::CreateOrder_RepairOwnObjects( CPlayerClass *pClass )
ORDER_REPAIR,
pObj,
info.m_pPlayer,
1e24,
1e16,
60,
pOrder
);

2
game/server/tf2/tf_obj_barbed_wire.cpp

@ -177,7 +177,7 @@ void CObjectBarbedWire::StartPlacement( CBaseTFPlayer *pPlayer ) @@ -177,7 +177,7 @@ void CObjectBarbedWire::StartPlacement( CBaseTFPlayer *pPlayer )
if ( pPlayer && !m_hConnectedTo )
{
// Automatically connect to the nearest barbed wire on our team.
float flClosest = 1e24;
float flClosest = 1e16;
CObjectBarbedWire *pClosest = NULL;
CBaseEntity *pCur = gEntList.FirstEnt();

2
game/server/tf2/tf_playerclass.cpp

@ -1041,7 +1041,7 @@ void CPlayerClass::InitVCollision( void ) @@ -1041,7 +1041,7 @@ void CPlayerClass::InitVCollision( void )
solid_t solid;
solid.params = g_PhysDefaultObjectParams;
solid.params.mass = 85.0f;
solid.params.inertia = 1e24f;
solid.params.inertia = 1e16f;
solid.params.enableCollisions = false;
//disable drag
solid.params.dragCoefficient = 0;

2
game/server/tf2/tf_team.h

@ -145,7 +145,7 @@ public: @@ -145,7 +145,7 @@ public:
int iOrderType,
CBaseEntity *pTarget,
CBaseTFPlayer *pPlayer = NULL,
float flDistanceToRemove = 1e24,
float flDistanceToRemove = 1e16,
float flLifetime = 60,
COrder *pDefaultOrder = NULL // If this is specified, then it is used instead of
// asking COrder to allocate an order.

2
game/shared/physics_shared.cpp

@ -478,7 +478,7 @@ void PhysGetDefaultAABBSolid( solid_t &solid ) @@ -478,7 +478,7 @@ void PhysGetDefaultAABBSolid( solid_t &solid )
{
solid.params = g_PhysDefaultObjectParams;
solid.params.mass = 85.0f;
solid.params.inertia = 1e24f;
solid.params.inertia = 1e16f;
Q_strncpy( solid.surfaceprop, "default", sizeof( solid.surfaceprop ) );
}

4
public/disp_common.cpp

@ -770,8 +770,8 @@ void ClearNeighborData( CCoreDispInfo *pDisp ) @@ -770,8 +770,8 @@ void ClearNeighborData( CCoreDispInfo *pDisp )
void GetDispBox( CCoreDispInfo *pDisp, CDispBox &box )
{
// Calculate the bbox for this displacement.
Vector vMin( 1e24, 1e24, 1e24 );
Vector vMax( -1e24, -1e24, -1e24 );
Vector vMin( 1e16, 1e16, 1e16 );
Vector vMax( -1e16, -1e16, -1e16 );
for ( int iVert = 0; iVert < 4; ++iVert )
{

2
public/keyframe/keyframe.cpp

@ -311,7 +311,7 @@ CPositionInterpolator_Rope::CPositionInterpolator_Rope() @@ -311,7 +311,7 @@ CPositionInterpolator_Rope::CPositionInterpolator_Rope()
m_nSegments = 5;
for( int i=0; i < 2; i++ )
m_Delegate.m_CurEndPoints[i] = Vector( 1e24, 1e24, 1e24 );
m_Delegate.m_CurEndPoints[i] = Vector( 1e16, 1e16, 1e16 );
}
void CPositionInterpolator_Rope::Release()

2
vphysics/ledgewriter.cpp

@ -65,7 +65,7 @@ static void BuildVertMap( vertmap_t &out, const Vector *pVerts, int vertexCount, @@ -65,7 +65,7 @@ static void BuildVertMap( vertmap_t &out, const Vector *pVerts, int vertexCount,
int index = -1;
Vector tmp;
ConvertPositionToHL( &pVertList[ivpIndex], tmp);
float minDist = 1e24;
float minDist = 1e16;
for ( int k = 0; k < vertexCount; k++ )
{
float dist = (tmp-pVerts[k]).Length();

6
vphysics/trace.cpp

@ -1231,7 +1231,7 @@ loop_without_store: @@ -1231,7 +1231,7 @@ loop_without_store:
const IVP_Compact_Ledgetree_Node *node0 = node->left_son();
center.set(node0->center.k);
// if we don't insert, this is larger than any quad distance
float lastDist = 1e24f;
float lastDist = 1e16f;
if ( SweepHitsSphereOS( &center, node0->radius ) )
{
lastDist = m_rayStartOS.quad_distance_to(&center);
@ -2073,7 +2073,7 @@ inline float Clip( const Vector &dir, const Vector &pos, const Vector &normal ) @@ -2073,7 +2073,7 @@ inline float Clip( const Vector &dir, const Vector &pos, const Vector &normal )
return dist / cosTheta;
// parallel or not facing the plane
return 1e24f;
return 1e16f;
}
// This is the first iteration of solving time of intersection.
@ -2258,7 +2258,7 @@ float simplex_t::ClipRayToTriangle( const Vector &dir, float epsilon ) @@ -2258,7 +2258,7 @@ float simplex_t::ClipRayToTriangle( const Vector &dir, float epsilon )
}
float dot = DotProduct( dir, *normals[best] );
if ( dot <= 0 )
return 1e24f;
return 1e16f;
dmin += epsilon/dot;
return dmin;

Loading…
Cancel
Save