From 6a57a43277cddaf1855eddabd753e8bf3ebfad60 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Wed, 12 May 2010 07:08:39 +0000 Subject: [PATCH] - added DavidPH's LifeSteal patch for A_CustomPunch/A_Saw. SVN r2317 (trunk) --- src/g_doom/a_doomweaps.cpp | 12 ++++++++++-- src/thingdef/thingdef_codeptr.cpp | 4 ++++ wadsrc/static/actors/shared/inventory.txt | 4 ++-- 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/src/g_doom/a_doomweaps.cpp b/src/g_doom/a_doomweaps.cpp index cfa5cdbae..026da4c5e 100644 --- a/src/g_doom/a_doomweaps.cpp +++ b/src/g_doom/a_doomweaps.cpp @@ -110,6 +110,8 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_Saw) ACTION_PARAM_SOUND(hitsound, 1); ACTION_PARAM_INT(damage, 2); ACTION_PARAM_CLASS(pufftype, 3); + ACTION_PARAM_FIXED(Range, 4) + ACTION_PARAM_FIXED(LifeSteal, 5); if (NULL == (player = self->player)) { @@ -131,8 +133,10 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_Saw) angle += pr_saw.Random2() << 18; // use meleerange + 1 so the puff doesn't skip the flash (i.e. plays all states) - P_LineAttack (self, angle, MELEERANGE+1, - P_AimLineAttack (self, angle, MELEERANGE+1, &linetarget), damage, + if (Range == 0) Range = MELEERANGE+1; + + P_LineAttack (self, angle, Range, + P_AimLineAttack (self, angle, Range, &linetarget), damage, NAME_None, pufftype); if (!linetarget) @@ -140,6 +144,10 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_Saw) S_Sound (self, CHAN_WEAPON, fullsound, 1, ATTN_NORM); return; } + + if (LifeSteal) + P_GiveBody (self, (damage * LifeSteal) >> FRACBITS); + S_Sound (self, CHAN_WEAPON, hitsound, 1, ATTN_NORM); // turn to face target diff --git a/src/thingdef/thingdef_codeptr.cpp b/src/thingdef/thingdef_codeptr.cpp index 8b09a2c10..cc3052b57 100644 --- a/src/thingdef/thingdef_codeptr.cpp +++ b/src/thingdef/thingdef_codeptr.cpp @@ -1080,6 +1080,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_CustomPunch) ACTION_PARAM_BOOL(UseAmmo, 2); ACTION_PARAM_CLASS(PuffType, 3); ACTION_PARAM_FIXED(Range, 4); + ACTION_PARAM_FIXED(LifeSteal, 5); if (!self->player) return; @@ -1110,6 +1111,9 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_CustomPunch) // turn to face target if (linetarget) { + if (LifeSteal) + P_GiveBody (self, (Damage * LifeSteal) >> FRACBITS); + S_Sound (self, CHAN_WEAPON, weapon->AttackSound, 1, ATTN_NORM); self->angle = R_PointToAngle2 (self->x, diff --git a/wadsrc/static/actors/shared/inventory.txt b/wadsrc/static/actors/shared/inventory.txt index 3e805ed05..e64012921 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); + action native A_CustomPunch(int damage, bool norandom = false, bool useammo = true, 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", bool useammo = true, 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"); @@ -40,7 +40,7 @@ ACTOR Inventory native action native A_ClearReFire(); action native A_CheckReload(); action native A_GunFlash(state flash = ""); - action native A_Saw(sound fullsound = "weapons/sawfull", sound hitsound = "weapons/sawhit", int damage = 2, class pufftype = "BulletPuff"); + action native A_Saw(sound fullsound = "weapons/sawfull", sound hitsound = "weapons/sawhit", int damage = 2, class pufftype = "BulletPuff", float range = 0, float lifesteal = 0); action native A_CheckForReload(int counter, state label, bool dontincrement = false); action native A_ResetReloadCounter(); action native A_RestoreSpecialPosition();