diff --git a/releases/3.2.0/source/dlls/player.cpp b/releases/3.2.0/source/dlls/player.cpp index b7af908d..f3878a00 100644 --- a/releases/3.2.0/source/dlls/player.cpp +++ b/releases/3.2.0/source/dlls/player.cpp @@ -92,7 +92,6 @@ #include "game.h" #include "common/hltv.h" #include "mod/AvHNetworkMessages.h" -#include "util/MathUtil.h" // #define DUCKFIX @@ -1779,31 +1778,28 @@ void CBasePlayer::PlayerUse ( void ) UTIL_MakeVectors ( pev->v_angle );// so we know which way we are facing - while ((pObject = UTIL_FindEntityInSphere( pObject, pev->origin, PLAYER_SEARCH_RADIUS*2 )) != NULL) + while ((pObject = UTIL_FindEntityInSphere( pObject, pev->origin, PLAYER_SEARCH_RADIUS )) != NULL) { - float distance=VectorDistance(pObject->pev->origin, pev->origin); - if ( distance < PLAYER_SEARCH_RADIUS || pObject->pev->iuser3 == AVH_USER3_HIVE ) { - if (pObject->ObjectCaps() & (FCAP_IMPULSE_USE | FCAP_CONTINUOUS_USE | FCAP_ONOFF_USE)) - { - // !!!PERFORMANCE- should this check be done on a per case basis AFTER we've determined that - // this object is actually usable? This dot is being done for every object within PLAYER_SEARCH_RADIUS - // when player hits the use key. How many objects can be in that area, anyway? (sjb) - vecLOS = (VecBModelOrigin( pObject->pev ) - (pev->origin + pev->view_ofs)); - - // This essentially moves the origin of the target to the corner nearest the player to test to see - // if it's "hull" is in the view cone - vecLOS = UTIL_ClampVectorToBox( vecLOS, pObject->pev->size * 0.5 ); - - flDot = DotProduct (vecLOS , gpGlobals->v_forward); - if (flDot > flMaxDot ) - {// only if the item is in front of the user - pClosest = pObject; - flMaxDot = flDot; - // ALERT( at_console, "%s : %f\n", STRING( pObject->pev->classname ), flDot ); - } - // ALERT( at_console, "%s : %f\n", STRING( pObject->pev->classname ), flDot ); + if (pObject->ObjectCaps() & (FCAP_IMPULSE_USE | FCAP_CONTINUOUS_USE | FCAP_ONOFF_USE)) + { + // !!!PERFORMANCE- should this check be done on a per case basis AFTER we've determined that + // this object is actually usable? This dot is being done for every object within PLAYER_SEARCH_RADIUS + // when player hits the use key. How many objects can be in that area, anyway? (sjb) + vecLOS = (VecBModelOrigin( pObject->pev ) - (pev->origin + pev->view_ofs)); + + // This essentially moves the origin of the target to the corner nearest the player to test to see + // if it's "hull" is in the view cone + vecLOS = UTIL_ClampVectorToBox( vecLOS, pObject->pev->size * 0.5 ); + + flDot = DotProduct (vecLOS , gpGlobals->v_forward); + if (flDot > flMaxDot ) + {// only if the item is in front of the user + pClosest = pObject; + flMaxDot = flDot; +// ALERT( at_console, "%s : %f\n", STRING( pObject->pev->classname ), flDot ); } +// ALERT( at_console, "%s : %f\n", STRING( pObject->pev->classname ), flDot ); } } pObject = pClosest;