Have you try to rearrange the order of those functions?

function fade_sparks(PARTICLE *p)
{
.....
.....
}

function sparks(PARTICLE *p)
{
.....
.....
}

function laser_bolt()
{
.....
}
function laser_top()
{
.....
}