mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-11-30 16:01:49 +00:00
Move the modified behaviour to a new "resetvel" parameter
This commit is contained in:
parent
3873ad6151
commit
0c776e3acd
2 changed files with 11 additions and 6 deletions
|
@ -171,7 +171,7 @@ void InterceptDefaultAim(AActor *mobj, AActor *targ, DVector3 aim, double speed)
|
|||
|
||||
// [MC] Was part of P_Thing_Projectile, now its own function for use in ZScript.
|
||||
// Aims mobj at targ based on speed and targ's velocity.
|
||||
static void VelIntercept(AActor *targ, AActor *mobj, double speed, bool aimpitch = false, bool oldvel = false, bool leadtarget = true)
|
||||
static void VelIntercept(AActor *targ, AActor *mobj, double speed, bool aimpitch = false, bool oldvel = false, bool resetvel = false, bool leadtarget = true)
|
||||
{
|
||||
if (targ == nullptr || mobj == nullptr) return;
|
||||
|
||||
|
@ -199,7 +199,7 @@ static void VelIntercept(AActor *targ, AActor *mobj, double speed, bool aimpitch
|
|||
if (targ->Vel.X == 0 && targ->Vel.Y == 0)
|
||||
{
|
||||
InterceptDefaultAim(mobj, targ, aim, speed);
|
||||
if (oldvel)
|
||||
if (resetvel)
|
||||
{
|
||||
mobj->Vel = prevel;
|
||||
}
|
||||
|
@ -225,6 +225,10 @@ static void VelIntercept(AActor *targ, AActor *mobj, double speed, bool aimpitch
|
|||
// And make the projectile follow that vector at the desired speed.
|
||||
mobj->Vel = aimvec * (speed / dist);
|
||||
mobj->AngleFromVel();
|
||||
if (oldvel)
|
||||
{
|
||||
mobj->Vel = prevel;
|
||||
}
|
||||
if (aimpitch) // [MC] Ripped right out of A_FaceMovementDirection
|
||||
{
|
||||
const DVector2 velocity = mobj->Vel.XY();
|
||||
|
@ -235,7 +239,7 @@ static void VelIntercept(AActor *targ, AActor *mobj, double speed, bool aimpitch
|
|||
{
|
||||
InterceptDefaultAim(mobj, targ, aim, speed);
|
||||
}
|
||||
if (oldvel)
|
||||
if (resetvel)
|
||||
{
|
||||
mobj->Vel = prevel;
|
||||
}
|
||||
|
@ -248,8 +252,9 @@ DEFINE_ACTION_FUNCTION(AActor, VelIntercept)
|
|||
PARAM_FLOAT(speed);
|
||||
PARAM_BOOL(aimpitch);
|
||||
PARAM_BOOL(oldvel);
|
||||
PARAM_BOOL(resetvel);
|
||||
if (speed < 0) speed = self->Speed;
|
||||
VelIntercept(targ, self, speed, aimpitch, oldvel);
|
||||
VelIntercept(targ, self, speed, aimpitch, oldvel, resetvel);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -335,7 +340,7 @@ bool FLevelLocals::EV_Thing_Projectile (int tid, AActor *source, int type, const
|
|||
|
||||
if (targ != nullptr)
|
||||
{
|
||||
VelIntercept(targ, mobj, speed, false, false, leadTarget);
|
||||
VelIntercept(targ, mobj, speed, false, false, false, leadTarget);
|
||||
|
||||
if (mobj->flags2 & MF2_SEEKERMISSILE)
|
||||
{
|
||||
|
|
|
@ -751,7 +751,7 @@ class Actor : Thinker native
|
|||
native clearscope vector2 Vec2Angle(double length, double angle, bool absolute = false) const;
|
||||
native clearscope vector2 Vec2Offset(double x, double y, bool absolute = false) const;
|
||||
native clearscope vector3 Vec2OffsetZ(double x, double y, double atz, bool absolute = false) const;
|
||||
native void VelIntercept(Actor targ, double speed = -1, bool aimpitch = true, bool oldvel = false);
|
||||
native void VelIntercept(Actor targ, double speed = -1, bool aimpitch = true, bool oldvel = false, bool resetvel = false);
|
||||
native void VelFromAngle(double speed = 1e37, double angle = 1e37);
|
||||
native void Vel3DFromAngle(double speed, double angle, double pitch);
|
||||
native void Thrust(double speed = 1e37, double angle = 1e37);
|
||||
|
|
Loading…
Reference in a new issue