{
fixed_t top = mobj->z;
UINT8 locnumsegs = (mthing->extrainfo)+2;
UINT8 numleaves = max(3, (abs(mthing->angle+1) % 6) + 3);
mobj_t *coconut;
// Spawn tree segments
for (i = 0; i < locnumsegs; i++)
{
P_SpawnMobj(mobj->x, mobj->y, top, MT_AAZTREE_SEG);
top += FixedMul(mobjinfo[MT_AAZTREE_SEG].height, mobj->scale);
}
// Big coconut topper
coconut = P_SpawnMobj(mobj->x, mobj->y, top - (8<<FRACBITS), MT_AAZTREE_COCONUT);
P_SetScale(coconut, (coconut->destscale = (2*mobj->scale)));
// Spawn all of the papersprite leaves
for (i = 0; i < numleaves; i++)
{
mobj_t *leaf;
mobj->angle = FixedAngle((i * (360/numleaves))<<FRACBITS);
leaf = P_SpawnMobj(mobj->x + FINECOSINE((mobj->angle>>ANGLETOFINESHIFT) & FINEMASK),
mobj->y + FINESINE((mobj->angle>>ANGLETOFINESHIFT) & FINEMASK), top, MT_AAZTREE_LEAF);
leaf->angle = mobj->angle;
// Small coconut for each leaf
P_SpawnMobj(mobj->x + (32 * FINECOSINE((mobj->angle>>ANGLETOFINESHIFT) & FINEMASK)),
mobj->y + (32 * FINESINE((mobj->angle>>ANGLETOFINESHIFT) & FINEMASK)), top - (24<<FRACBITS), MT_AAZTREE_COCONUT);
}
P_RemoveMobj(mobj); // Don't need this helper obj anymore
return;
}