- added some options to A_CustomPunch, including calling Strife's dagger alert function.

SVN r2367 (trunk)
This commit is contained in:
Christoph Oelckers 2010-06-13 09:06:12 +00:00
parent 4d86ebddf9
commit ec44397881
4 changed files with 21 additions and 3 deletions

View File

@ -44,6 +44,7 @@ struct FLookExParams
FState *seestate;
};
void P_DaggerAlert (AActor *target, AActor *emitter);
void P_RecursiveSound (sector_t *sec, AActor *soundtarget, bool splash, int soundblocks);
bool P_HitFriend (AActor *self);
void P_NoiseAlert (AActor *target, AActor *emmiter, bool splash=false);

View File

@ -1125,12 +1125,20 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_FireCustomMissile)
// Berserk is not handled here. That can be done with A_CheckIfInventory
//
//==========================================================================
enum
{
CPF_USEAMMO = 1,
CPF_DAGGER = 2,
CPF_PULLIN = 4,
};
DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_CustomPunch)
{
ACTION_PARAM_START(5);
ACTION_PARAM_INT(Damage, 0);
ACTION_PARAM_BOOL(norandom, 1);
ACTION_PARAM_BOOL(UseAmmo, 2);
ACTION_PARAM_INT(flags, 2);
ACTION_PARAM_CLASS(PuffType, 3);
ACTION_PARAM_FIXED(Range, 4);
ACTION_PARAM_FIXED(LifeSteal, 5);
@ -1152,7 +1160,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_CustomPunch)
pitch = P_AimLineAttack (self, angle, Range, &linetarget);
// only use ammo when actually hitting something!
if (UseAmmo && linetarget && weapon)
if ((flags & CPF_USEAMMO) && linetarget && weapon)
{
if (!weapon->DepleteAmmo(weapon->bAltFire, true)) return; // out of ammo
}
@ -1173,6 +1181,10 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_CustomPunch)
self->y,
linetarget->x,
linetarget->y);
if (flags & CPF_PULLIN) self->flags |= MF_JUSTATTACKED;
if (flags & CPF_DAGGER) P_DaggerAlert (self, linetarget);
}
}

View File

@ -90,6 +90,11 @@ const int BF_AFFECTBOSSES = 4;
const int SMF_LOOK = 1;
const int SMF_PRECISE = 2;
// Flags for A_CustomPunch
const int CPF_USEAMMO = 1;
const int CPF_DAGGER = 2;
const int CPF_PULLIN = 4;
// Activation flags
enum
{

View File

@ -7,7 +7,7 @@ ACTOR Inventory native
Inventory.PickupSound "misc/i_pkup"
action native A_JumpIfNoAmmo(state label);
action native A_CustomPunch(int damage, bool norandom = false, bool useammo = true, class<Actor> pufftype = "BulletPuff", float range = 0, float lifesteal = 0);
action native A_CustomPunch(int damage, bool norandom = false, int flags = CPF_USEAMMO, class<Actor> pufftype = "BulletPuff", float range = 0, float lifesteal = 0);
action native A_FireBullets(float spread_xy, float spread_z, int numbullets, int damageperbullet, class<Actor> pufftype = "BulletPuff", int flags = 1, float range = 0);
action native A_FireCustomMissile(class<Actor> missiletype, float angle = 0, bool useammo = true, int spawnofs_xy = 0, float spawnheight = 0, bool aimatangle = false, float pitch = 0);
action native A_RailAttack(int damage, int spawnofs_xy = 0, int useammo = true, color color1 = "", color color2 = "", int flags = 0, float maxdiff = 0, class<Actor> pufftype = "BulletPuff");