- added code to be able to properly render attack particles when unit is not visible (turned off for now due to questions)
This commit is contained in:
parent
b83e7dae90
commit
3126a10966
|
@ -560,6 +560,8 @@ Unit::~Unit() {
|
|||
Renderer::getInstance().cleanupParticleSystems(fireParticleSystems,rsGame);
|
||||
// Must set this to null of it will be used below in stopDamageParticles()
|
||||
|
||||
Renderer::getInstance().cleanupParticleSystems(attackParticleSystems,rsGame);
|
||||
|
||||
if(Renderer::getInstance().validateParticleSystemStillExists(this->fire,rsGame) == false) {
|
||||
this->fire = NULL;
|
||||
}
|
||||
|
@ -1252,6 +1254,10 @@ void Unit::setTargetPos(const Vec2i &targetPos) {
|
|||
logSynchData(extractFileFromDirectoryPath(__FILE__).c_str(),__LINE__);
|
||||
}
|
||||
|
||||
void Unit::addAttackParticleSystem(ParticleSystem *ps) {
|
||||
attackParticleSystems.push_back(ps);
|
||||
}
|
||||
|
||||
void Unit::setVisible(const bool visible) {
|
||||
this->visible = visible;
|
||||
|
||||
|
@ -1279,6 +1285,17 @@ void Unit::setVisible(const bool visible) {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(attackParticleSystems.empty() == false) {
|
||||
for(vector<ParticleSystem*>::iterator it= attackParticleSystems.begin(); it != attackParticleSystems.end(); ++it) {
|
||||
if(Renderer::getInstance().validateParticleSystemStillExists((*it),rsGame) == true) {
|
||||
// Not sure this is a good idea since the unit be not be visible but the attack particle might be.
|
||||
// This means you won't see the attacking projectile until the unit moves into view.
|
||||
//(*it)->setVisible(visible);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(currentAttackBoostEffects.empty() == false) {
|
||||
for(unsigned int i = 0; i < currentAttackBoostEffects.size(); ++i) {
|
||||
UnitAttackBoostEffect *effect = currentAttackBoostEffects[i];
|
||||
|
|
|
@ -408,6 +408,7 @@ private:
|
|||
|
||||
vector<ParticleSystem*> fireParticleSystems;
|
||||
vector<UnitParticleSystem*> smokeParticleSystems;
|
||||
vector<ParticleSystem*> attackParticleSystems;
|
||||
|
||||
CardinalDir modelFacing;
|
||||
|
||||
|
@ -771,6 +772,8 @@ public:
|
|||
void clearCaches();
|
||||
bool showTranslatedTechTree() const;
|
||||
|
||||
void addAttackParticleSystem(ParticleSystem *ps);
|
||||
|
||||
Checksum getCRC();
|
||||
|
||||
private:
|
||||
|
|
|
@ -2299,6 +2299,7 @@ void UnitUpdater::startAttackParticleSystem(Unit *unit){
|
|||
psProj->setFactionColor(unit->getFaction()->getTexture()->getPixmapConst()->getPixel3f(0,0));
|
||||
}
|
||||
renderer.manageParticleSystem(psProj, rsGame);
|
||||
unit->addAttackParticleSystem(psProj);
|
||||
}
|
||||
else{
|
||||
hit(unit);
|
||||
|
@ -2316,6 +2317,7 @@ void UnitUpdater::startAttackParticleSystem(Unit *unit){
|
|||
if(pstProj!=NULL){
|
||||
psProj->link(psSplash);
|
||||
}
|
||||
unit->addAttackParticleSystem(psSplash);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1470,6 +1470,7 @@ void ProjectileParticleSystem::link(SplashParticleSystem *particleSystem){
|
|||
}
|
||||
|
||||
void ProjectileParticleSystem::update(){
|
||||
//printf("Projectile particle system updating...\n");
|
||||
if(state == sPlay){
|
||||
|
||||
lastPos= pos;
|
||||
|
|
Loading…
Reference in New Issue
Block a user