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 "gstrings.h"
|
|
|
|
#include "a_action.h"
|
2007-05-28 14:46:49 +00:00
|
|
|
#include "thingdef/thingdef.h"
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
//
|
|
|
|
// Mancubus attack,
|
|
|
|
// firing three missiles in three different directions?
|
|
|
|
// Doesn't look like it.
|
|
|
|
//
|
|
|
|
#define FATSPREAD (ANG90/8)
|
|
|
|
|
2008-08-10 20:48:55 +00:00
|
|
|
DEFINE_ACTION_FUNCTION(AActor, A_FatRaise)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
|
|
|
A_FaceTarget (self);
|
|
|
|
S_Sound (self, CHAN_WEAPON, "fatso/raiseguns", 1, ATTN_NORM);
|
|
|
|
}
|
|
|
|
|
2008-08-10 20:48:55 +00:00
|
|
|
DEFINE_ACTION_FUNCTION(AActor, A_FatAttack1)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
|
|
|
AActor *missile;
|
|
|
|
angle_t an;
|
|
|
|
|
|
|
|
if (!self->target)
|
|
|
|
return;
|
|
|
|
|
2006-05-10 02:40:43 +00:00
|
|
|
const PClass *spawntype = NULL;
|
2006-02-24 04:48:15 +00:00
|
|
|
int index = CheckIndex (1, NULL);
|
2006-05-10 15:07:14 +00:00
|
|
|
if (index >= 0) spawntype = PClass::FindClass ((ENamedName)StateParameters[index]);
|
2006-11-04 22:26:04 +00:00
|
|
|
if (spawntype == NULL) spawntype = PClass::FindClass("FatShot");
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
A_FaceTarget (self);
|
|
|
|
// Change direction to ...
|
|
|
|
self->angle += FATSPREAD;
|
|
|
|
P_SpawnMissile (self, self->target, spawntype);
|
|
|
|
|
|
|
|
missile = P_SpawnMissile (self, self->target, spawntype);
|
|
|
|
if (missile != NULL)
|
|
|
|
{
|
|
|
|
missile->angle += FATSPREAD;
|
|
|
|
an = missile->angle >> ANGLETOFINESHIFT;
|
|
|
|
missile->momx = FixedMul (missile->Speed, finecosine[an]);
|
|
|
|
missile->momy = FixedMul (missile->Speed, finesine[an]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-08-10 20:48:55 +00:00
|
|
|
DEFINE_ACTION_FUNCTION(AActor, A_FatAttack2)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
|
|
|
AActor *missile;
|
|
|
|
angle_t an;
|
|
|
|
|
|
|
|
if (!self->target)
|
|
|
|
return;
|
|
|
|
|
2006-05-10 02:40:43 +00:00
|
|
|
const PClass *spawntype = NULL;
|
2006-02-24 04:48:15 +00:00
|
|
|
int index = CheckIndex (1, NULL);
|
2006-05-10 15:07:14 +00:00
|
|
|
if (index >= 0) spawntype = PClass::FindClass ((ENamedName)StateParameters[index]);
|
2006-11-04 22:26:04 +00:00
|
|
|
if (spawntype == NULL) spawntype = PClass::FindClass("FatShot");
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
A_FaceTarget (self);
|
|
|
|
// Now here choose opposite deviation.
|
|
|
|
self->angle -= FATSPREAD;
|
|
|
|
P_SpawnMissile (self, self->target, spawntype);
|
|
|
|
|
|
|
|
missile = P_SpawnMissile (self, self->target, spawntype);
|
|
|
|
if (missile != NULL)
|
|
|
|
{
|
|
|
|
missile->angle -= FATSPREAD*2;
|
|
|
|
an = missile->angle >> ANGLETOFINESHIFT;
|
|
|
|
missile->momx = FixedMul (missile->Speed, finecosine[an]);
|
|
|
|
missile->momy = FixedMul (missile->Speed, finesine[an]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-08-10 20:48:55 +00:00
|
|
|
DEFINE_ACTION_FUNCTION(AActor, A_FatAttack3)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
|
|
|
AActor *missile;
|
|
|
|
angle_t an;
|
|
|
|
|
|
|
|
if (!self->target)
|
|
|
|
return;
|
|
|
|
|
2006-05-10 02:40:43 +00:00
|
|
|
const PClass *spawntype = NULL;
|
2006-02-24 04:48:15 +00:00
|
|
|
int index = CheckIndex (1, NULL);
|
2006-05-10 15:07:14 +00:00
|
|
|
if (index >= 0) spawntype = PClass::FindClass ((ENamedName)StateParameters[index]);
|
2006-11-04 22:26:04 +00:00
|
|
|
if (spawntype == NULL) spawntype = PClass::FindClass("FatShot");
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
A_FaceTarget (self);
|
|
|
|
|
|
|
|
missile = P_SpawnMissile (self, self->target, spawntype);
|
|
|
|
if (missile != NULL)
|
|
|
|
{
|
|
|
|
missile->angle -= FATSPREAD/2;
|
|
|
|
an = missile->angle >> ANGLETOFINESHIFT;
|
|
|
|
missile->momx = FixedMul (missile->Speed, finecosine[an]);
|
|
|
|
missile->momy = FixedMul (missile->Speed, finesine[an]);
|
|
|
|
}
|
|
|
|
|
|
|
|
missile = P_SpawnMissile (self, self->target, spawntype);
|
|
|
|
if (missile != NULL)
|
|
|
|
{
|
|
|
|
missile->angle += FATSPREAD/2;
|
|
|
|
an = missile->angle >> ANGLETOFINESHIFT;
|
|
|
|
missile->momx = FixedMul (missile->Speed, finecosine[an]);
|
|
|
|
missile->momy = FixedMul (missile->Speed, finesine[an]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//
|
|
|
|
// killough 9/98: a mushroom explosion effect, sorta :)
|
|
|
|
// Original idea: Linguica
|
|
|
|
//
|
|
|
|
|
2008-08-10 20:48:55 +00:00
|
|
|
DEFINE_ACTION_FUNCTION(AActor, A_Mushroom)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
2008-08-10 20:48:55 +00:00
|
|
|
int i, j, n = self->GetMissileDamage (0, 1);
|
2006-02-24 04:48:15 +00:00
|
|
|
|
2006-05-10 02:40:43 +00:00
|
|
|
const PClass *spawntype = NULL;
|
2008-07-19 12:40:10 +00:00
|
|
|
int index = CheckIndex (2, NULL);
|
2006-02-24 04:48:15 +00:00
|
|
|
if (index >= 0)
|
|
|
|
{
|
2006-05-10 15:07:14 +00:00
|
|
|
spawntype = PClass::FindClass((ENamedName)StateParameters[index]);
|
2008-08-10 20:48:55 +00:00
|
|
|
n = EvalExpressionI (StateParameters[index+1], self);
|
2006-02-24 04:48:15 +00:00
|
|
|
if (n == 0)
|
2008-08-10 20:48:55 +00:00
|
|
|
n = self->GetMissileDamage (0, 1);
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
2006-11-04 22:26:04 +00:00
|
|
|
if (spawntype == NULL) spawntype = PClass::FindClass("FatShot");
|
2006-02-24 04:48:15 +00:00
|
|
|
|
2008-08-10 20:48:55 +00:00
|
|
|
P_RadiusAttack (self, self->target, 128, 128, self->DamageType, true);
|
|
|
|
if (self->z <= self->floorz + (128<<FRACBITS))
|
2008-08-08 19:47:18 +00:00
|
|
|
{
|
2008-08-10 20:48:55 +00:00
|
|
|
P_HitFloor (self);
|
2008-08-08 19:47:18 +00:00
|
|
|
}
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
// Now launch mushroom cloud
|
2008-03-20 21:12:03 +00:00
|
|
|
AActor *target = Spawn("Mapspot", 0, 0, 0, NO_REPLACE); // We need something to aim at.
|
2008-08-10 20:48:55 +00:00
|
|
|
target->height = self->height;
|
2006-02-24 04:48:15 +00:00
|
|
|
for (i = -n; i <= n; i += 8)
|
|
|
|
{
|
|
|
|
for (j = -n; j <= n; j += 8)
|
|
|
|
{
|
2008-03-20 21:12:03 +00:00
|
|
|
AActor *mo;
|
2008-08-10 20:48:55 +00:00
|
|
|
target->x = self->x + (i << FRACBITS); // Aim in many directions from source
|
|
|
|
target->y = self->y + (j << FRACBITS);
|
|
|
|
target->z = self->z + (P_AproxDistance(i,j) << (FRACBITS+2)); // Aim up fairly high
|
|
|
|
mo = P_SpawnMissile (self, target, spawntype); // Launch fireball
|
2006-02-24 04:48:15 +00:00
|
|
|
if (mo != NULL)
|
|
|
|
{
|
|
|
|
mo->momx >>= 1;
|
|
|
|
mo->momy >>= 1; // Slow it down a bit
|
|
|
|
mo->momz >>= 1;
|
|
|
|
mo->flags &= ~MF_NOGRAVITY; // Make debris fall under gravity
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2008-03-20 21:12:03 +00:00
|
|
|
target->Destroy();
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|