A_BrainSpit
Jump to navigation
Jump to search
void A_BrainSpit (class<Actor> spawntype = null)
Spits one boss cube for the Doom2 end boss sequence.
You can also optionally specify a parameter, which is the actor to spawn instead of the default boss cube.
The sound made when launching the projectile is the attack sound of the actor using A_BrainSpit (or "brain/spit" if no attack sound is defined).
ZScript definition
Note: The ZScript definition below is for reference and may be different in the current version of GZDoom.The most up-to-date version of this code can be found on GZDoom GitHub. |
void A_BrainSpit(class<Actor> spawntype = null)
{
SpotState spstate = Level.GetSpotState();
Actor targ;
Actor spit;
bool isdefault = false;
// shoot a cube at current target
targ = spstate.GetNextInList("BossTarget", G_SkillPropertyInt(SKILLP_EasyBossBrain));
if (targ)
{
if (spawntype == null)
{
spawntype = "SpawnShot";
isdefault = true;
}
// spawn brain missile
spit = SpawnMissile (targ, spawntype);
if (spit)
{
// Boss cubes should move freely to their destination so it's
// probably best to disable all collision detection for them.
spit.bNoInteraction = spit.bNoClip;
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.Vel.xy == (0, 0))
{
spit.special2 = 0;
}
else if (abs(spit.Vel.y) > abs(spit.Vel.x))
{
spit.special2 = int((targ.pos.y - pos.y) / spit.Vel.y);
}
else
{
spit.special2 = int((targ.pos.x - pos.x) / spit.Vel.x);
}
// [GZ] Calculates when the projectile will have reached destination
spit.special2 += level.maptime;
spit.bBossCube = true;
}
if (!isdefault)
{
A_StartSound(self.AttackSound, CHAN_WEAPON, CHANF_DEFAULT, 1., ATTN_NONE);
}
else
{
// compatibility fallback
A_StartSound("brain/spit", CHAN_WEAPON, CHANF_DEFAULT, 1., ATTN_NONE);
}
}
}
Examples
This example is taken from Doom's Icon of Sin
See: SSWV A 181 A_BrainAwake; SSWV A 150 A_BrainSpit; // See SpawnShot Wait;