2006-02-24 04:48:15 +00:00
|
|
|
#include "actor.h"
|
|
|
|
#include "info.h"
|
|
|
|
#include "m_random.h"
|
|
|
|
#include "s_sound.h"
|
|
|
|
#include "p_local.h"
|
|
|
|
#include "p_enemy.h"
|
|
|
|
#include "ravenshared.h"
|
|
|
|
#include "a_action.h"
|
|
|
|
#include "gi.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"
|
|
|
|
#include "doomstat.h"
|
2011-07-06 14:20:54 +00:00
|
|
|
#include "farchive.h"
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
#define MAULATORTICS (25*35)
|
|
|
|
|
|
|
|
static FRandom pr_minotauratk1 ("MinotaurAtk1");
|
|
|
|
static FRandom pr_minotaurdecide ("MinotaurDecide");
|
|
|
|
static FRandom pr_atk ("MinotaurAtk2");
|
|
|
|
static FRandom pr_minotauratk3 ("MinotaurAtk3");
|
|
|
|
static FRandom pr_fire ("MntrFloorFire");
|
|
|
|
static FRandom pr_minotaurslam ("MinotaurSlam");
|
|
|
|
static FRandom pr_minotaurroam ("MinotaurRoam");
|
|
|
|
static FRandom pr_minotaurchase ("MinotaurChase");
|
|
|
|
|
|
|
|
void P_MinotaurSlam (AActor *source, AActor *target);
|
|
|
|
|
2008-08-10 22:48:37 +00:00
|
|
|
DECLARE_ACTION(A_MinotaurLook)
|
|
|
|
|
2008-08-06 19:25:59 +00:00
|
|
|
IMPLEMENT_CLASS(AMinotaur)
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
void AMinotaur::Tick ()
|
|
|
|
{
|
|
|
|
Super::Tick ();
|
|
|
|
|
|
|
|
// The unfriendly Minotaur (Heretic's) is invulnerable while charging
|
2008-08-06 19:25:59 +00:00
|
|
|
if (!(flags5 & MF5_SUMMONEDMONSTER))
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
|
|
|
// Get MF_SKULLFLY bit and shift it so it matches MF2_INVULNERABLE
|
|
|
|
DWORD flying = (flags & MF_SKULLFLY) << 3;
|
|
|
|
if ((flags2 & MF2_INVULNERABLE) != flying)
|
|
|
|
{
|
|
|
|
flags2 ^= MF2_INVULNERABLE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
bool AMinotaur::Slam (AActor *thing)
|
|
|
|
{
|
|
|
|
// Slamming minotaurs shouldn't move non-creatures
|
|
|
|
if (!(thing->flags3&MF3_ISMONSTER) && !thing->player)
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
return Super::Slam (thing);
|
|
|
|
}
|
|
|
|
|
2012-06-29 04:21:31 +00:00
|
|
|
int AMinotaur::DoSpecialDamage (AActor *target, int damage, FName damagetype)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
2012-06-29 04:21:31 +00:00
|
|
|
damage = Super::DoSpecialDamage (target, damage, damagetype);
|
2006-02-24 04:48:15 +00:00
|
|
|
if ((damage != -1) && (flags & MF_SKULLFLY))
|
|
|
|
{ // Slam only when in charge mode
|
|
|
|
P_MinotaurSlam (this, target);
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
return damage;
|
|
|
|
}
|
|
|
|
|
2006-04-23 20:12:27 +00:00
|
|
|
// Minotaur Friend ----------------------------------------------------------
|
|
|
|
|
2008-08-06 19:25:59 +00:00
|
|
|
IMPLEMENT_CLASS(AMinotaurFriend)
|
2006-04-23 20:12:27 +00:00
|
|
|
|
|
|
|
void AMinotaurFriend::BeginPlay ()
|
|
|
|
{
|
|
|
|
Super::BeginPlay ();
|
|
|
|
StartTime = -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
void AMinotaurFriend::Serialize (FArchive &arc)
|
|
|
|
{
|
|
|
|
Super::Serialize (arc);
|
|
|
|
arc << StartTime;
|
|
|
|
}
|
|
|
|
|
2012-05-13 07:54:44 +00:00
|
|
|
void AMinotaurFriend::Die (AActor *source, AActor *inflictor, int dmgflags)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
2012-05-13 07:54:44 +00:00
|
|
|
Super::Die (source, inflictor, dmgflags);
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
if (tracer && tracer->health > 0 && tracer->player)
|
|
|
|
{
|
|
|
|
// Search thinker list for minotaur
|
2006-04-23 20:12:27 +00:00
|
|
|
TThinkerIterator<AMinotaurFriend> iterator;
|
|
|
|
AMinotaurFriend *mo;
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
while ((mo = iterator.Next()) != NULL)
|
|
|
|
{
|
|
|
|
if (mo->health <= 0) continue;
|
|
|
|
// [RH] Minotaurs can't be morphed, so this isn't needed
|
|
|
|
//if (!(mo->flags&MF_COUNTKILL)) continue; // for morphed minotaurs
|
|
|
|
if (mo->flags&MF_CORPSE) continue;
|
|
|
|
if (mo->StartTime >= 0 && (level.maptime - StartTime) >= MAULATORTICS) continue;
|
|
|
|
if (mo->tracer != NULL && mo->tracer->player == tracer->player) break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (mo == NULL)
|
|
|
|
{
|
2010-03-24 02:49:37 +00:00
|
|
|
AInventory *power = tracer->FindInventory(PClass::FindActor("PowerMinotaur"));
|
2006-02-24 04:48:15 +00:00
|
|
|
if (power != NULL)
|
|
|
|
{
|
|
|
|
power->Destroy ();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-04-23 20:12:27 +00:00
|
|
|
bool AMinotaurFriend::OkayToSwitchTarget (AActor *other)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
2006-04-23 20:12:27 +00:00
|
|
|
if (other == tracer) return false; // Do not target the master
|
|
|
|
return Super::OkayToSwitchTarget (other);
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Action functions for the minotaur ----------------------------------------
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
// PROC A_MinotaurAtk1
|
|
|
|
//
|
|
|
|
// Melee attack.
|
|
|
|
//
|
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
|
2008-08-10 20:48:55 +00:00
|
|
|
DEFINE_ACTION_FUNCTION(AActor, A_MinotaurDeath)
|
2008-08-06 19:25:59 +00:00
|
|
|
{
|
2010-02-12 06:04:57 +00:00
|
|
|
PARAM_ACTION_PROLOGUE;
|
|
|
|
|
2008-08-06 19:25:59 +00:00
|
|
|
if (Wads.CheckNumForName ("MNTRF1", ns_sprites) < 0 &&
|
|
|
|
Wads.CheckNumForName ("MNTRF0", ns_sprites) < 0)
|
2008-08-10 20:48:55 +00:00
|
|
|
self->SetState(self->FindState ("FadeOut"));
|
2010-02-12 06:04:57 +00:00
|
|
|
return 0;
|
2008-08-06 19:25:59 +00:00
|
|
|
}
|
|
|
|
|
2008-08-10 20:48:55 +00:00
|
|
|
DEFINE_ACTION_FUNCTION(AActor, A_MinotaurAtk1)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
2010-02-12 06:04:57 +00:00
|
|
|
PARAM_ACTION_PROLOGUE;
|
|
|
|
|
2006-02-24 04:48:15 +00:00
|
|
|
player_t *player;
|
|
|
|
|
2008-08-10 20:48:55 +00:00
|
|
|
if (!self->target)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
2010-02-12 06:04:57 +00:00
|
|
|
return 0;
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
2008-08-10 20:48:55 +00:00
|
|
|
S_Sound (self, CHAN_WEAPON, "minotaur/melee", 1, ATTN_NORM);
|
|
|
|
if (self->CheckMeleeRange())
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
|
|
|
int damage = pr_minotauratk1.HitDice (4);
|
2013-01-02 04:39:59 +00:00
|
|
|
int newdam = P_DamageMobj (self->target, self, self, damage, NAME_Melee);
|
|
|
|
P_TraceBleed (newdam > 0 ? newdam : damage, self->target, self);
|
2008-08-10 20:48:55 +00:00
|
|
|
if ((player = self->target->player) != NULL &&
|
|
|
|
player->mo == self->target)
|
2006-02-24 04:48:15 +00:00
|
|
|
{ // Squish the player
|
|
|
|
player->deltaviewheight = -16*FRACUNIT;
|
|
|
|
}
|
|
|
|
}
|
2010-02-12 06:04:57 +00:00
|
|
|
return 0;
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
// PROC A_MinotaurDecide
|
|
|
|
//
|
|
|
|
// Choose a missile attack.
|
|
|
|
//
|
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
#define MNTR_CHARGE_SPEED (13*FRACUNIT)
|
|
|
|
|
2008-08-10 20:48:55 +00:00
|
|
|
DEFINE_ACTION_FUNCTION(AActor, A_MinotaurDecide)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
2010-02-12 06:04:57 +00:00
|
|
|
PARAM_ACTION_PROLOGUE;
|
|
|
|
|
2008-08-10 20:48:55 +00:00
|
|
|
bool friendly = !!(self->flags5 & MF5_SUMMONEDMONSTER);
|
2006-02-24 04:48:15 +00:00
|
|
|
angle_t angle;
|
|
|
|
AActor *target;
|
|
|
|
int dist;
|
|
|
|
|
2008-08-10 20:48:55 +00:00
|
|
|
target = self->target;
|
2006-02-24 04:48:15 +00:00
|
|
|
if (!target)
|
|
|
|
{
|
2010-02-12 06:04:57 +00:00
|
|
|
return 0;
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
if (!friendly)
|
|
|
|
{
|
2008-08-10 20:48:55 +00:00
|
|
|
S_Sound (self, CHAN_WEAPON, "minotaur/sight", 1, ATTN_NORM);
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
2008-08-10 20:48:55 +00:00
|
|
|
dist = P_AproxDistance (self->x-target->x, self->y-target->y);
|
|
|
|
if (target->z+target->height > self->z
|
|
|
|
&& target->z+target->height < self->z+self->height
|
2006-02-24 04:48:15 +00:00
|
|
|
&& dist < (friendly ? 16*64*FRACUNIT : 8*64*FRACUNIT)
|
|
|
|
&& dist > 1*64*FRACUNIT
|
|
|
|
&& pr_minotaurdecide() < 150)
|
|
|
|
{ // Charge attack
|
|
|
|
// Don't call the state function right away
|
2010-04-19 02:46:50 +00:00
|
|
|
self->SetState (self->FindState ("Charge"), true);
|
2008-08-10 20:48:55 +00:00
|
|
|
self->flags |= MF_SKULLFLY;
|
2006-02-24 04:48:15 +00:00
|
|
|
if (!friendly)
|
|
|
|
{ // Heretic's Minotaur is invulnerable during charge attack
|
2008-08-10 20:48:55 +00:00
|
|
|
self->flags2 |= MF2_INVULNERABLE;
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
2008-08-10 20:48:55 +00:00
|
|
|
A_FaceTarget (self);
|
|
|
|
angle = self->angle>>ANGLETOFINESHIFT;
|
2009-06-30 20:57:51 +00:00
|
|
|
self->velx = FixedMul (MNTR_CHARGE_SPEED, finecosine[angle]);
|
|
|
|
self->vely = FixedMul (MNTR_CHARGE_SPEED, finesine[angle]);
|
2008-08-10 20:48:55 +00:00
|
|
|
self->special1 = TICRATE/2; // Charge duration
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
else if (target->z == target->floorz
|
|
|
|
&& dist < 9*64*FRACUNIT
|
|
|
|
&& pr_minotaurdecide() < (friendly ? 100 : 220))
|
|
|
|
{ // Floor fire attack
|
2008-08-10 20:48:55 +00:00
|
|
|
self->SetState (self->FindState ("Hammer"));
|
|
|
|
self->special2 = 0;
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{ // Swing attack
|
2008-08-10 20:48:55 +00:00
|
|
|
A_FaceTarget (self);
|
2006-02-24 04:48:15 +00:00
|
|
|
// Don't need to call P_SetMobjState because the current state
|
|
|
|
// falls through to the swing attack
|
|
|
|
}
|
2010-02-12 06:04:57 +00:00
|
|
|
return 0;
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
// PROC A_MinotaurCharge
|
|
|
|
//
|
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
|
2008-08-10 20:48:55 +00:00
|
|
|
DEFINE_ACTION_FUNCTION(AActor, A_MinotaurCharge)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
2010-02-12 06:04:57 +00:00
|
|
|
PARAM_ACTION_PROLOGUE;
|
2006-02-24 04:48:15 +00:00
|
|
|
|
2010-02-12 06:04:57 +00:00
|
|
|
AActor *puff;
|
2006-02-24 04:48:15 +00:00
|
|
|
|
2010-02-12 06:04:57 +00:00
|
|
|
if (self->target == NULL)
|
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
2008-08-10 20:48:55 +00:00
|
|
|
if (self->special1 > 0)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
2010-04-03 04:07:17 +00:00
|
|
|
PClassActor *type;
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
if (gameinfo.gametype == GAME_Heretic)
|
|
|
|
{
|
2010-04-03 04:07:17 +00:00
|
|
|
type = PClass::FindActor("PhoenixPuff");
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2010-04-03 04:07:17 +00:00
|
|
|
type = PClass::FindActor("PunchPuff");
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
2008-08-10 20:48:55 +00:00
|
|
|
puff = Spawn (type, self->x, self->y, self->z, ALLOW_REPLACE);
|
2009-06-30 20:57:51 +00:00
|
|
|
puff->velz = 2*FRACUNIT;
|
2008-08-10 20:48:55 +00:00
|
|
|
self->special1--;
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2008-08-10 20:48:55 +00:00
|
|
|
self->flags &= ~MF_SKULLFLY;
|
|
|
|
self->flags2 &= ~MF2_INVULNERABLE;
|
|
|
|
self->SetState (self->SeeState);
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
2010-02-12 06:04:57 +00:00
|
|
|
return 0;
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
// PROC A_MinotaurAtk2
|
|
|
|
//
|
|
|
|
// Swing attack.
|
|
|
|
//
|
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
|
2008-08-10 20:48:55 +00:00
|
|
|
DEFINE_ACTION_FUNCTION(AActor, A_MinotaurAtk2)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
2010-02-12 06:04:57 +00:00
|
|
|
PARAM_ACTION_PROLOGUE;
|
|
|
|
|
2006-02-24 04:48:15 +00:00
|
|
|
AActor *mo;
|
|
|
|
angle_t angle;
|
2009-06-30 20:57:51 +00:00
|
|
|
fixed_t velz;
|
2006-02-24 04:48:15 +00:00
|
|
|
fixed_t z;
|
2008-08-10 20:48:55 +00:00
|
|
|
bool friendly = !!(self->flags5 & MF5_SUMMONEDMONSTER);
|
2006-02-24 04:48:15 +00:00
|
|
|
|
2010-02-12 06:04:57 +00:00
|
|
|
if (self->target == NULL)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
2010-02-12 06:04:57 +00:00
|
|
|
return 0;
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
2008-08-10 20:48:55 +00:00
|
|
|
S_Sound (self, CHAN_WEAPON, "minotaur/attack2", 1, ATTN_NORM);
|
|
|
|
if (self->CheckMeleeRange())
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
|
|
|
int damage;
|
2006-04-23 20:12:27 +00:00
|
|
|
damage = pr_atk.HitDice (friendly ? 3 : 5);
|
2013-01-02 04:39:59 +00:00
|
|
|
int newdam = P_DamageMobj (self->target, self, self, damage, NAME_Melee);
|
|
|
|
P_TraceBleed (newdam > 0 ? newdam : damage, self->target, self);
|
2010-02-12 06:04:57 +00:00
|
|
|
return 0;
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
2008-08-10 20:48:55 +00:00
|
|
|
z = self->z + 40*FRACUNIT;
|
2010-03-25 20:38:00 +00:00
|
|
|
PClassActor *fx = PClass::FindActor("MinotaurFX1");
|
2008-08-04 19:25:13 +00:00
|
|
|
if (fx)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
2008-08-10 20:48:55 +00:00
|
|
|
mo = P_SpawnMissileZ (self, z, self->target, fx);
|
2008-08-04 19:25:13 +00:00
|
|
|
if (mo != NULL)
|
|
|
|
{
|
|
|
|
// S_Sound (mo, CHAN_WEAPON, "minotaur/attack2", 1, ATTN_NORM);
|
2009-06-30 20:57:51 +00:00
|
|
|
velz = mo->velz;
|
2008-08-04 19:25:13 +00:00
|
|
|
angle = mo->angle;
|
2009-06-30 20:57:51 +00:00
|
|
|
P_SpawnMissileAngleZ (self, z, fx, angle-(ANG45/8), velz);
|
|
|
|
P_SpawnMissileAngleZ (self, z, fx, angle+(ANG45/8), velz);
|
|
|
|
P_SpawnMissileAngleZ (self, z, fx, angle-(ANG45/16), velz);
|
|
|
|
P_SpawnMissileAngleZ (self, z, fx, angle+(ANG45/16), velz);
|
2008-08-04 19:25:13 +00:00
|
|
|
}
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
2010-02-12 06:04:57 +00:00
|
|
|
return 0;
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
// PROC A_MinotaurAtk3
|
|
|
|
//
|
|
|
|
// Floor fire attack.
|
|
|
|
//
|
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
|
2008-08-10 20:48:55 +00:00
|
|
|
DEFINE_ACTION_FUNCTION(AActor, A_MinotaurAtk3)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
2010-02-12 06:04:57 +00:00
|
|
|
PARAM_ACTION_PROLOGUE;
|
|
|
|
|
2006-02-24 04:48:15 +00:00
|
|
|
AActor *mo;
|
|
|
|
player_t *player;
|
2008-08-10 20:48:55 +00:00
|
|
|
bool friendly = !!(self->flags5 & MF5_SUMMONEDMONSTER);
|
2006-02-24 04:48:15 +00:00
|
|
|
|
2008-08-10 20:48:55 +00:00
|
|
|
if (!self->target)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
2010-02-12 06:04:57 +00:00
|
|
|
return 0;
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
2008-08-10 20:48:55 +00:00
|
|
|
S_Sound (self, CHAN_VOICE, "minotaur/attack3", 1, ATTN_NORM);
|
|
|
|
if (self->CheckMeleeRange())
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
|
|
|
int damage;
|
|
|
|
|
2006-04-23 20:12:27 +00:00
|
|
|
damage = pr_minotauratk3.HitDice (friendly ? 3 : 5);
|
2013-01-02 04:39:59 +00:00
|
|
|
int newdam = P_DamageMobj (self->target, self, self, damage, NAME_Melee);
|
|
|
|
P_TraceBleed (newdam > 0 ? newdam : damage, self->target, self);
|
2008-08-10 20:48:55 +00:00
|
|
|
if ((player = self->target->player) != NULL &&
|
|
|
|
player->mo == self->target)
|
2006-02-24 04:48:15 +00:00
|
|
|
{ // Squish the player
|
|
|
|
player->deltaviewheight = -16*FRACUNIT;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2009-06-14 13:47:38 +00:00
|
|
|
if (self->floorclip > 0 && (i_compatflags & COMPATF_MINOTAUR))
|
|
|
|
{
|
|
|
|
// only play the sound.
|
2009-06-14 14:56:34 +00:00
|
|
|
S_Sound (self, CHAN_WEAPON, "minotaur/fx2hit", 1, ATTN_NORM);
|
2009-06-14 13:47:38 +00:00
|
|
|
}
|
|
|
|
else
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
2010-04-03 04:07:17 +00:00
|
|
|
mo = P_SpawnMissile (self, self->target, PClass::FindActor("MinotaurFX2"));
|
2009-06-14 13:47:38 +00:00
|
|
|
if (mo != NULL)
|
|
|
|
{
|
|
|
|
S_Sound (mo, CHAN_WEAPON, "minotaur/attack1", 1, ATTN_NORM);
|
|
|
|
}
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
}
|
2008-08-10 20:48:55 +00:00
|
|
|
if (pr_minotauratk3() < 192 && self->special2 == 0)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
2008-08-11 10:02:24 +00:00
|
|
|
self->SetState (self->FindState ("HammerLoop"));
|
2008-08-10 20:48:55 +00:00
|
|
|
self->special2 = 1;
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
2010-02-12 06:04:57 +00:00
|
|
|
return 0;
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
// PROC A_MntrFloorFire
|
|
|
|
//
|
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
|
2008-08-10 20:48:55 +00:00
|
|
|
DEFINE_ACTION_FUNCTION(AActor, A_MntrFloorFire)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
2010-02-12 06:04:57 +00:00
|
|
|
PARAM_ACTION_PROLOGUE;
|
|
|
|
|
2006-02-24 04:48:15 +00:00
|
|
|
AActor *mo;
|
|
|
|
fixed_t x, y;
|
|
|
|
|
2008-08-10 20:48:55 +00:00
|
|
|
self->z = self->floorz;
|
|
|
|
x = self->x + (pr_fire.Random2 () << 10);
|
|
|
|
y = self->y + (pr_fire.Random2 () << 10);
|
2009-01-03 18:09:33 +00:00
|
|
|
mo = Spawn("MinotaurFX3", x, y, self->floorz, ALLOW_REPLACE);
|
2008-08-10 20:48:55 +00:00
|
|
|
mo->target = self->target;
|
2009-06-30 20:57:51 +00:00
|
|
|
mo->velx = 1; // Force block checking
|
2013-03-21 03:06:04 +00:00
|
|
|
P_CheckMissileSpawn (mo, self->radius);
|
2010-02-12 06:04:57 +00:00
|
|
|
return 0;
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
// FUNC P_MinotaurSlam
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
|
|
|
void P_MinotaurSlam (AActor *source, AActor *target)
|
|
|
|
{
|
|
|
|
angle_t angle;
|
|
|
|
fixed_t thrust;
|
|
|
|
int damage;
|
|
|
|
|
|
|
|
angle = R_PointToAngle2 (source->x, source->y, target->x, target->y);
|
|
|
|
angle >>= ANGLETOFINESHIFT;
|
|
|
|
thrust = 16*FRACUNIT+(pr_minotaurslam()<<10);
|
2009-06-30 20:57:51 +00:00
|
|
|
target->velx += FixedMul (thrust, finecosine[angle]);
|
|
|
|
target->vely += FixedMul (thrust, finesine[angle]);
|
2006-02-24 04:48:15 +00:00
|
|
|
damage = pr_minotaurslam.HitDice (static_cast<AMinotaur *>(source) ? 4 : 6);
|
2013-01-02 04:39:59 +00:00
|
|
|
int newdam = P_DamageMobj (target, NULL, NULL, damage, NAME_Melee);
|
|
|
|
P_TraceBleed (newdam > 0 ? newdam : damage, target, angle, 0);
|
2006-02-24 04:48:15 +00:00
|
|
|
if (target->player)
|
|
|
|
{
|
|
|
|
target->reactiontime = 14+(pr_minotaurslam()&7);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
// Minotaur variables
|
|
|
|
//
|
|
|
|
// special1 charge duration countdown
|
|
|
|
// special2 internal to minotaur AI
|
|
|
|
// StartTime minotaur start time
|
|
|
|
// tracer pointer to player that spawned it
|
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
// A_MinotaurRoam
|
|
|
|
//
|
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
|
2008-08-10 20:48:55 +00:00
|
|
|
DEFINE_ACTION_FUNCTION(AActor, A_MinotaurRoam)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
2010-02-12 06:04:57 +00:00
|
|
|
PARAM_ACTION_PROLOGUE;
|
|
|
|
|
2006-02-24 04:48:15 +00:00
|
|
|
// In case pain caused him to skip his fade in.
|
2009-08-12 18:57:31 +00:00
|
|
|
self->RenderStyle = STYLE_Normal;
|
2006-02-24 04:48:15 +00:00
|
|
|
|
2009-08-12 18:57:31 +00:00
|
|
|
if (self->IsKindOf(RUNTIME_CLASS(AMinotaurFriend)))
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
2009-08-12 18:57:31 +00:00
|
|
|
AMinotaurFriend *self1 = static_cast<AMinotaurFriend *> (self);
|
|
|
|
|
|
|
|
if (self1->StartTime >= 0 && (level.maptime - self1->StartTime) >= MAULATORTICS)
|
|
|
|
{
|
|
|
|
P_DamageMobj (self1, NULL, NULL, TELEFRAG_DAMAGE, NAME_None);
|
2010-02-12 06:04:57 +00:00
|
|
|
return 0;
|
2009-08-12 18:57:31 +00:00
|
|
|
}
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (pr_minotaurroam() < 30)
|
2009-08-12 18:57:31 +00:00
|
|
|
CALL_ACTION(A_MinotaurLook, self); // adjust to closest target
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
if (pr_minotaurroam() < 6)
|
|
|
|
{
|
|
|
|
//Choose new direction
|
2009-08-12 18:57:31 +00:00
|
|
|
self->movedir = pr_minotaurroam() % 8;
|
|
|
|
FaceMovementDirection (self);
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
2009-08-12 18:57:31 +00:00
|
|
|
if (!P_Move(self))
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
|
|
|
// Turn
|
|
|
|
if (pr_minotaurroam() & 1)
|
2010-09-01 03:30:18 +00:00
|
|
|
self->movedir = (self->movedir + 1) % 8;
|
2006-02-24 04:48:15 +00:00
|
|
|
else
|
2010-09-01 03:30:18 +00:00
|
|
|
self->movedir = (self->movedir + 7) % 8;
|
2009-08-12 18:57:31 +00:00
|
|
|
FaceMovementDirection (self);
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
2010-02-12 06:04:57 +00:00
|
|
|
return 0;
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
// PROC A_MinotaurLook
|
|
|
|
//
|
|
|
|
// Look for enemy of player
|
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
#define MINOTAUR_LOOK_DIST (16*54*FRACUNIT)
|
|
|
|
|
2008-08-10 20:48:55 +00:00
|
|
|
DEFINE_ACTION_FUNCTION(AActor, A_MinotaurLook)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
2010-02-12 06:04:57 +00:00
|
|
|
PARAM_ACTION_PROLOGUE;
|
|
|
|
|
2008-08-10 20:48:55 +00:00
|
|
|
if (!self->IsKindOf(RUNTIME_CLASS(AMinotaurFriend)))
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
2008-08-10 22:48:37 +00:00
|
|
|
CALL_ACTION(A_Look, self);
|
2010-02-12 06:04:57 +00:00
|
|
|
return 0;
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
AActor *mo = NULL;
|
|
|
|
player_t *player;
|
|
|
|
fixed_t dist;
|
|
|
|
int i;
|
2008-08-10 20:48:55 +00:00
|
|
|
AActor *master = self->tracer;
|
2006-02-24 04:48:15 +00:00
|
|
|
|
2008-08-10 20:48:55 +00:00
|
|
|
self->target = NULL;
|
2006-02-24 04:48:15 +00:00
|
|
|
if (deathmatch) // Quick search for players
|
|
|
|
{
|
|
|
|
for (i = 0; i < MAXPLAYERS; i++)
|
|
|
|
{
|
|
|
|
if (!playeringame[i]) continue;
|
|
|
|
player = &players[i];
|
|
|
|
mo = player->mo;
|
|
|
|
if (mo == master) continue;
|
|
|
|
if (mo->health <= 0) continue;
|
2008-08-10 20:48:55 +00:00
|
|
|
dist = P_AproxDistance(self->x - mo->x, self->y - mo->y);
|
2006-02-24 04:48:15 +00:00
|
|
|
if (dist > MINOTAUR_LOOK_DIST) continue;
|
2008-08-10 20:48:55 +00:00
|
|
|
self->target = mo;
|
2006-02-24 04:48:15 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-08-10 20:48:55 +00:00
|
|
|
if (!self->target) // Near player monster search
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
|
|
|
if (master && (master->health>0) && (master->player))
|
|
|
|
mo = P_RoughMonsterSearch(master, 20);
|
|
|
|
else
|
2008-08-10 20:48:55 +00:00
|
|
|
mo = P_RoughMonsterSearch(self, 20);
|
|
|
|
self->target = mo;
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
|
2008-08-10 20:48:55 +00:00
|
|
|
if (!self->target) // Normal monster search
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
|
|
|
FActorIterator iterator (0);
|
|
|
|
|
|
|
|
while ((mo = iterator.Next()) != NULL)
|
|
|
|
{
|
2008-11-14 23:12:15 +00:00
|
|
|
if (!(mo->flags3 & MF3_ISMONSTER)) continue;
|
2006-02-24 04:48:15 +00:00
|
|
|
if (mo->health <= 0) continue;
|
2008-11-14 23:12:15 +00:00
|
|
|
if (!(mo->flags & MF_SHOOTABLE)) continue;
|
2008-08-10 20:48:55 +00:00
|
|
|
dist = P_AproxDistance (self->x - mo->x, self->y - mo->y);
|
2006-02-24 04:48:15 +00:00
|
|
|
if (dist > MINOTAUR_LOOK_DIST) continue;
|
2008-08-10 20:48:55 +00:00
|
|
|
if ((mo == master) || (mo == self)) continue;
|
2008-08-06 19:25:59 +00:00
|
|
|
if ((mo->flags5 & MF5_SUMMONEDMONSTER) && (mo->tracer == master)) continue;
|
2008-08-10 20:48:55 +00:00
|
|
|
self->target = mo;
|
2008-08-11 10:02:24 +00:00
|
|
|
break; // Found actor to attack
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-08-10 20:48:55 +00:00
|
|
|
if (self->target)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
2010-04-19 02:46:50 +00:00
|
|
|
self->SetState (self->SeeState, true);
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2010-04-19 02:46:50 +00:00
|
|
|
self->SetState (self->FindState ("Roam"), true);
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
2010-02-12 06:04:57 +00:00
|
|
|
return 0;
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
|
2008-08-10 20:48:55 +00:00
|
|
|
DEFINE_ACTION_FUNCTION(AActor, A_MinotaurChase)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
2010-02-12 06:04:57 +00:00
|
|
|
PARAM_ACTION_PROLOGUE;
|
|
|
|
|
2008-08-10 20:48:55 +00:00
|
|
|
if (!self->IsKindOf(RUNTIME_CLASS(AMinotaurFriend)))
|
2006-04-23 20:12:27 +00:00
|
|
|
{
|
2010-02-12 06:04:57 +00:00
|
|
|
A_Chase (stack, self);
|
|
|
|
return 0;
|
2006-04-23 20:12:27 +00:00
|
|
|
}
|
|
|
|
|
2008-08-10 20:48:55 +00:00
|
|
|
AMinotaurFriend *self1 = static_cast<AMinotaurFriend *> (self);
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
// In case pain caused him to skip his fade in.
|
2008-08-10 20:48:55 +00:00
|
|
|
self1->RenderStyle = STYLE_Normal;
|
2006-02-24 04:48:15 +00:00
|
|
|
|
2008-08-10 20:48:55 +00:00
|
|
|
if (self1->StartTime >= 0 && (level.maptime - self1->StartTime) >= MAULATORTICS)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
2009-08-07 03:57:03 +00:00
|
|
|
P_DamageMobj (self1, NULL, NULL, TELEFRAG_DAMAGE, NAME_None);
|
2010-02-12 06:04:57 +00:00
|
|
|
return 0;
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (pr_minotaurchase() < 30)
|
2008-08-10 22:48:37 +00:00
|
|
|
CALL_ACTION(A_MinotaurLook, self1); // adjust to closest target
|
2006-02-24 04:48:15 +00:00
|
|
|
|
2008-08-10 20:48:55 +00:00
|
|
|
if (!self1->target || (self1->target->health <= 0) ||
|
|
|
|
!(self1->target->flags&MF_SHOOTABLE))
|
2006-02-24 04:48:15 +00:00
|
|
|
{ // look for a new target
|
2013-04-28 02:04:53 +00:00
|
|
|
self1->SetIdle();
|
2010-02-12 06:04:57 +00:00
|
|
|
return 0;
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
|
2008-08-10 20:48:55 +00:00
|
|
|
FaceMovementDirection (self1);
|
|
|
|
self1->reactiontime = 0;
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
// Melee attack
|
2008-08-10 20:48:55 +00:00
|
|
|
if (self1->MeleeState && self1->CheckMeleeRange ())
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
2008-08-10 20:48:55 +00:00
|
|
|
if (self1->AttackSound)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
2008-08-10 20:48:55 +00:00
|
|
|
S_Sound (self1, CHAN_WEAPON, self1->AttackSound, 1, ATTN_NORM);
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
2008-08-10 20:48:55 +00:00
|
|
|
self1->SetState (self1->MeleeState);
|
2010-02-12 06:04:57 +00:00
|
|
|
return 0;
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Missile attack
|
2008-08-10 20:48:55 +00:00
|
|
|
if (self1->MissileState && P_CheckMissileRange(self1))
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
2008-08-10 20:48:55 +00:00
|
|
|
self1->SetState (self1->MissileState);
|
2010-02-12 06:04:57 +00:00
|
|
|
return 0;
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// chase towards target
|
2008-08-10 20:48:55 +00:00
|
|
|
if (!P_Move (self1))
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
2008-08-10 20:48:55 +00:00
|
|
|
P_NewChaseDir (self1);
|
|
|
|
FaceMovementDirection (self1);
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Active sound
|
|
|
|
if (pr_minotaurchase() < 6)
|
|
|
|
{
|
2008-08-10 20:48:55 +00:00
|
|
|
self1->PlayActiveSound ();
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
2010-02-12 06:04:57 +00:00
|
|
|
return 0;
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
|