mirror of
https://github.com/glest/glest-source.git
synced 2025-08-20 07:01:21 +02:00
- 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:
@@ -560,6 +560,8 @@ Unit::~Unit() {
|
|||||||
Renderer::getInstance().cleanupParticleSystems(fireParticleSystems,rsGame);
|
Renderer::getInstance().cleanupParticleSystems(fireParticleSystems,rsGame);
|
||||||
// Must set this to null of it will be used below in stopDamageParticles()
|
// 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) {
|
if(Renderer::getInstance().validateParticleSystemStillExists(this->fire,rsGame) == false) {
|
||||||
this->fire = NULL;
|
this->fire = NULL;
|
||||||
}
|
}
|
||||||
@@ -1252,6 +1254,10 @@ void Unit::setTargetPos(const Vec2i &targetPos) {
|
|||||||
logSynchData(extractFileFromDirectoryPath(__FILE__).c_str(),__LINE__);
|
logSynchData(extractFileFromDirectoryPath(__FILE__).c_str(),__LINE__);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Unit::addAttackParticleSystem(ParticleSystem *ps) {
|
||||||
|
attackParticleSystems.push_back(ps);
|
||||||
|
}
|
||||||
|
|
||||||
void Unit::setVisible(const bool visible) {
|
void Unit::setVisible(const bool visible) {
|
||||||
this->visible = 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) {
|
if(currentAttackBoostEffects.empty() == false) {
|
||||||
for(unsigned int i = 0; i < currentAttackBoostEffects.size(); ++i) {
|
for(unsigned int i = 0; i < currentAttackBoostEffects.size(); ++i) {
|
||||||
UnitAttackBoostEffect *effect = currentAttackBoostEffects[i];
|
UnitAttackBoostEffect *effect = currentAttackBoostEffects[i];
|
||||||
|
@@ -408,6 +408,7 @@ private:
|
|||||||
|
|
||||||
vector<ParticleSystem*> fireParticleSystems;
|
vector<ParticleSystem*> fireParticleSystems;
|
||||||
vector<UnitParticleSystem*> smokeParticleSystems;
|
vector<UnitParticleSystem*> smokeParticleSystems;
|
||||||
|
vector<ParticleSystem*> attackParticleSystems;
|
||||||
|
|
||||||
CardinalDir modelFacing;
|
CardinalDir modelFacing;
|
||||||
|
|
||||||
@@ -771,6 +772,8 @@ public:
|
|||||||
void clearCaches();
|
void clearCaches();
|
||||||
bool showTranslatedTechTree() const;
|
bool showTranslatedTechTree() const;
|
||||||
|
|
||||||
|
void addAttackParticleSystem(ParticleSystem *ps);
|
||||||
|
|
||||||
Checksum getCRC();
|
Checksum getCRC();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@@ -2299,6 +2299,7 @@ void UnitUpdater::startAttackParticleSystem(Unit *unit){
|
|||||||
psProj->setFactionColor(unit->getFaction()->getTexture()->getPixmapConst()->getPixel3f(0,0));
|
psProj->setFactionColor(unit->getFaction()->getTexture()->getPixmapConst()->getPixel3f(0,0));
|
||||||
}
|
}
|
||||||
renderer.manageParticleSystem(psProj, rsGame);
|
renderer.manageParticleSystem(psProj, rsGame);
|
||||||
|
unit->addAttackParticleSystem(psProj);
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
hit(unit);
|
hit(unit);
|
||||||
@@ -2316,6 +2317,7 @@ void UnitUpdater::startAttackParticleSystem(Unit *unit){
|
|||||||
if(pstProj!=NULL){
|
if(pstProj!=NULL){
|
||||||
psProj->link(psSplash);
|
psProj->link(psSplash);
|
||||||
}
|
}
|
||||||
|
unit->addAttackParticleSystem(psSplash);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -1470,6 +1470,7 @@ void ProjectileParticleSystem::link(SplashParticleSystem *particleSystem){
|
|||||||
}
|
}
|
||||||
|
|
||||||
void ProjectileParticleSystem::update(){
|
void ProjectileParticleSystem::update(){
|
||||||
|
//printf("Projectile particle system updating...\n");
|
||||||
if(state == sPlay){
|
if(state == sPlay){
|
||||||
|
|
||||||
lastPos= pos;
|
lastPos= pos;
|
||||||
|
Reference in New Issue
Block a user