diff options
author | Andrei Karas <akaras@inbox.ru> | 2012-03-10 18:04:32 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2012-03-10 19:05:04 +0300 |
commit | 307818fecbd1f258c668a1667e76e950e9d22622 (patch) | |
tree | 6a4b82e23895a5f73b648aefafc8d77247661392 /src/gui/skilldialog.cpp | |
parent | 46cc993b30fe9a4da9175beb2795de91162c39fa (diff) | |
download | manaplus-307818fecbd1f258c668a1667e76e950e9d22622.tar.gz manaplus-307818fecbd1f258c668a1667e76e950e9d22622.tar.bz2 manaplus-307818fecbd1f258c668a1667e76e950e9d22622.tar.xz manaplus-307818fecbd1f258c668a1667e76e950e9d22622.zip |
Add to skills missile particle effect and hit/miss sounds.
Add to skills use effect 100000 + skillid on target.
Diffstat (limited to 'src/gui/skilldialog.cpp')
-rw-r--r-- | src/gui/skilldialog.cpp | 93 |
1 files changed, 35 insertions, 58 deletions
diff --git a/src/gui/skilldialog.cpp b/src/gui/skilldialog.cpp index d5af42aae..023c5a4f0 100644 --- a/src/gui/skilldialog.cpp +++ b/src/gui/skilldialog.cpp @@ -65,64 +65,6 @@ class SkillModel; class SkillEntry; -struct SkillInfo -{ - unsigned short id; - std::string name; - std::string dispName; - Image *icon; - bool modifiable; - bool visible; - SkillModel *model; - - int level; - std::string skillLevel; - int skillLevelWidth; - - std::string skillExp; - float progress; - gcn::Color color; - int range; - - SkillInfo() : - id(0), name(""), dispName(""), icon(nullptr), modifiable(false), - visible(false), model(nullptr), level(0), skillLevel(""), - skillLevelWidth(0), skillExp(""), progress(0.0f), range(0) - { - } - - ~SkillInfo() - { - if (icon) - { - icon->decRef(); - icon = nullptr; - } - } - - void setIcon(const std::string &iconPath) - { - ResourceManager *res = ResourceManager::getInstance(); - if (!iconPath.empty()) - { - icon = res->getImage(iconPath); - } - - if (!icon) - { - icon = Theme::getImageFromTheme( - paths.getStringValue("unknownItemFile")); - } - } - - void update(); - - void draw(Graphics *graphics, int y, int width); -}; - - -typedef std::vector<SkillInfo*> SkillList; - class SkillModel : public gcn::ListModel { public: @@ -477,6 +419,9 @@ void SkillDialog::loadSkills(const std::string &file) skill->setIcon(icon); skill->modifiable = false; skill->visible = false; + skill->particle = XML::getProperty(node, "particle", ""); + skill->soundHit = XML::getProperty(node, "soundHit", ""); + skill->soundMiss = XML::getProperty(node, "soundMiss", ""); skill->model = model; skill->update(); @@ -561,6 +506,38 @@ void SkillModel::updateVisibilities() } } +SkillInfo::SkillInfo() : + id(0), name(""), dispName(""), icon(nullptr), modifiable(false), + visible(false), model(nullptr), level(0), skillLevel(""), + skillLevelWidth(0), skillExp(""), progress(0.0f), range(0), + particle(""), soundHit(""), soundMiss("") +{ +} + +SkillInfo::~SkillInfo() +{ + if (icon) + { + icon->decRef(); + icon = nullptr; + } +} + +void SkillInfo::setIcon(const std::string &iconPath) +{ + ResourceManager *res = ResourceManager::getInstance(); + if (!iconPath.empty()) + { + icon = res->getImage(iconPath); + } + + if (!icon) + { + icon = Theme::getImageFromTheme( + paths.getStringValue("unknownItemFile")); + } +} + void SkillInfo::update() { int baseLevel = PlayerInfo::getStatBase(id); |