///////////////////////////////////////////////////////////////////////////////////////////////////////
// copy / overwrite the files inside this folder in your game folder (work if you are using the templates)
// don't forget to include waterfall.wdl in your main game file (office.wdl if you are using the templates)
// create a wmb entity for the water, place it in the level and attach it action waterfall
///////////////////////////////////////////////////////////////////////////////////////////////////////

function water_splash();
function splash_fade();

///////////////////////////////////////////////////////////////////////////////////////////////////////

bmap water_pcx = <water.tga>;

///////////////////////////////////////////////////////////////////////////////////////////////////////

action waterfall
{
	my.transparent = on;
	my.ambient = -40;
	while (1)
	{
		my.v -= 30 * time;		
		vec_set (temp, my.pos);
		temp.y += 60 - random(120); // add -60..+60 quants to the center of the waterfall entity (on y)
		effect (water_splash, 1, temp, normal); 
		wait (1);
	}
}

function water_splash()
{
	temp.x = random(4) - 2;
	temp.y = random(2) - 1;
	temp.z = random(1) + 1;
	vec_add (my.vel_x, temp);
	my.alpha = 10 + random(10);
	my.bmap = water_pcx;
	my.size = 20 + random(10);	
	my.flare = on;
	my.move = on;
	my.bright = on;
	my.lifespan = 200;
	my.function = splash_fade;
}

function splash_fade()
{
	my.size += 5 * time;
	my.alpha -= 1 * time;
	if (my.alpha < 0) 
	{
		my.lifespan = 0;
	}
}
