- bugfix for stopping damage particles properly
This commit is contained in:
parent
8b23634332
commit
f9ad27f655
|
@ -2202,6 +2202,8 @@ CommandResult Unit::undoCommand(Command *command){
|
|||
|
||||
void Unit::stopDamageParticles(bool force) {
|
||||
if(force == true || (hp > type->getTotalMaxHp(&totalUpgrade) / 2) ) {
|
||||
//printf("Checking to stop damageparticles for unit [%s - %d] hp = %d\n",this->getType()->getName().c_str(),this->getId(),hp);
|
||||
|
||||
if(Renderer::getInstance().validateParticleSystemStillExists(fire,rsGame) == false) {
|
||||
fire = NULL;
|
||||
}
|
||||
|
@ -2213,7 +2215,8 @@ void Unit::stopDamageParticles(bool force) {
|
|||
}
|
||||
// stop additional particles
|
||||
|
||||
for(unsigned int i = damageParticleSystems.size()-1; i <= 0; --i) {
|
||||
if(damageParticleSystems.size() > 0) {
|
||||
for(int i = damageParticleSystems.size()-1; i >= 0; --i) {
|
||||
UnitParticleSystem *ps = damageParticleSystems[i];
|
||||
UnitParticleSystemType *pst = NULL;
|
||||
int foundParticleIndexType = -2;
|
||||
|
@ -2227,21 +2230,22 @@ void Unit::stopDamageParticles(bool force) {
|
|||
}
|
||||
}
|
||||
}
|
||||
if(force == true || pst == NULL ||
|
||||
pst->getMinmaxEnabled() == false) {
|
||||
if(force == true || pst->getMinmaxEnabled() == false) {
|
||||
damageParticleSystemsInUse.erase(foundParticleIndexType);
|
||||
ps->fade();
|
||||
damageParticleSystems.pop_back();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
checkCustomizedParticleTriggers(force);
|
||||
}
|
||||
|
||||
void Unit::checkCustomizedParticleTriggers(bool force) {
|
||||
// Now check if we have special hp triggered particles
|
||||
for(unsigned int i = damageParticleSystems.size()-1; i <= 0; --i) {
|
||||
if(damageParticleSystems.size() > 0) {
|
||||
for(int i = damageParticleSystems.size()-1; i >= 0; --i) {
|
||||
UnitParticleSystem *ps = damageParticleSystems[i];
|
||||
UnitParticleSystemType *pst = NULL;
|
||||
int foundParticleIndexType = -2;
|
||||
|
@ -2283,10 +2287,12 @@ void Unit::checkCustomizedParticleTriggers(bool force) {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Now check if we have special hp triggered particles
|
||||
//start additional particles
|
||||
if( showUnitParticles && (type->damageParticleSystemTypes.empty() == false) ) {
|
||||
if(showUnitParticles && (type->damageParticleSystemTypes.empty() == false) &&
|
||||
force == false && alive == true) {
|
||||
for(unsigned int i = 0; i < type->damageParticleSystemTypes.size(); ++i) {
|
||||
UnitParticleSystemType *pst = type->damageParticleSystemTypes[i];
|
||||
|
||||
|
@ -2323,7 +2329,7 @@ void Unit::checkCustomizedParticleTriggers(bool force) {
|
|||
}
|
||||
|
||||
void Unit::startDamageParticles() {
|
||||
if(hp < type->getMaxHp() / 2 && hp > 0) {
|
||||
if(hp < type->getMaxHp() / 2 && hp > 0 && alive == true) {
|
||||
//start additional particles
|
||||
if( showUnitParticles && (!type->damageParticleSystemTypes.empty()) ) {
|
||||
for(unsigned int i = 0; i < type->damageParticleSystemTypes.size(); ++i) {
|
||||
|
|
Loading…
Reference in New Issue