diff --git a/mk/linux/configure.ac b/mk/linux/configure.ac index 7d0176c7..9885ec95 100644 --- a/mk/linux/configure.ac +++ b/mk/linux/configure.ac @@ -4,7 +4,7 @@ #---------------------------------------------------------------------------- AC_PREREQ([2.54]) -AC_INIT([megaglest], [3.2.4-2-beta2], [matze@braunis.de]) +AC_INIT([megaglest], [3.2.4-1-beta3], [matze@braunis.de]) AC_CONFIG_SRCDIR([mk/jam/build.jam]) AC_CONFIG_AUX_DIR([mk/autoconf]) diff --git a/source/glest_game/facilities/game_util.cpp b/source/glest_game/facilities/game_util.cpp index 3a29dcec..8be3f8f5 100644 --- a/source/glest_game/facilities/game_util.cpp +++ b/source/glest_game/facilities/game_util.cpp @@ -22,7 +22,7 @@ using namespace Shared::Util; namespace Glest{ namespace Game{ const string mailString= "contact_game@glest.org"; -const string glestVersionString= "v3.2.4-2-beta2"; +const string glestVersionString= "v3.2.4-1-beta3"; string getCrashDumpFileName(){ return "glest"+glestVersionString+".dmp"; diff --git a/source/glest_game/graphics/renderer.cpp b/source/glest_game/graphics/renderer.cpp index 23005b46..55d7700b 100644 --- a/source/glest_game/graphics/renderer.cpp +++ b/source/glest_game/graphics/renderer.cpp @@ -1355,15 +1355,11 @@ void Renderer::renderUnits(){ pointCount+= model->getVertexCount(); glPopMatrix(); - if(unit->skillParticleSystem!=NULL){ - unit->skillParticleSystem->setVisible(true); - } + unit->setVisible(true); } else { - if(unit->skillParticleSystem!=NULL){ - unit->skillParticleSystem->setVisible(false); - } + unit->setVisible(false); } } } diff --git a/source/glest_game/type_instances/unit.cpp b/source/glest_game/type_instances/unit.cpp index 0f830846..cd81587e 100644 --- a/source/glest_game/type_instances/unit.cpp +++ b/source/glest_game/type_instances/unit.cpp @@ -28,6 +28,7 @@ using namespace Shared::Graphics; using namespace Shared::Util; + namespace Glest{ namespace Game{ // ===================================================== @@ -140,7 +141,6 @@ Unit::Unit(int id, const Vec2i &pos, const UnitType *type, Faction *faction, Map if(getType()->getField(fLand)) currField=fLand; fire= NULL; - skillParticleSystem=NULL; computeTotalUpgrade(); @@ -314,21 +314,22 @@ void Unit::setCurrSkill(const SkillType *currSkill){ animProgress= 0; lastAnimProgress= 0; - if(skillParticleSystem!=NULL){ - skillParticleSystem->fade(); - skillParticleSystem=NULL; + while(!unitParticleSystems.empty()){ + unitParticleSystems.back()->fade(); + unitParticleSystems.pop_back(); } } - if((currSkill->getParticleSystemType()!=NULL) - && (skillParticleSystem==NULL) ){ - UnitParticleSystemType *upst=currSkill->getParticleSystemType(); - UnitParticleSystem *ups; - ups= new UnitParticleSystem(200); - upst->setValues(ups); - ups->setPos(getCurrVector()); - ups->setTeamNumber(getTeam()); - skillParticleSystem= ups; - Renderer::getInstance().manageParticleSystem(ups, rsGame); + if((!currSkill->unitParticleSystemTypes.empty()) + && (unitParticleSystems.empty()) ){ + for(UnitParticleSystemTypes::const_iterator it= currSkill->unitParticleSystemTypes.begin(); it!=currSkill->unitParticleSystemTypes.end(); ++it){ + UnitParticleSystem *ups; + ups= new UnitParticleSystem(200); + (*it)->setValues(ups); + ups->setPos(getCurrVector()); + ups->setTeamNumber(getTeam()); + unitParticleSystems.push_back(ups); + Renderer::getInstance().manageParticleSystem(ups, rsGame); + } } progress2= 0; this->currSkill= currSkill; @@ -365,6 +366,12 @@ void Unit::setTargetPos(const Vec2i &targetPos){ this->targetPos= targetPos; } +void Unit::setVisible(const bool visible){ + for(UnitParticleSystems::iterator it= unitParticleSystems.begin(); it!=unitParticleSystems.end(); ++it){ + (*it)->setVisible(visible); + } +} + // =============================== Render related ================================== const Model *Unit::getCurrentModel() const{ @@ -635,12 +642,10 @@ bool Unit::update(){ { fire->setPos(getCurrVector()); } - if (skillParticleSystem!=NULL) - { - skillParticleSystem->setPos(getCurrVector()); - skillParticleSystem->setRotation(getRotation()); + for(UnitParticleSystems::iterator it= unitParticleSystems.begin(); it!=unitParticleSystems.end(); ++it){ + (*it)->setPos(getCurrVector()); + (*it)->setRotation(getRotation()); } - //checks if(animProgress>1.f){ animProgress= currSkill->getClass()==scDie? 1.f: 0.f; diff --git a/source/glest_game/type_instances/unit.h b/source/glest_game/type_instances/unit.h index 2c68bd29..d8e837c1 100644 --- a/source/glest_game/type_instances/unit.h +++ b/source/glest_game/type_instances/unit.h @@ -122,13 +122,14 @@ class Unit{ private: typedef list Commands; typedef list Observers; + typedef list UnitParticleSystems; public: static const float speedDivider; static const int maxDeadCount; static const float highlightTime; static const int invalidId; - UnitParticleSystem *skillParticleSystem; + //UnitParticleSystem *skillParticleSystem; private: int id; @@ -175,6 +176,7 @@ private: Commands commands; Observers observers; + UnitParticleSystems unitParticleSystems; public: Unit(int id, const Vec2i &pos, const UnitType *type, Faction *faction, Map *map); @@ -209,7 +211,6 @@ public: float getRotation() const {return rotation;} float getVerticalRotation() const; ParticleSystem *getFire() const {return fire;} - UnitParticleSystem *getSkillParticleSystem() const {return skillParticleSystem;} int getKills() {return kills;} const Level *getLevel() const {return level;} const Level *getNextLevel() const; @@ -248,6 +249,7 @@ public: void setTarget(const Unit *unit); void setTargetVec(const Vec3f &targetVec) {this->targetVec= targetVec;} void setMeetingPos(const Vec2i &meetingPos) {this->meetingPos= meetingPos;} + void setVisible(const bool visible); //render related const Model *getCurrentModel() const; diff --git a/source/glest_game/types/skill_type.cpp b/source/glest_game/types/skill_type.cpp index 8c6e1baa..62622813 100644 --- a/source/glest_game/types/skill_type.cpp +++ b/source/glest_game/types/skill_type.cpp @@ -33,9 +33,12 @@ namespace Glest{ namespace Game{ // ===================================================== SkillType::~SkillType(){ - delete particleSystemType; - deleteValues(sounds.getSounds().begin(), sounds.getSounds().end()); + //remove unitParticleSystemTypes + while(!unitParticleSystemTypes.empty()){ + delete unitParticleSystemTypes.back(); + unitParticleSystemTypes.pop_back(); + } } void SkillType::load(const XmlNode *sn, const string &dir, const TechTree *tt, const FactionType *ft){ @@ -57,19 +60,20 @@ void SkillType::load(const XmlNode *sn, const string &dir, const TechTree *tt, c animation->load(dir + "/" + path); //particles - if(sn->hasChild("particle")){ - const XmlNode *particleNode= sn->getChild("particle"); + if(sn->hasChild("particles")){ + const XmlNode *particleNode= sn->getChild("particles"); bool particleEnabled= particleNode->getAttribute("value")->getBoolValue(); if(particleEnabled){ - string path= particleNode->getAttribute("path")->getRestrictedValue(); - particleSystemType= new UnitParticleSystemType(); - particleSystemType->load(dir, dir + "/" + path); + for(int i=0; igetChildCount(); ++i){ + const XmlNode *particleFileNode= particleNode->getChild("particle-file", i); + string path= particleFileNode->getAttribute("path")->getRestrictedValue(); + UnitParticleSystemType *unitParticleSystemType= new UnitParticleSystemType(); + unitParticleSystemType->load(dir, dir + "/" + path); + unitParticleSystemTypes.push_back(unitParticleSystemType); + } } } - else - { - particleSystemType=NULL; - } + //sound diff --git a/source/glest_game/types/skill_type.h b/source/glest_game/types/skill_type.h index fecf8a3f..d3ce4930 100644 --- a/source/glest_game/types/skill_type.h +++ b/source/glest_game/types/skill_type.h @@ -64,6 +64,7 @@ enum SkillClass{ scCount }; +typedef list UnitParticleSystemTypes; // ===================================================== // class SkillType // @@ -71,6 +72,8 @@ enum SkillClass{ // ===================================================== class SkillType{ + + protected: SkillClass skillClass; string name; @@ -80,7 +83,8 @@ protected: Model *animation; SoundContainer sounds; float soundStartTime; - UnitParticleSystemType *particleSystemType; +public: + UnitParticleSystemTypes unitParticleSystemTypes; public: //varios @@ -96,8 +100,7 @@ public: const Model *getAnimation() const {return animation;} StaticSound *getSound() const {return sounds.getRandSound();} float getSoundStartTime() const {return soundStartTime;} - UnitParticleSystemType *getParticleSystemType() const {return particleSystemType;} - + //other virtual string toString() const= 0; virtual int getTotalSpeed(const TotalUpgrade *) const {return speed;}