A_SmokeTrailer is an action that is used to spawn a trail of Objects of a type determined by Var1 when called repeatedly. In Doom Legacy, this action was originally used to spawn smoke trails for rockets and Lost Souls; the action itself is based on the action
A_Tracer from Doom, used for the Revenant's homing missiles, which spawned a smoke trail and followed the tracer.
A_SmokeTrailer in comparison reuses only the smoke-spawning code from
A_Tracer, hence the name of the action. In SRB2, this is used to spawn smoke trails behind the Snailer's missile and the Sea Egg's torpedo.
The position the Objects are spawned at relative to the actor depends on the speed and direction of the actor's current movement, set up so it will trail behind opposite to the actor's movement direction, and the Objects will only be spawned every 4 tics. The spawned Objects will then rise slowly in the air at a speed of 1 fracunit/tic, and their initial state's duration is randomly reduced by 0-2 tics.
Code – A_SmokeTrailer
// Function: A_SmokeTrailer
// Description: Adds smoke trails to an object.
// var1 = object # to spawn as smoke
// var2 = unused
void A_SmokeTrailer(mobj_t *actor)
INT32 locvar1 = var1;
if (LUA_CallAction("A_SmokeTrailer", actor))
if (leveltime % 4)
// add the smoke behind the rocket
if (actor->eflags & MFE_VERTICALFLIP)
th = P_SpawnMobj(actor->x-actor->momx, actor->y-actor->momy, actor->z + actor->height - FixedMul(mobjinfo[locvar1].height, actor->scale), locvar1);
th->flags2 |= MF2_OBJECTFLIP;
th = P_SpawnMobj(actor->x-actor->momx, actor->y-actor->momy, actor->z, locvar1);
P_SetObjectMomZ(th, FRACUNIT, false);
th->destscale = actor->scale;
th->tics -= P_RandomByte() & 3;
if (th->tics < 1)
th->tics = 1;