mirror of
https://github.com/glest/glest-source.git
synced 2025-09-09 15:30:41 +02:00
multiple particle systems for every skill
This commit is contained in:
@@ -4,7 +4,7 @@
|
|||||||
#----------------------------------------------------------------------------
|
#----------------------------------------------------------------------------
|
||||||
AC_PREREQ([2.54])
|
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_SRCDIR([mk/jam/build.jam])
|
||||||
AC_CONFIG_AUX_DIR([mk/autoconf])
|
AC_CONFIG_AUX_DIR([mk/autoconf])
|
||||||
|
|
||||||
|
@@ -22,7 +22,7 @@ using namespace Shared::Util;
|
|||||||
namespace Glest{ namespace Game{
|
namespace Glest{ namespace Game{
|
||||||
|
|
||||||
const string mailString= "contact_game@glest.org";
|
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(){
|
string getCrashDumpFileName(){
|
||||||
return "glest"+glestVersionString+".dmp";
|
return "glest"+glestVersionString+".dmp";
|
||||||
|
@@ -1355,15 +1355,11 @@ void Renderer::renderUnits(){
|
|||||||
pointCount+= model->getVertexCount();
|
pointCount+= model->getVertexCount();
|
||||||
|
|
||||||
glPopMatrix();
|
glPopMatrix();
|
||||||
if(unit->skillParticleSystem!=NULL){
|
unit->setVisible(true);
|
||||||
unit->skillParticleSystem->setVisible(true);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if(unit->skillParticleSystem!=NULL){
|
unit->setVisible(false);
|
||||||
unit->skillParticleSystem->setVisible(false);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -28,6 +28,7 @@
|
|||||||
using namespace Shared::Graphics;
|
using namespace Shared::Graphics;
|
||||||
using namespace Shared::Util;
|
using namespace Shared::Util;
|
||||||
|
|
||||||
|
|
||||||
namespace Glest{ namespace Game{
|
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;
|
if(getType()->getField(fLand)) currField=fLand;
|
||||||
|
|
||||||
fire= NULL;
|
fire= NULL;
|
||||||
skillParticleSystem=NULL;
|
|
||||||
|
|
||||||
computeTotalUpgrade();
|
computeTotalUpgrade();
|
||||||
|
|
||||||
@@ -314,21 +314,22 @@ void Unit::setCurrSkill(const SkillType *currSkill){
|
|||||||
animProgress= 0;
|
animProgress= 0;
|
||||||
lastAnimProgress= 0;
|
lastAnimProgress= 0;
|
||||||
|
|
||||||
if(skillParticleSystem!=NULL){
|
while(!unitParticleSystems.empty()){
|
||||||
skillParticleSystem->fade();
|
unitParticleSystems.back()->fade();
|
||||||
skillParticleSystem=NULL;
|
unitParticleSystems.pop_back();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if((currSkill->getParticleSystemType()!=NULL)
|
if((!currSkill->unitParticleSystemTypes.empty())
|
||||||
&& (skillParticleSystem==NULL) ){
|
&& (unitParticleSystems.empty()) ){
|
||||||
UnitParticleSystemType *upst=currSkill->getParticleSystemType();
|
for(UnitParticleSystemTypes::const_iterator it= currSkill->unitParticleSystemTypes.begin(); it!=currSkill->unitParticleSystemTypes.end(); ++it){
|
||||||
UnitParticleSystem *ups;
|
UnitParticleSystem *ups;
|
||||||
ups= new UnitParticleSystem(200);
|
ups= new UnitParticleSystem(200);
|
||||||
upst->setValues(ups);
|
(*it)->setValues(ups);
|
||||||
ups->setPos(getCurrVector());
|
ups->setPos(getCurrVector());
|
||||||
ups->setTeamNumber(getTeam());
|
ups->setTeamNumber(getTeam());
|
||||||
skillParticleSystem= ups;
|
unitParticleSystems.push_back(ups);
|
||||||
Renderer::getInstance().manageParticleSystem(ups, rsGame);
|
Renderer::getInstance().manageParticleSystem(ups, rsGame);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
progress2= 0;
|
progress2= 0;
|
||||||
this->currSkill= currSkill;
|
this->currSkill= currSkill;
|
||||||
@@ -365,6 +366,12 @@ void Unit::setTargetPos(const Vec2i &targetPos){
|
|||||||
this->targetPos= 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 ==================================
|
// =============================== Render related ==================================
|
||||||
|
|
||||||
const Model *Unit::getCurrentModel() const{
|
const Model *Unit::getCurrentModel() const{
|
||||||
@@ -635,12 +642,10 @@ bool Unit::update(){
|
|||||||
{
|
{
|
||||||
fire->setPos(getCurrVector());
|
fire->setPos(getCurrVector());
|
||||||
}
|
}
|
||||||
if (skillParticleSystem!=NULL)
|
for(UnitParticleSystems::iterator it= unitParticleSystems.begin(); it!=unitParticleSystems.end(); ++it){
|
||||||
{
|
(*it)->setPos(getCurrVector());
|
||||||
skillParticleSystem->setPos(getCurrVector());
|
(*it)->setRotation(getRotation());
|
||||||
skillParticleSystem->setRotation(getRotation());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//checks
|
//checks
|
||||||
if(animProgress>1.f){
|
if(animProgress>1.f){
|
||||||
animProgress= currSkill->getClass()==scDie? 1.f: 0.f;
|
animProgress= currSkill->getClass()==scDie? 1.f: 0.f;
|
||||||
|
@@ -122,13 +122,14 @@ class Unit{
|
|||||||
private:
|
private:
|
||||||
typedef list<Command*> Commands;
|
typedef list<Command*> Commands;
|
||||||
typedef list<UnitObserver*> Observers;
|
typedef list<UnitObserver*> Observers;
|
||||||
|
typedef list<UnitParticleSystem*> UnitParticleSystems;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static const float speedDivider;
|
static const float speedDivider;
|
||||||
static const int maxDeadCount;
|
static const int maxDeadCount;
|
||||||
static const float highlightTime;
|
static const float highlightTime;
|
||||||
static const int invalidId;
|
static const int invalidId;
|
||||||
UnitParticleSystem *skillParticleSystem;
|
//UnitParticleSystem *skillParticleSystem;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
int id;
|
int id;
|
||||||
@@ -175,6 +176,7 @@ private:
|
|||||||
|
|
||||||
Commands commands;
|
Commands commands;
|
||||||
Observers observers;
|
Observers observers;
|
||||||
|
UnitParticleSystems unitParticleSystems;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Unit(int id, const Vec2i &pos, const UnitType *type, Faction *faction, Map *map);
|
Unit(int id, const Vec2i &pos, const UnitType *type, Faction *faction, Map *map);
|
||||||
@@ -209,7 +211,6 @@ public:
|
|||||||
float getRotation() const {return rotation;}
|
float getRotation() const {return rotation;}
|
||||||
float getVerticalRotation() const;
|
float getVerticalRotation() const;
|
||||||
ParticleSystem *getFire() const {return fire;}
|
ParticleSystem *getFire() const {return fire;}
|
||||||
UnitParticleSystem *getSkillParticleSystem() const {return skillParticleSystem;}
|
|
||||||
int getKills() {return kills;}
|
int getKills() {return kills;}
|
||||||
const Level *getLevel() const {return level;}
|
const Level *getLevel() const {return level;}
|
||||||
const Level *getNextLevel() const;
|
const Level *getNextLevel() const;
|
||||||
@@ -248,6 +249,7 @@ public:
|
|||||||
void setTarget(const Unit *unit);
|
void setTarget(const Unit *unit);
|
||||||
void setTargetVec(const Vec3f &targetVec) {this->targetVec= targetVec;}
|
void setTargetVec(const Vec3f &targetVec) {this->targetVec= targetVec;}
|
||||||
void setMeetingPos(const Vec2i &meetingPos) {this->meetingPos= meetingPos;}
|
void setMeetingPos(const Vec2i &meetingPos) {this->meetingPos= meetingPos;}
|
||||||
|
void setVisible(const bool visible);
|
||||||
|
|
||||||
//render related
|
//render related
|
||||||
const Model *getCurrentModel() const;
|
const Model *getCurrentModel() const;
|
||||||
|
@@ -33,9 +33,12 @@ namespace Glest{ namespace Game{
|
|||||||
// =====================================================
|
// =====================================================
|
||||||
|
|
||||||
SkillType::~SkillType(){
|
SkillType::~SkillType(){
|
||||||
delete particleSystemType;
|
|
||||||
|
|
||||||
deleteValues(sounds.getSounds().begin(), sounds.getSounds().end());
|
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){
|
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);
|
animation->load(dir + "/" + path);
|
||||||
|
|
||||||
//particles
|
//particles
|
||||||
if(sn->hasChild("particle")){
|
if(sn->hasChild("particles")){
|
||||||
const XmlNode *particleNode= sn->getChild("particle");
|
const XmlNode *particleNode= sn->getChild("particles");
|
||||||
bool particleEnabled= particleNode->getAttribute("value")->getBoolValue();
|
bool particleEnabled= particleNode->getAttribute("value")->getBoolValue();
|
||||||
if(particleEnabled){
|
if(particleEnabled){
|
||||||
string path= particleNode->getAttribute("path")->getRestrictedValue();
|
for(int i=0; i<particleNode->getChildCount(); ++i){
|
||||||
particleSystemType= new UnitParticleSystemType();
|
const XmlNode *particleFileNode= particleNode->getChild("particle-file", i);
|
||||||
particleSystemType->load(dir, dir + "/" + path);
|
string path= particleFileNode->getAttribute("path")->getRestrictedValue();
|
||||||
|
UnitParticleSystemType *unitParticleSystemType= new UnitParticleSystemType();
|
||||||
|
unitParticleSystemType->load(dir, dir + "/" + path);
|
||||||
|
unitParticleSystemTypes.push_back(unitParticleSystemType);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
particleSystemType=NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//sound
|
//sound
|
||||||
|
@@ -64,6 +64,7 @@ enum SkillClass{
|
|||||||
scCount
|
scCount
|
||||||
};
|
};
|
||||||
|
|
||||||
|
typedef list<UnitParticleSystemType*> UnitParticleSystemTypes;
|
||||||
// =====================================================
|
// =====================================================
|
||||||
// class SkillType
|
// class SkillType
|
||||||
//
|
//
|
||||||
@@ -71,6 +72,8 @@ enum SkillClass{
|
|||||||
// =====================================================
|
// =====================================================
|
||||||
|
|
||||||
class SkillType{
|
class SkillType{
|
||||||
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
SkillClass skillClass;
|
SkillClass skillClass;
|
||||||
string name;
|
string name;
|
||||||
@@ -80,7 +83,8 @@ protected:
|
|||||||
Model *animation;
|
Model *animation;
|
||||||
SoundContainer sounds;
|
SoundContainer sounds;
|
||||||
float soundStartTime;
|
float soundStartTime;
|
||||||
UnitParticleSystemType *particleSystemType;
|
public:
|
||||||
|
UnitParticleSystemTypes unitParticleSystemTypes;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
//varios
|
//varios
|
||||||
@@ -96,8 +100,7 @@ public:
|
|||||||
const Model *getAnimation() const {return animation;}
|
const Model *getAnimation() const {return animation;}
|
||||||
StaticSound *getSound() const {return sounds.getRandSound();}
|
StaticSound *getSound() const {return sounds.getRandSound();}
|
||||||
float getSoundStartTime() const {return soundStartTime;}
|
float getSoundStartTime() const {return soundStartTime;}
|
||||||
UnitParticleSystemType *getParticleSystemType() const {return particleSystemType;}
|
|
||||||
|
|
||||||
//other
|
//other
|
||||||
virtual string toString() const= 0;
|
virtual string toString() const= 0;
|
||||||
virtual int getTotalSpeed(const TotalUpgrade *) const {return speed;}
|
virtual int getTotalSpeed(const TotalUpgrade *) const {return speed;}
|
||||||
|
Reference in New Issue
Block a user