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 __GLOBAL_MEDIA_HEADER__
12 #define __GLOBAL_MEDIA_HEADER__
13 
14 #include "common/global/objects/global_object.h"
15 #include "common/global/objects/global_item.h"
16 
17 #include "engine/video/image.h"
18 
19 namespace vt_audio {
20 class SoundDescriptor;
21 }
22 
23 namespace vt_global
24 {
25 
26 /** \brief A simple class used to store commonly used media files.
27 *** It is used as a member of the game global class.
28 **/
29 class GlobalMedia {
30 public:
GlobalMedia()31     GlobalMedia() {}
32 
33     ~GlobalMedia();
34 
35     //! \brief Loads all the media files.
36     //! Should be called after the final intialization of the VideoManager as
37     //! the texture manager is ready only afterward.
38     void Initialize();
39 
GetDrunesIcon()40     vt_video::StillImage* GetDrunesIcon() {
41         return &_drunes_icon;
42     }
43 
GetStarIcon()44     vt_video::StillImage* GetStarIcon() {
45         return &_star_icon;
46     }
47 
GetCheckIcon()48     vt_video::StillImage* GetCheckIcon() {
49         return &_check_icon;
50     }
51 
GetXIcon()52     vt_video::StillImage* GetXIcon() {
53         return &_x_icon;
54     }
55 
GetSpiritSlotIcon()56     vt_video::StillImage* GetSpiritSlotIcon() {
57         return &_spirit_slot_icon;
58     }
59 
GetEquipIcon()60     vt_video::StillImage* GetEquipIcon() {
61         return &_equip_icon;
62     }
63 
GetKeyItemIcon()64     vt_video::StillImage* GetKeyItemIcon() {
65         return &_key_item_icon;
66     }
67 
GetClockIcon()68     vt_video::StillImage* GetClockIcon() {
69         return &_clock_icon;
70     }
71 
GetBottomMenuImage()72     vt_video::StillImage* GetBottomMenuImage() {
73         return &_bottom_menu_image;
74     }
75 
GetStaminaBarBackgroundImage()76     vt_video::StillImage* GetStaminaBarBackgroundImage() {
77         return &_stamina_bar_background;
78     }
79 
GetStaminaBarImage()80     vt_video::StillImage* GetStaminaBarImage() {
81         return &_stamina_bar;
82     }
83 
GetStaminaInfiniteImage()84     vt_video::StillImage* GetStaminaInfiniteImage() {
85         return &_stamina_bar_infinite_overlay;
86     }
87 
GetAllItemCategoryIcons()88     std::vector<vt_video::StillImage>* GetAllItemCategoryIcons() {
89         return &_all_category_icons;
90     }
GetAllSmallItemCategoryIcons()91     std::vector<vt_video::StillImage>* GetAllSmallItemCategoryIcons() {
92         return &_small_category_icons;
93     }
94 
95     /** \brief Retrieves the category icon image that represents the specified object type
96     *** \param object_type The type of the global object to retrieve the icon for
97     *** \return A pointer to the image holding the category's icon. nullptr if the argument was invalid.
98     *** \note GLOBAL_OBJECT_TOTAL will return the icon for "all wares"
99     **/
100     vt_video::StillImage* GetItemCategoryIcon(GLOBAL_OBJECT object_type);
101 
102     /** \brief Retrieves the category icon image that represents the specified object type
103     *** \param object_type The type of the global object to retrieve the icon for
104     *** \return A pointer to the image holding the category's icon. nullptr if the argument was invalid.
105     *** \note GLOBAL_OBJECT_TOTAL will return the icon for "all wares"
106     **/
107     vt_video::StillImage* GetSmallItemCategoryIcon(ITEM_CATEGORY object_category);
108 
109     /** \brief Retrieves a specific elemental icon with the proper type and intensity
110     *** \param element_type The type of element the user is trying to retrieve the icon for
111     *** \param intensity The intensity level of the icon to retrieve
112     *** \return The icon representation of the element type and intensity
113     **/
114     vt_video::StillImage* GetElementalIcon(GLOBAL_ELEMENTAL element_type, GLOBAL_INTENSITY intensity);
115 
116     /** \brief Retrieves a specific status icon with the proper type and intensity
117     *** \param status_type The type of status the user is trying to retrieve the icon for
118     *** \param intensity The intensity level of the icon to retrieve
119     *** \return The icon representation of the status type and intensity
120     **/
121     vt_video::StillImage* GetStatusIcon(GLOBAL_STATUS status_type, GLOBAL_INTENSITY intensity);
122 
123     /** \brief Plays a sound object previously loaded
124     *** \param identifier The string identifier for the sound to play
125     **/
126     void PlaySound(const std::string& identifier);
127 
128 private:
129     //! \brief Retains icon images for all possible object categories, including "all wares"
130     std::vector<vt_video::StillImage> _all_category_icons;
131 
132     //! \brief Category icons - in a smaller size for the party menu.
133     std::vector<vt_video::StillImage> _small_category_icons;
134 
135     //! \brief Image icon representing drunes (currency)
136     vt_video::StillImage _drunes_icon;
137 
138     //! \brief Image icon of a single yellow/gold star
139     vt_video::StillImage _star_icon;
140 
141     //! \brief Image icon of a green check mark
142     vt_video::StillImage _check_icon;
143 
144     //! \brief Image icon of a red x
145     vt_video::StillImage _x_icon;
146 
147     //! \brief Image icon representing open spirit slots available on weapons and armors
148     vt_video::StillImage _spirit_slot_icon;
149 
150     //! \brief Image icon that represents when a character has a weapon or armor equipped
151     vt_video::StillImage _equip_icon;
152 
153     //! \brief The Key item icon
154     vt_video::StillImage _key_item_icon;
155 
156     //! \brief The clock icon
157     vt_video::StillImage _clock_icon;
158 
159     //! \brief Image which underlays the stamina bar for running
160     vt_video::StillImage _stamina_bar_background;
161 
162     //! \brief The stamina bar representing the current stamina
163     vt_video::StillImage _stamina_bar;
164 
165     //! \brief Image which overlays the stamina bar to show that the player has unlimited running
166     vt_video::StillImage _stamina_bar_infinite_overlay;
167 
168     //! \brief Retains all icon images that represent the game's status effects
169     std::vector<vt_video::StillImage> _status_icons;
170 
171     //! \brief The battle and boot bottom image
172     vt_video::StillImage _bottom_menu_image;
173 
174     //! \brief A map of the sounds used in different game modes
175     std::map<std::string, vt_audio::SoundDescriptor*> _sounds;
176 
177     //! \brief Loads a sound file and add it to the sound map
178     void _LoadSoundFile(const std::string& sound_name, const std::string& filename);
179 };
180 
181 } // namespace vt_global
182 
183 #endif // __GLOBAL_MEDIA_HEADER__
184