2006-02-24 04:48:15 +00:00
|
|
|
#include "actor.h"
|
|
|
|
#include "gi.h"
|
|
|
|
#include "m_random.h"
|
|
|
|
#include "s_sound.h"
|
|
|
|
#include "d_player.h"
|
|
|
|
#include "a_action.h"
|
|
|
|
#include "p_local.h"
|
|
|
|
#include "p_enemy.h"
|
|
|
|
#include "p_pspr.h"
|
|
|
|
#include "gstrings.h"
|
|
|
|
#include "a_hexenglobal.h"
|
|
|
|
|
|
|
|
static FRandom pr_quietusdrop ("QuietusDrop");
|
|
|
|
static FRandom pr_fswordflame ("FSwordFlame");
|
|
|
|
|
|
|
|
void A_FSwordAttack (AActor *actor);
|
|
|
|
void A_DropQuietusPieces (AActor *);
|
|
|
|
void A_FSwordFlames (AActor *);
|
|
|
|
|
2006-06-17 20:29:41 +00:00
|
|
|
//==========================================================================
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
class AFighterWeaponPiece : public AFourthWeaponPiece
|
|
|
|
{
|
|
|
|
DECLARE_STATELESS_ACTOR (AFighterWeaponPiece, AFourthWeaponPiece)
|
|
|
|
public:
|
|
|
|
void BeginPlay ();
|
|
|
|
protected:
|
|
|
|
bool MatchPlayerClass (AActor *toucher);
|
|
|
|
};
|
|
|
|
|
2008-08-08 07:40:41 +00:00
|
|
|
IMPLEMENT_CLASS (AFighterWeaponPiece)
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
bool AFighterWeaponPiece::MatchPlayerClass (AActor *toucher)
|
|
|
|
{
|
2006-11-07 10:20:09 +00:00
|
|
|
return !toucher->IsKindOf (PClass::FindClass(NAME_ClericPlayer)) &&
|
|
|
|
!toucher->IsKindOf (PClass::FindClass(NAME_MagePlayer));
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
|
2006-06-17 20:29:41 +00:00
|
|
|
//==========================================================================
|
|
|
|
|
2006-02-24 04:48:15 +00:00
|
|
|
class AFWeaponPiece1 : public AFighterWeaponPiece
|
|
|
|
{
|
2008-08-08 07:40:41 +00:00
|
|
|
DECLARE_CLASS (AFWeaponPiece1, AFighterWeaponPiece)
|
2006-02-24 04:48:15 +00:00
|
|
|
public:
|
|
|
|
void BeginPlay ();
|
|
|
|
};
|
|
|
|
|
2008-08-08 07:40:41 +00:00
|
|
|
IMPLEMENT_CLASS (AFWeaponPiece1)
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
void AFWeaponPiece1::BeginPlay ()
|
|
|
|
{
|
|
|
|
Super::BeginPlay ();
|
|
|
|
PieceValue = WPIECE1;
|
|
|
|
}
|
|
|
|
|
2006-06-17 20:29:41 +00:00
|
|
|
//==========================================================================
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
class AFWeaponPiece2 : public AFighterWeaponPiece
|
|
|
|
{
|
2008-08-08 07:40:41 +00:00
|
|
|
DECLARE_CLASS (AFWeaponPiece2, AFighterWeaponPiece)
|
2006-02-24 04:48:15 +00:00
|
|
|
public:
|
|
|
|
void BeginPlay ();
|
|
|
|
};
|
|
|
|
|
2008-08-08 07:40:41 +00:00
|
|
|
IMPLEMENT_CLASS (AFWeaponPiece2)
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
void AFWeaponPiece2::BeginPlay ()
|
|
|
|
{
|
|
|
|
Super::BeginPlay ();
|
|
|
|
PieceValue = WPIECE2;
|
|
|
|
}
|
|
|
|
|
2006-06-17 20:29:41 +00:00
|
|
|
//==========================================================================
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
class AFWeaponPiece3 : public AFighterWeaponPiece
|
|
|
|
{
|
2008-08-08 07:40:41 +00:00
|
|
|
DECLARE_CLASS (AFWeaponPiece3, AFighterWeaponPiece)
|
2006-02-24 04:48:15 +00:00
|
|
|
public:
|
|
|
|
void BeginPlay ();
|
|
|
|
};
|
|
|
|
|
2008-08-08 07:40:41 +00:00
|
|
|
IMPLEMENT_CLASS (AFWeaponPiece3)
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
void AFWeaponPiece3::BeginPlay ()
|
|
|
|
{
|
|
|
|
Super::BeginPlay ();
|
|
|
|
PieceValue = WPIECE3;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Fighter Sword Missile ----------------------------------------------------
|
|
|
|
|
|
|
|
class AFSwordMissile : public AActor
|
|
|
|
{
|
2008-08-08 07:40:41 +00:00
|
|
|
DECLARE_CLASS (AFSwordMissile, AActor)
|
2006-02-24 04:48:15 +00:00
|
|
|
public:
|
2007-10-29 20:27:40 +00:00
|
|
|
int DoSpecialDamage(AActor *victim, AActor *source, int damage);
|
2006-02-24 04:48:15 +00:00
|
|
|
};
|
|
|
|
|
2008-08-08 07:40:41 +00:00
|
|
|
IMPLEMENT_CLASS (AFSwordMissile)
|
2006-02-24 04:48:15 +00:00
|
|
|
|
2007-10-29 20:27:40 +00:00
|
|
|
int AFSwordMissile::DoSpecialDamage(AActor *victim, AActor *source, int damage)
|
|
|
|
{
|
|
|
|
if (victim->player)
|
|
|
|
{
|
|
|
|
damage -= damage >> 2;
|
|
|
|
}
|
|
|
|
return damage;
|
|
|
|
}
|
|
|
|
|
2006-06-17 20:29:41 +00:00
|
|
|
//============================================================================
|
|
|
|
//
|
|
|
|
// A_FSwordAttack
|
|
|
|
//
|
|
|
|
//============================================================================
|
|
|
|
|
|
|
|
void A_FSwordAttack (AActor *actor)
|
|
|
|
{
|
2006-02-24 04:48:15 +00:00
|
|
|
player_t *player;
|
|
|
|
|
|
|
|
if (NULL == (player = actor->player))
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
AWeapon *weapon = actor->player->ReadyWeapon;
|
|
|
|
if (weapon != NULL)
|
|
|
|
{
|
|
|
|
if (!weapon->DepleteAmmo (weapon->bAltFire))
|
|
|
|
return;
|
|
|
|
}
|
2007-03-07 17:31:40 +00:00
|
|
|
P_SpawnPlayerMissile (actor, 0, 0, -10*FRACUNIT, RUNTIME_CLASS(AFSwordMissile), actor->angle+ANGLE_45/4);
|
|
|
|
P_SpawnPlayerMissile (actor, 0, 0, -5*FRACUNIT, RUNTIME_CLASS(AFSwordMissile), actor->angle+ANGLE_45/8);
|
|
|
|
P_SpawnPlayerMissile (actor, 0, 0, 0, RUNTIME_CLASS(AFSwordMissile), actor->angle);
|
|
|
|
P_SpawnPlayerMissile (actor, 0, 0, 5*FRACUNIT, RUNTIME_CLASS(AFSwordMissile), actor->angle-ANGLE_45/8);
|
|
|
|
P_SpawnPlayerMissile (actor, 0, 0, 10*FRACUNIT, RUNTIME_CLASS(AFSwordMissile), actor->angle-ANGLE_45/4);
|
2006-06-17 20:29:41 +00:00
|
|
|
S_Sound (actor, CHAN_WEAPON, "FighterSwordFire", 1, ATTN_NORM);
|
|
|
|
}
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
//============================================================================
|
|
|
|
//
|
|
|
|
// A_FSwordFlames
|
|
|
|
//
|
|
|
|
//============================================================================
|
|
|
|
|
|
|
|
void A_FSwordFlames (AActor *actor)
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
|
|
|
|
for (i = 1+(pr_fswordflame()&3); i; i--)
|
|
|
|
{
|
|
|
|
fixed_t x = actor->x+((pr_fswordflame()-128)<<12);
|
|
|
|
fixed_t y = actor->y+((pr_fswordflame()-128)<<12);
|
|
|
|
fixed_t z = actor->z+((pr_fswordflame()-128)<<11);
|
2008-08-08 07:40:41 +00:00
|
|
|
Spawn ("FSwordFlame", x, y, z, ALLOW_REPLACE);
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//============================================================================
|
|
|
|
//
|
|
|
|
// A_DropQuietusPieces
|
|
|
|
//
|
|
|
|
//============================================================================
|
|
|
|
|
|
|
|
void A_DropQuietusPieces (AActor *actor)
|
|
|
|
{
|
2006-05-10 02:40:43 +00:00
|
|
|
static const PClass *pieces[3] =
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
|
|
|
RUNTIME_CLASS(AFWeaponPiece1),
|
|
|
|
RUNTIME_CLASS(AFWeaponPiece2),
|
|
|
|
RUNTIME_CLASS(AFWeaponPiece3)
|
|
|
|
};
|
|
|
|
|
|
|
|
for (int i = 0, j = 0, fineang = 0; i < 3; ++i)
|
|
|
|
{
|
2006-07-16 09:10:45 +00:00
|
|
|
AActor *piece = Spawn (pieces[j], actor->x, actor->y, actor->z, ALLOW_REPLACE);
|
2006-02-24 04:48:15 +00:00
|
|
|
if (piece != NULL)
|
|
|
|
{
|
|
|
|
piece->momx = actor->momx + finecosine[fineang];
|
|
|
|
piece->momy = actor->momy + finesine[fineang];
|
|
|
|
piece->momz = actor->momz;
|
|
|
|
piece->flags |= MF_DROPPED;
|
|
|
|
fineang += FINEANGLES/3;
|
|
|
|
j = (j == 0) ? (pr_quietusdrop() & 1) + 1 : 3-j;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void AFighterWeaponPiece::BeginPlay ()
|
|
|
|
{
|
|
|
|
Super::BeginPlay ();
|
2008-08-08 07:40:41 +00:00
|
|
|
FourthWeaponClass = PClass::FindClass ("FWeapQuietus");
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
2008-08-03 16:13:23 +00:00
|
|
|
|
|
|
|
//============================================================================
|
|
|
|
//
|
|
|
|
// A_FighterAttack
|
|
|
|
//
|
|
|
|
//============================================================================
|
|
|
|
|
|
|
|
void A_FighterAttack (AActor *actor)
|
|
|
|
{
|
|
|
|
if (!actor->target) return;
|
|
|
|
|
|
|
|
angle_t angle = actor->angle;
|
|
|
|
|
|
|
|
P_SpawnMissileAngle (actor, RUNTIME_CLASS(AFSwordMissile), angle+ANG45/4, 0);
|
|
|
|
P_SpawnMissileAngle (actor, RUNTIME_CLASS(AFSwordMissile), angle+ANG45/8, 0);
|
|
|
|
P_SpawnMissileAngle (actor, RUNTIME_CLASS(AFSwordMissile), angle, 0);
|
|
|
|
P_SpawnMissileAngle (actor, RUNTIME_CLASS(AFSwordMissile), angle-ANG45/8, 0);
|
|
|
|
P_SpawnMissileAngle (actor, RUNTIME_CLASS(AFSwordMissile), angle-ANG45/4, 0);
|
|
|
|
S_Sound (actor, CHAN_WEAPON, "FighterSwordFire", 1, ATTN_NORM);
|
|
|
|
}
|
|
|
|
|