2006-02-24 04:48:15 +00:00
|
|
|
#include "actor.h"
|
|
|
|
#include "info.h"
|
|
|
|
#include "p_enemy.h"
|
|
|
|
#include "a_doomglobal.h"
|
|
|
|
#include "a_pickups.h"
|
|
|
|
#include "a_action.h"
|
|
|
|
#include "m_random.h"
|
|
|
|
#include "p_local.h"
|
|
|
|
#include "s_sound.h"
|
|
|
|
#include "gstrings.h"
|
|
|
|
|
|
|
|
static FRandom pr_podpain ("PodPain");
|
|
|
|
static FRandom pr_makepod ("MakePod");
|
|
|
|
static FRandom pr_teleg ("TeleGlitter");
|
|
|
|
static FRandom pr_teleg2 ("TeleGlitter2");
|
|
|
|
static FRandom pr_volcano ("VolcanoSet");
|
|
|
|
static FRandom pr_blast ("VolcanoBlast");
|
|
|
|
static FRandom pr_impact ("VolcBallImpact");
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
// PROC A_PodPain
|
|
|
|
//
|
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
void A_PodPain (AActor *actor)
|
|
|
|
{
|
|
|
|
int count;
|
|
|
|
int chance;
|
|
|
|
AActor *goo;
|
|
|
|
|
|
|
|
chance = pr_podpain ();
|
|
|
|
if (chance < 128)
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
for (count = chance > 240 ? 2 : 1; count; count--)
|
|
|
|
{
|
2008-07-21 17:03:30 +00:00
|
|
|
goo = Spawn("PodGoo", actor->x, actor->y, actor->z + 48*FRACUNIT, ALLOW_REPLACE);
|
2006-02-24 04:48:15 +00:00
|
|
|
goo->target = actor;
|
|
|
|
goo->momx = pr_podpain.Random2() << 9;
|
|
|
|
goo->momy = pr_podpain.Random2() << 9;
|
|
|
|
goo->momz = FRACUNIT/2 + (pr_podpain() << 9);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
// PROC A_RemovePod
|
|
|
|
//
|
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
void A_RemovePod (AActor *actor)
|
|
|
|
{
|
|
|
|
AActor *mo;
|
|
|
|
|
2008-07-21 17:03:30 +00:00
|
|
|
if ( (mo = actor->master))
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
|
|
|
if (mo->special1 > 0)
|
|
|
|
{
|
|
|
|
mo->special1--;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
// PROC A_MakePod
|
|
|
|
//
|
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
#define MAX_GEN_PODS 16
|
|
|
|
|
|
|
|
void A_MakePod (AActor *actor)
|
|
|
|
{
|
2008-07-21 17:03:30 +00:00
|
|
|
AActor *mo;
|
2006-02-24 04:48:15 +00:00
|
|
|
fixed_t x;
|
|
|
|
fixed_t y;
|
|
|
|
fixed_t z;
|
|
|
|
|
|
|
|
if (actor->special1 == MAX_GEN_PODS)
|
|
|
|
{ // Too many generated pods
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
x = actor->x;
|
|
|
|
y = actor->y;
|
|
|
|
z = actor->z;
|
2008-07-21 17:03:30 +00:00
|
|
|
mo = Spawn("Pod", x, y, ONFLOORZ, ALLOW_REPLACE);
|
2008-04-08 20:52:49 +00:00
|
|
|
if (!P_CheckPosition (mo, x, y))
|
2006-02-24 04:48:15 +00:00
|
|
|
{ // Didn't fit
|
|
|
|
mo->Destroy ();
|
|
|
|
return;
|
|
|
|
}
|
2008-07-21 17:03:30 +00:00
|
|
|
mo->SetState (mo->FindState("Grow"));
|
2006-02-24 04:48:15 +00:00
|
|
|
P_ThrustMobj (mo, pr_makepod()<<24, (fixed_t)(4.5*FRACUNIT));
|
|
|
|
S_Sound (mo, CHAN_BODY, "world/podgrow", 1, ATTN_IDLE);
|
|
|
|
actor->special1++; // Increment generated pod count
|
2008-07-21 17:03:30 +00:00
|
|
|
mo->master = actor; // Link the generator to the pod
|
2006-02-24 04:48:15 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
// PROC A_AccTeleGlitter
|
|
|
|
//
|
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
void A_AccTeleGlitter (AActor *actor)
|
|
|
|
{
|
|
|
|
if (++actor->health > 35)
|
|
|
|
{
|
|
|
|
actor->momz += actor->momz/2;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2006-11-27 21:51:36 +00:00
|
|
|
//----------------------------------------------------------------------------
|
2006-02-24 04:48:15 +00:00
|
|
|
//
|
|
|
|
// PROC A_VolcanoSet
|
|
|
|
//
|
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
void A_VolcanoSet (AActor *volcano)
|
|
|
|
{
|
|
|
|
volcano->tics = 105 + (pr_volcano() & 127);
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
// PROC A_VolcanoBlast
|
|
|
|
//
|
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
void A_VolcanoBlast (AActor *volcano)
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
int count;
|
|
|
|
AActor *blast;
|
|
|
|
angle_t angle;
|
|
|
|
|
|
|
|
count = 1 + (pr_blast() % 3);
|
|
|
|
for (i = 0; i < count; i++)
|
|
|
|
{
|
2008-07-21 17:03:30 +00:00
|
|
|
blast = Spawn("VolcanoBlast", volcano->x, volcano->y,
|
2006-07-16 09:10:45 +00:00
|
|
|
volcano->z + 44*FRACUNIT, ALLOW_REPLACE);
|
2006-02-24 04:48:15 +00:00
|
|
|
blast->target = volcano;
|
|
|
|
angle = pr_blast () << 24;
|
|
|
|
blast->angle = angle;
|
|
|
|
angle >>= ANGLETOFINESHIFT;
|
|
|
|
blast->momx = FixedMul (1*FRACUNIT, finecosine[angle]);
|
|
|
|
blast->momy = FixedMul (1*FRACUNIT, finesine[angle]);
|
|
|
|
blast->momz = (FRACUNIT*5/2) + (pr_blast() << 10);
|
|
|
|
S_Sound (blast, CHAN_BODY, "world/volcano/shoot", 1, ATTN_NORM);
|
|
|
|
P_CheckMissileSpawn (blast);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
// PROC A_VolcBallImpact
|
|
|
|
//
|
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
void A_VolcBallImpact (AActor *ball)
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
AActor *tiny;
|
|
|
|
angle_t angle;
|
|
|
|
|
|
|
|
if (ball->z <= ball->floorz)
|
|
|
|
{
|
|
|
|
ball->flags |= MF_NOGRAVITY;
|
2007-01-20 14:27:44 +00:00
|
|
|
ball->gravity = FRACUNIT;
|
2006-02-24 04:48:15 +00:00
|
|
|
ball->z += 28*FRACUNIT;
|
|
|
|
//ball->momz = 3*FRACUNIT;
|
|
|
|
}
|
2006-10-31 14:53:21 +00:00
|
|
|
P_RadiusAttack (ball, ball->target, 25, 25, NAME_Fire, true);
|
2006-02-24 04:48:15 +00:00
|
|
|
for (i = 0; i < 4; i++)
|
|
|
|
{
|
2008-07-21 17:03:30 +00:00
|
|
|
tiny = Spawn("VolcanoTBlast", ball->x, ball->y, ball->z, ALLOW_REPLACE);
|
2006-02-24 04:48:15 +00:00
|
|
|
tiny->target = ball;
|
|
|
|
angle = i*ANG90;
|
|
|
|
tiny->angle = angle;
|
|
|
|
angle >>= ANGLETOFINESHIFT;
|
|
|
|
tiny->momx = FixedMul (FRACUNIT*7/10, finecosine[angle]);
|
|
|
|
tiny->momy = FixedMul (FRACUNIT*7/10, finesine[angle]);
|
|
|
|
tiny->momz = FRACUNIT + (pr_impact() << 9);
|
|
|
|
P_CheckMissileSpawn (tiny);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|