diff --git a/src/g_hexen/a_flechette.cpp b/src/g_hexen/a_flechette.cpp index b99ec97935..780b6d1ea0 100644 --- a/src/g_hexen/a_flechette.cpp +++ b/src/g_hexen/a_flechette.cpp @@ -119,7 +119,7 @@ bool AArtiPoisonBag3::Use (bool pickup) */ // When looking straight ahead, it uses a z velocity of 4 while the xy velocity - // is as set by the projectile. To accomodate this with a proper trajectory, we + // is as set by the projectile. To accommodate this with a proper trajectory, we // aim the projectile ~20 degrees higher than we're looking at and increase the // speed we fire at accordingly. angle_t orgpitch = angle_t(-Owner->pitch) >> ANGLETOFINESHIFT; @@ -141,6 +141,72 @@ bool AArtiPoisonBag3::Use (bool pickup) return false; } +// Poison Bag 4 (Generic Giver) ---------------------------------------------- + +class AArtiPoisonBagGiver : public AArtiPoisonBag +{ + DECLARE_CLASS (AArtiPoisonBagGiver, AArtiPoisonBag) +public: + bool Use (bool pickup); +}; + +IMPLEMENT_CLASS (AArtiPoisonBagGiver) + +bool AArtiPoisonBagGiver::Use (bool pickup) +{ + const PClass *MissileType = PClass::FindClass((ENamedName) this->GetClass()->Meta.GetMetaInt (ACMETA_MissileName, NAME_None)); + if (MissileType != NULL) + { + AActor *mo = Spawn (MissileType, Owner->x, Owner->y, Owner->z, ALLOW_REPLACE); + if (mo != NULL) + { + if (mo->IsKindOf(RUNTIME_CLASS(AInventory))) + { + AInventory *inv = static_cast(mo); + if (inv->CallTryPickup(Owner)) + return true; + } + mo->Destroy(); // Destroy if not inventory or couldn't be picked up + } + } + return false; +} + +// Poison Bag 5 (Generic Thrower) ---------------------------------------------- + +class AArtiPoisonBagShooter : public AArtiPoisonBag +{ + DECLARE_CLASS (AArtiPoisonBagShooter, AArtiPoisonBag) +public: + bool Use (bool pickup); +}; + +IMPLEMENT_CLASS (AArtiPoisonBagShooter) + +bool AArtiPoisonBagShooter::Use (bool pickup) +{ + const PClass *MissileType = PClass::FindClass((ENamedName) this->GetClass()->Meta.GetMetaInt (ACMETA_MissileName, NAME_None)); + if (MissileType != NULL) + { + AActor *mo = P_SpawnPlayerMissile(Owner, MissileType); + if (mo != NULL) + { + // automatic handling of seeker missiles + if (mo->flags2 & MF2_SEEKERMISSILE) + { + mo->tracer = Owner->target; + } + // set the health value so that the missile works properly + if (mo->flags4 & MF4_SPECTRAL) + { + mo->health = -2; + } + return true; + } + } + return false; +} + //============================================================================ // // GetFlechetteType diff --git a/wadsrc/static/actors/hexen/flechette.txt b/wadsrc/static/actors/hexen/flechette.txt index b2063a6ec0..6e12bff53c 100644 --- a/wadsrc/static/actors/hexen/flechette.txt +++ b/wadsrc/static/actors/hexen/flechette.txt @@ -137,6 +137,22 @@ ACTOR ArtiPoisonBag3 : ArtiPoisonBag native Inventory.Icon "ARTIPSB3" Tag "$TAG_ARTIPOISONBAG3" } + + +// Poison Bag 4 (Custom Giver) ---------------------------------------------- + +ACTOR ArtiPoisonBagGiver : ArtiPoisonBag native +{ + Inventory.Icon "ARTIPSB4" +} + +// Poison Bag 5 (Custom Thrower) -------------------------------------------- + +ACTOR ArtiPoisonBagShooter : ArtiPoisonBag native +{ + Inventory.Icon "ARTIPSB5" +} + // Poison Cloud ------------------------------------------------------------- ACTOR PoisonCloud native