- added an override for NOTAUTOAIMED flag when using P_AimLineAttack for informative CCMDs.

The flag is explicitly blocked for script use.
This commit is contained in:
Christoph Oelckers 2022-06-16 10:07:22 +02:00
parent 74866c28ce
commit de4627a477
6 changed files with 6 additions and 2 deletions

View File

@ -53,7 +53,7 @@ void C_PrintInfo(AActor *target, bool verbose)
void C_AimLine(FTranslatedLineTarget *t, bool nonshootable)
{
P_AimLineAttack(players[consoleplayer].mo,players[consoleplayer].mo->Angles.Yaw, MISSILERANGE, t, 0.,
(nonshootable) ? ALF_CHECKNONSHOOTABLE|ALF_FORCENOSMART : 0);
(nonshootable) ? ALF_CHECKNONSHOOTABLE|ALF_FORCENOSMART|ALF_IGNORENOAUTOAIM : ALF_IGNORENOAUTOAIM);
}
void C_PrintInv(AActor *target)

View File

@ -310,6 +310,7 @@ enum // P_AimLineAttack flags
ALF_NOFRIENDS = 16,
ALF_PORTALRESTRICT = 32, // only work through portals with a global offset (to be used for stuff that cannot remember the calculated FTranslatedLineTarget info)
ALF_NOWEAPONCHECK = 64, // ignore NOAUTOAIM flag on a player's weapon.
ALF_IGNORENOAUTOAIM = 128, // for informative stuff like 'linetarget' CCMD.
};
enum // P_LineAttack flags

View File

@ -4192,7 +4192,7 @@ struct aim_t
dist = attackrange * in->frac;
// Don't autoaim certain special actors
if (!cl_doautoaim && th->flags6 & MF6_NOTAUTOAIMED)
if (!cl_doautoaim && !(flags & ALF_IGNORENOAUTOAIM) && th->flags6 & MF6_NOTAUTOAIMED)
{
continue;
}

View File

@ -6846,6 +6846,7 @@ AActor *P_SpawnPlayerMissile (AActor *source, double x, double y, double z,
{
return nullptr;
}
aimflags &= ~ALF_IGNORENOAUTOAIM; // just to be safe.
static const double angdiff[3] = { -5.625, 5.625, 0 };
DAngle an = angle;

View File

@ -1198,6 +1198,7 @@ DAngle P_BulletSlope (AActor *mo, FTranslatedLineTarget *pLineTarget, int aimfla
DAngle pitch;
FTranslatedLineTarget scratch;
aimflags &= ~ALF_IGNORENOAUTOAIM; // just to be safe.
if (pLineTarget == NULL) pLineTarget = &scratch;
// see which target is to be aimed at
i = 2;

View File

@ -1150,6 +1150,7 @@ DEFINE_ACTION_FUNCTION_NATIVE(AActor, CheckMove, CheckMove)
static double AimLineAttack(AActor *self, double angle, double distance, FTranslatedLineTarget *pLineTarget, double vrange, int flags, AActor *target, AActor *friender)
{
flags &= ~ALF_IGNORENOAUTOAIM; // just to be safe. This flag is not supposed to be accesible to scripting.
return P_AimLineAttack(self, angle, distance, pLineTarget, vrange, flags, target, friender).Degrees;
}