Beispiel #1
0
void P_DSparilTeleport (AActor *actor)
{
	fixed_t prevX;
	fixed_t prevY;
	fixed_t prevZ;
	AActor *mo;
	AActor *spot;

	DSpotState *state = DSpotState::GetSpotState();
	if (state == NULL) return;

	spot = state->GetSpotWithMinMaxDistance(PClass::FindClass("BossSpot"), actor->X(), actor->Y(), 128*FRACUNIT, 0);
	if (spot == NULL) return;

	prevX = actor->X();
	prevY = actor->Y();
	prevZ = actor->Z();
	if (P_TeleportMove (actor, spot->Pos(), false))
	{
		mo = Spawn("Sorcerer2Telefade", prevX, prevY, prevZ, ALLOW_REPLACE);
		if (mo) mo->Translation = actor->Translation;
		S_Sound (mo, CHAN_BODY, "misc/teleport", 1, ATTN_NORM);
		actor->SetState (actor->FindState("Teleport"));
		S_Sound (actor, CHAN_BODY, "misc/teleport", 1, ATTN_NORM);
		actor->SetZ(actor->floorz, false);
		actor->angle = spot->angle;
		actor->velx = actor->vely = actor->velz = 0;
	}
}
Beispiel #2
0
void P_DSparilTeleport (AActor *actor)
{
	DVector3 prev;
	AActor *mo;
	AActor *spot;

	DSpotState *state = DSpotState::GetSpotState();
	if (state == NULL) return;

	spot = state->GetSpotWithMinMaxDistance(PClass::FindClass("BossSpot"), actor->X(), actor->Y(), 128, 0);
	if (spot == NULL) return;

	prev = actor->Pos();
	if (P_TeleportMove (actor, spot->Pos(), false))
	{
		mo = Spawn("Sorcerer2Telefade", prev, ALLOW_REPLACE);
		if (mo) mo->Translation = actor->Translation;
		S_Sound (mo, CHAN_BODY, "misc/teleport", 1, ATTN_NORM);
		actor->SetState (actor->FindState("Teleport"));
		S_Sound (actor, CHAN_BODY, "misc/teleport", 1, ATTN_NORM);
		actor->SetZ(actor->floorz);
		actor->Angles.Yaw = spot->Angles.Yaw;
		actor->Vel.Zero();
	}
}
DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SpawnSingleItem)
{
	PARAM_ACTION_PROLOGUE;
	PARAM_CLASS		(cls, AActor);
	PARAM_INT_OPT	(fail_sp) { fail_sp = 0; }
	PARAM_INT_OPT	(fail_co) { fail_co = 0; }
	PARAM_INT_OPT	(fail_dm) { fail_dm = 0; }

	AActor *spot = NULL;
	DSpotState *state = DSpotState::GetSpotState();

	if (state != NULL) spot = state->GetRandomSpot(self->GetClass(), true);
	if (spot == NULL) return 0;

	if (!multiplayer && pr_spawnmace() < fail_sp)
	{ // Sometimes doesn't show up if not in deathmatch
		return 0;
	}

	if (multiplayer && !deathmatch && pr_spawnmace() < fail_co)
	{
		return 0;
	}

	if (deathmatch && pr_spawnmace() < fail_dm)
	{
		return 0;
	}

	if (cls == NULL)
	{
		return 0;
	}

	AActor *spawned = Spawn(cls, self->Pos(), ALLOW_REPLACE);

	if (spawned)
	{
		spawned->SetOrigin (spot->Pos(), false);
		spawned->SetZ(spawned->floorz);
		// We want this to respawn.
		if (!(self->flags & MF_DROPPED)) 
		{
			spawned->flags &= ~MF_DROPPED;
		}
		if (spawned->IsKindOf(RUNTIME_CLASS(AInventory)))
		{
			static_cast<AInventory*>(spawned)->SpawnPointClass = self->GetClass();
		}
	}
	return 0;
}
Beispiel #4
0
bool AInventory::DoRespawn ()
{
	if (SpawnPointClass != NULL)
	{
		AActor *spot = NULL;
		DSpotState *state = DSpotState::GetSpotState();

		if (state != NULL) spot = state->GetRandomSpot(SpawnPointClass);
		if (spot != NULL) 
		{
			SetOrigin (spot->Pos(), false);
			SetZ(floorz);
		}
	}
	return true;
}
Beispiel #5
0
DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_BrainSpit)
{
	DSpotState *state = DSpotState::GetSpotState();
	AActor *targ;
	AActor *spit;
	bool isdefault = false;

	ACTION_PARAM_START(1);
	ACTION_PARAM_CLASS(spawntype, 0);

	// shoot a cube at current target
	targ = state->GetNextInList(PClass::FindClass("BossTarget"), G_SkillProperty(SKILLP_EasyBossBrain));

	if (targ != NULL)
	{
		if (spawntype == NULL) 
		{
			spawntype = PClass::FindClass("SpawnShot");
			isdefault = true;
		}

		// spawn brain missile
		spit = P_SpawnMissile (self, targ, spawntype);

		if (spit != NULL)
		{
			// Boss cubes should move freely to their destination so it's
			// probably best to disable all collision detection for them.
			if (spit->flags & MF_NOCLIP) spit->flags5 |= MF5_NOINTERACTION;
	
			spit->target = targ;
			spit->master = self;
			// [RH] Do this correctly for any trajectory. Doom would divide by 0
			// if the target had the same y coordinate as the spitter.
			if ((spit->velx | spit->vely) == 0)
			{
				spit->special2 = 0;
			}
			else if (abs(spit->vely) > abs(spit->velx))
			{
				spit->special2 = (targ->y - self->y) / spit->vely;
			}
			else
			{
				spit->special2 = (targ->x - self->x) / spit->velx;
			}
			// [GZ] Calculates when the projectile will have reached destination
			spit->special2 += level.maptime;
			spit->flags6 |= MF6_BOSSCUBE;
		}

		if (!isdefault)
		{
			S_Sound(self, CHAN_WEAPON, self->AttackSound, 1, ATTN_NONE);
		}
		else
		{
			// compatibility fallback
			S_Sound (self, CHAN_WEAPON, "brain/spit", 1, ATTN_NONE);
		}
	}
}
void ASpecialSpot::Destroy()
{
	DSpotState *state = DSpotState::GetSpotState(false);
	if (state != NULL) state->RemoveSpot(this);
	Super::Destroy();
}
void ASpecialSpot::BeginPlay()
{
	DSpotState *state = DSpotState::GetSpotState();
	if (state != NULL) state->AddSpot(this);
}