1 /*
2  *  This file is part of Dune Legacy.
3  *
4  *  Dune Legacy is free software: you can redistribute it and/or modify
5  *  it under the terms of the GNU General Public License as published by
6  *  the Free Software Foundation, either version 2 of the License, or
7  *  (at your option) any later version.
8  *
9  *  Dune Legacy is distributed in the hope that it will be useful,
10  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12  *  GNU General Public License for more details.
13  *
14  *  You should have received a copy of the GNU General Public License
15  *  along with Dune Legacy.  If not, see <http://www.gnu.org/licenses/>.
16  */
17 
18 #ifndef GLOBALS_H
19 #define GLOBALS_H
20 
21 #include <DataTypes.h>
22 #include <Definitions.h>
23 #include <Colors.h>
24 #include <FileClasses/Palette.h>
25 #include <data.h>
26 #include <misc/RobustList.h>
27 #include <misc/DrawingRectHelper.h>
28 
29 #include <SDL.h>
30 
31 #define _(msgid) pTextManager->getLocalized(msgid)
32 
33 // forward declarations
34 class SoundPlayer;
35 class MusicPlayer;
36 
37 class FileManager;
38 class GFXManager;
39 class SFXManager;
40 class FontManager;
41 class TextManager;
42 class NetworkManager;
43 
44 class Game;
45 class Map;
46 class ScreenBorder;
47 class House;
48 class HumanPlayer;
49 class UnitBase;
50 class StructureBase;
51 class Bullet;
52 
53 #ifndef SKIP_EXTERN_DEFINITION
54  #define EXTERN extern
55 #else
56  #define EXTERN
57 #endif
58 
59 
60 // SDL stuff
61 EXTERN SDL_Window*          window;                     ///< the window
62 EXTERN SDL_Renderer*        renderer;                   ///< the renderer
63 EXTERN SDL_Texture*         screenTexture;              ///< the texture
64 EXTERN Palette              palette;                    ///< the palette for the screen
65 EXTERN int                  drawnMouseX;                ///< the current mouse position (x coordinate)
66 EXTERN int                  drawnMouseY;                ///< the current mouse position (y coordinate)
67 EXTERN int                  cursorFrame;                ///< the current mouse cursor
68 EXTERN int                  currentZoomlevel;           ///< 0 = the smallest zoom level, 1 = medium zoom level, 2 = maximum zoom level
69 
70 
71 // abstraction layers
72 EXTERN SoundPlayer*         soundPlayer;                ///< manager for playing sfx and voice
73 EXTERN MusicPlayer*         musicPlayer;                ///< manager for playing background music
74 
75 EXTERN FileManager*         pFileManager;               ///< manager for loading files from PAKs
76 EXTERN GFXManager*          pGFXManager;                ///< manager for loading and managing graphics
77 EXTERN SFXManager*          pSFXManager;                ///< manager for loading and managing sounds
78 EXTERN FontManager*         pFontManager;               ///< manager for loading and managing fonts
79 EXTERN TextManager*         pTextManager;               ///< manager for loading and managing texts and providing localization
80 EXTERN NetworkManager*      pNetworkManager;            ///< manager for all network events (nullptr if not in multiplayer game)
81 
82 // game stuff
83 EXTERN Game*                currentGame;                ///< the current running game
84 EXTERN ScreenBorder*        screenborder;               ///< the screen border for the current running game
85 EXTERN Map*                 currentGameMap;             ///< the map for the current running game
86 EXTERN House*               pLocalHouse;                ///< the house of the human player that is playing the current running game on this computer
87 EXTERN HumanPlayer*         pLocalPlayer;               ///< the player that is playing the current running game on this computer
88 
89 EXTERN RobustList<UnitBase*>       unitList;            ///< the list of all units
90 EXTERN RobustList<StructureBase*>  structureList;       ///< the list of all structures
91 EXTERN RobustList<Bullet*>         bulletList;          ///< the list of all bullets
92 
93 
94 // misc
95 EXTERN SettingsClass    settings;                       ///< the settings read from the settings file
96 
97 EXTERN bool debug;                                      ///< is set for debugging purposes
98 
99 
100 // constants
101 static const int houseToPaletteIndex[NUM_HOUSES] = { PALCOLOR_HARKONNEN, PALCOLOR_ATREIDES, PALCOLOR_ORDOS, PALCOLOR_FREMEN, PALCOLOR_SARDAUKAR, PALCOLOR_MERCENARY };    ///< the base colors for the different houses
102 static const char houseChar[] = { 'H', 'A', 'O', 'F', 'S', 'M' };   ///< character for each house
103 
104 #endif //GLOBALS_H
105