- Converted Heretic's Clink (Sabreclaw) to DECORATE.
- Added MissSound parameter to A_CustomMeleeAttack. - Converted Heretic's Snake (Ophidian) to DECORATE. - Added an option to A_CustomMissile to jump to the see state if the caller's target is dead. - Fixed: A_ThrowGrenade didn't play the missile's spawn sound. - Added MF_SPAWNSOUNDSOURCE flag so that Raven's missile spawning code pointers can be recreated with DECORATE. - Converted a_ravenambient.cpp to DECORATE. SVN r388 (trunk)
This commit is contained in:
parent
824fa1a557
commit
49422188f2
18 changed files with 862 additions and 1112 deletions
|
|
@ -645,6 +645,13 @@ inline static bool isMissile(AActor * self, bool precise=true)
|
|||
// The ultimate code pointer: Fully customizable missiles!
|
||||
//
|
||||
//==========================================================================
|
||||
enum CM_Flags
|
||||
{
|
||||
CMF_AIMMODE = 3,
|
||||
CMF_TRACKOWNER = 4,
|
||||
CMF_CHECKTARGETDEAD = 8,
|
||||
};
|
||||
|
||||
void A_CustomMissile(AActor * self)
|
||||
{
|
||||
int index=CheckIndex(6);
|
||||
|
|
@ -654,8 +661,9 @@ void A_CustomMissile(AActor * self)
|
|||
fixed_t SpawnHeight=fixed_t(EvalExpressionF (StateParameters[index+1], self) * FRACUNIT);
|
||||
int Spawnofs_XY=EvalExpressionI (StateParameters[index+2], self);
|
||||
angle_t Angle=angle_t(EvalExpressionF (StateParameters[index+3], self) * ANGLE_1);
|
||||
int aimmode=EvalExpressionI (StateParameters[index+4], self);
|
||||
int flags=EvalExpressionI (StateParameters[index+4], self);
|
||||
angle_t pitch=angle_t(EvalExpressionF (StateParameters[index+5], self) * ANGLE_1);
|
||||
int aimmode = flags & CMF_AIMMODE;
|
||||
|
||||
AActor * targ;
|
||||
AActor * missile;
|
||||
|
|
@ -670,7 +678,7 @@ void A_CustomMissile(AActor * self)
|
|||
fixed_t y = Spawnofs_XY * finesine[ang];
|
||||
fixed_t z = SpawnHeight - 32*FRACUNIT + (self->player? self->player->crouchoffset : 0);
|
||||
|
||||
switch (aimmode&3)
|
||||
switch (aimmode)
|
||||
{
|
||||
case 0:
|
||||
default:
|
||||
|
|
@ -724,10 +732,10 @@ void A_CustomMissile(AActor * self)
|
|||
|
||||
// handle projectile shooting projectiles - track the
|
||||
// links back to a real owner
|
||||
if (isMissile(self, !!(aimmode&4)))
|
||||
if (isMissile(self, !!(flags & CMF_TRACKOWNER)))
|
||||
{
|
||||
AActor * owner=self ;//->target;
|
||||
while (isMissile(owner, !!(aimmode&4)) && owner->target) owner=owner->target;
|
||||
while (isMissile(owner, !!(flags & CMF_TRACKOWNER)) && owner->target) owner=owner->target;
|
||||
targ=owner;
|
||||
missile->target=owner;
|
||||
// automatic handling of seeker missiles
|
||||
|
|
@ -749,6 +757,11 @@ void A_CustomMissile(AActor * self)
|
|||
}
|
||||
}
|
||||
}
|
||||
else if (flags & CMF_CHECKTARGETDEAD)
|
||||
{
|
||||
// Target is dead and the attack shall be aborted.
|
||||
if (self->SeeState != NULL) self->SetState(self->SeeState);
|
||||
}
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
|
|
@ -804,13 +817,14 @@ void A_CustomBulletAttack (AActor *self)
|
|||
//==========================================================================
|
||||
void A_CustomMeleeAttack (AActor *self)
|
||||
{
|
||||
int index=CheckIndex(4);
|
||||
int index=CheckIndex(5);
|
||||
if (index<0) return;
|
||||
|
||||
int damage = EvalExpressionI (StateParameters[index], self);
|
||||
int MeleeSound=StateParameters[index+1];
|
||||
ENamedName DamageType = (ENamedName)StateParameters[index+2];
|
||||
bool bleed = EvalExpressionN (StateParameters[index+3], self);
|
||||
int MeleeSound = StateParameters[index+1];
|
||||
int MissSound = StateParameters[index+2];
|
||||
ENamedName DamageType = (ENamedName)StateParameters[index+3];
|
||||
bool bleed = EvalExpressionN (StateParameters[index+4], self);
|
||||
|
||||
if (DamageType==NAME_None) DamageType = NAME_Melee; // Melee is the default type
|
||||
|
||||
|
|
@ -824,6 +838,10 @@ void A_CustomMeleeAttack (AActor *self)
|
|||
P_DamageMobj (self->target, self, self, damage, DamageType);
|
||||
if (bleed) P_TraceBleed (damage, self->target, self);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (MissSound) S_SoundID (self, CHAN_WEAPON, MissSound, 1, ATTN_NORM);
|
||||
}
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
|
|
@ -1353,6 +1371,7 @@ void A_ThrowGrenade(AActor * self)
|
|||
{
|
||||
int pitch = self->pitch;
|
||||
|
||||
P_PlaySpawnSound(bo, self);
|
||||
if (xymom) bo->Speed=xymom;
|
||||
bo->angle = self->angle+(((pr_grenade()&7)-4)<<24);
|
||||
bo->momz = zmom + 2*finesine[pitch>>ANGLETOFINESHIFT];
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue