diff options
author | Andrei Karas <akaras@inbox.ru> | 2017-08-07 21:49:29 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2017-08-07 21:49:29 +0300 |
commit | ad6c177a459cf5afb3ad88169d8ba6b1c47fff93 (patch) | |
tree | 5740ffc69087801bdf66aff486f44a5c006db521 | |
parent | 0ff91dcf4754a867be162095f500ca5b0bea2fdf (diff) | |
download | ManaVerse-ad6c177a459cf5afb3ad88169d8ba6b1c47fff93.tar.gz ManaVerse-ad6c177a459cf5afb3ad88169d8ba6b1c47fff93.tar.bz2 ManaVerse-ad6c177a459cf5afb3ad88169d8ba6b1c47fff93.tar.xz ManaVerse-ad6c177a459cf5afb3ad88169d8ba6b1c47fff93.zip |
Spawn missile particles with configurable additional parameters.
-rw-r--r-- | src/being/being.cpp | 32 | ||||
-rw-r--r-- | src/being/being.h | 3 | ||||
-rw-r--r-- | src/resources/iteminfo.h | 4 |
3 files changed, 18 insertions, 21 deletions
diff --git a/src/being/being.cpp b/src/being/being.cpp index 0929b8b22..59326e4ad 100644 --- a/src/being/being.cpp +++ b/src/being/being.cpp @@ -956,9 +956,9 @@ void Being::handleAttack(Being *restrict const victim, mLastAttackY = victim->mY; if (mType == ActorType::Player && (mEquippedWeapon != nullptr)) - fireMissile(victim, mEquippedWeapon->getMissileParticleFile()); + fireMissile(victim, mEquippedWeapon->getMissileConst()); else if (mInfo->getAttack(attackId) != nullptr) - fireMissile(victim, mInfo->getAttack(attackId)->mMissile.particle); + fireMissile(victim, mInfo->getAttack(attackId)->mMissile); reset(); mActionTime = tick_time; @@ -1023,7 +1023,7 @@ void Being::handleSkillCasting(Being *restrict const victim, effectManager->triggerDefault(data->castingDstEffectId, victim, paths.getIntValue("skillCastingDstEffectId")); - fireMissile(victim, data->castingMissile.particle); + fireMissile(victim, data->castingMissile); } } @@ -1046,7 +1046,7 @@ void Being::handleSkill(Being *restrict const victim, effectManager->triggerDefault(data->dstEffectId, victim, paths.getIntValue("skillDstEffectId")); - fireMissile(victim, data->missile.particle); + fireMissile(victim, data->missile); } if (this != localPlayer && (skill != nullptr)) @@ -1327,12 +1327,12 @@ void Being::setGuild(Guild *restrict const guild) restrict2 } void Being::fireMissile(Being *restrict const victim, - const std::string &restrict particle) const restrict2 + const MissileInfo &restrict missile) const restrict2 { BLOCK_START("Being::fireMissile") if (victim == nullptr || - particle.empty() || + missile.particle.empty() || particleEngine == nullptr) { BLOCK_END("Being::fireMissile") @@ -1347,20 +1347,20 @@ void Being::fireMissile(Being *restrict const victim, return; } - Particle *restrict const missile = target->addEffect( - particle, + Particle *restrict const missileParticle = target->addEffect( + missile.particle, mPixelX, mPixelY); - if (missile != nullptr) - { - target->moveBy(Vector(0.0F, 0.0F, 32.0F)); - target->setLifetime(10000); - victim->controlAutoParticle(target); + target->moveBy(Vector(0.0F, 0.0F, missile.z)); + target->setLifetime(missile.lifeTime); + victim->controlAutoParticle(target); - missile->setDestination(target, 1.0F, 0.0F); - missile->setDieDistance(1); - missile->setLifetime(9000); + if (missileParticle != nullptr) + { + missileParticle->setDestination(target, missile.speed, 0.0F); + missileParticle->setDieDistance(missile.dieDistance); + missileParticle->setLifetime(missile.lifeTime); } BLOCK_END("Being::fireMissile") } diff --git a/src/being/being.h b/src/being/being.h index cd5b0efff..b6015486f 100644 --- a/src/being/being.h +++ b/src/being/being.h @@ -36,6 +36,7 @@ #include "resources/beinginfo.h" #include "resources/beingslot.h" +#include "resources/missileinfo.h" #include "being/actorsprite.h" @@ -534,7 +535,7 @@ class Being notfinal : public ActorSprite, * Shoots a missile particle from this being, to target being */ void fireMissile(Being *restrict const victim, - const std::string &restrict particle) const restrict2; + const MissileInfo &restrict missile) const restrict2; /** * Returns the path this being is following. An empty path is returned diff --git a/src/resources/iteminfo.h b/src/resources/iteminfo.h index 8abc78717..92474ff7e 100644 --- a/src/resources/iteminfo.h +++ b/src/resources/iteminfo.h @@ -156,10 +156,6 @@ class ItemInfo final void setMissileParticleFile(const std::string &s) noexcept2 { mMissile.particle = s; } - const std::string &getMissileParticleFile() const noexcept2 - A_WARN_UNUSED - { return mMissile.particle; } - MissileInfo &getMissile() noexcept2 A_WARN_UNUSED { return mMissile; } |