forked from Mirrors/openclonk
Move particle proplist definitions to global Particles.c
parent
292418a964
commit
7661b13ba6
|
@ -288,11 +288,11 @@ private func RainDrop()
|
|||
// Snow is special.
|
||||
if(mat == "Snow")
|
||||
{
|
||||
CreateParticle("RaindropSnow", x, y, xdir, 10, PV_Random(2000, 3000), Particles_Snow(RandomX(0,3), color), 0);
|
||||
CreateParticle("RaindropSnow", x, y, xdir, 10, PV_Random(2000, 3000), Particles_Snow(color), 0);
|
||||
continue;
|
||||
}
|
||||
|
||||
var particle = Particles_Rain(RandomX(10,30), color);
|
||||
var particle = Particles_Rain(color);
|
||||
if(Random(2))
|
||||
particle.Attach = ATTACH_Back;
|
||||
CreateParticle(particle_name, x, y, xdir, ydir, PV_Random(200, 300), particle, 0);
|
||||
|
@ -333,18 +333,18 @@ private func DropHit(string material_name, int x_orig, int y_orig, bool create_m
|
|||
else if(GBackLiquid(x,y))
|
||||
{
|
||||
if(!GBackLiquid(x-1,y) || !GBackLiquid(x+1,y)) y += 1;
|
||||
CreateParticle("RaindropSplashLiquid", x, y, 0, 0, 50, Particles_SplashWater(RandomX(2,5), color), 0);
|
||||
CreateParticle("RaindropSplashLiquid", x, y, 0, 0, 50, Particles_SplashWater(color), 0);
|
||||
}
|
||||
// Solid? normal splash!
|
||||
else
|
||||
{
|
||||
if( (material_name == "Acid" && GetMaterial(x,y) == Material("Earth")) || material_name == "Lava" || material_name == "DuroLava")
|
||||
Smoke(x, y, 3, RGB(150,160,150));
|
||||
CreateParticle("RaindropSplash", x, y-1, 0, 0, 5, Particles_Splash(RandomX(5,10), color), 0);
|
||||
CreateParticle("RaindropSplash", x, y-1, 0, 0, 5, Particles_Splash(color), 0);
|
||||
if(material_name == "Ice")
|
||||
CreateParticle("Hail", x, y, RandomX(-2,2), -Random(10), PV_Random(300, 300), Particles_Ice2(2, color), 0);
|
||||
CreateParticle("Hail", x, y, RandomX(-2,2), -Random(10), PV_Random(300, 300), Particles_Hail(color), 0);
|
||||
else
|
||||
CreateParticle("RaindropSmall", x, y, RandomX(-4, 4), -Random(10), PV_Random(300, 300), Particles_Rain2(20, color), 0);
|
||||
CreateParticle("RaindropSmall", x, y, RandomX(-4, 4), -Random(10), PV_Random(300, 300), Particles_RainSmall(color), 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -352,92 +352,7 @@ private func GetMaterialColor(string name)
|
|||
{
|
||||
// A Material's color is actually defined by its texture.
|
||||
var texture = GetMaterialVal("TextureOverlay", "Material", Material(name));
|
||||
var color = GetAverageTextureColor(texture);
|
||||
return [GetRGBaValue(color, 1), GetRGBaValue(color, 2), GetRGBaValue(color, 3)];
|
||||
}
|
||||
|
||||
private func Particles_Rain(iSize, color)
|
||||
{
|
||||
return
|
||||
{
|
||||
CollisionVertex = 0,
|
||||
OnCollision = PC_Die(),
|
||||
ForceY = GetGravity()/10,//PV_Gravity(100),
|
||||
Size = iSize,
|
||||
R = color[0], G = color[1], B = color[2],
|
||||
Rotation = PV_Direction(),
|
||||
CollisionDensity = 25,
|
||||
Stretch = 3000,
|
||||
};
|
||||
}
|
||||
private func Particles_Snow(iSize, color)
|
||||
{
|
||||
return
|
||||
{
|
||||
Phase = PV_Random(0, 16),
|
||||
CollisionVertex = 0,
|
||||
OnCollision = PC_Die(),
|
||||
DampingY = 1000,//PV_Cos(PV_Linear(0,1800),5,990),
|
||||
ForceY = 0,//GetGravity()/100,//PV_Gravity(100),
|
||||
ForceX = PV_Sin(PV_Step(RandomX(5,10), Random(180)),RandomX(5,8),0),
|
||||
Size = iSize,
|
||||
R = color[0], G = color[1], B = color[2],
|
||||
Rotation = PV_Random(360),
|
||||
CollisionDensity = 25,
|
||||
Stretch = 1000,
|
||||
};
|
||||
}
|
||||
private func Particles_Rain2(iSize, color)
|
||||
{
|
||||
return
|
||||
{
|
||||
CollisionVertex = 0,
|
||||
OnCollision = PC_Die(),
|
||||
ForceY = PV_Gravity(60),
|
||||
Size = iSize,
|
||||
R = color[0], G = color[1], B = color[2],
|
||||
Rotation = PV_Direction(),
|
||||
CollisionDensity = 25,
|
||||
Stretch = PV_KeyFrames(0, 0, 1000, 500, 1000, 1000, 0),
|
||||
};
|
||||
}
|
||||
private func Particles_Splash(iSize, color)
|
||||
{
|
||||
return
|
||||
{
|
||||
Phase = PV_Linear(0, 4),
|
||||
Alpha = PV_KeyFrames(0, 0, 255, 500, 255, 1000, 0),
|
||||
Size = iSize,
|
||||
R = color[0], G = color[1], B = color[2],
|
||||
Rotation = PV_Random(-5,5),
|
||||
Strech = 500+Random(500),
|
||||
};
|
||||
}
|
||||
private func Particles_SplashWater(iSize, color)
|
||||
{
|
||||
return
|
||||
{
|
||||
Phase = PV_Linear(0, 13),
|
||||
Alpha = PV_KeyFrames(0, 0, 255, 500, 255, 1000, 0),
|
||||
Size = iSize,
|
||||
R = color[0], G = color[1], B = color[2],
|
||||
Rotation = PV_Random(-5,5),
|
||||
Stretch = PV_Linear(3000, 3000),
|
||||
Attach = ATTACH_Back,
|
||||
};
|
||||
}
|
||||
private func Particles_Ice2(iSize, color)
|
||||
{
|
||||
return
|
||||
{
|
||||
CollisionVertex = 0,
|
||||
ForceY = PV_Gravity(60),
|
||||
OnCollision = PC_Stop(),
|
||||
Size = iSize,
|
||||
Alpha = PV_KeyFrames(255, 0, 255, 500, 255, 1000, 0),
|
||||
R = color[0], G = color[1], B = color[2],
|
||||
Rotation = PV_Random(360),
|
||||
};
|
||||
return GetAverageTextureColor(texture);
|
||||
}
|
||||
|
||||
// Launches possibly one thunder strike from the cloud.
|
||||
|
|
|
@ -344,4 +344,108 @@ global func Particles_ElectroSpark2()
|
|||
Prototype = Particles_ElectroSpark1(),
|
||||
Phase = PV_Linear(6, 11),
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
/* weather particles */
|
||||
|
||||
global func Particles_Rain(int color)
|
||||
{
|
||||
return
|
||||
{
|
||||
CollisionVertex = 0,
|
||||
OnCollision = PC_Die(),
|
||||
ForceY = PV_Gravity(100),
|
||||
Size = PV_Random(10, 30),
|
||||
R = GetRGBaValue(color, 1),
|
||||
G = GetRGBaValue(color, 2),
|
||||
B = GetRGBaValue(color, 3),
|
||||
Rotation = PV_Direction(),
|
||||
CollisionDensity = 25,
|
||||
Stretch = 3000,
|
||||
};
|
||||
}
|
||||
|
||||
global func Particles_Snow(int color)
|
||||
{
|
||||
return
|
||||
{
|
||||
Phase = PV_Random(0, 16),
|
||||
CollisionVertex = 0,
|
||||
OnCollision = PC_Die(),
|
||||
DampingY = 1000,//PV_Cos(PV_Linear(0,1800),5,990),
|
||||
ForceY = 0,//GetGravity()/100,//PV_Gravity(100),
|
||||
// TODO: PV_Random() here?
|
||||
ForceX = PV_Sin(PV_Step(PV_Random(5, 10), PV_Random(0, 180)), PV_Random(5, 8), 0),
|
||||
Size = PV_Random(0, 3),
|
||||
R = GetRGBaValue(color, 1),
|
||||
G = GetRGBaValue(color, 2),
|
||||
B = GetRGBaValue(color, 3),
|
||||
Rotation = PV_Random(360),
|
||||
CollisionDensity = 25,
|
||||
Stretch = 1000,
|
||||
};
|
||||
}
|
||||
|
||||
global func Particles_RainSmall(int color)
|
||||
{
|
||||
return
|
||||
{
|
||||
CollisionVertex = 0,
|
||||
OnCollision = PC_Die(),
|
||||
ForceY = PV_Gravity(60),
|
||||
Size = 20,
|
||||
R = GetRGBaValue(color, 1),
|
||||
G = GetRGBaValue(color, 2),
|
||||
B = GetRGBaValue(color, 3),
|
||||
Rotation = PV_Direction(),
|
||||
CollisionDensity = 25,
|
||||
Stretch = PV_KeyFrames(0, 0, 1000, 500, 1000, 1000, 0),
|
||||
};
|
||||
}
|
||||
|
||||
global func Particles_Splash(int color)
|
||||
{
|
||||
return
|
||||
{
|
||||
Phase = PV_Linear(0, 4),
|
||||
Alpha = PV_KeyFrames(0, 0, 255, 500, 255, 1000, 0),
|
||||
Size = PV_Random(5, 10),
|
||||
R = GetRGBaValue(color, 1),
|
||||
G = GetRGBaValue(color, 2),
|
||||
B = GetRGBaValue(color, 3),
|
||||
Rotation = PV_Random(-5,5),
|
||||
Stretch = PV_Random(500, 1000),
|
||||
};
|
||||
}
|
||||
|
||||
global func Particles_SplashWater(int color)
|
||||
{
|
||||
return
|
||||
{
|
||||
Phase = PV_Linear(0, 13),
|
||||
Alpha = PV_KeyFrames(0, 0, 255, 500, 255, 1000, 0),
|
||||
Size = PV_Random(2, 5),
|
||||
R = GetRGBaValue(color, 1),
|
||||
G = GetRGBaValue(color, 2),
|
||||
B = GetRGBaValue(color, 3),
|
||||
Rotation = PV_Random(-5,5),
|
||||
Stretch = 3000,
|
||||
Attach = ATTACH_Back,
|
||||
};
|
||||
}
|
||||
|
||||
global func Particles_Hail(int color)
|
||||
{
|
||||
return
|
||||
{
|
||||
CollisionVertex = 0,
|
||||
ForceY = PV_Gravity(60),
|
||||
OnCollision = PC_Stop(),
|
||||
Size = 2,
|
||||
Alpha = PV_KeyFrames(255, 0, 255, 500, 255, 1000, 0),
|
||||
R = GetRGBaValue(color, 1),
|
||||
G = GetRGBaValue(color, 2),
|
||||
B = GetRGBaValue(color, 3),
|
||||
Rotation = PV_Random(360),
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue