This commit is contained in:
Christoph Oelckers 2014-12-20 11:36:10 +01:00
commit a19f0219c5
4 changed files with 62 additions and 6 deletions

View file

@ -109,6 +109,7 @@ enum SAW_Flags
SF_NOUSEAMMO = 16, SF_NOUSEAMMO = 16,
SF_NOPULLIN = 32, SF_NOPULLIN = 32,
SF_NOTURN = 64, SF_NOTURN = 64,
SF_STEALARMOR = 128,
}; };
DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_Saw) DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_Saw)
@ -119,7 +120,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_Saw)
AActor *linetarget; AActor *linetarget;
int actualdamage; int actualdamage;
ACTION_PARAM_START(9); ACTION_PARAM_START(11);
ACTION_PARAM_SOUND(fullsound, 0); ACTION_PARAM_SOUND(fullsound, 0);
ACTION_PARAM_SOUND(hitsound, 1); ACTION_PARAM_SOUND(hitsound, 1);
ACTION_PARAM_INT(damage, 2); ACTION_PARAM_INT(damage, 2);
@ -129,6 +130,8 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_Saw)
ACTION_PARAM_ANGLE(Spread_XY, 6); ACTION_PARAM_ANGLE(Spread_XY, 6);
ACTION_PARAM_ANGLE(Spread_Z, 7); ACTION_PARAM_ANGLE(Spread_Z, 7);
ACTION_PARAM_FIXED(LifeSteal, 8); ACTION_PARAM_FIXED(LifeSteal, 8);
ACTION_PARAM_INT(lifestealmax, 9);
ACTION_PARAM_CLASS(armorbonustype, 10);
if (NULL == (player = self->player)) if (NULL == (player = self->player))
{ {
@ -184,7 +187,31 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_Saw)
} }
if (LifeSteal && !(linetarget->flags5 & MF5_DONTDRAIN)) if (LifeSteal && !(linetarget->flags5 & MF5_DONTDRAIN))
P_GiveBody (self, (actualdamage * LifeSteal) >> FRACBITS); {
if (flags & SF_STEALARMOR)
{
if (!armorbonustype) armorbonustype = PClass::FindClass("ArmorBonus");
if (armorbonustype->IsDescendantOf (RUNTIME_CLASS(ABasicArmorBonus)))
{
ABasicArmorBonus *armorbonus = static_cast<ABasicArmorBonus *>(Spawn (armorbonustype, 0,0,0, NO_REPLACE));
armorbonus->SaveAmount *= (actualdamage * LifeSteal) >> FRACBITS;
armorbonus->MaxSaveAmount = lifestealmax <= 0 ? armorbonus->MaxSaveAmount : lifestealmax;
armorbonus->flags |= MF_DROPPED;
armorbonus->ClearCounters();
if (!armorbonus->CallTryPickup (self))
{
armorbonus->Destroy ();
}
}
}
else
{
P_GiveBody (self, (actualdamage * LifeSteal) >> FRACBITS, lifestealmax);
}
}
S_Sound (self, CHAN_WEAPON, hitsound, 1, ATTN_NORM); S_Sound (self, CHAN_WEAPON, hitsound, 1, ATTN_NORM);

View file

