diff --git a/src/p_enemy.h b/src/p_enemy.h index e3e83be6c..1d80e08e3 100644 --- a/src/p_enemy.h +++ b/src/p_enemy.h @@ -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); diff --git a/src/thingdef/thingdef_codeptr.cpp b/src/thingdef/thingdef_codeptr.cpp index e2726e3f9..df1a9c23e 100644 --- a/src/thingdef/thingdef_codeptr.cpp +++ b/src/thingdef/thingdef_codeptr.cpp @@ -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); + } } diff --git a/wadsrc/static/actors/constants.txt b/wadsrc/static/actors/constants.txt index dfed8f5c0..6c027d82a 100644 --- a/wadsrc/static/actors/constants.txt +++ b/wadsrc/static/actors/constants.txt @@ -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 { diff --git a/wadsrc/static/actors/shared/inventory.txt b/wadsrc/static/actors/shared/inventory.txt index 48a966878..3a4dd20d9 100644 --- a/wadsrc/static/actors/shared/inventory.txt +++ b/wadsrc/static/actors/shared/inventory.txt @@ -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 pufftype = "BulletPuff", float range = 0, float lifesteal = 0); + action native A_CustomPunch(int damage, bool norandom = false, int flags = CPF_USEAMMO, class pufftype = "BulletPuff", float range = 0, float lifesteal = 0); action native A_FireBullets(float spread_xy, float spread_z, int numbullets, int damageperbullet, class pufftype = "BulletPuff", int flags = 1, float range = 0); action native A_FireCustomMissile(class 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 pufftype = "BulletPuff");