|
This article or section is incomplete. It doesn't have all of the necessary core information on this topic. Please help the SRB2 Wiki by finishing this article.
|
A_SlingAppear is an action used by the Hidden Chain to turn it into a spinning chain with four chain links. This action spawns the chain links, and sets the relevant properties for the actor to properly behave like a spinning chain.
Code – A_SlingAppear
|
|
//
// Function: A_SlingAppear
//
// Appears a sling.
//
// var1 = unused
// var2 = unused
//
void A_SlingAppear(mobj_t *actor)
{
UINT8 mlength = 4;
mobj_t *spawnee, *hprev;
#ifdef HAVE_BLUA
if (LUA_CallAction("A_SlingAppear", actor))
return;
#endif
P_UnsetThingPosition(actor);
actor->flags &= ~(MF_NOBLOCKMAP|MF_NOCLIP|MF_NOGRAVITY|MF_NOCLIPHEIGHT);
P_SetThingPosition(actor);
actor->lastlook = 128;
actor->movecount = actor->lastlook;
actor->threshold = 0;
actor->movefactor = actor->threshold;
actor->friction = 128;
hprev = P_SpawnMobj(actor->x, actor->y, actor->z, MT_SMALLGRABCHAIN);
P_SetTarget(&hprev->tracer, actor);
P_SetTarget(&hprev->hprev, actor);
P_SetTarget(&actor->hnext, hprev);
hprev->flags |= MF_NOCLIP|MF_NOCLIPHEIGHT;
hprev->movecount = mlength;
mlength--;
while (mlength > 0)
{
spawnee = P_SpawnMobj(actor->x, actor->y, actor->z, MT_SMALLMACECHAIN);
P_SetTarget(&spawnee->tracer, actor);
P_SetTarget(&spawnee->hprev, hprev);
P_SetTarget(&hprev->hnext, spawnee);
hprev = spawnee;
spawnee->flags |= MF_NOCLIP|MF_NOCLIPHEIGHT;
spawnee->movecount = mlength;
mlength--;
}
}
|
|