diff options
author | Andrei Karas <akaras@inbox.ru> | 2017-08-07 20:44:16 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2017-08-07 20:44:16 +0300 |
commit | 04716c42ec49bfbb42296dd8980d6f8dd1c09e59 (patch) | |
tree | a2cf6e57036d96609a653cf68f2adc9255fec5ba /src | |
parent | 8ec4e8575001e50ac2917b0a1599d2a6223aa337 (diff) | |
download | manaverse-04716c42ec49bfbb42296dd8980d6f8dd1c09e59.tar.gz manaverse-04716c42ec49bfbb42296dd8980d6f8dd1c09e59.tar.bz2 manaverse-04716c42ec49bfbb42296dd8980d6f8dd1c09e59.tar.xz manaverse-04716c42ec49bfbb42296dd8980d6f8dd1c09e59.zip |
Add additional attributes to missile particle in attacks.
Diffstat (limited to 'src')
-rw-r--r-- | src/being/being.cpp | 2 | ||||
-rw-r--r-- | src/resources/attack.h | 19 | ||||
-rw-r--r-- | src/resources/beingcommon.cpp | 15 | ||||
-rw-r--r-- | src/resources/beinginfo.cpp | 23 | ||||
-rw-r--r-- | src/resources/beinginfo.h | 6 |
5 files changed, 52 insertions, 13 deletions
diff --git a/src/being/being.cpp b/src/being/being.cpp index 9e3104c5f..030f022a2 100644 --- a/src/being/being.cpp +++ b/src/being/being.cpp @@ -958,7 +958,7 @@ void Being::handleAttack(Being *restrict const victim, if (mType == ActorType::Player && (mEquippedWeapon != nullptr)) fireMissile(victim, mEquippedWeapon->getMissileParticleFile()); else if (mInfo->getAttack(attackId) != nullptr) - fireMissile(victim, mInfo->getAttack(attackId)->mMissileParticle); + fireMissile(victim, mInfo->getAttack(attackId)->mMissile.particle); reset(); mActionTime = tick_time; diff --git a/src/resources/attack.h b/src/resources/attack.h index d9881bf0d..90b3da9c3 100644 --- a/src/resources/attack.h +++ b/src/resources/attack.h @@ -23,9 +23,7 @@ #ifndef RESOURCES_ATTACK_H #define RESOURCES_ATTACK_H -#include <string> - -#include "localconsts.h" +#include "resources/missileinfo.h" struct Attack final { @@ -37,7 +35,7 @@ struct Attack final int mHitEffectId; int mCriticalHitEffectId; int mMissEffectId; - std::string mMissileParticle; + MissileInfo mMissile; Attack(const std::string &action, const std::string &skyAction, @@ -47,7 +45,11 @@ struct Attack final const int hitEffectId, const int criticalHitEffectId, const int missEffectId, - const std::string &missileParticle) : + const std::string &missileParticle, + const float missileZ, + const float missileSpeed, + const float missileDieDistance, + const int missileLifeTime) : mAction(action), mSkyAction(skyAction), mWaterAction(waterAction), @@ -56,8 +58,13 @@ struct Attack final mHitEffectId(hitEffectId), mCriticalHitEffectId(criticalHitEffectId), mMissEffectId(missEffectId), - mMissileParticle(missileParticle) + mMissile() { + mMissile.particle = missileParticle; + mMissile.z = missileZ; + mMissile.speed = missileSpeed; + mMissile.dieDistance = missileDieDistance; + mMissile.lifeTime = missileLifeTime; } A_DELETE_COPY(Attack) diff --git a/src/resources/beingcommon.cpp b/src/resources/beingcommon.cpp index 6d244960f..7e5fb9481 100644 --- a/src/resources/beingcommon.cpp +++ b/src/resources/beingcommon.cpp @@ -231,6 +231,15 @@ bool BeingCommon::readObjectNodes(XmlNodePtrConst &spriteNode, const std::string missileParticle = XML::getProperty(spriteNode, "missile-particle", ""); + const float missileZ = static_cast<float>(XML::getFloatProperty( + spriteNode, "missile-z", 32.0f)); + const int missileLifeTime = static_cast<float>(XML::getProperty( + spriteNode, "missile-lifetime", 3000)); + const float missileSpeed = static_cast<float>(XML::getFloatProperty( + spriteNode, "missile-speed", 7.0f)); + const float missileDieDistance = static_cast<float>( + XML::getFloatProperty(spriteNode, "missile-diedistance", 8.0f)); + currentInfo->addAttack(attackId, spriteAction, skySpriteAction, @@ -240,7 +249,11 @@ bool BeingCommon::readObjectNodes(XmlNodePtrConst &spriteNode, hitEffectId, criticalHitEffectId, missEffectId, - missileParticle); + missileParticle, + missileZ, + missileSpeed, + missileDieDistance, + missileLifeTime); return true; } else if (xmlNameEqual(spriteNode, "particlefx")) diff --git a/src/resources/beinginfo.cpp b/src/resources/beinginfo.cpp index 326d5fd9a..93d8a5d4b 100644 --- a/src/resources/beinginfo.cpp +++ b/src/resources/beinginfo.cpp @@ -47,8 +47,15 @@ Attack *BeingInfo::empty = new Attack(SpriteAction::ATTACK, SpriteAction::ATTACKSKY, SpriteAction::ATTACKWATER, SpriteAction::ATTACKRIDE, - -1, -1, -1, -1, - std::string()); + -1, + -1, + -1, + -1, + std::string(), + 32.0F, + 7.0F, + 8.0F, + 3000); BeingInfo::BeingInfo() : mDisplay(), @@ -184,7 +191,11 @@ void BeingInfo::addAttack(const int id, const int hitEffectId, const int criticalHitEffectId, const int missEffectId, - const std::string &missileParticle) + const std::string &missileParticle, + const float missileZ, + const float missileSpeed, + const float missileDieDistance, + const int missileLifeTime) { delete mAttacks[id]; mAttacks[id] = new Attack(action, @@ -195,7 +206,11 @@ void BeingInfo::addAttack(const int id, hitEffectId, criticalHitEffectId, missEffectId, - missileParticle); + missileParticle, + missileZ, + missileSpeed, + missileDieDistance, + missileLifeTime); } void BeingInfo::clear() diff --git a/src/resources/beinginfo.h b/src/resources/beinginfo.h index 7e016d580..bd60131c8 100644 --- a/src/resources/beinginfo.h +++ b/src/resources/beinginfo.h @@ -105,7 +105,11 @@ class BeingInfo final const int hitEffectId, const int criticalHitEffectId, const int missEffectId, - const std::string &missileParticle); + const std::string &missileParticle, + const float missileZ, + const float missileSpeed, + const float missileDieDistance, + const int missileLifeTime); const Attack *getAttack(const int id) const A_WARN_UNUSED; |