2008-09-15 14:11:05 +00:00
|
|
|
/*
|
2006-02-24 04:48:15 +00:00
|
|
|
#include "info.h"
|
|
|
|
#include "a_pickups.h"
|
|
|
|
#include "a_artifacts.h"
|
|
|
|
#include "gstrings.h"
|
|
|
|
#include "p_local.h"
|
|
|
|
#include "s_sound.h"
|
|
|
|
#include "ravenshared.h"
|
2008-08-10 20:48:55 +00:00
|
|
|
#include "thingdef/thingdef.h"
|
2008-09-14 23:54:38 +00:00
|
|
|
#include "g_level.h"
|
2008-09-15 14:11:05 +00:00
|
|
|
*/
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
void A_Summon (AActor *);
|
|
|
|
|
|
|
|
// Dark Servant Artifact ----------------------------------------------------
|
|
|
|
|
|
|
|
class AArtiDarkServant : public AInventory
|
|
|
|
{
|
2008-08-09 11:35:42 +00:00
|
|
|
DECLARE_CLASS (AArtiDarkServant, AInventory)
|
2006-02-24 04:48:15 +00:00
|
|
|
public:
|
|
|
|
bool Use (bool pickup);
|
|
|
|
};
|
|
|
|
|
2008-08-08 15:18:23 +00:00
|
|
|
IMPLEMENT_CLASS (AArtiDarkServant)
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
//============================================================================
|
|
|
|
//
|
|
|
|
// Activate the summoning artifact
|
|
|
|
//
|
|
|
|
//============================================================================
|
|
|
|
|
|
|
|
bool AArtiDarkServant::Use (bool pickup)
|
|
|
|
{
|
2008-08-03 16:13:23 +00:00
|
|
|
AActor *mo = P_SpawnPlayerMissile (Owner, PClass::FindClass ("SummoningDoll"));
|
2006-02-24 04:48:15 +00:00
|
|
|
if (mo)
|
|
|
|
{
|
|
|
|
mo->target = Owner;
|
|
|
|
mo->tracer = Owner;
|
|
|
|
mo->momz = 5*FRACUNIT;
|
|
|
|
}
|
2006-04-10 21:54:50 +00:00
|
|
|
return true;
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//============================================================================
|
|
|
|
//
|
|
|
|
// A_Summon
|
|
|
|
//
|
|
|
|
//============================================================================
|
|
|
|
|
2008-08-10 20:48:55 +00:00
|
|
|
DEFINE_ACTION_FUNCTION(AActor, A_Summon)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
2006-04-23 20:12:27 +00:00
|
|
|
AMinotaurFriend *mo;
|
2006-02-24 04:48:15 +00:00
|
|
|
|
2008-08-10 20:48:55 +00:00
|
|
|
mo = Spawn<AMinotaurFriend> (self->x, self->y, self->z, ALLOW_REPLACE);
|
2006-02-24 04:48:15 +00:00
|
|
|
if (mo)
|
|
|
|
{
|
2008-08-10 20:48:55 +00:00
|
|
|
if (P_TestMobjLocation(mo) == false || !self->tracer)
|
2006-02-24 04:48:15 +00:00
|
|
|
{ // Didn't fit - change back to artifact
|
|
|
|
mo->Destroy ();
|
2008-08-10 20:48:55 +00:00
|
|
|
AActor *arti = Spawn<AArtiDarkServant> (self->x, self->y, self->z, ALLOW_REPLACE);
|
2006-02-24 04:48:15 +00:00
|
|
|
if (arti) arti->flags |= MF_DROPPED;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
mo->StartTime = level.maptime;
|
2008-08-10 20:48:55 +00:00
|
|
|
if (self->tracer->flags & MF_CORPSE)
|
2006-02-24 04:48:15 +00:00
|
|
|
{ // Master dead
|
|
|
|
mo->tracer = NULL; // No master
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2008-08-10 20:48:55 +00:00
|
|
|
mo->tracer = self->tracer; // Pointer to master
|
2006-07-16 09:10:45 +00:00
|
|
|
AInventory *power = Spawn<APowerMinotaur> (0, 0, 0, NO_REPLACE);
|
2008-09-13 22:08:41 +00:00
|
|
|
power->CallTryPickup (self->tracer);
|
2008-08-10 20:48:55 +00:00
|
|
|
if (self->tracer->player != NULL)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
2008-08-10 20:48:55 +00:00
|
|
|
mo->FriendPlayer = int(self->tracer->player - players + 1);
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Make smoke puff
|
2008-08-10 20:48:55 +00:00
|
|
|
Spawn ("MinotaurSmoke", self->x, self->y, self->z, ALLOW_REPLACE);
|
|
|
|
S_Sound (self, CHAN_VOICE, mo->ActiveSound, 1, ATTN_NORM);
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
}
|