2010-04-01 18:13:21 +00:00
|
|
|
/*--- Cloud effect ---*/
|
|
|
|
|
|
|
|
func Initialize()
|
|
|
|
{
|
|
|
|
SetAction("Fly");
|
2011-07-06 17:11:12 +00:00
|
|
|
SetComDir(COMD_None);
|
2010-04-01 18:13:21 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func Show(int clr, int layer, int size,bool diffuse)
|
|
|
|
{
|
|
|
|
// where on the z-axis?
|
|
|
|
// FIXME
|
|
|
|
this["Parallaxity"] = [layer,layer];
|
|
|
|
if(layer < 100) SetCategory(GetCategory()|C4D_Background);
|
|
|
|
else SetCategory(GetCategory()|C4D_Foreground);
|
|
|
|
|
2013-10-22 14:28:27 +00:00
|
|
|
if(!size) size = 360;
|
2010-04-01 18:13:21 +00:00
|
|
|
|
|
|
|
var clrmod = clr;
|
|
|
|
var count = 5;
|
|
|
|
|
2013-10-22 14:28:27 +00:00
|
|
|
var particles =
|
|
|
|
{
|
|
|
|
Prototype = Particles_Cloud(),
|
|
|
|
Alpha = (clr >> 24) & 0xff,
|
|
|
|
R = (clr >> 16) & 0xff,
|
|
|
|
G = (clr >> 8) & 0xff,
|
|
|
|
B = clr & 0xff,
|
|
|
|
Size = PV_Random(size - 20, size + 20)
|
|
|
|
};
|
|
|
|
|
2010-04-01 18:13:21 +00:00
|
|
|
// Create some clouds
|
|
|
|
for(var i=0; i<count; ++i)
|
|
|
|
{
|
2013-10-22 14:28:27 +00:00
|
|
|
var x, y;
|
2010-04-01 18:13:21 +00:00
|
|
|
|
|
|
|
var radius = RandomX(size/10);
|
|
|
|
var angle = Random(360);
|
|
|
|
x = Sin(angle,+radius);
|
|
|
|
y = Cos(angle,-radius/3);
|
|
|
|
|
2013-12-17 20:40:40 +00:00
|
|
|
CreateParticle("Cloud", x, y, PV_Random(-diffuse, +diffuse), 0, 0, particles);
|
2010-04-01 18:13:21 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// re-draw the particles of the cloud
|
2013-12-17 16:16:11 +00:00
|
|
|
func OnSynchronized()
|
2010-04-01 18:13:21 +00:00
|
|
|
{
|
|
|
|
Show();
|
|
|
|
}
|
|
|
|
|
2010-09-09 21:29:11 +00:00
|
|
|
local ActMap = {
|
2010-12-11 23:05:42 +00:00
|
|
|
Fly = {
|
|
|
|
Prototype = Action,
|
|
|
|
Name = "Fly",
|
|
|
|
Procedure = DFA_FLOAT,
|
|
|
|
Speed = 1000,
|
|
|
|
Accel = 16,
|
2011-07-06 17:11:12 +00:00
|
|
|
Decel = 16,
|
2010-12-11 23:05:42 +00:00
|
|
|
NextAction = "Hold"
|
|
|
|
},
|
2010-09-09 21:29:11 +00:00
|
|
|
};
|
|
|
|
local Name = "Cloud";
|
2015-11-29 17:28:40 +00:00
|
|
|
local Plane = 300;
|