summaryrefslogtreecommitdiff
path: root/src/being
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2017-08-07 21:49:29 +0300
committerAndrei Karas <akaras@inbox.ru>2017-08-07 21:49:29 +0300
commitad6c177a459cf5afb3ad88169d8ba6b1c47fff93 (patch)
tree5740ffc69087801bdf66aff486f44a5c006db521 /src/being
parent0ff91dcf4754a867be162095f500ca5b0bea2fdf (diff)
downloadmanaplus-ad6c177a459cf5afb3ad88169d8ba6b1c47fff93.tar.gz
manaplus-ad6c177a459cf5afb3ad88169d8ba6b1c47fff93.tar.bz2
manaplus-ad6c177a459cf5afb3ad88169d8ba6b1c47fff93.tar.xz
manaplus-ad6c177a459cf5afb3ad88169d8ba6b1c47fff93.zip
Spawn missile particles with configurable additional parameters.
Diffstat (limited to 'src/being')
-rw-r--r--src/being/being.cpp32
-rw-r--r--src/being/being.h3
2 files changed, 18 insertions, 17 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