- new switch for unit_particle _systems called static-particle-count
- Bugfix for "wild particles". ( the splash particle systems never died before! ) - Better german language file ( cpu player have english words again, words like ultra are common enough in germany )
This commit is contained in:
parent
9d8bb49a1b
commit
3b1ef055b1
|
@ -133,6 +133,15 @@ void UnitParticleSystemType::load(const XmlNode *particleSystemNode, const strin
|
|||
relativeDirection=true;
|
||||
}
|
||||
|
||||
if(particleSystemNode->hasChild("static-particle-count")){
|
||||
//staticParticleCount
|
||||
const XmlNode *staticParticleCountNode= particleSystemNode->getChild("static-particle-count");
|
||||
staticParticleCount= staticParticleCountNode->getAttribute("value")->getIntValue();
|
||||
}
|
||||
else{
|
||||
staticParticleCount=0;
|
||||
}
|
||||
|
||||
//fixed
|
||||
const XmlNode *fixedNode= particleSystemNode->getChild("fixed");
|
||||
fixed= fixedNode->getAttribute("value")->getBoolValue();
|
||||
|
@ -186,8 +195,19 @@ void UnitParticleSystemType::setValues(UnitParticleSystem *ups){
|
|||
ups->setRelativeDirection(relativeDirection);
|
||||
ups->setTeamcolorNoEnergy(teamcolorNoEnergy);
|
||||
ups->setTeamcolorEnergy(teamcolorEnergy);
|
||||
ups->setStaticParticleCount(staticParticleCount);
|
||||
ups->setRadius(radius);
|
||||
ups->setBlendMode(ParticleSystem::strToBlendMode(mode));
|
||||
//prepare system for given staticParticleCount
|
||||
if(staticParticleCount>0)
|
||||
{
|
||||
ups->setEmissionRate(0.0f);
|
||||
ups->setSpeed(0);
|
||||
direction.x= 0.0f;
|
||||
direction.y= 0.0f;
|
||||
direction.z= 0.0f;
|
||||
ups->setDirection(direction);
|
||||
}
|
||||
}
|
||||
|
||||
void UnitParticleSystemType::load(const string &dir, const string &path, RendererInterface *renderer){
|
||||
|
|
|
@ -63,6 +63,7 @@ protected:
|
|||
bool fixed;
|
||||
bool teamcolorNoEnergy;
|
||||
bool teamcolorEnergy;
|
||||
int staticParticleCount;
|
||||
string mode;
|
||||
|
||||
public:
|
||||
|
|
|
@ -211,6 +211,7 @@ private:
|
|||
Vec3f cRotation;
|
||||
Vec3f fixedAddition;
|
||||
Vec3f oldPosition;
|
||||
bool energyUp;
|
||||
public:
|
||||
enum Primitive{
|
||||
pQuad,
|
||||
|
@ -227,6 +228,7 @@ public:
|
|||
float sizeNoEnergy;
|
||||
float gravity;
|
||||
float rotation;
|
||||
int staticParticleCount;
|
||||
|
||||
public:
|
||||
UnitParticleSystem(int particleCount= 2000);
|
||||
|
@ -250,6 +252,7 @@ public:
|
|||
void setRelativeDirection(bool relativeDirection) {this->relativeDirection= relativeDirection;}
|
||||
void setFixed(bool fixed) {this->fixed= fixed;}
|
||||
void setPrimitive(Primitive primitive) {this->primitive= primitive;}
|
||||
void setStaticParticleCount(int staticParticleCount){this->staticParticleCount= staticParticleCount;}
|
||||
|
||||
static Primitive strToPrimitive(const string &str);
|
||||
|
||||
|
|
|
@ -58,7 +58,7 @@ ParticleSystem::ParticleSystem(int particleCount) {
|
|||
color= Vec4f(1.0f);
|
||||
colorNoEnergy= Vec4f(0.0f);
|
||||
emissionRate= 15.0f;
|
||||
emissionState= 1.0f;
|
||||
emissionState= 1.0f; // initialized with 1 because we must have at least one particle in the beginning!
|
||||
speed= 1.0f;
|
||||
teamcolorNoEnergy=false;
|
||||
teamcolorEnergy=false;
|
||||
|
@ -102,11 +102,11 @@ void ParticleSystem::update() {
|
|||
initParticle(p, i);
|
||||
}
|
||||
emissionState=emissionState-(float)emissionIntValue;
|
||||
if(aliveParticleCount==0){
|
||||
Particle *p = createParticle();
|
||||
initParticle(p, 0);
|
||||
emissionState=0;
|
||||
}
|
||||
// if(aliveParticleCount==0){
|
||||
// Particle *p = createParticle();
|
||||
// initParticle(p, 0);
|
||||
// emissionState=0;
|
||||
// }
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -380,10 +380,16 @@ UnitParticleSystem::UnitParticleSystem(int particleCount): ParticleSystem(partic
|
|||
rotation=0.0f;
|
||||
relativeDirection=true;
|
||||
relative=false;
|
||||
staticParticleCount=0;
|
||||
|
||||
cRotation= Vec3f(1.0f,1.0f,1.0f);
|
||||
fixedAddition = Vec3f(0.0f,0.0f,0.0f);
|
||||
|
||||
//prepare system for given staticParticleCount
|
||||
if(staticParticleCount>0)
|
||||
{
|
||||
emissionState= (float)staticParticleCount;
|
||||
}
|
||||
energyUp=false;
|
||||
}
|
||||
|
||||
void UnitParticleSystem::render(ParticleRenderer *pr,ModelRenderer *mr){
|
||||
|
@ -492,7 +498,29 @@ void UnitParticleSystem::updateParticle(Particle *p){
|
|||
p->speed+= p->accel;
|
||||
p->color = color * energyRatio + colorNoEnergy * (1.0f-energyRatio);
|
||||
p->size = particleSize * energyRatio + sizeNoEnergy * (1.0f-energyRatio);
|
||||
p->energy--;
|
||||
if(state == ParticleSystem::sFade || staticParticleCount<1)
|
||||
{
|
||||
p->energy--;
|
||||
}
|
||||
else
|
||||
{
|
||||
if(maxParticleEnergy>0)
|
||||
{
|
||||
if(energyUp){
|
||||
p->energy++;
|
||||
}
|
||||
else {
|
||||
p->energy--;
|
||||
}
|
||||
|
||||
if(p->energy==1){
|
||||
energyUp=true;
|
||||
}
|
||||
if(p->energy==maxParticleEnergy){
|
||||
energyUp=false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
p->lastPos= p->pos;
|
||||
|
@ -876,6 +904,10 @@ void SplashParticleSystem::update(){
|
|||
ParticleSystem::update();
|
||||
if(state!=sPause){
|
||||
emissionRate-= emissionRateFade;
|
||||
if(emissionRate<0.0f)
|
||||
{//otherwise this system lives forever!
|
||||
fade();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue