summaryrefslogtreecommitdiff
path: root/src/being.cpp
diff options
context:
space:
mode:
authorIra Rice <irarice@gmail.com>2008-12-03 12:30:11 -0700
committerIra Rice <irarice@gmail.com>2008-12-03 12:30:11 -0700
commit68926c15e6d31c4af90bce9ec57aa39f839d7d6b (patch)
tree18fc1553fabfe16022950facf16422afd191fa01 /src/being.cpp
parent414afae670d09e34a4b5c0528c9ca6c3abb03124 (diff)
downloadmana-client-68926c15e6d31c4af90bce9ec57aa39f839d7d6b.tar.gz
mana-client-68926c15e6d31c4af90bce9ec57aa39f839d7d6b.tar.bz2
mana-client-68926c15e6d31c4af90bce9ec57aa39f839d7d6b.tar.xz
mana-client-68926c15e6d31c4af90bce9ec57aa39f839d7d6b.zip
Add an effects manager (patch by Kage Jittai)
NOTE: This patch demonstrates the need to fix pixel coordinates in the eAthena client. Bjorn did the movement patch in the TMWClient, however, I still haven't got that fully working with the merges. It's likely that a clone will be developed to tackle this problem. Signed-off-by: Ira Rice <irarice@gmail.com>
Diffstat (limited to 'src/being.cpp')
-rw-r--r--src/being.cpp90
1 files changed, 0 insertions, 90 deletions
diff --git a/src/being.cpp b/src/being.cpp
index 27bd0c57..ded3abd8 100644
--- a/src/being.cpp
+++ b/src/being.cpp
@@ -571,93 +571,3 @@ int Being::getHeight() const
}
}
-struct EffectDescription
-{
- std::string mGFXEffect;
- std::string mSFXEffect;
-};
-
-static EffectDescription *default_effect = NULL;
-static std::map<int, EffectDescription *> effects;
-static bool effects_initialized = false;
-
-static EffectDescription *getEffectDescription(xmlNodePtr node, int *id)
-{
- EffectDescription *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(BEING_EFFECTS_FILE);
- xmlNodePtr root = doc.rootNode();
-
- if (!root || !xmlStrEqual(root->name, BAD_CAST "being-effects"))
- {
- logger->log("Error loading being effects file: "
- BEING_EFFECTS_FILE);
- return NULL;
- }
-
- 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);
-
- if (default_effect)
- delete default_effect;
-
- default_effect = EffectDescription;
- }
- }
-
- effects_initialized = true;
- } // done initializing
-
- EffectDescription *ed = effects[effectId];
-
- if (!ed)
- return default_effect;
- else
- return ed;
-}
-
-void Being::internalTriggerEffect(int effectId, bool sfx, bool gfx)
-{
- logger->log("Special effect #%d on %s", effectId,
- getId() == player_node->getId() ? "self" : "other");
-
- EffectDescription *ed = getEffectDescription(effectId);
-
- if (!ed) {
- logger->log("Unknown special effect and no default recorded");
- return;
- }
-
- if (gfx && ed->mGFXEffect != "" && mParticleEffects) {
- Particle *selfFX;
-
- selfFX = particleEngine->addEffect(ed->mGFXEffect, 0, 0);
- controlParticle(selfFX);
- }
-
- if (sfx && ed->mSFXEffect != "") {
- sound.playSfx(ed->mSFXEffect);
- }
-}