diff options
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/skilldialog.cpp | 93 | ||||
-rw-r--r-- | src/gui/skilldialog.h | 37 |
2 files changed, 71 insertions, 59 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); diff --git a/src/gui/skilldialog.h b/src/gui/skilldialog.h index 56858ef5e..1cb832906 100644 --- a/src/gui/skilldialog.h +++ b/src/gui/skilldialog.h @@ -40,7 +40,42 @@ class SkillModel; class Tab; class TabbedArea; -struct SkillInfo; +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; + std::string particle; + std::string soundHit; + std::string soundMiss; + + SkillInfo(); + + ~SkillInfo(); + + void setIcon(const std::string &iconPath); + + void update(); + + void draw(Graphics *graphics, int y, int width); +}; + + +typedef std::vector<SkillInfo*> SkillList; + /** * The skill dialog. |