1 /**
2  * @file common.h
3  *
4  * @authors Copyright &copy; 2011-2017 Jaakko Keränen <jaakko.keranen@iki.fi>
5  * @authors Copyright &copy; 2013 Daniel Swanson <danij@dengine.net>
6  *
7  * @par License
8  * GPL: http://www.gnu.org/licenses/gpl.html
9  *
10  * <small>This program is free software; you can redistribute it and/or modify
11  * it under the terms of the GNU General Public License as published by the
12  * Free Software Foundation; either version 2 of the License, or (at your
13  * option) any later version. This program is distributed in the hope that it
14  * will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty
15  * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
16  * Public License for more details. You should have received a copy of the GNU
17  * General Public License along with this program; if not, write to the Free
18  * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
19  * 02110-1301 USA</small>
20  */
21 
22 #ifndef LIBCOMMON_GAME_INCLUDES
23 #define LIBCOMMON_GAME_INCLUDES
24 
25 #include <de/mathutil.h>
26 #include <de/timer.h>
27 
28 #ifdef UNIX
29 #  include <strings.h>
30 #endif
31 
32 #define WEAPONBOTTOM            (128)   // from p_pspr.c
33 
34 #define IS_NETWORK_SERVER       (DD_GetInteger(DD_SERVER) && DD_GetInteger(DD_NETGAME))
35 #define IS_NETWORK_CLIENT       (DD_GetInteger(DD_CLIENT) && DD_GetInteger(DD_NETGAME))
36 
37 #include "config.h"
38 
39 #if __JDOOM__
40 #  include "jdoom.h"
41 #elif __JDOOM64__
42 #  include "jdoom64.h"
43 #elif __JHERETIC__
44 #  include "jheretic.h"
45 #elif __JHEXEN__
46 #  include "jhexen.h"
47 #endif
48 
49 #ifdef __cplusplus
50 #  include <doomsday/filesys/lumpindex.h>
51 #  include <de/Binder>
52 #  include <de/Context>
53 #endif
54 #include "gamerules.h"
55 #include "pause.h"
56 #include "p_mapsetup.h"
57 
58 #ifdef __cplusplus
59 extern "C" {
60 #endif
61 
62 void *  Common_GetGameAPI(char const *name);
63 int     Common_GetInteger(int id);
64 void    Common_Load();
65 void    Common_Unload();
66 void    Common_Register();
67 void    Common_RegisterMapObjs();
68 
69 #ifdef __cplusplus
70 } // extern "C"
71 
72 de::Binder &     Common_GameBindings();
73 struct player_s &P_ContextPlayer(const de::Context &ctx);
74 struct mobj_s &  P_ContextMobj(const de::Context &ctx);
75 
76 /**
77  * Returns the central LumpIndex from the engine. For use with old subsystems
78  * which still depend on this old fashioned mechanism for file access.
79  *
80  * @deprecated  Implement file access without depending on this specialized behavior.
81  */
CentralLumpIndex()82 inline de::LumpIndex const &CentralLumpIndex() { return *reinterpret_cast<de::LumpIndex const *>(F_LumpIndex()); }
83 
84 #endif
85 
86 #endif // LIBCOMMON_GAME_INCLUDES
87