1 ////////////////////////////////////////////////////////////////////////////////
2 //            Copyright (C) 2004-2011 by The Allacrost Project
3 //            Copyright (C) 2012-2018 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_EMOTES_HEADER__
12 #define __GLOBAL_EMOTES_HEADER__
13 
14 #include "modes/map/map_utils.h"
15 
16 #include "engine/video/image.h"
17 
18 #include <string>
19 #include <map>
20 
21 namespace vt_global
22 {
23 
24 class EmoteHandler
25 {
26 public:
EmoteHandler()27     EmoteHandler() {}
~EmoteHandler()28     ~EmoteHandler() {}
29 
30     //! \brief Clear emotes data
31     void Clear();
32 
33     //! \brief loads the emotes used for character feelings expression in the given lua file.
34     void LoadEmotes(const std::string& emotes_filename);
35 
36     //! \brief Set up the offsets for the given emote animation and sprite direction.
37     void GetEmoteOffset(float& x, float& y,
38                         const std::string& emote_id,
39                         vt_map::private_map::ANIM_DIRECTIONS dir);
40 
41     //! \brief Tells whether an emote id exists and is valid
42     bool DoesEmoteExist(const std::string& emote_id);
43 
44     //! \brief Get a pointer reference to the given emote animation. Don't delete it!
45     vt_video::AnimatedImage* GetEmoteAnimation(const std::string& emote_id);
46 
47 private:
48     //! \brief A map containing all the emote animations
49     std::map<std::string, vt_video::AnimatedImage> _emotes;
50     //! \brief The map continaing the four sprite direction offsets (x and y value).
51     std::map<std::string, std::vector<std::pair<float, float> > > _emotes_offsets;
52 };
53 
54 } // namespace vt_global
55 
56 #endif // __GLOBAL_EMOTES_HEADER__
57