- unit particles now support minHp / mapHp tags
This commit is contained in:
parent
04bc3b9f06
commit
3b3132ccce
|
@ -1 +1 @@
|
||||||
Subproject commit 1503ca70fd0813c5fd090aef2b024e04bb1c3161
|
Subproject commit 3de3304fd08fed556c5bfee168fcaa64bbf75612
|
|
@ -1,3 +1,4 @@
|
||||||
/windows_deps*/
|
/windows_deps*/
|
||||||
/glest_game/facilities/gitversion.h
|
/glest_game/facilities/gitversion.h
|
||||||
/glest_game/site/
|
/glest_game/site/
|
||||||
|
/Debug
|
||||||
|
|
|
@ -1371,6 +1371,8 @@ void MainWindow::loadParticle(string path) {
|
||||||
|
|
||||||
for(std::vector<UnitParticleSystemType *>::const_iterator it= unitParticleSystemTypes.begin(); it != unitParticleSystemTypes.end(); ++it) {
|
for(std::vector<UnitParticleSystemType *>::const_iterator it= unitParticleSystemTypes.begin(); it != unitParticleSystemTypes.end(); ++it) {
|
||||||
UnitParticleSystem *ups= new UnitParticleSystem(200);
|
UnitParticleSystem *ups= new UnitParticleSystem(200);
|
||||||
|
|
||||||
|
ups->setParticleType((*it));
|
||||||
(*it)->setValues(ups);
|
(*it)->setValues(ups);
|
||||||
if(size > 0) {
|
if(size > 0) {
|
||||||
//getCurrVectorFlat() + Vec3f(0.f, type->getHeight()/2.f, 0.f);
|
//getCurrVectorFlat() + Vec3f(0.f, type->getHeight()/2.f, 0.f);
|
||||||
|
|
|
@ -305,6 +305,7 @@ void ParticleSystemType::setValues(AttackParticleSystem *ats){
|
||||||
for(Children::iterator i=children.begin(); i!=children.end(); ++i){
|
for(Children::iterator i=children.begin(); i!=children.end(); ++i){
|
||||||
UnitParticleSystem *child = new UnitParticleSystem();
|
UnitParticleSystem *child = new UnitParticleSystem();
|
||||||
child->setParticleOwner(ats->getParticleOwner());
|
child->setParticleOwner(ats->getParticleOwner());
|
||||||
|
child->setParticleType((*i));
|
||||||
(*i)->setValues(child);
|
(*i)->setValues(child);
|
||||||
ats->addChild(child);
|
ats->addChild(child);
|
||||||
child->setState(ParticleSystem::sPlay);
|
child->setState(ParticleSystem::sPlay);
|
||||||
|
|
|
@ -52,7 +52,7 @@ class UnitParticleSystemType;
|
||||||
/// A type of particle system
|
/// A type of particle system
|
||||||
// ===========================================================
|
// ===========================================================
|
||||||
|
|
||||||
class ParticleSystemType {
|
class ParticleSystemType : public ParticleSystemTypeInterface {
|
||||||
protected:
|
protected:
|
||||||
string type;
|
string type;
|
||||||
Texture2D *texture;
|
Texture2D *texture;
|
||||||
|
|
|
@ -218,6 +218,7 @@ const void UnitParticleSystemType::setValues(UnitParticleSystem *ups){
|
||||||
for(Children::iterator i=children.begin(); i!=children.end(); ++i){
|
for(Children::iterator i=children.begin(); i!=children.end(); ++i){
|
||||||
UnitParticleSystem *child = new UnitParticleSystem();
|
UnitParticleSystem *child = new UnitParticleSystem();
|
||||||
child->setParticleOwner(ups->getParticleOwner());
|
child->setParticleOwner(ups->getParticleOwner());
|
||||||
|
child->setParticleType((*i));
|
||||||
(*i)->setValues(child);
|
(*i)->setValues(child);
|
||||||
ups->addChild(child);
|
ups->addChild(child);
|
||||||
}
|
}
|
||||||
|
|
|
@ -113,6 +113,7 @@ void Object::initParticlesFromTypes(const ModelParticleSystemTypes *particleType
|
||||||
for(ObjectParticleSystemTypes::const_iterator it= particleTypes->begin(); it != particleTypes->end(); ++it){
|
for(ObjectParticleSystemTypes::const_iterator it= particleTypes->begin(); it != particleTypes->end(); ++it){
|
||||||
UnitParticleSystem *ups= new UnitParticleSystem(200);
|
UnitParticleSystem *ups= new UnitParticleSystem(200);
|
||||||
ups->setParticleOwner(this);
|
ups->setParticleOwner(this);
|
||||||
|
ups->setParticleType((*it));
|
||||||
(*it)->setValues(ups);
|
(*it)->setValues(ups);
|
||||||
ups->setPos(this->pos);
|
ups->setPos(this->pos);
|
||||||
ups->setRotation(this->rotation);
|
ups->setRotation(this->rotation);
|
||||||
|
|
|
@ -331,6 +331,8 @@ void UnitAttackBoostEffect::applyLoadedAttackBoostParticles(UnitParticleSystemTy
|
||||||
ups = new UnitParticleSystem(200);
|
ups = new UnitParticleSystem(200);
|
||||||
//ups->loadGame(node2);
|
//ups->loadGame(node2);
|
||||||
ups->setParticleOwner(unit);
|
ups->setParticleOwner(unit);
|
||||||
|
ups->setParticleType(upst);
|
||||||
|
|
||||||
upst->setValues(ups);
|
upst->setValues(ups);
|
||||||
ups->setPos(unit->getCurrVector());
|
ups->setPos(unit->getCurrVector());
|
||||||
ups->setRotation(unit->getRotation());
|
ups->setRotation(unit->getRotation());
|
||||||
|
@ -1291,12 +1293,16 @@ void Unit::setCurrSkill(const SkillType *currSkill) {
|
||||||
unitParticleSystems.empty() == true) {
|
unitParticleSystems.empty() == true) {
|
||||||
//printf("START - particle system type\n");
|
//printf("START - particle system type\n");
|
||||||
|
|
||||||
for(UnitParticleSystemTypes::const_iterator it= currSkill->unitParticleSystemTypes.begin(); it != currSkill->unitParticleSystemTypes.end(); ++it) {
|
/*
|
||||||
|
for(UnitParticleSystemTypes::const_iterator it= currSkill->unitParticleSystemTypes.begin();
|
||||||
|
it != currSkill->unitParticleSystemTypes.end(); ++it) {
|
||||||
if((*it)->getStartTime() == 0.0) {
|
if((*it)->getStartTime() == 0.0) {
|
||||||
//printf("Adding NON-queued particle system type [%s] [%f] [%f]\n",(*it)->getType().c_str(),(*it)->getStartTime(),(*it)->getEndTime());
|
//printf("Adding NON-queued particle system type [%s] [%f] [%f]\n",(*it)->getType().c_str(),(*it)->getStartTime(),(*it)->getEndTime());
|
||||||
|
|
||||||
UnitParticleSystem *ups = new UnitParticleSystem(200);
|
UnitParticleSystem *ups = new UnitParticleSystem(200);
|
||||||
ups->setParticleOwner(this);
|
ups->setParticleOwner(this);
|
||||||
|
ups->setParticleType((*it));
|
||||||
|
|
||||||
(*it)->setValues(ups);
|
(*it)->setValues(ups);
|
||||||
ups->setPos(getCurrVector());
|
ups->setPos(getCurrVector());
|
||||||
ups->setRotation(getRotation());
|
ups->setRotation(getRotation());
|
||||||
|
@ -1313,6 +1319,9 @@ void Unit::setCurrSkill(const SkillType *currSkill) {
|
||||||
queuedUnitParticleSystemTypes.push_back(*it);
|
queuedUnitParticleSystemTypes.push_back(*it);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
checkCustomizedUnitParticleListTriggers(unitParticleSystems,
|
||||||
|
currSkill->unitParticleSystemTypes,queuedUnitParticleSystemTypes);
|
||||||
}
|
}
|
||||||
progress2= 0;
|
progress2= 0;
|
||||||
if(this->currSkill != currSkill) {
|
if(this->currSkill != currSkill) {
|
||||||
|
@ -2396,6 +2405,8 @@ void Unit::updateAttackBoostProgress(const Game* game) {
|
||||||
|
|
||||||
currentAttackBoostOriginatorEffect.currentAppliedEffect->ups = new UnitParticleSystem(200);
|
currentAttackBoostOriginatorEffect.currentAppliedEffect->ups = new UnitParticleSystem(200);
|
||||||
currentAttackBoostOriginatorEffect.currentAppliedEffect->ups->setParticleOwner(this);
|
currentAttackBoostOriginatorEffect.currentAppliedEffect->ups->setParticleOwner(this);
|
||||||
|
currentAttackBoostOriginatorEffect.currentAppliedEffect->ups->setParticleType(currentAttackBoostOriginatorEffect.currentAppliedEffect->upst);
|
||||||
|
|
||||||
currentAttackBoostOriginatorEffect.currentAppliedEffect->upst->setValues(
|
currentAttackBoostOriginatorEffect.currentAppliedEffect->upst->setValues(
|
||||||
currentAttackBoostOriginatorEffect.currentAppliedEffect->ups);
|
currentAttackBoostOriginatorEffect.currentAppliedEffect->ups);
|
||||||
currentAttackBoostOriginatorEffect.currentAppliedEffect->ups->setPos(
|
currentAttackBoostOriginatorEffect.currentAppliedEffect->ups->setPos(
|
||||||
|
@ -2507,6 +2518,8 @@ void Unit::updateAttackBoostProgress(const Game* game) {
|
||||||
|
|
||||||
currentAttackBoostOriginatorEffect.currentAppliedEffect->ups = new UnitParticleSystem(200);
|
currentAttackBoostOriginatorEffect.currentAppliedEffect->ups = new UnitParticleSystem(200);
|
||||||
currentAttackBoostOriginatorEffect.currentAppliedEffect->ups->setParticleOwner(this);
|
currentAttackBoostOriginatorEffect.currentAppliedEffect->ups->setParticleOwner(this);
|
||||||
|
currentAttackBoostOriginatorEffect.currentAppliedEffect->ups->setParticleType(currentAttackBoostOriginatorEffect.currentAppliedEffect->upst);
|
||||||
|
|
||||||
currentAttackBoostOriginatorEffect.currentAppliedEffect->upst->setValues(
|
currentAttackBoostOriginatorEffect.currentAppliedEffect->upst->setValues(
|
||||||
currentAttackBoostOriginatorEffect.currentAppliedEffect->ups);
|
currentAttackBoostOriginatorEffect.currentAppliedEffect->ups);
|
||||||
currentAttackBoostOriginatorEffect.currentAppliedEffect->ups->setPos(
|
currentAttackBoostOriginatorEffect.currentAppliedEffect->ups->setPos(
|
||||||
|
@ -2786,6 +2799,8 @@ void Unit::updateTimedParticles() {
|
||||||
|
|
||||||
UnitParticleSystem *ups = new UnitParticleSystem(200);
|
UnitParticleSystem *ups = new UnitParticleSystem(200);
|
||||||
ups->setParticleOwner(this);
|
ups->setParticleOwner(this);
|
||||||
|
ups->setParticleType(pst);
|
||||||
|
|
||||||
pst->setValues(ups);
|
pst->setValues(ups);
|
||||||
ups->setPos(getCurrVector());
|
ups->setPos(getCurrVector());
|
||||||
ups->setRotation(getRotation());
|
ups->setRotation(getRotation());
|
||||||
|
@ -2927,6 +2942,8 @@ bool Unit::applyAttackBoost(const AttackBoost *boost, const Unit *source) {
|
||||||
|
|
||||||
effect->ups = new UnitParticleSystem(200);
|
effect->ups = new UnitParticleSystem(200);
|
||||||
effect->ups->setParticleOwner(this);
|
effect->ups->setParticleOwner(this);
|
||||||
|
effect->ups->setParticleType(effect->upst);
|
||||||
|
|
||||||
effect->upst->setValues(effect->ups);
|
effect->upst->setValues(effect->ups);
|
||||||
effect->ups->setPos(getCurrVector());
|
effect->ups->setPos(getCurrVector());
|
||||||
effect->ups->setRotation(getRotation());
|
effect->ups->setRotation(getRotation());
|
||||||
|
@ -3977,8 +3994,131 @@ void Unit::stopDamageParticles(bool force) {
|
||||||
checkCustomizedParticleTriggers(force);
|
checkCustomizedParticleTriggers(force);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Unit::checkCustomizedUnitParticleListTriggers(vector<UnitParticleSystem*> &unitParticleSystemsList,
|
||||||
|
const UnitParticleSystemTypes &unitParticleSystemTypesList,
|
||||||
|
vector<UnitParticleSystemType*> &queuedUnitParticleSystemTypesList) {
|
||||||
|
if(showUnitParticles == true) {
|
||||||
|
vector<ParticleSystemTypeInterface *> systemTypesInUse;
|
||||||
|
|
||||||
|
if(unitParticleSystemsList.empty() == false) {
|
||||||
|
for(int index = (int)unitParticleSystemsList.size() - 1; index >= 0; index--) {
|
||||||
|
UnitParticleSystem *ps = unitParticleSystemsList[index];
|
||||||
|
if(ps != NULL) {
|
||||||
|
if(Renderer::getInstance().validateParticleSystemStillExists(ps,rsGame) == true) {
|
||||||
|
|
||||||
|
bool stopParticle = false;
|
||||||
|
if((ps->getParticleType() != NULL &&
|
||||||
|
ps->getParticleType()->getMinmaxEnabled())) {
|
||||||
|
|
||||||
|
if(ps->getParticleType() != NULL) {
|
||||||
|
if(ps->getParticleType()->getMinmaxIsPercent() == false) {
|
||||||
|
if(hp < ps->getParticleType()->getMinHp() || hp > ps->getParticleType()->getMaxHp()) {
|
||||||
|
stopParticle = true;
|
||||||
|
|
||||||
|
//printf("STOP Particle line: %d\n",__LINE__);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
int hpPercent = (hp / type->getTotalMaxHp(&totalUpgrade) * 100);
|
||||||
|
if(hpPercent < ps->getParticleType()->getMinHp() || hpPercent > ps->getParticleType()->getMaxHp()) {
|
||||||
|
stopParticle = true;
|
||||||
|
|
||||||
|
//printf("STOP Particle line: %d\n",__LINE__);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(stopParticle == true) {
|
||||||
|
ps->fade();
|
||||||
|
unitParticleSystemsList.erase(unitParticleSystemsList.begin() + index);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(ps->getParticleType() != NULL && stopParticle == false) {
|
||||||
|
systemTypesInUse.push_back(ps->getParticleType());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//printf("Check Particle start line: %d size: %d\n",__LINE__,(int)unitParticleSystemTypesList.size());
|
||||||
|
|
||||||
|
if(unitParticleSystemTypesList.empty() == false) {
|
||||||
|
|
||||||
|
//for(unsigned int index = 0; index < unitParticleSystemTypesList.size(); ++index) {
|
||||||
|
for(UnitParticleSystemTypes::const_iterator iterParticleType = unitParticleSystemTypesList.begin();
|
||||||
|
iterParticleType != unitParticleSystemTypesList.end(); ++iterParticleType) {
|
||||||
|
UnitParticleSystemType *pst = *iterParticleType;
|
||||||
|
|
||||||
|
vector<ParticleSystemTypeInterface *>::iterator iterFind = std::find(systemTypesInUse.begin(),systemTypesInUse.end(),pst);
|
||||||
|
|
||||||
|
//printf("Check Particle line: %d isenabled: %d already in use: %d\n",__LINE__,pst->getMinmaxEnabled(),(iterFind == systemTypesInUse.end()));
|
||||||
|
|
||||||
|
if(pst->getMinmaxEnabled() == true) {
|
||||||
|
|
||||||
|
//printf("Check Particle line: %d isenabled: %d already in use: %d\n",__LINE__,pst->getMinmaxEnabled(),(iterFind != systemTypesInUse.end()));
|
||||||
|
|
||||||
|
if(iterFind == systemTypesInUse.end()) {
|
||||||
|
bool showParticle = false;
|
||||||
|
if(pst->getMinmaxIsPercent() == false) {
|
||||||
|
if(hp >= pst->getMinHp() && hp <= pst->getMaxHp()) {
|
||||||
|
showParticle = true;
|
||||||
|
|
||||||
|
//printf("START Particle line: %d\n",__LINE__);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
int hpPercent = (hp / type->getTotalMaxHp(&totalUpgrade) * 100);
|
||||||
|
if(hpPercent >= pst->getMinHp() && hpPercent <= pst->getMaxHp()) {
|
||||||
|
showParticle = true;
|
||||||
|
|
||||||
|
//printf("START Particle line: %d\n",__LINE__);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(showParticle == true) {
|
||||||
|
|
||||||
|
if(pst->getStartTime() == 0.0) {
|
||||||
|
UnitParticleSystem *ups = new UnitParticleSystem(200);
|
||||||
|
ups->setParticleOwner(this);
|
||||||
|
ups->setParticleType(pst);
|
||||||
|
|
||||||
|
pst->setValues(ups);
|
||||||
|
ups->setPos(getCurrVector());
|
||||||
|
ups->setRotation(getRotation());
|
||||||
|
ups->setUnitModel(getCurrentModelPtr());
|
||||||
|
if(getFaction()->getTexture()) {
|
||||||
|
ups->setFactionColor(getFaction()->getTexture()->getPixmapConst()->getPixel3f(0,0));
|
||||||
|
}
|
||||||
|
unitParticleSystemsList.push_back(ups);
|
||||||
|
Renderer::getInstance().manageParticleSystem(ups, rsGame);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
queuedUnitParticleSystemTypesList.push_back(pst);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void Unit::checkCustomizedUnitParticleTriggers() {
|
||||||
|
if(currSkill != NULL) {
|
||||||
|
checkCustomizedUnitParticleListTriggers(unitParticleSystems,
|
||||||
|
currSkill->unitParticleSystemTypes,queuedUnitParticleSystemTypes);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void Unit::checkCustomizedParticleTriggers(bool force) {
|
void Unit::checkCustomizedParticleTriggers(bool force) {
|
||||||
// Now check if we have special hp triggered particles
|
//
|
||||||
|
// Now check if we have special pre-exisitng hp triggered particles and
|
||||||
|
// end those that should no longer display
|
||||||
|
//
|
||||||
|
// end s particles
|
||||||
if(damageParticleSystems.empty() == false) {
|
if(damageParticleSystems.empty() == false) {
|
||||||
for(int i = (int)damageParticleSystems.size()-1; i >= 0; --i) {
|
for(int i = (int)damageParticleSystems.size()-1; i >= 0; --i) {
|
||||||
UnitParticleSystem *ps = damageParticleSystems[i];
|
UnitParticleSystem *ps = damageParticleSystems[i];
|
||||||
|
@ -4028,7 +4168,9 @@ void Unit::checkCustomizedParticleTriggers(bool force) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Now check if we have special hp triggered particles
|
//
|
||||||
|
// Now check if we have new special hp triggered particles to display
|
||||||
|
//
|
||||||
//start additional particles
|
//start additional particles
|
||||||
if(showUnitParticles &&
|
if(showUnitParticles &&
|
||||||
type->damageParticleSystemTypes.empty() == false &&
|
type->damageParticleSystemTypes.empty() == false &&
|
||||||
|
@ -4057,6 +4199,8 @@ void Unit::checkCustomizedParticleTriggers(bool force) {
|
||||||
|
|
||||||
UnitParticleSystem *ups = new UnitParticleSystem(200);
|
UnitParticleSystem *ups = new UnitParticleSystem(200);
|
||||||
ups->setParticleOwner(this);
|
ups->setParticleOwner(this);
|
||||||
|
ups->setParticleType(pst);
|
||||||
|
|
||||||
pst->setValues(ups);
|
pst->setValues(ups);
|
||||||
ups->setPos(getCurrVector());
|
ups->setPos(getCurrVector());
|
||||||
ups->setRotation(getRotation());
|
ups->setRotation(getRotation());
|
||||||
|
@ -4071,6 +4215,8 @@ void Unit::checkCustomizedParticleTriggers(bool force) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
checkCustomizedUnitParticleTriggers();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Unit::startDamageParticles() {
|
void Unit::startDamageParticles() {
|
||||||
|
@ -4084,6 +4230,8 @@ void Unit::startDamageParticles() {
|
||||||
if(pst->getMinmaxEnabled() == false && damageParticleSystemsInUse.find(i) == damageParticleSystemsInUse.end()) {
|
if(pst->getMinmaxEnabled() == false && damageParticleSystemsInUse.find(i) == damageParticleSystemsInUse.end()) {
|
||||||
UnitParticleSystem *ups = new UnitParticleSystem(200);
|
UnitParticleSystem *ups = new UnitParticleSystem(200);
|
||||||
ups->setParticleOwner(this);
|
ups->setParticleOwner(this);
|
||||||
|
ups->setParticleType(pst);
|
||||||
|
|
||||||
pst->setValues(ups);
|
pst->setValues(ups);
|
||||||
ups->setPos(getCurrVector());
|
ups->setPos(getCurrVector());
|
||||||
ups->setRotation(getRotation());
|
ups->setRotation(getRotation());
|
||||||
|
|
|
@ -821,7 +821,14 @@ private:
|
||||||
void startDamageParticles();
|
void startDamageParticles();
|
||||||
|
|
||||||
uint32 getFrameCount() const;
|
uint32 getFrameCount() const;
|
||||||
|
|
||||||
void checkCustomizedParticleTriggers(bool force);
|
void checkCustomizedParticleTriggers(bool force);
|
||||||
|
void checkCustomizedUnitParticleTriggers();
|
||||||
|
void checkCustomizedUnitParticleListTriggers(vector<UnitParticleSystem*> &unitParticleSystemsList,
|
||||||
|
const UnitParticleSystemTypes &unitParticleSystemTypesList,
|
||||||
|
vector<UnitParticleSystemType*> &queuedUnitParticleSystemTypesList);
|
||||||
|
|
||||||
|
|
||||||
bool checkModelStateInfoForNewHpValue();
|
bool checkModelStateInfoForNewHpValue();
|
||||||
void checkUnitLevel();
|
void checkUnitLevel();
|
||||||
|
|
||||||
|
|
|
@ -533,9 +533,21 @@ void SkillType::load(const XmlNode *sn, const XmlNode *attackBoostsNode,
|
||||||
unitParticleSystemType->setEndTime(particleNode->getAttribute("end-time")->getFloatValue());
|
unitParticleSystemType->setEndTime(particleNode->getAttribute("end-time")->getFloatValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(particleNode->getChild(i)->hasAttribute("minHp") && particleNode->getChild(i)->hasAttribute("maxHp")) {
|
||||||
|
unitParticleSystemType->setMinmaxEnabled(true);
|
||||||
|
unitParticleSystemType->setMinHp(particleNode->getChild(i)->getAttribute("minHp")->getIntValue());
|
||||||
|
unitParticleSystemType->setMaxHp(particleNode->getChild(i)->getAttribute("maxHp")->getIntValue());
|
||||||
|
|
||||||
|
if(particleNode->getChild(i)->hasAttribute("ispercentbased")) {
|
||||||
|
unitParticleSystemType->setMinmaxIsPercent(particleNode->getChild(i)->getAttribute("ispercentbased")->getBoolValue());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
loadedFileList[currentPath + path].push_back(make_pair(parentLoader,particleFileNode->getAttribute("path")->getRestrictedValue()));
|
loadedFileList[currentPath + path].push_back(make_pair(parentLoader,particleFileNode->getAttribute("path")->getRestrictedValue()));
|
||||||
unitParticleSystemTypes.push_back(unitParticleSystemType);
|
unitParticleSystemTypes.push_back(unitParticleSystemType);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//printf("Load skill particles line: %d size: %d\n",__LINE__,(int)unitParticleSystemTypes.size());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -58,6 +58,7 @@ public:
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Particle() {
|
Particle() {
|
||||||
|
speedUpRelative = 0;
|
||||||
size = 0;
|
size = 0;
|
||||||
energy = 0;
|
energy = 0;
|
||||||
}
|
}
|
||||||
|
@ -93,6 +94,20 @@ public:
|
||||||
virtual void logParticleInfo(string info)= 0;
|
virtual void logParticleInfo(string info)= 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
class ParticleSystemTypeInterface {
|
||||||
|
public:
|
||||||
|
|
||||||
|
ParticleSystemTypeInterface() {};
|
||||||
|
virtual ~ParticleSystemTypeInterface() {};
|
||||||
|
|
||||||
|
virtual bool getMinmaxEnabled() const = 0;
|
||||||
|
virtual int getMinHp() const = 0;
|
||||||
|
virtual int getMaxHp() const = 0;
|
||||||
|
virtual bool getMinmaxIsPercent() const = 0;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
// =====================================================
|
// =====================================================
|
||||||
// class ParticleSystem
|
// class ParticleSystem
|
||||||
// =====================================================
|
// =====================================================
|
||||||
|
@ -344,12 +359,15 @@ private:
|
||||||
float startTime;
|
float startTime;
|
||||||
float endTime;
|
float endTime;
|
||||||
|
|
||||||
|
ParticleSystemTypeInterface *particleSystemType;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
enum Shape{
|
enum Shape{
|
||||||
sLinear, // generated in a sphere, flying in direction
|
sLinear, // generated in a sphere, flying in direction
|
||||||
sSpherical, // generated in a sphere, flying away from center
|
sSpherical, // generated in a sphere, flying away from center
|
||||||
sConical, // generated in a cone at angle from direction
|
sConical, // generated in a cone at angle from direction
|
||||||
};
|
};
|
||||||
|
|
||||||
bool relative;
|
bool relative;
|
||||||
bool relativeDirection;
|
bool relativeDirection;
|
||||||
bool fixed;
|
bool fixed;
|
||||||
|
@ -376,6 +394,13 @@ public:
|
||||||
|
|
||||||
virtual ParticleSystemType getParticleSystemType() const { return pst_UnitParticleSystem;}
|
virtual ParticleSystemType getParticleSystemType() const { return pst_UnitParticleSystem;}
|
||||||
|
|
||||||
|
ParticleSystemTypeInterface * getParticleType() const {
|
||||||
|
return particleSystemType;
|
||||||
|
}
|
||||||
|
void setParticleType(ParticleSystemTypeInterface *type) {
|
||||||
|
particleSystemType = type;
|
||||||
|
}
|
||||||
|
|
||||||
//virtual
|
//virtual
|
||||||
virtual void initParticle(Particle *p, int particleIndex);
|
virtual void initParticle(Particle *p, int particleIndex);
|
||||||
virtual void updateParticle(Particle *p);
|
virtual void updateParticle(Particle *p);
|
||||||
|
|
|
@ -1009,6 +1009,8 @@ Vec3f UnitParticleSystem::lightColor=Vec3f(1.0f,1.0f,1.0f);
|
||||||
|
|
||||||
UnitParticleSystem::UnitParticleSystem(int particleCount) :
|
UnitParticleSystem::UnitParticleSystem(int particleCount) :
|
||||||
GameParticleSystem(particleCount), parent(NULL) {
|
GameParticleSystem(particleCount), parent(NULL) {
|
||||||
|
|
||||||
|
particleSystemType = NULL;
|
||||||
radius= 0.5f;
|
radius= 0.5f;
|
||||||
speed= 0.01f;
|
speed= 0.01f;
|
||||||
windSpeed= Vec3f(0.0f);
|
windSpeed= Vec3f(0.0f);
|
||||||
|
|
Loading…
Reference in New Issue