Particlesystems can now be positioned unit height independend
In the faction.xml you can set teh following now: <flat-particle-positions value="true"/> By this the positions of the particle systems ( attack and unit particles ) can be done based of the units centered ground position and by this height independend.
This commit is contained in:
parent
54905c0e5c
commit
3eb9c05b4a
|
@ -334,7 +334,7 @@ void UnitAttackBoostEffect::applyLoadedAttackBoostParticles(UnitParticleSystemTy
|
||||||
ups->setParticleType(upst);
|
ups->setParticleType(upst);
|
||||||
|
|
||||||
upst->setValues(ups);
|
upst->setValues(ups);
|
||||||
ups->setPos(unit->getCurrMidHeightVector());
|
ups->setPos(unit->getCurrVectorForParticlesystems());
|
||||||
ups->setRotation(unit->getRotation());
|
ups->setRotation(unit->getRotation());
|
||||||
ups->setUnitModel(unit->getCurrentModelPtr());
|
ups->setUnitModel(unit->getCurrentModelPtr());
|
||||||
if (unit->getFaction()->getTexture()) {
|
if (unit->getFaction()->getTexture()) {
|
||||||
|
@ -1600,6 +1600,15 @@ bool Unit::checkModelStateInfoForNewHpValue() {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Vec3f Unit::getCurrVectorForParticlesystems() const{
|
||||||
|
if(getFaction()->getType()->isFlatParticlePositions()){
|
||||||
|
return getCurrVectorFlat();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return getCurrMidHeightVector();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Vec3f Unit::getCurrMidHeightVector() const{
|
Vec3f Unit::getCurrMidHeightVector() const{
|
||||||
if(type == NULL) {
|
if(type == NULL) {
|
||||||
char szBuf[8096]="";
|
char szBuf[8096]="";
|
||||||
|
@ -2441,7 +2450,7 @@ void Unit::updateAttackBoostProgress(const Game* game) {
|
||||||
currentAttackBoostOriginatorEffect.currentAppliedEffect->upst->setValues(
|
currentAttackBoostOriginatorEffect.currentAppliedEffect->upst->setValues(
|
||||||
currentAttackBoostOriginatorEffect.currentAppliedEffect->ups);
|
currentAttackBoostOriginatorEffect.currentAppliedEffect->ups);
|
||||||
currentAttackBoostOriginatorEffect.currentAppliedEffect->ups->setPos(
|
currentAttackBoostOriginatorEffect.currentAppliedEffect->ups->setPos(
|
||||||
getCurrMidHeightVector());
|
getCurrVectorForParticlesystems());
|
||||||
currentAttackBoostOriginatorEffect.currentAppliedEffect->ups->setRotation(getRotation());
|
currentAttackBoostOriginatorEffect.currentAppliedEffect->ups->setRotation(getRotation());
|
||||||
currentAttackBoostOriginatorEffect.currentAppliedEffect->ups->setUnitModel(getCurrentModelPtr());
|
currentAttackBoostOriginatorEffect.currentAppliedEffect->ups->setUnitModel(getCurrentModelPtr());
|
||||||
|
|
||||||
|
@ -2554,7 +2563,7 @@ void Unit::updateAttackBoostProgress(const Game* game) {
|
||||||
currentAttackBoostOriginatorEffect.currentAppliedEffect->upst->setValues(
|
currentAttackBoostOriginatorEffect.currentAppliedEffect->upst->setValues(
|
||||||
currentAttackBoostOriginatorEffect.currentAppliedEffect->ups);
|
currentAttackBoostOriginatorEffect.currentAppliedEffect->ups);
|
||||||
currentAttackBoostOriginatorEffect.currentAppliedEffect->ups->setPos(
|
currentAttackBoostOriginatorEffect.currentAppliedEffect->ups->setPos(
|
||||||
getCurrMidHeightVector());
|
getCurrVectorForParticlesystems());
|
||||||
currentAttackBoostOriginatorEffect.currentAppliedEffect->ups->setRotation(getRotation());
|
currentAttackBoostOriginatorEffect.currentAppliedEffect->ups->setRotation(getRotation());
|
||||||
currentAttackBoostOriginatorEffect.currentAppliedEffect->ups->setUnitModel(getCurrentModelPtr());
|
currentAttackBoostOriginatorEffect.currentAppliedEffect->ups->setUnitModel(getCurrentModelPtr());
|
||||||
|
|
||||||
|
@ -2761,7 +2770,7 @@ bool Unit::update() {
|
||||||
if(effect != NULL && effect->ups != NULL) {
|
if(effect != NULL && effect->ups != NULL) {
|
||||||
bool particleValid = Renderer::getInstance().validateParticleSystemStillExists(effect->ups,rsGame);
|
bool particleValid = Renderer::getInstance().validateParticleSystemStillExists(effect->ups,rsGame);
|
||||||
if(particleValid == true) {
|
if(particleValid == true) {
|
||||||
effect->ups->setPos(getCurrMidHeightVector());
|
effect->ups->setPos(getCurrVectorForParticlesystems());
|
||||||
effect->ups->setRotation(getRotation());
|
effect->ups->setRotation(getRotation());
|
||||||
effect->ups->setUnitModel(getCurrentModelPtr());
|
effect->ups->setUnitModel(getCurrentModelPtr());
|
||||||
}
|
}
|
||||||
|
@ -2776,7 +2785,7 @@ bool Unit::update() {
|
||||||
if(currentAttackBoostOriginatorEffect.currentAppliedEffect->ups != NULL) {
|
if(currentAttackBoostOriginatorEffect.currentAppliedEffect->ups != NULL) {
|
||||||
bool particleValid = Renderer::getInstance().validateParticleSystemStillExists(currentAttackBoostOriginatorEffect.currentAppliedEffect->ups,rsGame);
|
bool particleValid = Renderer::getInstance().validateParticleSystemStillExists(currentAttackBoostOriginatorEffect.currentAppliedEffect->ups,rsGame);
|
||||||
if(particleValid == true) {
|
if(particleValid == true) {
|
||||||
currentAttackBoostOriginatorEffect.currentAppliedEffect->ups->setPos(getCurrMidHeightVector());
|
currentAttackBoostOriginatorEffect.currentAppliedEffect->ups->setPos(getCurrVectorForParticlesystems());
|
||||||
currentAttackBoostOriginatorEffect.currentAppliedEffect->ups->setRotation(getRotation());
|
currentAttackBoostOriginatorEffect.currentAppliedEffect->ups->setRotation(getRotation());
|
||||||
currentAttackBoostOriginatorEffect.currentAppliedEffect->ups->setUnitModel(getCurrentModelPtr());
|
currentAttackBoostOriginatorEffect.currentAppliedEffect->ups->setUnitModel(getCurrentModelPtr());
|
||||||
}
|
}
|
||||||
|
@ -2833,7 +2842,7 @@ void Unit::updateTimedParticles() {
|
||||||
ups->setParticleType(pst);
|
ups->setParticleType(pst);
|
||||||
|
|
||||||
pst->setValues(ups);
|
pst->setValues(ups);
|
||||||
ups->setPos(getCurrMidHeightVector());
|
ups->setPos(getCurrVectorForParticlesystems());
|
||||||
ups->setRotation(getRotation());
|
ups->setRotation(getRotation());
|
||||||
ups->setUnitModel(getCurrentModelPtr());
|
ups->setUnitModel(getCurrentModelPtr());
|
||||||
|
|
||||||
|
@ -2976,7 +2985,7 @@ bool Unit::applyAttackBoost(const AttackBoost *boost, const Unit *source) {
|
||||||
effect->ups->setParticleType(effect->upst);
|
effect->ups->setParticleType(effect->upst);
|
||||||
|
|
||||||
effect->upst->setValues(effect->ups);
|
effect->upst->setValues(effect->ups);
|
||||||
effect->ups->setPos(getCurrMidHeightVector());
|
effect->ups->setPos(getCurrVectorForParticlesystems());
|
||||||
effect->ups->setRotation(getRotation());
|
effect->ups->setRotation(getRotation());
|
||||||
effect->ups->setUnitModel(getCurrentModelPtr());
|
effect->ups->setUnitModel(getCurrentModelPtr());
|
||||||
if(getFaction()->getTexture()) {
|
if(getFaction()->getTexture()) {
|
||||||
|
@ -4120,7 +4129,7 @@ void Unit::checkCustomizedUnitParticleListTriggers(vector<UnitParticleSystem*> &
|
||||||
ups->setParticleType(pst);
|
ups->setParticleType(pst);
|
||||||
|
|
||||||
pst->setValues(ups);
|
pst->setValues(ups);
|
||||||
ups->setPos(getCurrMidHeightVector());
|
ups->setPos(getCurrVectorForParticlesystems());
|
||||||
ups->setRotation(getRotation());
|
ups->setRotation(getRotation());
|
||||||
ups->setUnitModel(getCurrentModelPtr());
|
ups->setUnitModel(getCurrentModelPtr());
|
||||||
if(getFaction()->getTexture()) {
|
if(getFaction()->getTexture()) {
|
||||||
|
@ -4237,7 +4246,7 @@ void Unit::checkCustomizedParticleTriggers(bool force) {
|
||||||
ups->setParticleType(pst);
|
ups->setParticleType(pst);
|
||||||
|
|
||||||
pst->setValues(ups);
|
pst->setValues(ups);
|
||||||
ups->setPos(getCurrMidHeightVector());
|
ups->setPos(getCurrVectorForParticlesystems());
|
||||||
ups->setRotation(getRotation());
|
ups->setRotation(getRotation());
|
||||||
ups->setUnitModel(getCurrentModelPtr());
|
ups->setUnitModel(getCurrentModelPtr());
|
||||||
if(getFaction()->getTexture()) {
|
if(getFaction()->getTexture()) {
|
||||||
|
@ -4268,7 +4277,7 @@ void Unit::startDamageParticles() {
|
||||||
ups->setParticleType(pst);
|
ups->setParticleType(pst);
|
||||||
|
|
||||||
pst->setValues(ups);
|
pst->setValues(ups);
|
||||||
ups->setPos(getCurrMidHeightVector());
|
ups->setPos(getCurrVectorForParticlesystems());
|
||||||
ups->setRotation(getRotation());
|
ups->setRotation(getRotation());
|
||||||
ups->setUnitModel(getCurrentModelPtr());
|
ups->setUnitModel(getCurrentModelPtr());
|
||||||
if(getFaction()->getTexture()) {
|
if(getFaction()->getTexture()) {
|
||||||
|
|
|
@ -638,6 +638,7 @@ public:
|
||||||
const Model *getCurrentModel();
|
const Model *getCurrentModel();
|
||||||
Model *getCurrentModelPtr();
|
Model *getCurrentModelPtr();
|
||||||
Vec3f getCurrMidHeightVector() const;
|
Vec3f getCurrMidHeightVector() const;
|
||||||
|
Vec3f getCurrVectorForParticlesystems() const;
|
||||||
Vec3f getCurrVectorAsTarget() const;
|
Vec3f getCurrVectorAsTarget() const;
|
||||||
Vec3f getCurrBurnVector() const;
|
Vec3f getCurrBurnVector() const;
|
||||||
Vec3f getCurrVectorFlat() const;
|
Vec3f getCurrVectorFlat() const;
|
||||||
|
|
|
@ -43,6 +43,7 @@ FactionType::FactionType() {
|
||||||
healthbarLineBorder=true;
|
healthbarLineBorder=true;
|
||||||
healthbarTexture=NULL;
|
healthbarTexture=NULL;
|
||||||
healthbarBackgroundTexture=NULL;
|
healthbarBackgroundTexture=NULL;
|
||||||
|
flatParticlePositions=false;
|
||||||
}
|
}
|
||||||
|
|
||||||
//load a faction, given a directory
|
//load a faction, given a directory
|
||||||
|
@ -281,6 +282,11 @@ void FactionType::load(const string &factionName, const TechTree *techTree, Chec
|
||||||
loadedFileList[musicNode->getAttribute("path")->getRestrictedValue(currentPath)].push_back(make_pair(path,musicNode->getAttribute("path")->getRestrictedValue()));
|
loadedFileList[musicNode->getAttribute("path")->getRestrictedValue(currentPath)].push_back(make_pair(path,musicNode->getAttribute("path")->getRestrictedValue()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(factionNode->hasChild("flat-particle-positions")) {
|
||||||
|
const XmlNode *node= factionNode->getChild("flat-particle-positions");
|
||||||
|
flatParticlePositions = node->getAttribute("value")->getBoolValue();
|
||||||
|
}
|
||||||
|
|
||||||
//healthbar
|
//healthbar
|
||||||
if(factionNode->hasChild("healthbar")) {
|
if(factionNode->hasChild("healthbar")) {
|
||||||
const XmlNode *healthbarNode= factionNode->getChild("healthbar");
|
const XmlNode *healthbarNode= factionNode->getChild("healthbar");
|
||||||
|
|
|
@ -104,7 +104,7 @@ private:
|
||||||
bool healthbarLineBorder;
|
bool healthbarLineBorder;
|
||||||
Texture2D *healthbarTexture;
|
Texture2D *healthbarTexture;
|
||||||
Texture2D *healthbarBackgroundTexture;
|
Texture2D *healthbarBackgroundTexture;
|
||||||
|
bool flatParticlePositions;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
//init
|
//init
|
||||||
|
@ -138,6 +138,7 @@ public:
|
||||||
inline bool isHealthbarLineBorder() const {return healthbarLineBorder;}
|
inline bool isHealthbarLineBorder() const {return healthbarLineBorder;}
|
||||||
Texture2D *getHealthbarTexture() const {return healthbarTexture;}
|
Texture2D *getHealthbarTexture() const {return healthbarTexture;}
|
||||||
Texture2D *getHealthbarBackgroundTexture() const {return healthbarBackgroundTexture;}
|
Texture2D *getHealthbarBackgroundTexture() const {return healthbarBackgroundTexture;}
|
||||||
|
bool isFlatParticlePositions() const {return flatParticlePositions;}
|
||||||
|
|
||||||
|
|
||||||
const UnitType *getUnitType(const string &name) const;
|
const UnitType *getUnitType(const string &name) const;
|
||||||
|
|
|
@ -2665,7 +2665,7 @@ void UnitUpdater::startAttackParticleSystem(Unit *unit, float lastAnimProgress,
|
||||||
|
|
||||||
ParticleSystemTypeSplash *pstSplash= ast->getSplashParticleType();
|
ParticleSystemTypeSplash *pstSplash= ast->getSplashParticleType();
|
||||||
bool hasProjectile = !ast->projectileTypes.empty();
|
bool hasProjectile = !ast->projectileTypes.empty();
|
||||||
Vec3f startPos= unit->getCurrMidHeightVector();
|
Vec3f startPos= unit->getCurrVectorForParticlesystems();
|
||||||
Vec3f endPos= unit->getTargetVec();
|
Vec3f endPos= unit->getTargetVec();
|
||||||
|
|
||||||
//make particle system
|
//make particle system
|
||||||
|
|
Loading…
Reference in New Issue