BMAP* scatter_map = "steam.dds";
// Hilfsfunktion: setzt den Vektor auf zufällige Richtung und Länge
void vec_randomize (var* vec, var range)
{
vec[0] = random(0.05) - 0.025;
vec[1] = random(0.05) - 0.025;
vec[2] = random(0.05) - 0.025;
vec_normalize(vec,random(range));
}
// Hilfsfunktion: blendet einen Partikel aus
void part_alphafade(PARTICLE *p)
{
p.alpha -= 2*time_step;
if (p.alpha <= 0) p.lifespan = 0;
p.size += (0.75 * time_step);
if(c_content(p.x,3))
{
p.lifespan = 0;
}
}
// Partikelfunktion: generiert eine verblassende Explosion in vel-Richtung
void effect_smoke(PARTICLE *p)
{
var temp[3];
vec_randomize(temp,10);
vec_add (p.vel_x, temp);
p.alpha = 25 + random(25);
p.bmap = scatter_map;
p.flags |= (BRIGHT | MOVE);
p.event = part_alphafade; // wechsle zu einer kürzeren, schnelleren Funktion
}