changed DrawParticleLine to use the new particle system

stable-5.4
David Dormagen 2013-11-28 23:27:56 +01:00
parent defe1f7525
commit 6844cbbc71
4 changed files with 29 additions and 21 deletions

View File

@ -11,9 +11,8 @@ public func ControlUse(object clonk, int x, int y)
var pos = GetRandomSpawn();
x = pos[0];
y = pos[1];
DrawParticleLine("Magic",0,0,-GetX()+x,-GetY()+y,3,64,RGB(0,128,255),RGB(0,200,255),-1);
DrawParticleLine("MagicFire",0,0,-GetX()+x,-GetY()+y,4,64,RGB(0,255,128),RGB(0,255,20),-1);
DrawParticleLine("Flash", 0,0,-GetX()+x,-GetY()+y, 3, 0, 0, 8, {Prototype = Particles_Flash(), Size = 20, R = 50, G = 50, B = 255});
// Make sure the clonk loses the attach procedure.
var action = clonk->GetAction();
if (action && clonk.ActMap[action].Procedure == DFA_ATTACH)

View File

@ -78,14 +78,25 @@ protected func FxFlagReturnDelayTimer() { return -1; }
protected func FxFlagCarriedStart(object target, effect, int temp)
{
ReducePhysicals(target, effect);
if (temp == 0)
if (temp) return;
effect.x=target->GetX();
effect.y=target->GetY();
var trans = Trans_Mul(Trans_Translate(0, -17000, 0), Trans_Rotate(-90, 0, 1, 0));
effect.mesh_id = target->AttachMesh(this, "pos_back1", "main", trans);
this.Visibility = VIS_None;
var color = GetTeamColor(this->GetTeam());
effect.tracer_particles =
{
effect.x=target->GetX();
effect.y=target->GetY();
var trans = Trans_Mul(Trans_Translate(0, -17000, 0), Trans_Rotate(-90, 0, 1, 0));
effect.mesh_id = target->AttachMesh(this, "pos_back1", "main", trans);
this.Visibility = VIS_None;
}
Size = PV_KeyFrames(0, 0, 0, 200, 5, 900, 10, 1000, 0),
R = (color >> 16) & 0xff,
G = (color >> 8) & 0xff,
B = (color >> 0) & 0xff,
Alpha = 200,
Attach = ATTACH_Back
};
return 1;
}
@ -99,9 +110,9 @@ protected func FxFlagCarriedTimer(object target, effect)
var newx = target->GetX();
var newy = target->GetY();
// Draw partical line following the flag.
if (Distance(x, y, newx, newy) > 2)
if (Distance(x, y, newx, newy) > 5)
{
DrawParticleLine("FlagTracer",AbsX(x),AbsY(y),AbsX(newx),AbsY(newy),4,30-Random(4),GetTeamColor(this->GetTeam()) | 255 <<24,GetTeamColor(this->GetTeam()) | 255 <<24);
target->CreateParticleEx("SphereSpark", 0, 0, 0, 0, PV_Random(36 * 3, 36 * 3 + 10), effect.tracer_particles);
effect.x=newx;
effect.y=newy;
}

View File

@ -31,9 +31,9 @@ public func OnProjectileHit()
public func Burst()
{
DrawParticleLine("Straw",0,0,AbsX(gate->GetX()),AbsY(gate->GetY()),6,80,RGB(255,255,255),RGB(255,150,200));
DrawParticleLine("Straw", 0, 0, AbsX(gate->GetX()), AbsY(gate->GetY()), 6, PV_Random(-5, 5), PV_Random(-5, 0), PV_Random(30, 60), Particles_Straw());
CreateParticleEx("Straw", 0, 0, PV_Random(-30, 30), PV_Random(-30,30), PV_Random(30, 120), Particles_Straw(), 200);
gate->OpenDoor();
CastParticles("Straw",130,30,0,-3,30,40,RGB(255,255,255),RGB(255,120,200));
RemoveObject();
}

View File

@ -117,10 +117,10 @@ global func CastPXS(string mat, int am, int lev, int x, int y, int angs, int ang
return;
}
global func DrawParticleLine (string particle, int x0, int y0, int x1, int y1, int prtdist, int a, int b0, int b1, int ydir)
global func DrawParticleLine(string particle, int x0, int y0, int x1, int y1, int prtdist, xdir, ydir, lifetime, proplist properties)
{
// Right parameters?
if (!prtdist)
if (!properties)
return 0;
// Calculate required number of particles.
var prtnum = Max(Distance(x0, y0, x1, y1) / prtdist, 2);
@ -132,16 +132,14 @@ global func DrawParticleLine (string particle, int x0, int y0, int x1, int y1, i
i2 = i * 256 / prtnum;
i1 = 256 - i2;
b = ((b0 & 16711935) * i1 + (b1 & 16711935) * i2) >> 8 & 16711935
| ((b0 >> 8 & 16711935) * i1 + (b1 >> 8 & 16711935) * i2) & -16711936;
if (!b && (b0 | b1))
b++;
CreateParticle(particle, x0 + (x1 - x0) * i / prtnum, y0 + (y1 - y0) * i-- / prtnum, 0, ydir, a, b);
CreateParticleEx(particle, x0 + (x1 - x0) * i / prtnum, y0 + (y1 - y0) * i-- / prtnum, xdir, ydir, lifetime, properties, 1);
}
// Succes, return number of created particles.
return prtnum;
}
/** Place a nice shaped forest. If no area is given, the whole landscape is used (which is not recommended!).
@param plants An array containing all plants that should be in the forest. plants[0] is the main plant, the others will be randomly scattered throughout the forest.
@param x The starting X-coordinate of the forest.