1 ///////////////////////////////////////////////////////////////////////////////
2 //            Copyright (C) 2004-2011 by The Allacrost Project
3 //            Copyright (C) 2012-2016 by Bertram (Valyria Tear)
4 //                         All Rights Reserved
5 //
6 // This code is licensed under the GNU GPL version 2. It is free software
7 // and you may modify it and/or redistribute it under the terms of this license.
8 // See https://www.gnu.org/copyleft/gpl.html for details.
9 ///////////////////////////////////////////////////////////////////////////////
10 
11 #ifndef __MENU_SKILLS_WINDOW__
12 #define __MENU_SKILLS_WINDOW__
13 
14 #include "common/global/global.h"
15 #include "common/gui/textbox.h"
16 
17 #include "common/gui/menu_window.h"
18 #include "common/gui/option.h"
19 
20 namespace vt_menu
21 {
22 
23 class MenuMode;
24 
25 namespace private_menu
26 {
27 
28 //! \brief The different skill types
29 enum SKILL_CATEGORY {
30     SKILL_ALL = 0,
31     SKILL_FIELD = 1,
32     SKILL_BATTLE = 2,
33     SKILL_CATEGORY_SIZE = 3
34 };
35 
36 //! \brief The different option boxes that can be active for skills
37 enum SKILL_ACTIVE_OPTION {
38     SKILL_ACTIVE_NONE = 0,
39     SKILL_ACTIVE_CHAR = 1,
40     SKILL_ACTIVE_CATEGORY = 2,
41     SKILL_ACTIVE_LIST = 3,
42     SKILL_ACTIVE_CHAR_APPLY = 4,
43     SKILL_ACTIVE_SIZE = 5
44 };
45 
46 /** ****************************************************************************
47 *** \brief Represents the Skills window, displaying all the skills for the character.
48 ***
49 *** This window display all the skills for a particular character.
50 *** You can scroll through them all, filter by category, choose one, and apply it
51 *** to a character.
52 *** ***************************************************************************/
53 class SkillsWindow : public vt_gui::MenuWindow
54 {
55     friend class vt_menu::MenuMode;
56     friend class SkillsState;
57 public:
58     SkillsWindow();
59 
~SkillsWindow()60     ~SkillsWindow()
61     {}
62 
63     /*!
64     * \brief Updates key presses and window states
65     */
66     void Update();
67 
68     /*!
69     * \brief Draws the windows and option boxes
70     * \return success/failure
71     */
72     void Draw();
73 
74     /*!
75     * \brief Activates the window
76     * \param new_value true to activate window, false to deactivate window
77     */
78     void Activate(bool is_active_state);
79 
80     /*!
81     * \brief Checks to see if the skills window is active
82     * \return true if the window is active, false if it's not
83     */
IsActive()84     bool IsActive() {
85         return _active_box;
86     }
87 
88 private:
89     //! Flag to specify the active option box
90     uint32_t _active_box;
91 
92     //! The character select option box
93     vt_gui::OptionBox _char_select;
94 
95     //! The skills categories option box
96     vt_gui::OptionBox _skills_categories;
97 
98     //! The skills list option box
99     vt_gui::OptionBox _skills_list;
100 
101     //! The skill SP cost option box
102     vt_gui::OptionBox _skill_cost_list;
103 
104     //! TextBox that holds the selected skill's description
105     vt_gui::TextBox _description;
106 
107     //! The current skill icon, if any
108     vt_video::StillImage _skill_icon;
109 
110     //! Track which character's skillset was chosen
111     int32_t _char_skillset;
112 
113     /*!
114     * \brief Initializes the skills category chooser
115     */
116     void _InitSkillsCategories();
117 
118     /*!
119     * \brief Initializes the skills chooser
120     */
121     void _InitSkillsList();
122 
123     /*!
124     * \brief Initializes the character selector
125     */
126     void _InitCharSelect();
127 
128     //! \brief Returns the currently selected skill
129     vt_global::GlobalSkill *_GetCurrentSkill();
130 
131     /*!
132     * \brief Sets up the skills that comprise the different categories
133     */
134     void _UpdateSkillList();
135 
136     vt_utils::ustring _BuildSkillListText(const vt_global::GlobalSkill *skill);
137 
138     //! \brief parses the 3 skill lists of the global character and sorts them according to use (menu/battle)
139     void _BuildMenuBattleSkillLists(std::vector<vt_global::GlobalSkill *> *skill_list,
140                                     std::vector<vt_global::GlobalSkill *> *field, std::vector<vt_global::GlobalSkill *> *battle,
141                                     std::vector<vt_global::GlobalSkill *> *all);
142 
143 };
144 
145 } // namespace private_menu
146 
147 } // namespace vt_menu
148 
149 #endif // __MENU_SKILLS_WINDOW__
150