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 and 7 // 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 __BATTLE_COMMAND_SETTINGS_HEADER__ 12 #define __BATTLE_COMMAND_SETTINGS_HEADER__ 13 14 #include "modes/battle/battle_target.h" 15 16 #include "common/gui/menu_window.h" 17 #include "common/gui/option.h" 18 19 namespace vt_battle 20 { 21 22 namespace private_battle 23 { 24 25 class BattleCharacter; 26 27 //! \brief Action Type Constants 28 enum COMMAND_CATEGORY { 29 CATEGORY_WEAPON = 0, 30 CATEGORY_MAGIC = 1, 31 CATEGORY_SPECIAL = 2, 32 CATEGORY_ITEM = 3 33 }; 34 35 /** **************************************************************************** 36 *** \brief Manages skill selection lists and cursor memory for an individual character 37 *** 38 *** Each character participating in the battle will have an instance of this class 39 *** created for it. The class has two primary functions. First, it creates and 40 *** manages OptionBox objects for the character's attack, defense, and support skills. 41 *** Second, it retains the previous selections that were made for that character. 42 *** 43 *** The class retains three different types of previous targets rather than a single target. 44 *** These three target members are used to retain different target types (self, ally, and foe). 45 *** Party targets (all allies, all foes) are not retained since there are not mulitple possibilites 46 *** for those target types. The self target types also only have a single actor target (the character 47 *** himself/herself), but it is still used because the character can target multiple points on itself. 48 *** ***************************************************************************/ 49 class CommandSettings 50 { 51 public: 52 /** \param character A pointer to the character represented by this class 53 *** \param window A reference to the MenuWindow that should be the owner of the GUI displays 54 **/ 55 CommandSettings(BattleCharacter* character, vt_gui::MenuWindow& window); 56 ~CommandSettings()57 ~CommandSettings() 58 {} 59 60 /** \brief Refreshes all entries in the attack, defense, and support lists 61 *** This should be called whenever the character's current skill points has changed or may have 62 *** changed. This method will go through all three skill lists and use the character's current 63 *** skill points to determine whether each entry should be enabled or disabled. 64 **/ 65 void RefreshLists(); 66 67 /** \brief Sets the appropriate last target member based on the argument target type 68 *** \param target A reference to the target to save 69 *** 70 *** This function will not complain if given any valid target type, including party type targets. 71 *** Party targets will simply be ignored since those target types are not retained. Otherwise if 72 *** the target type is not invalid, the appropriate last target will be set. 73 **/ 74 void SaveLastTarget(BattleTarget &target); 75 76 //! \name Class member accessor methods 77 //@{ SetLastCategory(uint32_t category)78 void SetLastCategory(uint32_t category) { 79 _last_category = category; 80 } 81 SetLastItem(uint32_t item)82 void SetLastItem(uint32_t item) { 83 _last_item = item; 84 } 85 GetCharacter()86 BattleCharacter *GetCharacter() const { 87 return _character; 88 } 89 GetLastCategory()90 uint32_t GetLastCategory() const { 91 return _last_category; 92 } 93 GetLastItem()94 uint32_t GetLastItem() const { 95 return _last_item; 96 } 97 GetLastSelfTarget()98 BattleTarget GetLastSelfTarget() const { 99 return _last_self_target; 100 } 101 GetLastCharacterTarget()102 BattleTarget GetLastCharacterTarget() const { 103 return _last_character_target; 104 } 105 GetLastEnemyTarget()106 BattleTarget GetLastEnemyTarget() const { 107 return _last_enemy_target; 108 } 109 GetWeaponSkillList()110 vt_gui::OptionBox* GetWeaponSkillList() { 111 return &_weapon_skill_list; 112 } GetWeaponTargetList()113 vt_gui::OptionBox* GetWeaponTargetList() { 114 return &_weapon_target_list; 115 } 116 GetMagicSkillList()117 vt_gui::OptionBox* GetMagicSkillList() { 118 return &_magic_skill_list; 119 } GetMagicTargetList()120 vt_gui::OptionBox* GetMagicTargetList() { 121 return &_magic_target_list; 122 } 123 GetSpecialSkillList()124 vt_gui::OptionBox* GetSpecialSkillList() { 125 return &_special_skill_list; 126 } GetSpecialTargetList()127 vt_gui::OptionBox* GetSpecialTargetList() { 128 return &_special_target_list; 129 } 130 //@} 131 132 private: 133 //! \brief A pointer to the character whose properties are represented by this class 134 BattleCharacter* _character; 135 136 //! \brief The last category of action that the player selected for this character 137 uint32_t _last_category; 138 139 //! \brief The index of the last item that the player selected for this character 140 uint32_t _last_item; 141 142 //! \brief Holds the last attack point that the player selected for the character to target on themselves 143 BattleTarget _last_self_target; 144 145 //! \brief The last character target that the player selected for this character 146 BattleTarget _last_character_target; 147 148 //! \brief The last enemy target that the player selected for this character 149 BattleTarget _last_enemy_target; 150 151 //! \brief A display list of all usable weapon skills 152 vt_gui::OptionBox _weapon_skill_list; 153 vt_gui::OptionBox _weapon_target_list; 154 155 //! \brief A display list of all usable magic skills 156 vt_gui::OptionBox _magic_skill_list; 157 vt_gui::OptionBox _magic_target_list; 158 159 //! \brief A display list of all usable items 160 vt_gui::OptionBox _special_skill_list; 161 vt_gui::OptionBox _special_target_list; 162 }; 163 164 } // namespace private_battle 165 166 } // namespace vt_battle 167 168 #endif // __BATTLE_COMMAND_SETTINGS_HEADER__ 169