diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/actorsprite.cpp | 94 | ||||
-rw-r--r-- | src/actorsprite.h | 19 |
2 files changed, 0 insertions, 113 deletions
diff --git a/src/actorsprite.cpp b/src/actorsprite.cpp index af98a0fbc..60857a5af 100644 --- a/src/actorsprite.cpp +++ b/src/actorsprite.cpp @@ -42,8 +42,6 @@ #include "debug.h" -static const char *const EFFECTS_FILE = "effects.xml"; - ImageSet *ActorSprite::targetCursorImages[2][NUM_TC]; SimpleAnimation *ActorSprite::targetCursor[2][NUM_TC]; bool ActorSprite::loaded = false; @@ -166,71 +164,6 @@ struct EffectDescription final std::string mSFXEffect; }; -static EffectDescription *default_effect = nullptr; -static std::map<int, EffectDescription *> effects; -static bool effects_initialized = false; - -static EffectDescription *getEffectDescription(XmlNodePtr const node, - int *const id) -{ - if (!id) - return nullptr; - - EffectDescription *const ed = new EffectDescription; - - *id = atoi(XML::getProperty(node, "id", "-1").c_str()); - ed->mSFXEffect = XML::getProperty(node, "audio", ""); - ed->mGFXEffect = XML::getProperty(node, "particle", ""); - - return ed; -} - -static EffectDescription *getEffectDescription(const int effectId) -{ - if (!effects_initialized) - { - XML::Document doc(EFFECTS_FILE); - const XmlNodePtr root = doc.rootNode(); - - if (!root || !xmlNameEqual(root, "being-effects")) - { - logger->log1("Error loading being effects file"); - return nullptr; - } - - for_each_xml_child_node(node, root) - { - int id; - - if (xmlNameEqual(node, "effect")) - { - EffectDescription *const effectDescription = - getEffectDescription(node, &id); - effects[id] = effectDescription; - } - else if (xmlNameEqual(node, "default")) - { - EffectDescription *const effectDescription = - getEffectDescription(node, &id); - - delete default_effect; - - default_effect = effectDescription; - } - } - - effects_initialized = true; - } // done initializing - - std::map<int, EffectDescription *>::iterator it = effects.find(effectId); - if (it == effects.end()) - return default_effect; - - EffectDescription *const ed = (*it).second; - - return ed ? ed : default_effect; -} - void ActorSprite::setStatusEffect(const int index, const bool active) { const bool wasActive = mStatusEffects.find(index) != mStatusEffects.end(); @@ -258,33 +191,6 @@ void ActorSprite::setStatusEffectBlock(const int offset, } } -void ActorSprite::internalTriggerEffect(const int effectId, const bool sfx, - const bool gfx) -{ - if (reportTrue(!particleEngine)) - return; - - if (player_node) - { - logger->log("Special effect #%d on %s", effectId, - getId() == player_node->getId() ? "self" : "other"); - } - - const EffectDescription *const ed = getEffectDescription(effectId); - - if (reportTrue(!ed)) - { - logger->log1("Unknown special effect and no default recorded"); - return; - } - - if (gfx && !ed->mGFXEffect.empty()) - controlParticle(particleEngine->addEffect(ed->mGFXEffect, 0, 0)); - - if (sfx && !ed->mSFXEffect.empty()) - soundManager.playSfx(ed->mSFXEffect); -} - void ActorSprite::updateStunMode(const int oldMode, const int newMode) { handleStatusEffect(StatusEffect::getStatusEffect(oldMode, false), -1); diff --git a/src/actorsprite.h b/src/actorsprite.h index 4a9723353..a09191dfc 100644 --- a/src/actorsprite.h +++ b/src/actorsprite.h @@ -133,15 +133,6 @@ public: { mUsedTargetCursor = nullptr; } /** - * Triggers a visual effect, such as `level up'. Only draws the visual - * effect, does not play sound effects. - * - * \param effectId ID of the effect to trigger - */ - virtual void triggerEffect(const int effectId) - { internalTriggerEffect(effectId, false, true); } - - /** * Sets the actor's stun mode. If zero, the being is `normal', otherwise it * is `stunned' in some fashion. */ @@ -190,16 +181,6 @@ public: protected: /** - * Trigger visual effect, with components - * - * \param effectId ID of the effect to trigger - * \param sfx Whether to trigger sound effects - * \param gfx Whether to trigger graphical effects - */ - void internalTriggerEffect(const int effectId, const bool sfx, - const bool gfx); - - /** * Notify self that the stun mode has been updated. Invoked by * setStunMode if something changed. */ |