- Added pointer field to A_ChangeVelocity.

- Defaults to AAPTR_DEFAULT, otherwise known as the calling actor.
This commit is contained in:
MajorCooke 2015-01-19 14:54:20 -06:00
commit 105a62cc20
2 changed files with 19 additions and 10 deletions

View file

@ -4029,12 +4029,21 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_ChangeVelocity)
ACTION_PARAM_FIXED(y, 1);
ACTION_PARAM_FIXED(z, 2);
ACTION_PARAM_INT(flags, 3);
ACTION_PARAM_INT(ptr, 4);
INTBOOL was_moving = self->velx | self->vely | self->velz;
AActor *ref = COPY_AAPTR(self, ptr);
if (!ref)
{
ACTION_SET_RESULT(false);
return;
}
INTBOOL was_moving = ref->velx | ref->vely | ref->velz;
fixed_t vx = x, vy = y, vz = z;
fixed_t sina = finesine[self->angle >> ANGLETOFINESHIFT];
fixed_t cosa = finecosine[self->angle >> ANGLETOFINESHIFT];
fixed_t sina = finesine[ref->angle >> ANGLETOFINESHIFT];
fixed_t cosa = finecosine[ref->angle >> ANGLETOFINESHIFT];
if (flags & 1) // relative axes - make x, y relative to actor's current angle
{
@ -4043,15 +4052,15 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_ChangeVelocity)
}
if (flags & 2) // discard old velocity - replace old velocity with new velocity
{
self->velx = vx;
self->vely = vy;
self->velz = vz;
ref->velx = vx;
ref->vely = vy;
ref->velz = vz;
}
else // add new velocity to old velocity
{
self->velx += vx;
self->vely += vy;
self->velz += vz;
ref->velx += vx;
ref->vely += vy;
ref->velz += vz;
}
if (was_moving)