mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-12-01 00:21:43 +00:00
- Added A_SetAngle, A_SetPitch, A_ScaleVelocity, and A_ChangeVelocity.
SVN r1691 (trunk)
This commit is contained in:
parent
e4af82ae96
commit
bd4496a582
4 changed files with 110 additions and 1 deletions
|
@ -1,4 +1,5 @@
|
|||
June 30, 2009
|
||||
- Added A_SetAngle, A_SetPitch, A_ScaleVelocity, and A_ChangeVelocity.
|
||||
- Enough with this "momentum" garbage. What Doom calls "momentum" is really
|
||||
velocity, and now it's known as such. The actor variables momx/momy/momz
|
||||
are now known as velx/vely/velz, and the ACS functions GetActorMomX/Y/Z
|
||||
|
|
|
@ -2533,7 +2533,9 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_RemoveChildren)
|
|||
|
||||
//===========================================================================
|
||||
//
|
||||
// keep firing unless target got out of sight
|
||||
// A_MonsterRefire
|
||||
//
|
||||
// Keep firing unless target got out of sight
|
||||
//
|
||||
//===========================================================================
|
||||
DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_MonsterRefire)
|
||||
|
@ -2557,3 +2559,101 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_MonsterRefire)
|
|||
}
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
//
|
||||
// A_SetAngle
|
||||
//
|
||||
// Set actor's angle (in degrees).
|
||||
//
|
||||
//===========================================================================
|
||||
|
||||
DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SetAngle)
|
||||
{
|
||||
ACTION_PARAM_START(1);
|
||||
ACTION_PARAM_ANGLE(angle, 0);
|
||||
self->angle = angle;
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
//
|
||||
// A_SetPitch
|
||||
//
|
||||
// Set actor's pitch (in degrees).
|
||||
//
|
||||
//===========================================================================
|
||||
|
||||
DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SetPitch)
|
||||
{
|
||||
ACTION_PARAM_START(1);
|
||||
ACTION_PARAM_ANGLE(pitch, 0);
|
||||
self->pitch = pitch;
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
//
|
||||
// A_ScaleVelocity
|
||||
//
|
||||
// Scale actor's velocity.
|
||||
//
|
||||
//===========================================================================
|
||||
|
||||
DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_ScaleVelocity)
|
||||
{
|
||||
ACTION_PARAM_START(1);
|
||||
ACTION_PARAM_FIXED(scale, 0);
|
||||
|
||||
INTBOOL was_moving = self->velx | self->vely | self->velz;
|
||||
|
||||
self->velx = FixedMul(self->velx, scale);
|
||||
self->vely = FixedMul(self->vely, scale);
|
||||
self->velz = FixedMul(self->velz, scale);
|
||||
|
||||
// If the actor was previously moving but now is not, and is a player,
|
||||
// update its player variables. (See A_Stop.)
|
||||
if (was_moving &&
|
||||
self->player != NULL &&
|
||||
self->player->mo == self &&
|
||||
!(self->player->cheats & CF_PREDICTING) &&
|
||||
!(self->velx | self->vely | self->velz))
|
||||
{
|
||||
self->player->mo->PlayIdle();
|
||||
self->player->velx = self->player->vely = 0;
|
||||
}
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
//
|
||||
// A_ChangeVelocity
|
||||
//
|
||||
//===========================================================================
|
||||
|
||||
DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_ChangeVelocity)
|
||||
{
|
||||
ACTION_PARAM_START(4);
|
||||
ACTION_PARAM_FIXED(x, 0);
|
||||
ACTION_PARAM_FIXED(y, 1);
|
||||
ACTION_PARAM_FIXED(z, 2);
|
||||
ACTION_PARAM_INT(flags, 3);
|
||||
|
||||
fixed_t vx = x, vy = y, vz = z;
|
||||
fixed_t sina = finesine[self->angle >> ANGLETOFINESHIFT];
|
||||
fixed_t cosa = finecosine[self->angle >> ANGLETOFINESHIFT];
|
||||
|
||||
if (flags & 1) // relative axes - make x, y relative to actor's current angle
|
||||
{
|
||||
vx = DMulScale16(x, cosa, -y, sina);
|
||||
vy = DMulScale16(x, sina, y, cosa);
|
||||
}
|
||||
if (flags & 2) // discard old velocity - replace old velocity with new velocity
|
||||
{
|
||||
self->velx = vx;
|
||||
self->vely = vy;
|
||||
self->velz = vz;
|
||||
}
|
||||
else // add new velocity to old velocity
|
||||
{
|
||||
self->velx += vx;
|
||||
self->vely += vy;
|
||||
self->velz += vz;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -241,6 +241,10 @@ ACTOR Actor native //: Thinker
|
|||
action native A_DropWeaponPieces(class<Actor> p1, class<Actor> p2, class<Actor> p3);
|
||||
action native A_PigPain ();
|
||||
action native A_MonsterRefire(int chance, state label);
|
||||
action native A_SetAngle(float angle);
|
||||
action native A_SetPitch(float pitch);
|
||||
action native A_ScaleVelocity(float scale);
|
||||
action native A_ChangeVelocity(float x = 0, float y = 0, float z = 0, int flags = 0);
|
||||
|
||||
States
|
||||
{
|
||||
|
|
|
@ -33,6 +33,10 @@ const int LOF_DONTCHASEGOAL = 4;
|
|||
const int LOF_NOSEESOUND = 8;
|
||||
const int LOF_FULLVOLSEESOUND = 16;
|
||||
|
||||
// Flags for A_ChangeVelocity
|
||||
const int CVF_RELATIVE = 1;
|
||||
const int CVF_REPLACE = 2;
|
||||
|
||||
// Morph constants
|
||||
const int MRF_ADDSTAMINA = 1;
|
||||
const int MRF_FULLHEALTH = 2;
|
||||
|
|
Loading…
Reference in a new issue