summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThorbjørn Lindeijer <bjorn@lindeijer.nl>2024-04-09 11:58:11 +0200
committerThorbjørn Lindeijer <bjorn@lindeijer.nl>2024-04-09 11:58:16 +0200
commit6f102137fc36447b7ce29fd065581a1f6f996fc6 (patch)
tree907bccd9cb67f9b7e05baaf73b52637e86984bc8
parent20ec47a6504f5ebed9a4986e3d004f3445e3f987 (diff)
downloadmana-6f102137fc36447b7ce29fd065581a1f6f996fc6.tar.gz
mana-6f102137fc36447b7ce29fd065581a1f6f996fc6.tar.bz2
mana-6f102137fc36447b7ce29fd065581a1f6f996fc6.tar.xz
mana-6f102137fc36447b7ce29fd065581a1f6f996fc6.zip
Removed unused duplicate parsing of effects.xml
The loading of effects.xml has ended up being duplicated, with an implementation in getEffectDescription in actorsprite.cpp as well as in EffectManager. But the one in actorsprite.cpp was actually never used.
-rw-r--r--src/actorsprite.cpp88
-rw-r--r--src/actorsprite.h20
2 files changed, 0 insertions, 108 deletions
diff --git a/src/actorsprite.cpp b/src/actorsprite.cpp
index 90176dcd..e279ba5f 100644
--- a/src/actorsprite.cpp
+++ b/src/actorsprite.cpp
@@ -27,7 +27,6 @@
#include "localplayer.h"
#include "log.h"
#include "simpleanimation.h"
-#include "sound.h"
#include "statuseffect.h"
#include "resources/animation.h"
@@ -151,68 +150,6 @@ void ActorSprite::setTargetType(TargetCursorType type)
mUsedTargetCursor = targetCursor[type][getTargetCursorSize()];
}
-struct EffectDescription {
- std::string mGFXEffect;
- std::string mSFXEffect;
-};
-
-static EffectDescription *default_effect = nullptr;
-static std::map<int, EffectDescription *> effects;
-static bool effects_initialized = false;
-
-static EffectDescription *getEffectDescription(xmlNodePtr node, int *id)
-{
- auto *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(int effectId)
-{
- if (!effects_initialized)
- {
- XML::Document doc(EFFECTS_FILE);
- xmlNodePtr root = doc.rootNode();
-
- if (!root || !xmlStrEqual(root->name, BAD_CAST "effects"))
- {
- logger->log("Error loading being effects file: "
- EFFECTS_FILE);
- return nullptr;
- }
-
- for_each_xml_child_node(node, root)
- {
- int id;
-
- if (xmlStrEqual(node->name, BAD_CAST "effect"))
- {
- EffectDescription *EffectDescription =
- getEffectDescription(node, &id);
- effects[id] = EffectDescription;
- }
- else if (xmlStrEqual(node->name, BAD_CAST "default"))
- {
- EffectDescription *effectDescription =
- getEffectDescription(node, &id);
-
- delete default_effect;
- default_effect = effectDescription;
- }
- }
-
- effects_initialized = true;
- } // done initializing
-
- EffectDescription *ed = effects[effectId];
-
- return ed ? ed : default_effect;
-}
-
void ActorSprite::setStatusEffect(int index, bool active)
{
const bool wasActive = mStatusEffects.find(index) != mStatusEffects.end();
@@ -238,31 +175,6 @@ void ActorSprite::setStatusEffectBlock(int offset, uint16_t newEffects)
}
}
-void ActorSprite::internalTriggerEffect(int effectId, bool sfx, bool gfx)
-{
- logger->log("Special effect #%d on %s", effectId,
- getId() == local_player->getId() ? "self" : "other");
-
- EffectDescription *ed = getEffectDescription(effectId);
-
- if (!ed)
- {
- logger->log("Unknown special effect and no default recorded");
- return;
- }
-
- if (gfx && !ed->mGFXEffect.empty())
- {
- Particle *selfFX;
-
- selfFX = particleEngine->addEffect(ed->mGFXEffect, 0, 0);
- controlParticle(selfFX);
- }
-
- if (sfx && !ed->mSFXEffect.empty())
- sound.playSfx(ed->mSFXEffect);
-}
-
void ActorSprite::updateStunMode(int oldMode, int newMode)
{
if (this == local_player)
diff --git a/src/actorsprite.h b/src/actorsprite.h
index b3e14830..883934aa 100644
--- a/src/actorsprite.h
+++ b/src/actorsprite.h
@@ -114,17 +114,6 @@ public:
void untarget() { 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(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.
*/
@@ -163,15 +152,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(int effectId, bool sfx, bool gfx);
-
- /**
* Notify self that the stun mode has been updated. Invoked by
* setStunMode if something changed.
*/