2008-09-15 14:11:05 +00:00
|
|
|
/*
|
2006-02-24 04:48:15 +00:00
|
|
|
#include "templates.h"
|
|
|
|
#include "actor.h"
|
|
|
|
#include "info.h"
|
|
|
|
#include "s_sound.h"
|
|
|
|
#include "m_random.h"
|
|
|
|
#include "a_pickups.h"
|
|
|
|
#include "d_player.h"
|
|
|
|
#include "p_pspr.h"
|
|
|
|
#include "p_local.h"
|
|
|
|
#include "gstrings.h"
|
|
|
|
#include "gi.h"
|
2011-07-06 08:50:15 +00:00
|
|
|
#include "r_data/r_translate.h"
|
2008-07-21 18:01:06 +00:00
|
|
|
#include "thingdef/thingdef.h"
|
2008-09-14 23:54:38 +00:00
|
|
|
#include "doomstat.h"
|
2008-09-15 14:11:05 +00:00
|
|
|
*/
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
static FRandom pr_sap ("StaffAtkPL1");
|
|
|
|
static FRandom pr_sap2 ("StaffAtkPL2");
|
|
|
|
static FRandom pr_fgw ("FireWandPL1");
|
|
|
|
static FRandom pr_fgw2 ("FireWandPL2");
|
|
|
|
static FRandom pr_boltspark ("BoltSpark");
|
|
|
|
static FRandom pr_macerespawn ("MaceRespawn");
|
|
|
|
static FRandom pr_maceatk ("FireMacePL1");
|
|
|
|
static FRandom pr_gatk ("GauntletAttack");
|
|
|
|
static FRandom pr_bfx1 ("BlasterFX1");
|
|
|
|
static FRandom pr_ripd ("RipperD");
|
|
|
|
static FRandom pr_fb1 ("FireBlasterPL1");
|
|
|
|
static FRandom pr_bfx1t ("BlasterFX1Tick");
|
|
|
|
static FRandom pr_hrfx2 ("HornRodFX2");
|
|
|
|
static FRandom pr_rp ("RainPillar");
|
|
|
|
static FRandom pr_fsr1 ("FireSkullRodPL1");
|
|
|
|
static FRandom pr_storm ("SkullRodStorm");
|
|
|
|
static FRandom pr_impact ("RainImpact");
|
|
|
|
static FRandom pr_pfx1 ("PhoenixFX1");
|
|
|
|
static FRandom pr_pfx2 ("PhoenixFX2");
|
|
|
|
static FRandom pr_fp2 ("FirePhoenixPL2");
|
|
|
|
|
|
|
|
#define FLAME_THROWER_TICS (10*TICRATE)
|
|
|
|
|
2008-08-04 22:30:45 +00:00
|
|
|
void P_DSparilTeleport (AActor *actor);
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
#define USE_BLSR_AMMO_1 1
|
|
|
|
#define USE_BLSR_AMMO_2 5
|
|
|
|
#define USE_SKRD_AMMO_1 1
|
|
|
|
#define USE_SKRD_AMMO_2 5
|
|
|
|
#define USE_PHRD_AMMO_1 1
|
|
|
|
#define USE_PHRD_AMMO_2 1
|
|
|
|
#define USE_MACE_AMMO_1 1
|
|
|
|
#define USE_MACE_AMMO_2 5
|
|
|
|
|
|
|
|
extern bool P_AutoUseChaosDevice (player_t *player);
|
|
|
|
|
|
|
|
// --- Staff ----------------------------------------------------------------
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
// PROC A_StaffAttackPL1
|
|
|
|
//
|
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
|
2008-08-12 14:30:07 +00:00
|
|
|
DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_StaffAttack)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
|
|
|
angle_t angle;
|
|
|
|
int slope;
|
|
|
|
player_t *player;
|
2008-04-10 14:38:43 +00:00
|
|
|
AActor *linetarget;
|
2006-02-24 04:48:15 +00:00
|
|
|
|
2008-08-10 20:48:55 +00:00
|
|
|
if (NULL == (player = self->player))
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2008-08-13 22:54:24 +00:00
|
|
|
ACTION_PARAM_START(2);
|
|
|
|
ACTION_PARAM_INT(damage, 0);
|
|
|
|
ACTION_PARAM_CLASS(puff, 1);
|
2006-02-24 04:48:15 +00:00
|
|
|
|
2008-04-14 12:10:45 +00:00
|
|
|
AWeapon *weapon = player->ReadyWeapon;
|
2006-02-24 04:48:15 +00:00
|
|
|
if (weapon != NULL)
|
|
|
|
{
|
|
|
|
if (!weapon->DepleteAmmo (weapon->bAltFire))
|
|
|
|
return;
|
|
|
|
}
|
2008-10-25 17:38:00 +00:00
|
|
|
if (puff == NULL) puff = PClass::FindClass(NAME_BulletPuff); // just to be sure
|
2008-08-10 20:48:55 +00:00
|
|
|
angle = self->angle;
|
2008-07-21 18:01:06 +00:00
|
|
|
angle += pr_sap.Random2() << 18;
|
2008-08-10 20:48:55 +00:00
|
|
|
slope = P_AimLineAttack (self, angle, MELEERANGE, &linetarget);
|
2010-06-13 11:14:01 +00:00
|
|
|
P_LineAttack (self, angle, MELEERANGE, slope, damage, NAME_Melee, puff, true, &linetarget);
|
2006-02-24 04:48:15 +00:00
|
|
|
if (linetarget)
|
|
|
|
{
|
2008-07-21 18:01:06 +00:00
|
|
|
//S_StartSound(player->mo, sfx_stfhit);
|
2006-02-24 04:48:15 +00:00
|
|
|
// turn to face target
|
2008-08-10 20:48:55 +00:00
|
|
|
self->angle = R_PointToAngle2 (self->x,
|
|
|
|
self->y, linetarget->x, linetarget->y);
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
// PROC A_FireGoldWandPL1
|
|
|
|
//
|
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
|
2008-08-10 20:48:55 +00:00
|
|
|
DEFINE_ACTION_FUNCTION(AActor, A_FireGoldWandPL1)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
|
|
|
angle_t angle;
|
|
|
|
int damage;
|
|
|
|
player_t *player;
|
|
|
|
|
2008-08-10 20:48:55 +00:00
|
|
|
if (NULL == (player = self->player))
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2008-04-14 12:10:45 +00:00
|
|
|
AWeapon *weapon = player->ReadyWeapon;
|
2006-02-24 04:48:15 +00:00
|
|
|
if (weapon != NULL)
|
|
|
|
{
|
|
|
|
if (!weapon->DepleteAmmo (weapon->bAltFire))
|
|
|
|
return;
|
|
|
|
}
|
2008-08-10 20:48:55 +00:00
|
|
|
angle_t pitch = P_BulletSlope(self);
|
2006-02-24 04:48:15 +00:00
|
|
|
damage = 7+(pr_fgw()&7);
|
2008-08-10 20:48:55 +00:00
|
|
|
angle = self->angle;
|
2006-02-24 04:48:15 +00:00
|
|
|
if (player->refire)
|
|
|
|
{
|
|
|
|
angle += pr_fgw.Random2() << 18;
|
|
|
|
}
|
2012-06-17 03:18:26 +00:00
|
|
|
P_LineAttack (self, angle, PLAYERMISSILERANGE, pitch, damage, NAME_Hitscan, "GoldWandPuff1");
|
2008-08-10 20:48:55 +00:00
|
|
|
S_Sound (self, CHAN_WEAPON, "weapons/wandhit", 1, ATTN_NORM);
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
// PROC A_FireGoldWandPL2
|
|
|
|
//
|
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
|
2008-08-10 20:48:55 +00:00
|
|
|
DEFINE_ACTION_FUNCTION(AActor, A_FireGoldWandPL2)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
|
|
|
int i;
|
|
|
|
angle_t angle;
|
|
|
|
int damage;
|
2009-06-30 20:57:51 +00:00
|
|
|
fixed_t velz;
|
2006-02-24 04:48:15 +00:00
|
|
|
player_t *player;
|
|
|
|
|
2008-08-10 20:48:55 +00:00
|
|
|
if (NULL == (player = self->player))
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2008-04-14 12:10:45 +00:00
|
|
|
AWeapon *weapon = player->ReadyWeapon;
|
2006-02-24 04:48:15 +00:00
|
|
|
if (weapon != NULL)
|
|
|
|
{
|
|
|
|
if (!weapon->DepleteAmmo (weapon->bAltFire))
|
|
|
|
return;
|
|
|
|
}
|
2008-08-10 20:48:55 +00:00
|
|
|
angle_t pitch = P_BulletSlope(self);
|
2009-06-30 20:57:51 +00:00
|
|
|
velz = FixedMul (GetDefaultByName("GoldWandFX2")->Speed,
|
2008-04-10 14:38:43 +00:00
|
|
|
finetangent[FINEANGLES/4-((signed)pitch>>ANGLETOFINESHIFT)]);
|
2009-06-30 20:57:51 +00:00
|
|
|
P_SpawnMissileAngle (self, PClass::FindClass("GoldWandFX2"), self->angle-(ANG45/8), velz);
|
|
|
|
P_SpawnMissileAngle (self, PClass::FindClass("GoldWandFX2"), self->angle+(ANG45/8), velz);
|
2008-08-10 20:48:55 +00:00
|
|
|
angle = self->angle-(ANG45/8);
|
2006-02-24 04:48:15 +00:00
|
|
|
for(i = 0; i < 5; i++)
|
|
|
|
{
|
|
|
|
damage = 1+(pr_fgw2()&7);
|
2012-06-17 03:18:26 +00:00
|
|
|
P_LineAttack (self, angle, PLAYERMISSILERANGE, pitch, damage, NAME_Hitscan, "GoldWandPuff2");
|
2006-02-24 04:48:15 +00:00
|
|
|
angle += ((ANG45/8)*2)/4;
|
|
|
|
}
|
2008-08-10 20:48:55 +00:00
|
|
|
S_Sound (self, CHAN_WEAPON, "weapons/wandhit", 1, ATTN_NORM);
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
// PROC A_FireCrossbowPL1
|
|
|
|
//
|
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
|
2008-08-10 20:48:55 +00:00
|
|
|
DEFINE_ACTION_FUNCTION(AActor, A_FireCrossbowPL1)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
|
|
|
player_t *player;
|
|
|
|
|
2008-08-10 20:48:55 +00:00
|
|
|
if (NULL == (player = self->player))
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2008-04-14 12:10:45 +00:00
|
|
|
AWeapon *weapon = player->ReadyWeapon;
|
2006-02-24 04:48:15 +00:00
|
|
|
if (weapon != NULL)
|
|
|
|
{
|
|
|
|
if (!weapon->DepleteAmmo (weapon->bAltFire))
|
|
|
|
return;
|
|
|
|
}
|
2008-08-10 20:48:55 +00:00
|
|
|
P_SpawnPlayerMissile (self, PClass::FindClass("CrossbowFX1"));
|
|
|
|
P_SpawnPlayerMissile (self, PClass::FindClass("CrossbowFX3"), self->angle-(ANG45/10));
|
|
|
|
P_SpawnPlayerMissile (self, PClass::FindClass("CrossbowFX3"), self->angle+(ANG45/10));
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
// PROC A_FireCrossbowPL2
|
|
|
|
//
|
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
|
2008-08-10 20:48:55 +00:00
|
|
|
DEFINE_ACTION_FUNCTION(AActor, A_FireCrossbowPL2)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
|
|
|
player_t *player;
|
|
|
|
|
2008-08-10 20:48:55 +00:00
|
|
|
if (NULL == (player = self->player))
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2008-08-10 20:48:55 +00:00
|
|
|
AWeapon *weapon = self->player->ReadyWeapon;
|
2006-02-24 04:48:15 +00:00
|
|
|
if (weapon != NULL)
|
|
|
|
{
|
|
|
|
if (!weapon->DepleteAmmo (weapon->bAltFire))
|
|
|
|
return;
|
|
|
|
}
|
2008-08-10 20:48:55 +00:00
|
|
|
P_SpawnPlayerMissile (self, PClass::FindClass("CrossbowFX2"));
|
|
|
|
P_SpawnPlayerMissile (self, PClass::FindClass("CrossbowFX2"), self->angle-(ANG45/10));
|
|
|
|
P_SpawnPlayerMissile (self, PClass::FindClass("CrossbowFX2"), self->angle+(ANG45/10));
|
|
|
|
P_SpawnPlayerMissile (self, PClass::FindClass("CrossbowFX3"), self->angle-(ANG45/5));
|
|
|
|
P_SpawnPlayerMissile (self, PClass::FindClass("CrossbowFX3"), self->angle+(ANG45/5));
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
|
2008-07-21 18:01:06 +00:00
|
|
|
//---------------------------------------------------------------------------
|
2006-02-24 04:48:15 +00:00
|
|
|
//
|
2008-07-21 18:01:06 +00:00
|
|
|
// PROC A_GauntletAttack
|
2006-02-24 04:48:15 +00:00
|
|
|
//
|
2008-07-21 18:01:06 +00:00
|
|
|
//---------------------------------------------------------------------------
|
2006-02-24 04:48:15 +00:00
|
|
|
|
2008-08-12 14:30:07 +00:00
|
|
|
DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_GauntletAttack)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
2008-07-21 18:01:06 +00:00
|
|
|
angle_t angle;
|
|
|
|
int damage;
|
|
|
|
int slope;
|
|
|
|
int randVal;
|
|
|
|
fixed_t dist;
|
|
|
|
player_t *player;
|
|
|
|
const PClass *pufftype;
|
|
|
|
AActor *linetarget;
|
2013-06-24 14:42:43 +00:00
|
|
|
int actualdamage = 0;
|
2006-02-24 04:48:15 +00:00
|
|
|
|
2008-08-10 20:48:55 +00:00
|
|
|
if (NULL == (player = self->player))
|
2008-07-21 18:01:06 +00:00
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2008-08-13 22:54:24 +00:00
|
|
|
ACTION_PARAM_START(1);
|
|
|
|
ACTION_PARAM_INT(power, 0);
|
2008-07-21 18:01:06 +00:00
|
|
|
|
|
|
|
AWeapon *weapon = player->ReadyWeapon;
|
|
|
|
if (weapon != NULL)
|
|
|
|
{
|
|
|
|
if (!weapon->DepleteAmmo (weapon->bAltFire))
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
player->psprites[ps_weapon].sx = ((pr_gatk()&3)-2) * FRACUNIT;
|
|
|
|
player->psprites[ps_weapon].sy = WEAPONTOP + (pr_gatk()&3) * FRACUNIT;
|
2008-08-10 20:48:55 +00:00
|
|
|
angle = self->angle;
|
2008-07-21 18:01:06 +00:00
|
|
|
if (power)
|
|
|
|
{
|
|
|
|
damage = pr_gatk.HitDice (2);
|
|
|
|
dist = 4*MELEERANGE;
|
|
|
|
angle += pr_gatk.Random2() << 17;
|
|
|
|
pufftype = PClass::FindClass("GauntletPuff2");
|
|
|
|
}
|
|
|
|
else
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
2008-07-21 18:01:06 +00:00
|
|
|
damage = pr_gatk.HitDice (2);
|
|
|
|
dist = MELEERANGE+1;
|
|
|
|
angle += pr_gatk.Random2() << 18;
|
|
|
|
pufftype = PClass::FindClass("GauntletPuff1");
|
|
|
|
}
|
2008-08-10 20:48:55 +00:00
|
|
|
slope = P_AimLineAttack (self, angle, dist, &linetarget);
|
2013-06-24 14:42:43 +00:00
|
|
|
P_LineAttack (self, angle, dist, slope, damage, NAME_Melee, pufftype, false, &linetarget, &actualdamage);
|
2008-07-21 18:01:06 +00:00
|
|
|
if (!linetarget)
|
|
|
|
{
|
|
|
|
if (pr_gatk() > 64)
|
|
|
|
{
|
|
|
|
player->extralight = !player->extralight;
|
|
|
|
}
|
2008-08-10 20:48:55 +00:00
|
|
|
S_Sound (self, CHAN_AUTO, "weapons/gauntletson", 1, ATTN_NORM);
|
2008-07-21 18:01:06 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
randVal = pr_gatk();
|
|
|
|
if (randVal < 64)
|
|
|
|
{
|
|
|
|
player->extralight = 0;
|
|
|
|
}
|
|
|
|
else if (randVal < 160)
|
|
|
|
{
|
|
|
|
player->extralight = 1;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
player->extralight = 2;
|
|
|
|
}
|
|
|
|
if (power)
|
|
|
|
{
|
2013-06-24 14:42:43 +00:00
|
|
|
if (!(linetarget->flags5 & MF5_DONTDRAIN)) P_GiveBody (self, actualdamage>>1);
|
2008-08-10 20:48:55 +00:00
|
|
|
S_Sound (self, CHAN_AUTO, "weapons/gauntletspowhit", 1, ATTN_NORM);
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
2008-07-21 18:01:06 +00:00
|
|
|
else
|
|
|
|
{
|
2008-08-10 20:48:55 +00:00
|
|
|
S_Sound (self, CHAN_AUTO, "weapons/gauntletshit", 1, ATTN_NORM);
|
2008-07-21 18:01:06 +00:00
|
|
|
}
|
|
|
|
// turn to face target
|
2008-08-10 20:48:55 +00:00
|
|
|
angle = R_PointToAngle2 (self->x, self->y,
|
2008-07-21 18:01:06 +00:00
|
|
|
linetarget->x, linetarget->y);
|
2008-08-10 20:48:55 +00:00
|
|
|
if (angle-self->angle > ANG180)
|
2008-07-21 18:01:06 +00:00
|
|
|
{
|
2008-08-10 20:48:55 +00:00
|
|
|
if ((int)(angle-self->angle) < -ANG90/20)
|
|
|
|
self->angle = angle+ANG90/21;
|
2008-07-21 18:01:06 +00:00
|
|
|
else
|
2008-08-10 20:48:55 +00:00
|
|
|
self->angle -= ANG90/20;
|
2008-07-21 18:01:06 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2008-08-10 20:48:55 +00:00
|
|
|
if (angle-self->angle > ANG90/20)
|
|
|
|
self->angle = angle-ANG90/21;
|
2008-07-21 18:01:06 +00:00
|
|
|
else
|
2008-08-10 20:48:55 +00:00
|
|
|
self->angle += ANG90/20;
|
2008-07-21 18:01:06 +00:00
|
|
|
}
|
2008-08-10 20:48:55 +00:00
|
|
|
self->flags |= MF_JUSTATTACKED;
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// --- Mace -----------------------------------------------------------------
|
|
|
|
|
|
|
|
#define MAGIC_JUNK 1234
|
|
|
|
|
|
|
|
// Mace FX4 -----------------------------------------------------------------
|
|
|
|
|
|
|
|
class AMaceFX4 : public AActor
|
|
|
|
{
|
2008-08-03 19:10:48 +00:00
|
|
|
DECLARE_CLASS (AMaceFX4, AActor)
|
2006-02-24 04:48:15 +00:00
|
|
|
public:
|
2012-06-29 04:21:31 +00:00
|
|
|
int DoSpecialDamage (AActor *target, int damage, FName damagetype);
|
2006-02-24 04:48:15 +00:00
|
|
|
};
|
|
|
|
|
2008-08-03 19:10:48 +00:00
|
|
|
IMPLEMENT_CLASS (AMaceFX4)
|
2006-02-24 04:48:15 +00:00
|
|
|
|
2012-06-29 04:21:31 +00:00
|
|
|
int AMaceFX4::DoSpecialDamage (AActor *target, int damage, FName damagetype)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
|
|
|
if ((target->flags2 & MF2_BOSS) || (target->flags3 & MF3_DONTSQUASH) || target->IsTeammate (this->target))
|
|
|
|
{ // Don't allow cheap boss kills and don't instagib teammates
|
|
|
|
return damage;
|
|
|
|
}
|
|
|
|
else if (target->player)
|
|
|
|
{ // Player specific checks
|
|
|
|
if (target->player->mo->flags2 & MF2_INVULNERABLE)
|
|
|
|
{ // Can't hurt invulnerable players
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
if (P_AutoUseChaosDevice (target->player))
|
|
|
|
{ // Player was saved using chaos device
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
}
|
2009-08-07 03:57:03 +00:00
|
|
|
return TELEFRAG_DAMAGE; // Something's gonna die
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
// PROC A_FireMacePL1B
|
|
|
|
//
|
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
|
2008-08-10 20:48:55 +00:00
|
|
|
void FireMacePL1B (AActor *actor)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
|
|
|
AActor *ball;
|
|
|
|
angle_t angle;
|
|
|
|
player_t *player;
|
|
|
|
|
|
|
|
if (NULL == (player = actor->player))
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2008-04-14 12:10:45 +00:00
|
|
|
AWeapon *weapon = player->ReadyWeapon;
|
2006-02-24 04:48:15 +00:00
|
|
|
if (weapon != NULL)
|
|
|
|
{
|
|
|
|
if (!weapon->DepleteAmmo (weapon->bAltFire))
|
|
|
|
return;
|
|
|
|
}
|
2008-08-03 19:10:48 +00:00
|
|
|
ball = Spawn("MaceFX2", actor->x, actor->y, actor->z + 28*FRACUNIT
|
2008-04-14 12:10:45 +00:00
|
|
|
- actor->floorclip, ALLOW_REPLACE);
|
2009-06-30 20:57:51 +00:00
|
|
|
ball->velz = 2*FRACUNIT+/*((player->lookdir)<<(FRACBITS-5))*/
|
2008-04-14 12:10:45 +00:00
|
|
|
finetangent[FINEANGLES/4-(actor->pitch>>ANGLETOFINESHIFT)];
|
|
|
|
angle = actor->angle;
|
|
|
|
ball->target = actor;
|
2006-02-24 04:48:15 +00:00
|
|
|
ball->angle = angle;
|
2008-04-14 12:10:45 +00:00
|
|
|
ball->z += 2*finetangent[FINEANGLES/4-(actor->pitch>>ANGLETOFINESHIFT)];
|
2006-02-24 04:48:15 +00:00
|
|
|
angle >>= ANGLETOFINESHIFT;
|
2009-06-30 20:57:51 +00:00
|
|
|
ball->velx = (actor->velx>>1) + FixedMul(ball->Speed, finecosine[angle]);
|
|
|
|
ball->vely = (actor->vely>>1) + FixedMul(ball->Speed, finesine[angle]);
|
2006-02-24 04:48:15 +00:00
|
|
|
S_Sound (ball, CHAN_BODY, "weapons/maceshoot", 1, ATTN_NORM);
|
2013-03-21 03:06:04 +00:00
|
|
|
P_CheckMissileSpawn (ball, actor->radius);
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
// PROC A_FireMacePL1
|
|
|
|
//
|
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
|
2008-08-10 20:48:55 +00:00
|
|
|
DEFINE_ACTION_FUNCTION(AActor, A_FireMacePL1)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
|
|
|
AActor *ball;
|
|
|
|
player_t *player;
|
|
|
|
|
2008-08-10 20:48:55 +00:00
|
|
|
if (NULL == (player = self->player))
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (pr_maceatk() < 28)
|
|
|
|
{
|
2008-08-10 20:48:55 +00:00
|
|
|
FireMacePL1B (self);
|
2006-02-24 04:48:15 +00:00
|
|
|
return;
|
|
|
|
}
|
2008-04-14 12:10:45 +00:00
|
|
|
AWeapon *weapon = player->ReadyWeapon;
|
2006-02-24 04:48:15 +00:00
|
|
|
if (weapon != NULL)
|
|
|
|
{
|
|
|
|
if (!weapon->DepleteAmmo (weapon->bAltFire))
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
player->psprites[ps_weapon].sx = ((pr_maceatk()&3)-2)*FRACUNIT;
|
|
|
|
player->psprites[ps_weapon].sy = WEAPONTOP+(pr_maceatk()&3)*FRACUNIT;
|
2008-08-10 20:48:55 +00:00
|
|
|
ball = P_SpawnPlayerMissile (self, PClass::FindClass("MaceFX1"),
|
|
|
|
self->angle+(((pr_maceatk()&7)-4)<<24));
|
2006-02-24 04:48:15 +00:00
|
|
|
if (ball)
|
|
|
|
{
|
|
|
|
ball->special1 = 16; // tics till dropoff
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
// PROC A_MacePL1Check
|
|
|
|
//
|
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
|
2008-08-10 20:48:55 +00:00
|
|
|
DEFINE_ACTION_FUNCTION(AActor, A_MacePL1Check)
|
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
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
2008-08-10 20:48:55 +00:00
|
|
|
self->special1 -= 4;
|
|
|
|
if (self->special1 > 0)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
2008-08-10 20:48:55 +00:00
|
|
|
self->special1 = 0;
|
|
|
|
self->flags &= ~MF_NOGRAVITY;
|
|
|
|
self->gravity = FRACUNIT/8;
|
2009-06-30 20:57:51 +00:00
|
|
|
// [RH] Avoid some precision loss by scaling the velocity directly
|
2006-02-24 04:48:15 +00:00
|
|
|
#if 0
|
2009-06-30 20:57:51 +00:00
|
|
|
// This is the original code, for reference.
|
2008-08-10 20:48:55 +00:00
|
|
|
angle_t angle = self->angle>>ANGLETOFINESHIFT;
|
2009-06-30 20:57:51 +00:00
|
|
|
self->velx = FixedMul(7*FRACUNIT, finecosine[angle]);
|
|
|
|
self->vely = FixedMul(7*FRACUNIT, finesine[angle]);
|
2006-02-24 04:48:15 +00:00
|
|
|
#else
|
2010-11-07 14:39:09 +00:00
|
|
|
double velscale = sqrt ((double)self->velx * (double)self->velx +
|
|
|
|
(double)self->vely * (double)self->vely);
|
2009-06-30 20:57:51 +00:00
|
|
|
velscale = 458752 / velscale;
|
|
|
|
self->velx = (int)(self->velx * velscale);
|
|
|
|
self->vely = (int)(self->vely * velscale);
|
2006-02-24 04:48:15 +00:00
|
|
|
#endif
|
2009-06-30 20:57:51 +00:00
|
|
|
self->velz -= self->velz >> 1;
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
// PROC A_MaceBallImpact
|
|
|
|
//
|
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
|
2008-08-10 20:48:55 +00:00
|
|
|
DEFINE_ACTION_FUNCTION(AActor, A_MaceBallImpact)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
2008-08-10 20:48:55 +00:00
|
|
|
if ((self->health != MAGIC_JUNK) && (self->flags & MF_INBOUNCE))
|
2006-02-24 04:48:15 +00:00
|
|
|
{ // Bounce
|
2008-08-10 20:48:55 +00:00
|
|
|
self->health = MAGIC_JUNK;
|
2009-06-30 20:57:51 +00:00
|
|
|
self->velz = (self->velz * 192) >> 8;
|
2009-09-06 01:49:17 +00:00
|
|
|
self->BounceFlags = BOUNCE_None;
|
2008-08-10 20:48:55 +00:00
|
|
|
self->SetState (self->SpawnState);
|
|
|
|
S_Sound (self, CHAN_BODY, "weapons/macebounce", 1, ATTN_NORM);
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{ // Explode
|
2009-06-30 20:57:51 +00:00
|
|
|
self->velx = self->vely = self->velz = 0;
|
2008-08-10 20:48:55 +00:00
|
|
|
self->flags |= MF_NOGRAVITY;
|
|
|
|
self->gravity = FRACUNIT;
|
|
|
|
S_Sound (self, CHAN_BODY, "weapons/macehit", 1, ATTN_NORM);
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
// PROC A_MaceBallImpact2
|
|
|
|
//
|
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
|
2008-08-10 20:48:55 +00:00
|
|
|
DEFINE_ACTION_FUNCTION(AActor, A_MaceBallImpact2)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
|
|
|
AActor *tiny;
|
|
|
|
angle_t angle;
|
|
|
|
|
2008-08-10 20:48:55 +00:00
|
|
|
if (self->flags & MF_INBOUNCE)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
2008-08-10 20:48:55 +00:00
|
|
|
fixed_t floordist = self->z - self->floorz;
|
|
|
|
fixed_t ceildist = self->ceilingz - self->z;
|
2006-02-24 04:48:15 +00:00
|
|
|
fixed_t vel;
|
|
|
|
|
|
|
|
if (floordist <= ceildist)
|
|
|
|
{
|
2009-06-30 20:57:51 +00:00
|
|
|
vel = MulScale32 (self->velz, self->Sector->floorplane.c);
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2009-06-30 20:57:51 +00:00
|
|
|
vel = MulScale32 (self->velz, self->Sector->ceilingplane.c);
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
if (vel < 2)
|
|
|
|
{
|
|
|
|
goto boom;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Bounce
|
2009-06-30 20:57:51 +00:00
|
|
|
self->velz = (self->velz * 192) >> 8;
|
2008-08-10 20:48:55 +00:00
|
|
|
self->SetState (self->SpawnState);
|
2006-02-24 04:48:15 +00:00
|
|
|
|
2008-08-10 20:48:55 +00:00
|
|
|
tiny = Spawn("MaceFX3", self->x, self->y, self->z, ALLOW_REPLACE);
|
|
|
|
angle = self->angle+ANG90;
|
|
|
|
tiny->target = self->target;
|
2006-02-24 04:48:15 +00:00
|
|
|
tiny->angle = angle;
|
|
|
|
angle >>= ANGLETOFINESHIFT;
|
2009-06-30 20:57:51 +00:00
|
|
|
tiny->velx = (self->velx>>1) + FixedMul(self->velz-FRACUNIT, finecosine[angle]);
|
|
|
|
tiny->vely = (self->vely>>1) + FixedMul(self->velz-FRACUNIT, finesine[angle]);
|
|
|
|
tiny->velz = self->velz;
|
2013-03-21 03:06:04 +00:00
|
|
|
P_CheckMissileSpawn (tiny, self->radius);
|
2006-02-24 04:48:15 +00:00
|
|
|
|
2008-08-10 20:48:55 +00:00
|
|
|
tiny = Spawn("MaceFX3", self->x, self->y, self->z, ALLOW_REPLACE);
|
|
|
|
angle = self->angle-ANG90;
|
|
|
|
tiny->target = self->target;
|
2006-02-24 04:48:15 +00:00
|
|
|
tiny->angle = angle;
|
|
|
|
angle >>= ANGLETOFINESHIFT;
|
2009-06-30 20:57:51 +00:00
|
|
|
tiny->velx = (self->velx>>1) + FixedMul(self->velz-FRACUNIT, finecosine[angle]);
|
|
|
|
tiny->vely = (self->vely>>1) + FixedMul(self->velz-FRACUNIT, finesine[angle]);
|
|
|
|
tiny->velz = self->velz;
|
2013-03-21 03:06:04 +00:00
|
|
|
P_CheckMissileSpawn (tiny, self->radius);
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{ // Explode
|
|
|
|
boom:
|
2009-06-30 20:57:51 +00:00
|
|
|
self->velx = self->vely = self->velz = 0;
|
2008-08-10 20:48:55 +00:00
|
|
|
self->flags |= MF_NOGRAVITY;
|
2009-09-06 01:49:17 +00:00
|
|
|
self->BounceFlags = BOUNCE_None;
|
2008-08-10 20:48:55 +00:00
|
|
|
self->gravity = FRACUNIT;
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
// PROC A_FireMacePL2
|
|
|
|
//
|
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
|
2008-08-10 20:48:55 +00:00
|
|
|
DEFINE_ACTION_FUNCTION(AActor, A_FireMacePL2)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
|
|
|
AActor *mo;
|
|
|
|
player_t *player;
|
2008-04-10 14:38:43 +00:00
|
|
|
AActor *linetarget;
|
2006-02-24 04:48:15 +00:00
|
|
|
|
2008-08-10 20:48:55 +00:00
|
|
|
if (NULL == (player = self->player))
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2008-04-14 12:10:45 +00:00
|
|
|
AWeapon *weapon = player->ReadyWeapon;
|
2006-02-24 04:48:15 +00:00
|
|
|
if (weapon != NULL)
|
|
|
|
{
|
|
|
|
if (!weapon->DepleteAmmo (weapon->bAltFire))
|
|
|
|
return;
|
|
|
|
}
|
2008-08-10 20:48:55 +00:00
|
|
|
mo = P_SpawnPlayerMissile (self, 0,0,0, RUNTIME_CLASS(AMaceFX4), self->angle, &linetarget);
|
2006-02-24 04:48:15 +00:00
|
|
|
if (mo)
|
|
|
|
{
|
2009-06-30 20:57:51 +00:00
|
|
|
mo->velx += self->velx;
|
|
|
|
mo->vely += self->vely;
|
|
|
|
mo->velz = 2*FRACUNIT+
|
2008-08-10 20:48:55 +00:00
|
|
|
clamp<fixed_t>(finetangent[FINEANGLES/4-(self->pitch>>ANGLETOFINESHIFT)], -5*FRACUNIT, 5*FRACUNIT);
|
2006-02-24 04:48:15 +00:00
|
|
|
if (linetarget)
|
|
|
|
{
|
|
|
|
mo->tracer = linetarget;
|
|
|
|
}
|
|
|
|
}
|
2008-08-10 20:48:55 +00:00
|
|
|
S_Sound (self, CHAN_WEAPON, "weapons/maceshoot", 1, ATTN_NORM);
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
// PROC A_DeathBallImpact
|
|
|
|
//
|
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
|
2008-08-10 20:48:55 +00:00
|
|
|
DEFINE_ACTION_FUNCTION(AActor, A_DeathBallImpact)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
|
|
|
int i;
|
|
|
|
AActor *target;
|
|
|
|
angle_t angle = 0;
|
|
|
|
bool newAngle;
|
2008-04-10 14:38:43 +00:00
|
|
|
AActor *linetarget;
|
2006-02-24 04:48:15 +00:00
|
|
|
|
2008-08-10 20:48:55 +00:00
|
|
|
if ((self->z <= self->floorz) && P_HitFloor (self))
|
2006-02-24 04:48:15 +00:00
|
|
|
{ // Landed in some sort of liquid
|
2008-08-10 20:48:55 +00:00
|
|
|
self->Destroy ();
|
2006-02-24 04:48:15 +00:00
|
|
|
return;
|
|
|
|
}
|
2008-08-10 20:48:55 +00:00
|
|
|
if (self->flags & MF_INBOUNCE)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
2008-08-10 20:48:55 +00:00
|
|
|
fixed_t floordist = self->z - self->floorz;
|
|
|
|
fixed_t ceildist = self->ceilingz - self->z;
|
2006-02-24 04:48:15 +00:00
|
|
|
fixed_t vel;
|
|
|
|
|
|
|
|
if (floordist <= ceildist)
|
|
|
|
{
|
2009-06-30 20:57:51 +00:00
|
|
|
vel = MulScale32 (self->velz, self->Sector->floorplane.c);
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2009-06-30 20:57:51 +00:00
|
|
|
vel = MulScale32 (self->velz, self->Sector->ceilingplane.c);
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
if (vel < 2)
|
|
|
|
{
|
|
|
|
goto boom;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Bounce
|
|
|
|
newAngle = false;
|
2008-08-10 20:48:55 +00:00
|
|
|
target = self->tracer;
|
2006-02-24 04:48:15 +00:00
|
|
|
if (target)
|
|
|
|
{
|
|
|
|
if (!(target->flags&MF_SHOOTABLE))
|
|
|
|
{ // Target died
|
2008-08-10 20:48:55 +00:00
|
|
|
self->tracer = NULL;
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{ // Seek
|
2008-08-10 20:48:55 +00:00
|
|
|
angle = R_PointToAngle2(self->x, self->y,
|
2006-02-24 04:48:15 +00:00
|
|
|
target->x, target->y);
|
|
|
|
newAngle = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{ // Find new target
|
|
|
|
angle = 0;
|
|
|
|
for (i = 0; i < 16; i++)
|
|
|
|
{
|
2011-11-07 01:23:23 +00:00
|
|
|
P_AimLineAttack (self, angle, 10*64*FRACUNIT, &linetarget, 0, ALF_NOFRIENDS, NULL, self->target);
|
2008-08-10 20:48:55 +00:00
|
|
|
if (linetarget && self->target != linetarget)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
2008-08-10 20:48:55 +00:00
|
|
|
self->tracer = linetarget;
|
|
|
|
angle = R_PointToAngle2 (self->x, self->y,
|
2006-02-24 04:48:15 +00:00
|
|
|
linetarget->x, linetarget->y);
|
|
|
|
newAngle = true;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
angle += ANGLE_45/2;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (newAngle)
|
|
|
|
{
|
2008-08-10 20:48:55 +00:00
|
|
|
self->angle = angle;
|
2006-02-24 04:48:15 +00:00
|
|
|
angle >>= ANGLETOFINESHIFT;
|
2009-06-30 20:57:51 +00:00
|
|
|
self->velx = FixedMul (self->Speed, finecosine[angle]);
|
|
|
|
self->vely = FixedMul (self->Speed, finesine[angle]);
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
2008-08-10 20:48:55 +00:00
|
|
|
self->SetState (self->SpawnState);
|
|
|
|
S_Sound (self, CHAN_BODY, "weapons/macestop", 1, ATTN_NORM);
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{ // Explode
|
|
|
|
boom:
|
2009-06-30 20:57:51 +00:00
|
|
|
self->velx = self->vely = self->velz = 0;
|
2008-08-10 20:48:55 +00:00
|
|
|
self->flags |= MF_NOGRAVITY;
|
|
|
|
self->gravity = FRACUNIT;
|
|
|
|
S_Sound (self, CHAN_BODY, "weapons/maceexplode", 1, ATTN_NORM);
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Blaster FX 1 -------------------------------------------------------------
|
|
|
|
|
2008-11-15 09:57:18 +00:00
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
// Thinker for the ultra-fast blaster PL2 ripper-spawning missile.
|
|
|
|
//
|
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
class ABlasterFX1 : public AFastProjectile
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
2008-11-15 09:57:18 +00:00
|
|
|
DECLARE_CLASS(ABlasterFX1, AFastProjectile)
|
2006-02-24 04:48:15 +00:00
|
|
|
public:
|
2008-11-15 09:57:18 +00:00
|
|
|
void Effect ();
|
2012-06-29 04:21:31 +00:00
|
|
|
int DoSpecialDamage (AActor *target, int damage, FName damagetype);
|
2006-02-24 04:48:15 +00:00
|
|
|
};
|
|
|
|
|
2012-06-29 04:21:31 +00:00
|
|
|
int ABlasterFX1::DoSpecialDamage (AActor *target, int damage, FName damagetype)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
2006-05-10 02:40:43 +00:00
|
|
|
if (target->IsKindOf (PClass::FindClass ("Ironlich")))
|
2006-02-24 04:48:15 +00:00
|
|
|
{ // Less damage to Ironlich bosses
|
|
|
|
damage = pr_bfx1() & 1;
|
|
|
|
if (!damage)
|
|
|
|
{
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return damage;
|
|
|
|
}
|
|
|
|
|
2008-11-15 09:57:18 +00:00
|
|
|
void ABlasterFX1::Effect ()
|
|
|
|
{
|
|
|
|
if (pr_bfx1t() < 64)
|
|
|
|
{
|
|
|
|
Spawn("BlasterSmoke", x, y, MAX<fixed_t> (z - 8 * FRACUNIT, floorz), ALLOW_REPLACE);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-08-04 19:25:13 +00:00
|
|
|
IMPLEMENT_CLASS(ABlasterFX1)
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
// Ripper -------------------------------------------------------------------
|
|
|
|
|
2008-11-15 09:57:18 +00:00
|
|
|
|
2006-02-24 04:48:15 +00:00
|
|
|
class ARipper : public AActor
|
|
|
|
{
|
2008-08-04 19:25:13 +00:00
|
|
|
DECLARE_CLASS (ARipper, AActor)
|
2006-02-24 04:48:15 +00:00
|
|
|
public:
|
2012-06-29 04:21:31 +00:00
|
|
|
int DoSpecialDamage (AActor *target, int damage, FName damagetype);
|
2006-02-24 04:48:15 +00:00
|
|
|
};
|
|
|
|
|
2008-08-04 19:25:13 +00:00
|
|
|
IMPLEMENT_CLASS(ARipper)
|
2006-02-24 04:48:15 +00:00
|
|
|
|
2012-06-29 04:21:31 +00:00
|
|
|
int ARipper::DoSpecialDamage (AActor *target, int damage, FName damagetype)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
2006-05-10 02:40:43 +00:00
|
|
|
if (target->IsKindOf (PClass::FindClass ("Ironlich")))
|
2006-02-24 04:48:15 +00:00
|
|
|
{ // Less damage to Ironlich bosses
|
|
|
|
damage = pr_ripd() & 1;
|
|
|
|
if (!damage)
|
|
|
|
{
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return damage;
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
// PROC A_FireBlasterPL1
|
|
|
|
//
|
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
|
2008-08-10 20:48:55 +00:00
|
|
|
DEFINE_ACTION_FUNCTION(AActor, A_FireBlasterPL1)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
|
|
|
angle_t angle;
|
|
|
|
int damage;
|
|
|
|
player_t *player;
|
|
|
|
|
2008-08-10 20:48:55 +00:00
|
|
|
if (NULL == (player = self->player))
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2008-08-10 20:48:55 +00:00
|
|
|
AWeapon *weapon = self->player->ReadyWeapon;
|
2006-02-24 04:48:15 +00:00
|
|
|
if (weapon != NULL)
|
|
|
|
{
|
|
|
|
if (!weapon->DepleteAmmo (weapon->bAltFire))
|
|
|
|
return;
|
|
|
|
}
|
2008-08-10 20:48:55 +00:00
|
|
|
angle_t pitch = P_BulletSlope(self);
|
2006-02-24 04:48:15 +00:00
|
|
|
damage = pr_fb1.HitDice (4);
|
2008-08-10 20:48:55 +00:00
|
|
|
angle = self->angle;
|
2006-02-24 04:48:15 +00:00
|
|
|
if (player->refire)
|
|
|
|
{
|
|
|
|
angle += pr_fb1.Random2() << 18;
|
|
|
|
}
|
2012-06-17 03:18:26 +00:00
|
|
|
P_LineAttack (self, angle, PLAYERMISSILERANGE, pitch, damage, NAME_Hitscan, "BlasterPuff");
|
2008-08-10 20:48:55 +00:00
|
|
|
S_Sound (self, CHAN_WEAPON, "weapons/blastershoot", 1, ATTN_NORM);
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
// PROC A_SpawnRippers
|
|
|
|
//
|
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
|
2008-08-10 20:48:55 +00:00
|
|
|
DEFINE_ACTION_FUNCTION(AActor, A_SpawnRippers)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
2014-05-25 08:11:09 +00:00
|
|
|
unsigned int i;
|
2006-02-24 04:48:15 +00:00
|
|
|
angle_t angle;
|
|
|
|
AActor *ripper;
|
|
|
|
|
|
|
|
for(i = 0; i < 8; i++)
|
|
|
|
{
|
2008-08-10 20:48:55 +00:00
|
|
|
ripper = Spawn<ARipper> (self->x, self->y, self->z, ALLOW_REPLACE);
|
2006-02-24 04:48:15 +00:00
|
|
|
angle = i*ANG45;
|
2008-08-10 20:48:55 +00:00
|
|
|
ripper->target = self->target;
|
2006-02-24 04:48:15 +00:00
|
|
|
ripper->angle = angle;
|
|
|
|
angle >>= ANGLETOFINESHIFT;
|
2009-06-30 20:57:51 +00:00
|
|
|
ripper->velx = FixedMul (ripper->Speed, finecosine[angle]);
|
|
|
|
ripper->vely = FixedMul (ripper->Speed, finesine[angle]);
|
2013-03-21 03:06:04 +00:00
|
|
|
P_CheckMissileSpawn (ripper, self->radius);
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// --- Skull rod ------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
|
|
// Horn Rod FX 2 ------------------------------------------------------------
|
|
|
|
|
|
|
|
class AHornRodFX2 : public AActor
|
|
|
|
{
|
2008-08-04 19:25:13 +00:00
|
|
|
DECLARE_CLASS (AHornRodFX2, AActor)
|
2006-02-24 04:48:15 +00:00
|
|
|
public:
|
2012-06-29 04:21:31 +00:00
|
|
|
int DoSpecialDamage (AActor *target, int damage, FName damagetype);
|
2006-02-24 04:48:15 +00:00
|
|
|
};
|
|
|
|
|
2008-08-04 19:25:13 +00:00
|
|
|
IMPLEMENT_CLASS (AHornRodFX2)
|
2006-02-24 04:48:15 +00:00
|
|
|
|
2012-06-29 04:21:31 +00:00
|
|
|
int AHornRodFX2::DoSpecialDamage (AActor *target, int damage, FName damagetype)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
2008-07-21 17:03:30 +00:00
|
|
|
if (target->IsKindOf (PClass::FindClass("Sorcerer2")) && pr_hrfx2() < 96)
|
2006-02-24 04:48:15 +00:00
|
|
|
{ // D'Sparil teleports away
|
|
|
|
P_DSparilTeleport (target);
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
return damage;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Rain pillar 1 ------------------------------------------------------------
|
|
|
|
|
|
|
|
class ARainPillar : public AActor
|
|
|
|
{
|
2008-08-04 19:25:13 +00:00
|
|
|
DECLARE_CLASS (ARainPillar, AActor)
|
2006-02-24 04:48:15 +00:00
|
|
|
public:
|
2012-06-29 04:21:31 +00:00
|
|
|
int DoSpecialDamage (AActor *target, int damage, FName damagetype);
|
2006-02-24 04:48:15 +00:00
|
|
|
};
|
|
|
|
|
2008-08-04 19:25:13 +00:00
|
|
|
IMPLEMENT_CLASS (ARainPillar)
|
2006-02-24 04:48:15 +00:00
|
|
|
|
2012-06-29 04:21:31 +00:00
|
|
|
int ARainPillar::DoSpecialDamage (AActor *target, int damage, FName damagetype)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
|
|
|
if (target->flags2 & MF2_BOSS)
|
|
|
|
{ // Decrease damage for bosses
|
|
|
|
damage = (pr_rp() & 7) + 1;
|
|
|
|
}
|
|
|
|
return damage;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Rain tracker "inventory" item --------------------------------------------
|
|
|
|
|
|
|
|
class ARainTracker : public AInventory
|
|
|
|
{
|
2008-08-04 19:25:13 +00:00
|
|
|
DECLARE_CLASS (ARainTracker, AInventory)
|
2006-02-24 04:48:15 +00:00
|
|
|
public:
|
|
|
|
void Serialize (FArchive &arc);
|
|
|
|
AActor *Rain1, *Rain2;
|
|
|
|
};
|
|
|
|
|
2008-08-04 19:25:13 +00:00
|
|
|
IMPLEMENT_CLASS (ARainTracker)
|
|
|
|
|
2006-02-24 04:48:15 +00:00
|
|
|
void ARainTracker::Serialize (FArchive &arc)
|
|
|
|
{
|
|
|
|
Super::Serialize (arc);
|
|
|
|
arc << Rain1 << Rain2;
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
// PROC A_FireSkullRodPL1
|
|
|
|
//
|
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
|
2008-08-10 20:48:55 +00:00
|
|
|
DEFINE_ACTION_FUNCTION(AActor, A_FireSkullRodPL1)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
|
|
|
AActor *mo;
|
|
|
|
player_t *player;
|
|
|
|
|
2008-08-10 20:48:55 +00:00
|
|
|
if (NULL == (player = self->player))
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2008-04-14 12:10:45 +00:00
|
|
|
AWeapon *weapon = player->ReadyWeapon;
|
2006-02-24 04:48:15 +00:00
|
|
|
if (weapon != NULL)
|
|
|
|
{
|
|
|
|
if (!weapon->DepleteAmmo (weapon->bAltFire))
|
|
|
|
return;
|
|
|
|
}
|
2008-08-10 20:48:55 +00:00
|
|
|
mo = P_SpawnPlayerMissile (self, PClass::FindClass("HornRodFX1"));
|
2006-02-24 04:48:15 +00:00
|
|
|
// Randomize the first frame
|
|
|
|
if (mo && pr_fsr1() > 128)
|
|
|
|
{
|
|
|
|
mo->SetState (mo->state->GetNextState());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
// PROC A_FireSkullRodPL2
|
|
|
|
//
|
|
|
|
// The special2 field holds the player number that shot the rain missile.
|
|
|
|
// The special1 field holds the id of the rain sound.
|
|
|
|
//
|
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
|
2008-08-10 20:48:55 +00:00
|
|
|
DEFINE_ACTION_FUNCTION(AActor, A_FireSkullRodPL2)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
|
|
|
player_t *player;
|
2008-04-10 14:38:43 +00:00
|
|
|
AActor *MissileActor;
|
|
|
|
AActor *linetarget;
|
2006-02-24 04:48:15 +00:00
|
|
|
|
2008-08-10 20:48:55 +00:00
|
|
|
if (NULL == (player = self->player))
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
2008-04-14 12:10:45 +00:00
|
|
|
AWeapon *weapon = player->ReadyWeapon;
|
2006-02-24 04:48:15 +00:00
|
|
|
if (weapon != NULL)
|
|
|
|
{
|
|
|
|
if (!weapon->DepleteAmmo (weapon->bAltFire))
|
|
|
|
return;
|
|
|
|
}
|
2008-08-10 20:48:55 +00:00
|
|
|
P_SpawnPlayerMissile (self, 0,0,0, RUNTIME_CLASS(AHornRodFX2), self->angle, &linetarget, &MissileActor);
|
2006-02-24 04:48:15 +00:00
|
|
|
// Use MissileActor instead of the return value from
|
|
|
|
// P_SpawnPlayerMissile because we need to give info to the mobj
|
|
|
|
// even if it exploded immediately.
|
|
|
|
if (MissileActor != NULL)
|
|
|
|
{
|
|
|
|
MissileActor->special2 = (int)(player - players);
|
|
|
|
if (linetarget)
|
|
|
|
{
|
|
|
|
MissileActor->tracer = linetarget;
|
|
|
|
}
|
|
|
|
S_Sound (MissileActor, CHAN_WEAPON, "weapons/hornrodpowshoot", 1, ATTN_NORM);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
// PROC A_AddPlayerRain
|
|
|
|
//
|
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
|
2008-08-10 20:48:55 +00:00
|
|
|
DEFINE_ACTION_FUNCTION(AActor, A_AddPlayerRain)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
|
|
|
ARainTracker *tracker;
|
|
|
|
|
2008-08-10 20:48:55 +00:00
|
|
|
if (self->target == NULL || self->target->health <= 0)
|
2006-02-24 04:48:15 +00:00
|
|
|
{ // Shooter is dead or nonexistant
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2008-08-10 20:48:55 +00:00
|
|
|
tracker = self->target->FindInventory<ARainTracker> ();
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
// They player is only allowed two rainstorms at a time. Shooting more
|
|
|
|
// than that will cause the oldest one to terminate.
|
|
|
|
if (tracker != NULL)
|
|
|
|
{
|
|
|
|
if (tracker->Rain1 && tracker->Rain2)
|
|
|
|
{ // Terminate an active rain
|
|
|
|
if (tracker->Rain1->health < tracker->Rain2->health)
|
|
|
|
{
|
|
|
|
if (tracker->Rain1->health > 16)
|
|
|
|
{
|
|
|
|
tracker->Rain1->health = 16;
|
|
|
|
}
|
|
|
|
tracker->Rain1 = NULL;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (tracker->Rain2->health > 16)
|
|
|
|
{
|
|
|
|
tracker->Rain2->health = 16;
|
|
|
|
}
|
|
|
|
tracker->Rain2 = NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2008-08-10 20:48:55 +00:00
|
|
|
tracker = static_cast<ARainTracker *> (self->target->GiveInventoryType (RUNTIME_CLASS(ARainTracker)));
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
// Add rain mobj to list
|
|
|
|
if (tracker->Rain1)
|
|
|
|
{
|
2008-08-10 20:48:55 +00:00
|
|
|
tracker->Rain2 = self;
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2008-08-10 20:48:55 +00:00
|
|
|
tracker->Rain1 = self;
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
2008-08-10 20:48:55 +00:00
|
|
|
self->special1 = S_FindSound ("misc/rain");
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
// PROC A_SkullRodStorm
|
|
|
|
//
|
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
|
2008-08-10 20:48:55 +00:00
|
|
|
DEFINE_ACTION_FUNCTION(AActor, A_SkullRodStorm)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
|
|
|
fixed_t x;
|
|
|
|
fixed_t y;
|
|
|
|
AActor *mo;
|
|
|
|
ARainTracker *tracker;
|
|
|
|
|
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
|
|
|
S_StopSound (self, CHAN_BODY);
|
|
|
|
if (self->target == NULL)
|
2006-02-24 04:48:15 +00:00
|
|
|
{ // Player left the game
|
2008-08-10 20:48:55 +00:00
|
|
|
self->Destroy ();
|
2006-02-24 04:48:15 +00:00
|
|
|
return;
|
|
|
|
}
|
2008-08-10 20:48:55 +00:00
|
|
|
tracker = self->target->FindInventory<ARainTracker> ();
|
2006-02-24 04:48:15 +00:00
|
|
|
if (tracker != NULL)
|
|
|
|
{
|
2008-08-10 20:48:55 +00:00
|
|
|
if (tracker->Rain1 == self)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
|
|
|
tracker->Rain1 = NULL;
|
|
|
|
}
|
2008-08-10 20:48:55 +00:00
|
|
|
else if (tracker->Rain2 == self)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
|
|
|
tracker->Rain2 = NULL;
|
|
|
|
}
|
|
|
|
}
|
2008-08-10 20:48:55 +00:00
|
|
|
self->Destroy ();
|
2006-02-24 04:48:15 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
if (pr_storm() < 25)
|
|
|
|
{ // Fudge rain frequency
|
|
|
|
return;
|
|
|
|
}
|
2008-08-10 20:48:55 +00:00
|
|
|
x = self->x + ((pr_storm()&127) - 64) * FRACUNIT;
|
|
|
|
y = self->y + ((pr_storm()&127) - 64) * FRACUNIT;
|
2006-07-16 09:10:45 +00:00
|
|
|
mo = Spawn<ARainPillar> (x, y, ONCEILINGZ, ALLOW_REPLACE);
|
2011-01-29 11:09:38 +00:00
|
|
|
// We used bouncecount to store the 3D floor index in A_HideInCeiling
|
|
|
|
if (!mo) return;
|
|
|
|
fixed_t newz;
|
|
|
|
if (self->bouncecount >= 0
|
|
|
|
&& (unsigned)self->bouncecount < self->Sector->e->XFloor.ffloors.Size())
|
|
|
|
newz = self->Sector->e->XFloor.ffloors[self->bouncecount]->bottom.plane->ZatPoint(x, y);// - 40 * FRACUNIT;
|
|
|
|
else
|
|
|
|
newz = self->Sector->ceilingplane.ZatPoint(x, y);
|
|
|
|
int moceiling = P_Find3DFloor(NULL, x, y, newz, false, false, newz);
|
|
|
|
if (moceiling >= 0)
|
|
|
|
mo->z = newz - mo->height;
|
2006-02-24 04:48:15 +00:00
|
|
|
mo->Translation = multiplayer ?
|
2008-08-10 20:48:55 +00:00
|
|
|
TRANSLATION(TRANSLATION_PlayersExtra,self->special2) : 0;
|
|
|
|
mo->target = self->target;
|
2009-06-30 20:57:51 +00:00
|
|
|
mo->velx = 1; // Force collision detection
|
|
|
|
mo->velz = -mo->Speed;
|
2008-08-10 20:48:55 +00:00
|
|
|
mo->special2 = self->special2; // Transfer player number
|
2013-03-21 03:06:04 +00:00
|
|
|
P_CheckMissileSpawn (mo, self->radius);
|
2008-08-10 20:48:55 +00:00
|
|
|
if (self->special1 != -1 && !S_IsActorPlayingSomething (self, CHAN_BODY, -1))
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
2008-08-10 20:48:55 +00:00
|
|
|
S_Sound (self, CHAN_BODY|CHAN_LOOP, self->special1, 1, ATTN_NORM);
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
// PROC A_RainImpact
|
|
|
|
//
|
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
|
2008-08-10 20:48:55 +00:00
|
|
|
DEFINE_ACTION_FUNCTION(AActor, A_RainImpact)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
2008-08-10 20:48:55 +00:00
|
|
|
if (self->z > self->floorz)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
2008-08-10 20:48:55 +00:00
|
|
|
self->SetState (self->FindState("NotFloor"));
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
else if (pr_impact() < 40)
|
|
|
|
{
|
2008-08-10 20:48:55 +00:00
|
|
|
P_HitFloor (self);
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
// PROC A_HideInCeiling
|
|
|
|
//
|
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
|
2008-08-10 20:48:55 +00:00
|
|
|
DEFINE_ACTION_FUNCTION(AActor, A_HideInCeiling)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
2011-01-29 11:09:38 +00:00
|
|
|
// We use bouncecount to store the 3D floor index
|
|
|
|
fixed_t foo;
|
|
|
|
for (unsigned int i=0; i< self->Sector->e->XFloor.ffloors.Size(); i++)
|
|
|
|
{
|
|
|
|
F3DFloor * rover = self->Sector->e->XFloor.ffloors[i];
|
|
|
|
if(!(rover->flags & FF_SOLID) || !(rover->flags & FF_EXISTS)) continue;
|
|
|
|
|
|
|
|
if ((foo = rover->bottom.plane->ZatPoint(self->x, self->y)) >= (self->z + self->height))
|
|
|
|
{
|
|
|
|
self->z = foo + 4*FRACUNIT;
|
|
|
|
self->bouncecount = i;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
self->bouncecount = -1;
|
2008-08-10 20:48:55 +00:00
|
|
|
self->z = self->ceilingz + 4*FRACUNIT;
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// --- Phoenix Rod ----------------------------------------------------------
|
|
|
|
|
2008-08-04 22:30:45 +00:00
|
|
|
class APhoenixRod : public AWeapon
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
2008-08-04 22:30:45 +00:00
|
|
|
DECLARE_CLASS (APhoenixRod, AWeapon)
|
2006-02-24 04:48:15 +00:00
|
|
|
public:
|
|
|
|
void Serialize (FArchive &arc)
|
|
|
|
{
|
|
|
|
Super::Serialize (arc);
|
|
|
|
arc << FlameCount;
|
|
|
|
}
|
|
|
|
int FlameCount; // for flamethrower duration
|
|
|
|
};
|
|
|
|
|
|
|
|
class APhoenixRodPowered : public APhoenixRod
|
|
|
|
{
|
2008-08-04 22:30:45 +00:00
|
|
|
DECLARE_CLASS (APhoenixRodPowered, APhoenixRod)
|
2006-02-24 04:48:15 +00:00
|
|
|
public:
|
|
|
|
void EndPowerup ();
|
|
|
|
};
|
|
|
|
|
2008-08-04 22:30:45 +00:00
|
|
|
IMPLEMENT_CLASS (APhoenixRod)
|
|
|
|
IMPLEMENT_CLASS (APhoenixRodPowered)
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
void APhoenixRodPowered::EndPowerup ()
|
|
|
|
{
|
2008-08-04 22:30:45 +00:00
|
|
|
P_SetPsprite (Owner->player, ps_weapon, SisterWeapon->GetReadyState());
|
2006-02-24 04:48:15 +00:00
|
|
|
DepleteAmmo (bAltFire);
|
|
|
|
Owner->player->refire = 0;
|
|
|
|
S_StopSound (Owner, CHAN_WEAPON);
|
|
|
|
Owner->player->ReadyWeapon = SisterWeapon;
|
|
|
|
}
|
|
|
|
|
2008-08-04 22:30:45 +00:00
|
|
|
class APhoenixFX1 : public AActor
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
2008-08-04 22:30:45 +00:00
|
|
|
DECLARE_CLASS (APhoenixFX1, AActor)
|
|
|
|
public:
|
2012-06-29 04:21:31 +00:00
|
|
|
int DoSpecialDamage (AActor *target, int damage, FName damagetype);
|
2006-02-24 04:48:15 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2008-08-04 22:30:45 +00:00
|
|
|
IMPLEMENT_CLASS (APhoenixFX1)
|
2006-02-24 04:48:15 +00:00
|
|
|
|
2012-06-29 04:21:31 +00:00
|
|
|
int APhoenixFX1::DoSpecialDamage (AActor *target, int damage, FName damagetype)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
2008-07-21 17:03:30 +00:00
|
|
|
if (target->IsKindOf (PClass::FindClass("Sorcerer2")) && pr_hrfx2() < 96)
|
2006-02-24 04:48:15 +00:00
|
|
|
{ // D'Sparil teleports away
|
|
|
|
P_DSparilTeleport (target);
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
return damage;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Phoenix FX 2 -------------------------------------------------------------
|
|
|
|
|
|
|
|
class APhoenixFX2 : public AActor
|
|
|
|
{
|
2008-08-04 22:30:45 +00:00
|
|
|
DECLARE_CLASS (APhoenixFX2, AActor)
|
2006-02-24 04:48:15 +00:00
|
|
|
public:
|
2012-06-29 04:21:31 +00:00
|
|
|
int DoSpecialDamage (AActor *target, int damage, FName damagetype);
|
2006-02-24 04:48:15 +00:00
|
|
|
};
|
|
|
|
|
2008-08-04 22:30:45 +00:00
|
|
|
IMPLEMENT_CLASS (APhoenixFX2)
|
2006-02-24 04:48:15 +00:00
|
|
|
|
2012-06-29 04:21:31 +00:00
|
|
|
int APhoenixFX2::DoSpecialDamage (AActor *target, int damage, FName damagetype)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
|
|
|
if (target->player && pr_pfx2 () < 128)
|
|
|
|
{ // Freeze player for a bit
|
|
|
|
target->reactiontime += 4;
|
|
|
|
}
|
|
|
|
return damage;
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
// PROC A_FirePhoenixPL1
|
|
|
|
//
|
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
|
2008-08-10 20:48:55 +00:00
|
|
|
DEFINE_ACTION_FUNCTION(AActor, A_FirePhoenixPL1)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
|
|
|
angle_t angle;
|
|
|
|
player_t *player;
|
|
|
|
|
2008-08-10 20:48:55 +00:00
|
|
|
if (NULL == (player = self->player))
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2008-08-10 20:48:55 +00:00
|
|
|
AWeapon *weapon = self->player->ReadyWeapon;
|
2006-02-24 04:48:15 +00:00
|
|
|
if (weapon != NULL)
|
|
|
|
{
|
|
|
|
if (!weapon->DepleteAmmo (weapon->bAltFire))
|
|
|
|
return;
|
|
|
|
}
|
2008-08-10 20:48:55 +00:00
|
|
|
P_SpawnPlayerMissile (self, RUNTIME_CLASS(APhoenixFX1));
|
|
|
|
angle = self->angle + ANG180;
|
2006-02-24 04:48:15 +00:00
|
|
|
angle >>= ANGLETOFINESHIFT;
|
2009-06-30 20:57:51 +00:00
|
|
|
self->velx += FixedMul (4*FRACUNIT, finecosine[angle]);
|
|
|
|
self->vely += FixedMul (4*FRACUNIT, finesine[angle]);
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
// PROC A_PhoenixPuff
|
|
|
|
//
|
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
|
2008-08-10 20:48:55 +00:00
|
|
|
DEFINE_ACTION_FUNCTION(AActor, A_PhoenixPuff)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
|
|
|
AActor *puff;
|
|
|
|
angle_t angle;
|
|
|
|
|
|
|
|
//[RH] Heretic never sets the target for seeking
|
2008-08-10 20:48:55 +00:00
|
|
|
//P_SeekerMissile (self, ANGLE_1*5, ANGLE_1*10);
|
|
|
|
puff = Spawn("PhoenixPuff", self->x, self->y, self->z, ALLOW_REPLACE);
|
|
|
|
angle = self->angle + ANG90;
|
2006-02-24 04:48:15 +00:00
|
|
|
angle >>= ANGLETOFINESHIFT;
|
2009-06-30 20:57:51 +00:00
|
|
|
puff->velx = FixedMul (FRACUNIT*13/10, finecosine[angle]);
|
|
|
|
puff->vely = FixedMul (FRACUNIT*13/10, finesine[angle]);
|
|
|
|
puff->velz = 0;
|
2008-08-10 20:48:55 +00:00
|
|
|
puff = Spawn("PhoenixPuff", self->x, self->y, self->z, ALLOW_REPLACE);
|
|
|
|
angle = self->angle - ANG90;
|
2006-02-24 04:48:15 +00:00
|
|
|
angle >>= ANGLETOFINESHIFT;
|
2009-06-30 20:57:51 +00:00
|
|
|
puff->velx = FixedMul (FRACUNIT*13/10, finecosine[angle]);
|
|
|
|
puff->vely = FixedMul (FRACUNIT*13/10, finesine[angle]);
|
|
|
|
puff->velz = 0;
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
// PROC A_InitPhoenixPL2
|
|
|
|
//
|
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
|
2008-08-10 20:48:55 +00:00
|
|
|
DEFINE_ACTION_FUNCTION(AActor, A_InitPhoenixPL2)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
2008-08-10 20:48:55 +00:00
|
|
|
if (self->player != NULL)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
2008-08-10 20:48:55 +00:00
|
|
|
APhoenixRod *flamethrower = static_cast<APhoenixRod *> (self->player->ReadyWeapon);
|
2006-02-24 04:48:15 +00:00
|
|
|
if (flamethrower != NULL)
|
|
|
|
{
|
|
|
|
flamethrower->FlameCount = FLAME_THROWER_TICS;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
// PROC A_FirePhoenixPL2
|
|
|
|
//
|
|
|
|
// Flame thrower effect.
|
|
|
|
//
|
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
|
2008-08-10 20:48:55 +00:00
|
|
|
DEFINE_ACTION_FUNCTION(AActor, A_FirePhoenixPL2)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
|
|
|
AActor *mo;
|
|
|
|
angle_t angle;
|
|
|
|
fixed_t x, y, z;
|
2011-11-07 01:23:23 +00:00
|
|
|
|
2006-02-24 04:48:15 +00:00
|
|
|
fixed_t slope;
|
2008-06-15 02:25:09 +00:00
|
|
|
FSoundID soundid;
|
2006-02-24 04:48:15 +00:00
|
|
|
player_t *player;
|
|
|
|
APhoenixRod *flamethrower;
|
|
|
|
|
2008-08-10 20:48:55 +00:00
|
|
|
if (NULL == (player = self->player))
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2008-06-15 02:25:09 +00:00
|
|
|
soundid = "weapons/phoenixpowshoot";
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
flamethrower = static_cast<APhoenixRod *> (player->ReadyWeapon);
|
|
|
|
if (flamethrower == NULL || --flamethrower->FlameCount == 0)
|
|
|
|
{ // Out of flame
|
2008-08-04 22:30:45 +00:00
|
|
|
P_SetPsprite (player, ps_weapon, flamethrower->FindState("Powerdown"));
|
2006-02-24 04:48:15 +00:00
|
|
|
player->refire = 0;
|
2008-08-10 20:48:55 +00:00
|
|
|
S_StopSound (self, CHAN_WEAPON);
|
2006-02-24 04:48:15 +00:00
|
|
|
return;
|
|
|
|
}
|
2008-08-10 20:48:55 +00:00
|
|
|
angle = self->angle;
|
|
|
|
x = self->x + (pr_fp2.Random2() << 9);
|
|
|
|
y = self->y + (pr_fp2.Random2() << 9);
|
|
|
|
z = self->z + 26*FRACUNIT + finetangent[FINEANGLES/4-(self->pitch>>ANGLETOFINESHIFT)];
|
|
|
|
z -= self->floorclip;
|
|
|
|
slope = finetangent[FINEANGLES/4-(self->pitch>>ANGLETOFINESHIFT)] + (FRACUNIT/10);
|
2008-08-04 22:30:45 +00:00
|
|
|
mo = Spawn("PhoenixFX2", x, y, z, ALLOW_REPLACE);
|
2008-08-10 20:48:55 +00:00
|
|
|
mo->target = self;
|
2006-02-24 04:48:15 +00:00
|
|
|
mo->angle = angle;
|
2009-06-30 20:57:51 +00:00
|
|
|
mo->velx = self->velx + FixedMul (mo->Speed, finecosine[angle>>ANGLETOFINESHIFT]);
|
|
|
|
mo->vely = self->vely + FixedMul (mo->Speed, finesine[angle>>ANGLETOFINESHIFT]);
|
|
|
|
mo->velz = FixedMul (mo->Speed, slope);
|
2008-08-10 20:48:55 +00:00
|
|
|
if (!player->refire || !S_IsActorPlayingSomething (self, CHAN_WEAPON, -1))
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
2008-08-10 20:48:55 +00:00
|
|
|
S_Sound (self, CHAN_WEAPON|CHAN_LOOP, soundid, 1, ATTN_NORM);
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
2013-03-21 03:06:04 +00:00
|
|
|
P_CheckMissileSpawn (mo, self->radius);
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
// PROC A_ShutdownPhoenixPL2
|
|
|
|
//
|
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
|
2008-08-10 20:48:55 +00:00
|
|
|
DEFINE_ACTION_FUNCTION(AActor, A_ShutdownPhoenixPL2)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
|
|
|
player_t *player;
|
|
|
|
|
2008-08-10 20:48:55 +00:00
|
|
|
if (NULL == (player = self->player))
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
2008-08-10 20:48:55 +00:00
|
|
|
S_StopSound (self, CHAN_WEAPON);
|
2008-04-14 12:10:45 +00:00
|
|
|
AWeapon *weapon = player->ReadyWeapon;
|
2006-02-24 04:48:15 +00:00
|
|
|
if (weapon != NULL)
|
|
|
|
{
|
|
|
|
if (!weapon->DepleteAmmo (weapon->bAltFire))
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
// PROC A_FlameEnd
|
|
|
|
//
|
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
|
2008-08-10 20:48:55 +00:00
|
|
|
DEFINE_ACTION_FUNCTION(AActor, A_FlameEnd)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
2009-06-30 20:57:51 +00:00
|
|
|
self->velz += FRACUNIT*3/2;
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
// PROC A_FloatPuff
|
|
|
|
//
|
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
|
2008-08-10 20:48:55 +00:00
|
|
|
DEFINE_ACTION_FUNCTION(AActor, A_FloatPuff)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
2009-06-30 20:57:51 +00:00
|
|
|
self->velz += FRACUNIT*18/10;
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
|