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 http://www.gnu.org/copyleft/gpl.html for details.
9 ////////////////////////////////////////////////////////////////////////////////
10 
11 #ifndef __BATTLE_MEDIA_HEADER__
12 #define __BATTLE_MEDIA_HEADER__
13 
14 #include "common/global/global_target.h"
15 
16 #include "engine/video/image.h"
17 #include "engine/video/text.h"
18 
19 #include "engine/audio/audio_descriptor.h"
20 
21 namespace vt_global {
22 
23 /** ****************************************************************************
24 *** \brief A specialized class to BattleMode that holds various related multimedia data
25 ***
26 *** Many of the battle mode interfaces require access to a common set of media data.
27 *** This class retains all of this common media data and makes it available for these
28 *** classes to utilize. It also serves to reduce the number of methods and members of
29 *** the BattleMode class.
30 *** ***************************************************************************/
31 class BattleMedia
32 {
33 public:
BattleMedia()34     BattleMedia()
35     {}
36 
~BattleMedia()37     ~BattleMedia()
38     {}
39 
40     //! \brief Loads all the battle media files.
41     //! Should be called after the final intialization of the VideoManager as
42     //! the texture manager is ready only afterward.
43     void Initialize();
44 
45     ///! \brief Updates the different animations and media
46     void Update();
47 
48     /** \brief Sets the background image for the battle
49     *** \param filename The filename of the new background image to load
50     **/
51     void SetBackgroundImage(const std::string& filename);
52 
53     /** \brief Sets the battle music to use
54     *** \param filename The full filename of the music to play
55     **/
56     void SetBattleMusic(const std::string& filename);
57 
58     /** \brief Retrieves a specific button icon for character action
59     *** \param index The index of the button to retrieve
60     *** \return A pointer to the appropriate button image, or nullptr if the index argument was out of bounds
61     **/
62     vt_video::StillImage* GetCharacterActionButton(uint32_t index);
63 
64     /** \brief Retrieves the appropriate icon image given a valid target type
65     *** \param target_type The enumerated value that represents the type of target
66     *** \return A pointer to the appropriate icon image, or nullptr if the target type was invalid
67     **/
68     vt_video::StillImage* GetTargetTypeIcon(vt_global::GLOBAL_TARGET target_type);
69 
GetStunnedIcon()70     inline const vt_video::StillImage& GetStunnedIcon() const {
71         return _stunned_icon;
72     }
73 
GetAutoBattleIcon()74     inline const vt_video::StillImage& GetAutoBattleIcon() const {
75         return _auto_battle_icon;
76     }
77 
GetEscapeIcon()78     inline const vt_video::StillImage& GetEscapeIcon() const {
79         return _escape_icon;
80     }
81 
82     // ---------- Public members
83 
84     //! \brief The static background image to be used for the battle
85     vt_video::StillImage background_image;
86 
87     //! \brief The static image that is drawn for the bottom menus
88     vt_video::StillImage bottom_menu_image;
89 
90     /** \brief An image that indicates that a particular actor has been selected
91     *** This image best suites character sprites and enemy sprites of similar size. It does not work
92     *** well with larger or smaller sprites.
93     **/
94     vt_video::StillImage actor_selection_image;
95 
96     /** \brief An image that points out the location of specific attack points on an actor
97     *** This image may be used for both character and enemy actors. It is used to indicate an actively selected
98     *** attack point, <b>not</b> just any attack points present.
99     **/
100     vt_video::AnimatedImage attack_point_indicator;
101 
102     //! \brief Used to provide a background highlight for a selected character
103     vt_video::StillImage character_selected_highlight;
104 
105     //! \brief Used to provide a background highlight for a character that needs a command set
106     vt_video::StillImage character_command_highlight;
107 
108     /** \brief The universal stamina bar that is used to represent the state of battle actors
109     *** All battle actors have a portrait that moves along this meter to signify their
110     *** turn in the rotation.  The meter and corresponding portraits must be drawn after the
111     *** character sprites.
112     **/
113     vt_video::StillImage stamina_meter;
114 
115     //! \brief The image used to highlight stamina icons for selected actors
116     vt_video::StillImage stamina_icon_selected;
117 
118     /** \brief Small button icons used to indicate when a player can select an action for their characters
119     *** These buttons are used to indicate to the player what button to press to bring up a character's command
120     *** menu. This vector is built from a 2-row, 5-column multi-image. The rows represent the buttons for when
121     *** the character can be given a command (first row) versus when they may not (second row). The first element
122     *** in each row is a "blank" button that is not used. The next four elements correspond to the characters on
123     *** the screen, from top to bottom.
124     **/
125     std::vector<vt_video::StillImage> character_action_buttons;
126 
127     //! \brief The music filename played during the battle.
128     //! We only keep a string because this music is handled by the audio manager
129     //! for better cross game modes support.
130     std::string battle_music_filename;
131 
132     //! \brief The music filename played after the player has won the battle.
133     //! We only keep a string because this music is handled by the audio manager
134     //! for better cross game modes support.
135     std::string victory_music_filename;
136 
137     //! \brief The music filename played after the player has lost the battle. Don't delete it.
138     //! We only keep a string because this music is handled by the audio manager
139     //! for better cross game modes support.
140     std::string defeat_music_filename;
141     //@}
142 
143 private:
144     /** \brief Holds icon images that represent the different types of targets
145     *** Target types include attack points, ally/enemy, and different parties.
146     **/
147     std::vector<vt_video::StillImage> _target_type_icons;
148 
149     //! \brief An icon displayed above the character's head when it is stunned.
150     vt_video::StillImage _stunned_icon;
151 
152     //! \brief The auto battle icon.
153     vt_video::StillImage _auto_battle_icon;
154 
155     //! \brief The escape icon.
156     vt_video::StillImage _escape_icon;
157 }; // class BattleMedia
158 
159 } // namespace vt_global
160 
161 #endif // __BATTLE_MEDIA_HEADER__
162