2006-02-24 04:48:15 +00:00
|
|
|
#include "actor.h"
|
|
|
|
#include "m_random.h"
|
|
|
|
#include "a_action.h"
|
|
|
|
#include "p_local.h"
|
|
|
|
#include "p_enemy.h"
|
|
|
|
#include "s_sound.h"
|
|
|
|
#include "a_strifeglobal.h"
|
|
|
|
#include "f_finale.h"
|
|
|
|
|
|
|
|
static FRandom pr_prog ("Programmer");
|
|
|
|
|
|
|
|
// The Programmer level ending thing ----------------------------------------
|
|
|
|
// [RH] I took some liberties to make this "cooler" than it was in Strife.
|
|
|
|
|
|
|
|
class AProgLevelEnder : public AInventory
|
|
|
|
{
|
2008-08-06 22:59:24 +00:00
|
|
|
DECLARE_CLASS (AProgLevelEnder, AInventory)
|
2006-02-24 04:48:15 +00:00
|
|
|
public:
|
|
|
|
void Tick ();
|
|
|
|
PalEntry GetBlend ();
|
|
|
|
};
|
|
|
|
|
2008-08-06 22:59:24 +00:00
|
|
|
IMPLEMENT_CLASS (AProgLevelEnder)
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
//============================================================================
|
|
|
|
//
|
|
|
|
// AProgLevelEnder :: Tick
|
|
|
|
//
|
|
|
|
// Fade to black, end the level, then unfade.
|
|
|
|
//
|
|
|
|
//============================================================================
|
|
|
|
|
|
|
|
void AProgLevelEnder::Tick ()
|
|
|
|
{
|
|
|
|
if (special2 == 0)
|
|
|
|
{ // fade out over .66 second
|
|
|
|
special1 += 255 / (TICRATE*2/3);
|
|
|
|
if (++special1 >= 255)
|
|
|
|
{
|
|
|
|
special1 = 255;
|
|
|
|
special2 = 1;
|
|
|
|
G_ExitLevel (0, false);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{ // fade in over two seconds
|
|
|
|
special1 -= 255 / (TICRATE*2);
|
|
|
|
if (special1 <= 0)
|
|
|
|
{
|
|
|
|
Destroy ();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//============================================================================
|
|
|
|
//
|
|
|
|
// AProgLevelEnder :: GetBlend
|
|
|
|
//
|
|
|
|
//============================================================================
|
|
|
|
|
|
|
|
PalEntry AProgLevelEnder::GetBlend ()
|
|
|
|
{
|
2006-12-21 04:34:43 +00:00
|
|
|
return PalEntry ((BYTE)special1, 0, 0, 0);
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//============================================================================
|
|
|
|
//
|
|
|
|
// A_ProgrammerMelee
|
|
|
|
//
|
|
|
|
//============================================================================
|
|
|
|
|
|
|
|
void A_ProgrammerMelee (AActor *self)
|
|
|
|
{
|
|
|
|
int damage;
|
|
|
|
|
|
|
|
if (self->target == NULL)
|
|
|
|
return;
|
|
|
|
|
|
|
|
A_FaceTarget (self);
|
|
|
|
|
|
|
|
if (!self->CheckMeleeRange ())
|
|
|
|
return;
|
|
|
|
|
|
|
|
S_Sound (self, CHAN_WEAPON, "programmer/clank", 1, ATTN_NORM);
|
|
|
|
|
|
|
|
damage = ((pr_prog() % 10) + 1) * 6;
|
2006-10-31 14:53:21 +00:00
|
|
|
P_DamageMobj (self->target, self, self, damage, NAME_Melee);
|
2006-02-24 04:48:15 +00:00
|
|
|
P_TraceBleed (damage, self->target, self);
|
|
|
|
}
|
|
|
|
|
|
|
|
//============================================================================
|
|
|
|
//
|
|
|
|
// A_SpotLightning
|
|
|
|
//
|
|
|
|
//============================================================================
|
|
|
|
|
|
|
|
void A_SpotLightning (AActor *self)
|
|
|
|
{
|
|
|
|
AActor *spot;
|
|
|
|
|
|
|
|
if (self->target == NULL)
|
|
|
|
return;
|
|
|
|
|
2008-08-05 22:51:51 +00:00
|
|
|
spot = Spawn("SpectralLightningSpot", self->target->x, self->target->y, ONFLOORZ, ALLOW_REPLACE);
|
2006-02-24 04:48:15 +00:00
|
|
|
if (spot != NULL)
|
|
|
|
{
|
|
|
|
spot->threshold = 25;
|
|
|
|
spot->target = self;
|
|
|
|
spot->health = -2;
|
|
|
|
spot->tracer = self->target;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//============================================================================
|
|
|
|
//
|
|
|
|
// A_SpawnProgrammerBase
|
|
|
|
//
|
|
|
|
//============================================================================
|
|
|
|
|
|
|
|
void A_SpawnProgrammerBase (AActor *self)
|
|
|
|
{
|
2008-08-06 22:59:24 +00:00
|
|
|
AActor *foo = Spawn("ProgrammerBase", self->x, self->y, self->z + 24*FRACUNIT, ALLOW_REPLACE);
|
2006-02-24 04:48:15 +00:00
|
|
|
if (foo != NULL)
|
|
|
|
{
|
|
|
|
foo->angle = self->angle + ANGLE_180 + (pr_prog.Random2() << 22);
|
|
|
|
foo->momx = FixedMul (foo->Speed, finecosine[foo->angle >> ANGLETOFINESHIFT]);
|
|
|
|
foo->momy = FixedMul (foo->Speed, finesine[foo->angle >> ANGLETOFINESHIFT]);
|
|
|
|
foo->momz = pr_prog() << 9;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//============================================================================
|
|
|
|
//
|
|
|
|
// A_ProgrammerDeath
|
|
|
|
//
|
|
|
|
//============================================================================
|
|
|
|
|
|
|
|
void A_ProgrammerDeath (AActor *self)
|
|
|
|
{
|
|
|
|
if (!CheckBossDeath (self))
|
|
|
|
return;
|
|
|
|
|
|
|
|
for (int i = 0; i < MAXPLAYERS; ++i)
|
|
|
|
{
|
|
|
|
if (playeringame[i] && players[i].health > 0)
|
|
|
|
{
|
|
|
|
players[i].mo->GiveInventoryType (RUNTIME_CLASS(AProgLevelEnder));
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2006-04-18 22:15:05 +00:00
|
|
|
// the sky change scripts are now done as special actions in MAPINFO
|
|
|
|
A_BossDeath(self);
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|