Skip to content

Commit

Permalink
- added an override for NOTAUTOAIMED flag when using P_AimLineAttack …
Browse files Browse the repository at this point in the history
…for informative CCMDs.

The flag is explicitly blocked for script use.
  • Loading branch information
coelckers committed Jun 16, 2022
1 parent 74866c2 commit de4627a
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/console/c_functions.cpp
Expand Up @@ -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)
Expand Down
1 change: 1 addition & 0 deletions src/playsim/p_local.h
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/playsim/p_map.cpp
Expand Up @@ -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;
}
Expand Down
1 change: 1 addition & 0 deletions src/playsim/p_mobj.cpp
Expand Up @@ -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;
Expand Down
1 change: 1 addition & 0 deletions src/playsim/p_pspr.cpp
Expand Up @@ -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;
Expand Down
1 change: 1 addition & 0 deletions src/scripting/vmthunks_actors.cpp
Expand Up @@ -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;
}

Expand Down

0 comments on commit de4627a

Please sign in to comment.