2008-09-15 14:11:05 +00:00
|
|
|
/*
|
2006-02-24 04:48:15 +00:00
|
|
|
#include "actor.h"
|
|
|
|
#include "info.h"
|
|
|
|
#include "a_pickups.h"
|
|
|
|
#include "a_artifacts.h"
|
|
|
|
#include "gstrings.h"
|
|
|
|
#include "p_local.h"
|
|
|
|
#include "s_sound.h"
|
|
|
|
#include "m_random.h"
|
|
|
|
#include "a_action.h"
|
|
|
|
#include "a_hexenglobal.h"
|
|
|
|
#include "w_wad.h"
|
2008-08-10 20:48:55 +00:00
|
|
|
#include "thingdef/thingdef.h"
|
2008-09-14 23:54:38 +00:00
|
|
|
#include "g_level.h"
|
2008-09-15 14:11:05 +00:00
|
|
|
*/
|
2006-02-24 04:48:15 +00:00
|
|
|
|
2012-07-01 22:47:13 +00:00
|
|
|
EXTERN_CVAR(Bool, sv_unlimited_pickup)
|
|
|
|
|
2006-02-24 04:48:15 +00:00
|
|
|
static FRandom pr_poisonbag ("PoisonBag");
|
|
|
|
static FRandom pr_poisoncloud ("PoisonCloud");
|
|
|
|
static FRandom pr_poisoncloudd ("PoisonCloudDamage");
|
|
|
|
|
2008-08-10 22:48:37 +00:00
|
|
|
DECLARE_ACTION(A_CheckThrowBomb)
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
// Poison Bag Artifact (Flechette) ------------------------------------------
|
|
|
|
|
|
|
|
class AArtiPoisonBag : public AInventory
|
|
|
|
{
|
2008-08-08 15:18:23 +00:00
|
|
|
DECLARE_CLASS (AArtiPoisonBag, AInventory)
|
2006-02-24 04:48:15 +00:00
|
|
|
public:
|
|
|
|
bool HandlePickup (AInventory *item);
|
|
|
|
AInventory *CreateCopy (AActor *other);
|
|
|
|
void BeginPlay ();
|
|
|
|
};
|
|
|
|
|
2008-08-08 15:18:23 +00:00
|
|
|
IMPLEMENT_CLASS (AArtiPoisonBag)
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
// Poison Bag 1 (The Cleric's) ----------------------------------------------
|
|
|
|
|
|
|
|
class AArtiPoisonBag1 : public AArtiPoisonBag
|
|
|
|
{
|
2008-08-08 15:18:23 +00:00
|
|
|
DECLARE_CLASS (AArtiPoisonBag1, AArtiPoisonBag)
|
2006-02-24 04:48:15 +00:00
|
|
|
public:
|
|
|
|
bool Use (bool pickup);
|
|
|
|
};
|
|
|
|
|
2008-08-08 15:18:23 +00:00
|
|
|
IMPLEMENT_CLASS (AArtiPoisonBag1)
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
bool AArtiPoisonBag1::Use (bool pickup)
|
|
|
|
{
|
|
|
|
angle_t angle = Owner->angle >> ANGLETOFINESHIFT;
|
|
|
|
AActor *mo;
|
|
|
|
|
2016-01-18 21:26:02 +00:00
|
|
|
mo = Spawn ("PoisonBag", Owner->Vec3Offset(
|
|
|
|
16*finecosine[angle],
|
|
|
|
24*finesine[angle],
|
|
|
|
-Owner->floorclip+8*FRACUNIT), ALLOW_REPLACE);
|
2006-02-24 04:48:15 +00:00
|
|
|
if (mo)
|
|
|
|
{
|
|
|
|
mo->target = Owner;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Poison Bag 2 (The Mage's) ------------------------------------------------
|
|
|
|
|
|
|
|
class AArtiPoisonBag2 : public AArtiPoisonBag
|
|
|
|
{
|
2008-08-08 15:18:23 +00:00
|
|
|
DECLARE_CLASS (AArtiPoisonBag2, AArtiPoisonBag)
|
2006-02-24 04:48:15 +00:00
|
|
|
public:
|
|
|
|
bool Use (bool pickup);
|
|
|
|
};
|
|
|
|
|
2008-08-08 15:18:23 +00:00
|
|
|
IMPLEMENT_CLASS (AArtiPoisonBag2)
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
bool AArtiPoisonBag2::Use (bool pickup)
|
|
|
|
{
|
|
|
|
angle_t angle = Owner->angle >> ANGLETOFINESHIFT;
|
|
|
|
AActor *mo;
|
|
|
|
|
2016-01-18 21:26:02 +00:00
|
|
|
mo = Spawn ("FireBomb", Owner->Vec3Offset(
|
|
|
|
16*finecosine[angle],
|
|
|
|
24*finesine[angle],
|
|
|
|
-Owner->floorclip+8*FRACUNIT), ALLOW_REPLACE);
|
2006-02-24 04:48:15 +00:00
|
|
|
if (mo)
|
|
|
|
{
|
|
|
|
mo->target = Owner;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Poison Bag 3 (The Fighter's) ---------------------------------------------
|
|
|
|
|
|
|
|
class AArtiPoisonBag3 : public AArtiPoisonBag
|
|
|
|
{
|
2008-08-08 15:18:23 +00:00
|
|
|
DECLARE_CLASS (AArtiPoisonBag3, AArtiPoisonBag)
|
2006-02-24 04:48:15 +00:00
|
|
|
public:
|
|
|
|
bool Use (bool pickup);
|
|
|
|
};
|
|
|
|
|
2008-08-08 15:18:23 +00:00
|
|
|
IMPLEMENT_CLASS (AArtiPoisonBag3)
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
bool AArtiPoisonBag3::Use (bool pickup)
|
|
|
|
{
|
|
|
|
AActor *mo;
|
|
|
|
|
2016-01-18 21:26:02 +00:00
|
|
|
mo = Spawn("ThrowingBomb", Owner->PosPlusZ(-Owner->floorclip+35*FRACUNIT + (Owner->player? Owner->player->crouchoffset : 0)), ALLOW_REPLACE);
|
2006-02-24 04:48:15 +00:00
|
|
|
if (mo)
|
|
|
|
{
|
2009-12-29 04:50:56 +00:00
|
|
|
mo->angle = Owner->angle + (((pr_poisonbag()&7) - 4) << 24);
|
|
|
|
|
|
|
|
/* Original flight code from Hexen
|
|
|
|
* mo->momz = 4*FRACUNIT+((player->lookdir)<<(FRACBITS-4));
|
|
|
|
* mo->z += player->lookdir<<(FRACBITS-4);
|
|
|
|
* P_ThrustMobj(mo, mo->angle, mo->info->speed);
|
|
|
|
* mo->momx += player->mo->momx>>1;
|
|
|
|
* mo->momy += player->mo->momy>>1;
|
|
|
|
*/
|
|
|
|
|
|
|
|
// When looking straight ahead, it uses a z velocity of 4 while the xy velocity
|
2012-02-21 20:58:33 +00:00
|
|
|
// is as set by the projectile. To accommodate this with a proper trajectory, we
|
2009-12-29 04:50:56 +00:00
|
|
|
// 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;
|
|
|
|
angle_t modpitch = angle_t(0xDC00000 - Owner->pitch) >> ANGLETOFINESHIFT;
|
|
|
|
angle_t angle = mo->angle >> ANGLETOFINESHIFT;
|
2009-12-31 20:50:30 +00:00
|
|
|
fixed_t speed = fixed_t(sqrt((double)mo->Speed*mo->Speed + (4.0*65536*4*65536)));
|
2009-12-29 04:50:56 +00:00
|
|
|
fixed_t xyscale = FixedMul(speed, finecosine[modpitch]);
|
|
|
|
|
|
|
|
mo->velz = FixedMul(speed, finesine[modpitch]);
|
|
|
|
mo->velx = FixedMul(xyscale, finecosine[angle]) + (Owner->velx >> 1);
|
|
|
|
mo->vely = FixedMul(xyscale, finesine[angle]) + (Owner->vely >> 1);
|
2016-01-18 21:26:02 +00:00
|
|
|
mo->SetZ(mo->Z() + FixedMul(mo->Speed, finesine[orgpitch]));
|
2009-12-29 04:50:56 +00:00
|
|
|
|
2006-02-24 04:48:15 +00:00
|
|
|
mo->target = Owner;
|
|
|
|
mo->tics -= pr_poisonbag()&3;
|
2013-03-21 03:06:04 +00:00
|
|
|
P_CheckMissileSpawn(mo, Owner->radius);
|
2006-02-24 04:48:15 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2012-02-21 20:58:33 +00:00
|
|
|
// 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)
|
|
|
|
{
|
2016-01-18 21:26:02 +00:00
|
|
|
AActor *mo = Spawn (MissileType, Owner->Pos(), ALLOW_REPLACE);
|
2012-02-21 20:58:33 +00:00
|
|
|
if (mo != NULL)
|
|
|
|
{
|
|
|
|
if (mo->IsKindOf(RUNTIME_CLASS(AInventory)))
|
|
|
|
{
|
|
|
|
AInventory *inv = static_cast<AInventory *>(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;
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2011-01-01 11:16:46 +00:00
|
|
|
//============================================================================
|
|
|
|
//
|
|
|
|
// GetFlechetteType
|
|
|
|
//
|
|
|
|
//============================================================================
|
|
|
|
|
|
|
|
const PClass *GetFlechetteType(AActor *other)
|
|
|
|
{
|
|
|
|
const PClass *spawntype = NULL;
|
|
|
|
if (other->IsKindOf(RUNTIME_CLASS(APlayerPawn)))
|
|
|
|
{
|
|
|
|
spawntype = static_cast<APlayerPawn*>(other)->FlechetteType;
|
|
|
|
}
|
|
|
|
if (spawntype == NULL)
|
|
|
|
{
|
|
|
|
// default fallback if nothing valid defined.
|
|
|
|
spawntype = RUNTIME_CLASS(AArtiPoisonBag3);
|
|
|
|
}
|
|
|
|
return spawntype;
|
|
|
|
}
|
|
|
|
|
2006-02-24 04:48:15 +00:00
|
|
|
//============================================================================
|
|
|
|
//
|
|
|
|
// AArtiPoisonBag :: HandlePickup
|
|
|
|
//
|
|
|
|
//============================================================================
|
|
|
|
|
|
|
|
bool AArtiPoisonBag::HandlePickup (AInventory *item)
|
|
|
|
{
|
|
|
|
// Only do special handling when picking up the base class
|
|
|
|
if (item->GetClass() != RUNTIME_CLASS(AArtiPoisonBag))
|
|
|
|
{
|
|
|
|
return Super::HandlePickup (item);
|
|
|
|
}
|
|
|
|
|
2011-01-01 11:16:46 +00:00
|
|
|
if (GetClass() == GetFlechetteType(Owner))
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
2012-07-01 22:47:13 +00:00
|
|
|
if (Amount < MaxAmount || sv_unlimited_pickup)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
|
|
|
Amount += item->Amount;
|
2012-07-01 22:47:13 +00:00
|
|
|
if (Amount > MaxAmount && !sv_unlimited_pickup)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
|
|
|
Amount = MaxAmount;
|
|
|
|
}
|
|
|
|
item->ItemFlags |= IF_PICKUPGOOD;
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
if (Inventory != NULL)
|
|
|
|
{
|
|
|
|
return Inventory->HandlePickup (item);
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
//============================================================================
|
|
|
|
//
|
|
|
|
// AArtiPoisonBag :: CreateCopy
|
|
|
|
//
|
|
|
|
//============================================================================
|
|
|
|
|
|
|
|
AInventory *AArtiPoisonBag::CreateCopy (AActor *other)
|
|
|
|
{
|
|
|
|
// Only the base class gets special handling
|
|
|
|
if (GetClass() != RUNTIME_CLASS(AArtiPoisonBag))
|
|
|
|
{
|
|
|
|
return Super::CreateCopy (other);
|
|
|
|
}
|
|
|
|
|
|
|
|
AInventory *copy;
|
|
|
|
|
2011-01-01 11:16:46 +00:00
|
|
|
const PClass *spawntype = GetFlechetteType(other);
|
2006-07-16 09:10:45 +00:00
|
|
|
copy = static_cast<AInventory *>(Spawn (spawntype, 0, 0, 0, NO_REPLACE));
|
2006-02-24 04:48:15 +00:00
|
|
|
copy->Amount = Amount;
|
|
|
|
copy->MaxAmount = MaxAmount;
|
|
|
|
GoAwayAndDie ();
|
|
|
|
return copy;
|
|
|
|
}
|
|
|
|
|
|
|
|
//============================================================================
|
|
|
|
//
|
|
|
|
// AArtiPoisonBag :: BeginPlay
|
|
|
|
//
|
|
|
|
//============================================================================
|
|
|
|
|
|
|
|
void AArtiPoisonBag::BeginPlay ()
|
|
|
|
{
|
|
|
|
Super::BeginPlay ();
|
|
|
|
// If a subclass's specific icon is not defined, let it use the base class's.
|
2008-06-15 18:36:26 +00:00
|
|
|
if (!Icon.isValid())
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
|
|
|
AInventory *defbag;
|
|
|
|
// Why doesn't this work?
|
|
|
|
//defbag = GetDefault<AArtiPoisonBag>();
|
|
|
|
defbag = (AInventory *)GetDefaultByType (RUNTIME_CLASS(AArtiPoisonBag));
|
|
|
|
Icon = defbag->Icon;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Poison Cloud -------------------------------------------------------------
|
|
|
|
|
2008-08-08 15:18:23 +00:00
|
|
|
class APoisonCloud : public AActor
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
2008-08-08 15:18:23 +00:00
|
|
|
DECLARE_CLASS (APoisonCloud, AActor)
|
|
|
|
public:
|
2012-06-29 04:21:31 +00:00
|
|
|
int DoSpecialDamage (AActor *target, int damage, FName damagetype);
|
2008-08-08 15:18:23 +00:00
|
|
|
void BeginPlay ();
|
2006-02-24 04:48:15 +00:00
|
|
|
};
|
|
|
|
|
2008-08-08 15:18:23 +00:00
|
|
|
IMPLEMENT_CLASS (APoisonCloud)
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
void APoisonCloud::BeginPlay ()
|
|
|
|
{
|
2009-06-30 20:57:51 +00:00
|
|
|
velx = 1; // missile objects must move to impact other objects
|
2006-02-24 04:48:15 +00:00
|
|
|
special1 = 24+(pr_poisoncloud()&7);
|
|
|
|
special2 = 0;
|
|
|
|
}
|
|
|
|
|
2012-06-29 04:21:31 +00:00
|
|
|
int APoisonCloud::DoSpecialDamage (AActor *victim, int damage, FName damagetype)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
|
|
|
if (victim->player)
|
|
|
|
{
|
|
|
|
bool mate = (target != NULL && victim->player != target->player && victim->IsTeammate (target));
|
|
|
|
bool dopoison;
|
|
|
|
|
|
|
|
if (!mate)
|
|
|
|
{
|
|
|
|
dopoison = victim->player->poisoncount < 4;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2007-12-22 22:04:20 +00:00
|
|
|
dopoison = victim->player->poisoncount < (int)(4.f * level.teamdamage);
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (dopoison)
|
|
|
|
{
|
|
|
|
int damage = 15 + (pr_poisoncloudd()&15);
|
|
|
|
if (mate)
|
|
|
|
{
|
2007-12-22 22:04:20 +00:00
|
|
|
damage = (int)((float)damage * level.teamdamage);
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
2012-06-30 01:06:30 +00:00
|
|
|
// Handle passive damage modifiers (e.g. PowerProtection)
|
|
|
|
if (victim->Inventory != NULL)
|
|
|
|
{
|
|
|
|
victim->Inventory->ModifyDamage(damage, damagetype, damage, true);
|
|
|
|
}
|
2012-06-29 04:21:31 +00:00
|
|
|
// Modify with damage factors
|
|
|
|
damage = FixedMul(damage, victim->DamageFactor);
|
|
|
|
if (damage > 0)
|
|
|
|
{
|
|
|
|
damage = DamageTypeDefinition::ApplyMobjDamageFactor(damage, damagetype, victim->GetClass()->ActorInfo->DamageFactors);
|
|
|
|
}
|
2006-02-24 04:48:15 +00:00
|
|
|
if (damage > 0)
|
|
|
|
{
|
|
|
|
P_PoisonDamage (victim->player, this,
|
|
|
|
15+(pr_poisoncloudd()&15), false); // Don't play painsound
|
|
|
|
|
2012-06-29 04:21:31 +00:00
|
|
|
// If successful, play the poison sound.
|
2009-06-07 09:41:22 +00:00
|
|
|
if (P_PoisonPlayer (victim->player, this, this->target, 50))
|
|
|
|
S_Sound (victim, CHAN_VOICE, "*poison", 1, ATTN_NORM);
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
else if (!(victim->flags3 & MF3_ISMONSTER))
|
|
|
|
{ // only damage monsters/players with the poison cloud
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
return damage;
|
|
|
|
}
|
|
|
|
|
|
|
|
//===========================================================================
|
|
|
|
//
|
|
|
|
// A_PoisonBagInit
|
|
|
|
//
|
|
|
|
//===========================================================================
|
|
|
|
|
2008-08-10 20:48:55 +00:00
|
|
|
DEFINE_ACTION_FUNCTION(AActor, A_PoisonBagInit)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
|
|
|
AActor *mo;
|
|
|
|
|
2016-01-18 21:26:02 +00:00
|
|
|
mo = Spawn<APoisonCloud> (self->PosPlusZ(28*FRACUNIT), ALLOW_REPLACE);
|
2006-02-24 04:48:15 +00:00
|
|
|
if (mo)
|
|
|
|
{
|
2008-08-10 20:48:55 +00:00
|
|
|
mo->target = self->target;
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//===========================================================================
|
|
|
|
//
|
|
|
|
// A_PoisonBagCheck
|
|
|
|
//
|
|
|
|
//===========================================================================
|
|
|
|
|
2008-08-10 20:48:55 +00:00
|
|
|
DEFINE_ACTION_FUNCTION(AActor, A_PoisonBagCheck)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
2008-08-10 20:48:55 +00:00
|
|
|
if (--self->special1 <= 0)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
2008-08-10 20:48:55 +00:00
|
|
|
self->SetState (self->FindState ("Death"));
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//===========================================================================
|
|
|
|
//
|
|
|
|
// A_PoisonBagDamage
|
|
|
|
//
|
|
|
|
//===========================================================================
|
|
|
|
|
2008-08-10 20:48:55 +00:00
|
|
|
DEFINE_ACTION_FUNCTION(AActor, A_PoisonBagDamage)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
|
|
|
int bobIndex;
|
|
|
|
|
2012-08-30 04:01:50 +00:00
|
|
|
P_RadiusAttack (self, self->target, 4, 40, self->DamageType, RADF_HURTSOURCE);
|
2008-08-10 20:48:55 +00:00
|
|
|
bobIndex = self->special2;
|
2016-01-18 21:26:02 +00:00
|
|
|
self->SetZ(self->Z() + finesine[bobIndex << BOBTOFINESHIFT] >> 1);
|
2012-07-11 02:50:13 +00:00
|
|
|
self->special2 = (bobIndex + 1) & 63;
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//===========================================================================
|
|
|
|
//
|
|
|
|
// A_CheckThrowBomb
|
|
|
|
//
|
|
|
|
//===========================================================================
|
|
|
|
|
2008-08-10 20:48:55 +00:00
|
|
|
DEFINE_ACTION_FUNCTION(AActor, A_CheckThrowBomb)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
2008-08-10 20:48:55 +00:00
|
|
|
if (--self->health <= 0)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
2008-08-10 20:48:55 +00:00
|
|
|
self->SetState (self->FindState(NAME_Death));
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//===========================================================================
|
|
|
|
//
|
|
|
|
// A_CheckThrowBomb2
|
|
|
|
//
|
|
|
|
//===========================================================================
|
|
|
|
|
2008-08-10 20:48:55 +00:00
|
|
|
DEFINE_ACTION_FUNCTION(AActor, A_CheckThrowBomb2)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
2009-06-30 20:57:51 +00:00
|
|
|
// [RH] Check using actual velocity, although the velz < 2 check still stands
|
|
|
|
//if (abs(self->velx) < FRACUNIT*3/2 && abs(self->vely) < FRACUNIT*3/2
|
|
|
|
// && self->velz < 2*FRACUNIT)
|
|
|
|
if (self->velz < 2*FRACUNIT &&
|
|
|
|
TMulScale32 (self->velx, self->velx, self->vely, self->vely, self->velz, self->velz)
|
2006-02-24 04:48:15 +00:00
|
|
|
< (3*3)/(2*2))
|
|
|
|
{
|
2008-08-10 20:48:55 +00:00
|
|
|
self->SetState (self->SpawnState + 6);
|
2016-01-18 21:26:02 +00:00
|
|
|
self->SetZ(self->floorz);
|
2009-06-30 20:57:51 +00:00
|
|
|
self->velz = 0;
|
2009-09-06 01:49:17 +00:00
|
|
|
self->BounceFlags = BOUNCE_None;
|
2008-08-10 20:48:55 +00:00
|
|
|
self->flags &= ~MF_MISSILE;
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
2008-08-10 22:48:37 +00:00
|
|
|
CALL_ACTION(A_CheckThrowBomb, self);
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|