mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-11-24 21:21:04 +00:00
Merge branch 'changevelptr' of https://github.com/MajorCooke/zdoom
This commit is contained in:
commit
afb90040c2
2 changed files with 19 additions and 10 deletions
|
@ -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)
|
||||
|
|
|
@ -293,7 +293,7 @@ ACTOR Actor native //: Thinker
|
|||
action native A_SetPitch(float pitch, int flags = 0);
|
||||
action native A_SetRoll(float roll, int flags = 0);
|
||||
action native A_ScaleVelocity(float scale);
|
||||
action native A_ChangeVelocity(float x = 0, float y = 0, float z = 0, int flags = 0);
|
||||
action native A_ChangeVelocity(float x = 0, float y = 0, float z = 0, int flags = 0, int ptr = AAPTR_DEFAULT);
|
||||
action native A_SetArg(int pos, int value);
|
||||
action native A_SetUserVar(name varname, int value);
|
||||
action native A_SetUserArray(name varname, int index, int value);
|
||||
|
|
Loading…
Reference in a new issue