@ -1385,17 +1385,20 @@ enum
CPF_PULLIN = 4, CPF_PULLIN = 4,
CPF_NORANDOMPUFFZ = 8, CPF_NORANDOMPUFFZ = 8,
CPF_NOTURN = 16, CPF_NOTURN = 16,
CPF_STEALARMOR = 32,
}; };
DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_CustomPunch) DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_CustomPunch)
{ {
ACTION_PARAM_START(5); ACTION_PARAM_START(8);
ACTION_PARAM_INT(Damage, 0); ACTION_PARAM_INT(Damage, 0);
ACTION_PARAM_BOOL(norandom, 1); ACTION_PARAM_BOOL(norandom, 1);
ACTION_PARAM_INT(flags, 2); ACTION_PARAM_INT(flags, 2);
ACTION_PARAM_CLASS(PuffType, 3); ACTION_PARAM_CLASS(PuffType, 3);
ACTION_PARAM_FIXED(Range, 4); ACTION_PARAM_FIXED(Range, 4);
ACTION_PARAM_FIXED(LifeSteal, 5); ACTION_PARAM_FIXED(LifeSteal, 5);
ACTION_PARAM_INT(lifestealmax, 6);
ACTION_PARAM_CLASS(armorbonustype, 7);
if (!self->player) return; if (!self->player) return;
@ -1428,7 +1431,31 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_CustomPunch)
if (linetarget) if (linetarget)
{ {
if (LifeSteal && !(linetarget->flags5 & MF5_DONTDRAIN)) if (LifeSteal && !(linetarget->flags5 & MF5_DONTDRAIN))
P_GiveBody (self, (actualdamage * LifeSteal) >> FRACBITS); {
if (flags & CPF_STEALARMOR)
{
if (!armorbonustype) armorbonustype = PClass::FindClass("ArmorBonus");
if (armorbonustype->IsDescendantOf (RUNTIME_CLASS(ABasicArmorBonus)))
{
ABasicArmorBonus *armorbonus = static_cast<ABasicArmorBonus *>(Spawn (armorbonustype, 0,0,0, NO_REPLACE));
armorbonus->SaveAmount *= (actualdamage * LifeSteal) >> FRACBITS;
armorbonus->MaxSaveAmount = lifestealmax <= 0 ? armorbonus->MaxSaveAmount : lifestealmax;
armorbonus->flags |= MF_DROPPED;
armorbonus->ClearCounters();
if (!armorbonus->CallTryPickup (self))
{
armorbonus->Destroy ();
}
}
}
else
{
P_GiveBody (self, (actualdamage * LifeSteal) >> FRACBITS, lifestealmax);
}
}
if (weapon != NULL) if (weapon != NULL)
{ {

View file

@ -16,6 +16,7 @@ const int SF_NOUSEAMMOMISS = 8;
const int SF_NOUSEAMMO = 16; const int SF_NOUSEAMMO = 16;
const int SF_NOPULLIN = 32; const int SF_NOPULLIN = 32;
const int SF_NOTURN = 64; const int SF_NOTURN = 64;
const int SF_STEALARMOR = 128;
// Flags for A_CustomMissile // Flags for A_CustomMissile
const int CMF_AIMOFFSET = 1; const int CMF_AIMOFFSET = 1;
@ -176,6 +177,7 @@ const int CPF_DAGGER = 2;
const int CPF_PULLIN = 4; const int CPF_PULLIN = 4;
const int CPF_NORANDOMPUFFZ = 8; const int CPF_NORANDOMPUFFZ = 8;
const int CPF_NOTURN = 16; const int CPF_NOTURN = 16;
const int CPF_STEALARMOR = 32;
// Flags for A_CustomMissile // Flags for A_CustomMissile
const int FPF_AIMATANGLE = 1; const int FPF_AIMATANGLE = 1;

View file

@ -8,7 +8,7 @@ ACTOR Inventory native
Inventory.PickupMessage "$TXT_DEFAULTPICKUPMSG" Inventory.PickupMessage "$TXT_DEFAULTPICKUPMSG"
action native A_JumpIfNoAmmo(state label); action native A_JumpIfNoAmmo(state label);
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_CustomPunch(int damage, bool norandom = false, int flags = CPF_USEAMMO, class<Actor> pufftype = "BulletPuff", float range = 0, float lifesteal = 0, int lifestealmax = 0, class<BasicArmorBonus> armorbonustype = "ArmorBonus");
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_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_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", float spread_xy = 0, float spread_z = 0, float range = 0, int duration = 0, float sparsity = 1.0, float driftspeed = 1.0, class<Actor> spawnclass = "none", float spawnofs_z = 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", float spread_xy = 0, float spread_z = 0, float range = 0, int duration = 0, float sparsity = 1.0, float driftspeed = 1.0, class<Actor> spawnclass = "none", float spawnofs_z = 0);
@ -41,7 +41,7 @@ ACTOR Inventory native
action native A_ClearReFire(); action native A_ClearReFire();
action native A_CheckReload(); action native A_CheckReload();
action native A_GunFlash(state flash = "", int flags = 0); action native A_GunFlash(state flash = "", int flags = 0);
action native A_Saw(sound fullsound = "weapons/sawfull", sound hitsound = "weapons/sawhit", int damage = 2, class<Actor> pufftype = "BulletPuff", int flags = 0, float range = 0, float spread_xy = 2.8125, float spread_z = 0, float lifesteal = 0); action native A_Saw(sound fullsound = "weapons/sawfull", sound hitsound = "weapons/sawhit", int damage = 2, class<Actor> pufftype = "BulletPuff", int flags = 0, float range = 0, float spread_xy = 2.8125, float spread_z = 0, float lifesteal = 0, int lifestealmax = 0, class<BasicArmorBonus> armorbonustype = "ArmorBonus");
action native A_CheckForReload(int counter, state label, bool dontincrement = false); action native A_CheckForReload(int counter, state label, bool dontincrement = false);
action native A_ResetReloadCounter(); action native A_ResetReloadCounter();
action native A_RestoreSpecialPosition(); action native A_RestoreSpecialPosition();