Skip to content

Commit 7161f1f

Browse files
committed
feat(aiming): add convar for controlling vertical aiming limit
Set rd_limit_aim_top_offset to -9999 to disable this feature
1 parent c9727e0 commit 7161f1f

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

src/game/client/swarm/asw_input.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,8 @@ ConVar joy_disable_movement_in_ui( "joy_disable_movement_in_ui", "1", FCVAR_NONE
5555
ConVar rd_input_controller_mode_mouse( "rd_input_controller_mode_mouse", "-1", FCVAR_NONE );
5656
ConVar rd_input_controller_mode_keyboard( "rd_input_controller_mode_keyboard", "-1", FCVAR_NONE );
5757

58+
ConVar rd_limit_aim_top_offset( "rd_limit_aim_top_offset", "50", FCVAR_NONE, "Ignore aim targets this many units from below the camera and higher" );
59+
5860
extern kbutton_t in_attack;
5961
extern kbutton_t in_walk;
6062
extern int g_asw_iPlayerListOpen;
@@ -464,7 +466,7 @@ C_BaseEntity* HUDToWorld(float screenx, float screeny,
464466
Vector vecAlienPos = pBestAlien->GetAimTargetRadiusPos( vecWeaponPos );
465467

466468
// Don't aim at stuff a bit below camera and higher
467-
if ( vecAlienPos.z > vCameraLocation.z - 50.0f )
469+
if ( vecAlienPos.z > vCameraLocation.z - rd_limit_aim_top_offset.GetFloat() )
468470
{
469471
pBestAlien = NULL;
470472
}
@@ -519,7 +521,8 @@ C_BaseEntity* HUDToWorld(float screenx, float screeny,
519521
continue;
520522

521523
// Don't aim at stuff a bit below camera and higher
522-
if ( pPlayer->GetASWControls() == ASWC_TOPDOWN && vecAlienPos.z > vCameraLocation.z - 50.0f )
524+
if ( pPlayer->GetASWControls() == ASWC_TOPDOWN &&
525+
vecAlienPos.z > vCameraLocation.z - rd_limit_aim_top_offset.GetFloat() )
523526
continue;
524527

525528
Vector vDirection = vecAlienPos - vecWeaponPos;

0 commit comments

Comments
 (0)