Code: Select all
OptionValue "Autoaim"
{
0, "Never"
1, "Very low"
2, "Low"
3, "Medium"
4, "High"
5, "Very high"
6, "Always"
}Code: Select all
void DPlayerMenu::AutoaimChanged (FListMenuItem *li)
{
static const float ranges[] = { 0, 0.25, 0.5, 1, 2, 3, 5000 };
int sel;
if (li->GetValue(0, &sel))
{
autoaim = ranges[sel];
}
}Code: Select all
if (autoaim > 35.f || autoaim < 0.f)
{
coninfo->aimdist = ANGLE_1*35;
}
else
{
coninfo->aimdist = abs ((int)(autoaim * (float)ANGLE_1));
}
Now let's look at how aimdist is used. It does not affect railguns, so it is only used for hitscans and projectiles. First, when aiming, it always eventually boils down to this:
Code: Select all
fixed_t P_AimLineAttack (AActor *t1, angle_t angle, fixed_t distance, AActor **pLineTarget, fixed_t vrange,
int flags, AActor *target, AActor *friender)
{
<snip some code not relevant here>
// can't shoot outside view angles
if (vrange == 0)
{
if (t1->player == NULL || !level.IsFreelookAllowed())
{
vrange = ANGLE_1*35;
}
else
{
// [BB] Disable autoaim on weapons with WIF_NOAUTOAIM.
AWeapon *weapon = t1->player->ReadyWeapon;
if ( weapon && (weapon->WeaponFlags & WIF_NOAUTOAIM) )
{
vrange = ANGLE_1/2;
}
else
{
// 35 degrees is approximately what Doom used. You cannot have a
// vrange of 0 degrees, because then toppitch and bottompitch will
// be equal, and PTR_AimTraverse will never find anything to shoot at
// if it crosses a line.
vrange = clamp (t1->player->userinfo.aimdist, ANGLE_1/2, ANGLE_1*35);
}
}
}
Also, here's a snippet the player projectile function eventually reached from pretty much all the weapon projectile functions (P_SpawnPlayerMissile()):
Code: Select all
if (source->player != NULL &&
!nofreeaim &&
level.IsFreelookAllowed() &&
source->player->userinfo.GetAimDist() <= ANGLE_1/2)
{
break;
}
And here's a snippet from the hitscan function (P_BulletSlope()):
Code: Select all
if (mo->player != NULL &&
level.IsFreelookAllowed() &&
mo->player->userinfo.GetAimDist() <= ANGLE_1/2)
{
break;
}
Am I missing something or is this borderline a bug? Given that 0.5 is the effective minimum value, I'd suggest changing "very low" to 1, "low" to 2, "medium" to 3, "high" to 5, and "very high" to 8.
