1 //-------------------------------------------------------------------------
2 /*
3 Copyright (C) 2016 EDuke32 developers and contributors
4
5 This file is part of EDuke32.
6
7 EDuke32 is free software; you can redistribute it and/or
8 modify it under the terms of the GNU General Public License version 2
9 as published by the Free Software Foundation.
10
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
14
15 See the GNU General Public License for more details.
16
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software
19 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20 */
21 //-------------------------------------------------------------------------
22
23 #ifndef duke3d_h_
24 #define duke3d_h_
25
26 // JBF
27 #include "a.h"
28 #include "baselayer.h"
29 #include "build.h"
30 #include "cache1d.h"
31 #include "compat.h"
32 #include "fx_man.h"
33 #include "keyboard.h"
34 #include "pragmas.h"
35
36 #ifdef POLYMER
37 #include "polymer.h"
38 #else
39 #ifdef USE_OPENGL
40 #include "polymost.h"
41 #endif
42 #endif
43
44
45 #define HEAD2 APPNAME
46
47 #ifdef EDUKE32_STANDALONE
48 #define VOLUMEALL (1)
49 #define PLUTOPAK (1)
50 #define WORLDTOUR (0)
51 #define VOLUMEONE (0)
52 #else
53 #define VOLUMEALL (g_Shareware == 0)
54 #define PLUTOPAK (g_scriptVersion >= 14)
55 #define WORLDTOUR (DUKE && g_scriptVersion >= 16)
56 #define VOLUMEONE (g_Shareware == 1)
57 #endif
58
59 // increase by 3, because atomic GRP adds 1, and Shareware adds 2
60 #define BYTEVERSION_EDUKE32 348
61
62 //#define BYTEVERSION_13 27
63 //#define BYTEVERSION_14 116
64 //#define BYTEVERSION_15 117
65 #define BYTEVERSION (BYTEVERSION_EDUKE32+(PLUTOPAK?1:(VOLUMEONE<<1)))
66
67 #define NUMPAGES 1
68
69 #define RECSYNCBUFSIZ 2520 //2520 is the (LCM of 1-8)*3
70 #define MOVEFIFOSIZ 2
71
72 #define MAXVOLUMES 7
73 #define MAXLEVELS 64
74 #define MAXGAMETYPES 16
75
76 enum {
77 MUS_FIRST_SPECIAL = MAXVOLUMES*MAXLEVELS,
78
79 MUS_INTRO = MUS_FIRST_SPECIAL,
80 MUS_BRIEFING = MUS_FIRST_SPECIAL + 1,
81 MUS_LOADING = MUS_FIRST_SPECIAL + 2,
82 MUS_USERMAP = MUS_FIRST_SPECIAL + 3,
83 };
84
85 ////////// TIMING CONSTANTS //////////
86 // The number of 'totalclock' increments per second:
87 #define TICRATE 120
88 // The number of game state updates per second:
89 #define REALGAMETICSPERSEC 30
90 // The number of 'totalclock' increments per game state update:
91 // NOTE: calling a game state update a 'frame' is really weird.
92 // (This used to be TICRATE/GAMETICSPERSEC, which was 120/26 = 4.615~ truncated
93 // to 4 by integer division.)
94 #define TICSPERFRAME (TICRATE/REALGAMETICSPERSEC)
95 // Used as a constant to satisfy all of the calculations written with ticrate =
96 // 26 in mind:
97 #define GAMETICSPERSEC 26
98
99
100 #define PACKBUF_SIZE 32768
101
102 #define TILE_SAVESHOT (MAXTILES-1)
103 #define TILE_LOADSHOT (MAXTILES-3)
104 #define TILE_TILT (MAXTILES-2)
105 #define TILE_ANIM (MAXTILES-4)
106 #define TILE_VIEWSCR (MAXTILES-5)
107 // Reserved: TILE_VIEWSCR_1 (MAXTILES-6)
108 // Reserved: TILE_VIEWSCR_2 (MAXTILES-7)
109 EDUKE32_STATIC_ASSERT(7 <= MAXTILES-MAXUSERTILES);
110
111 // sprites with these statnums should be considered for fixing
112 #define ROTFIXSPR_STATNUMP(k) ((k)==STAT_DEFAULT || (k)==STAT_STANDABLE || (k)==STAT_FX || \
113 (k)==STAT_FALLER || (k)==STAT_LIGHT)
114 #define ROTFIXSPR_MAGIC 0x18190000
115
116 // JBF 20040604: sync is a function on some platforms
117 #define sync dsync
118
119 #define WT_WIDE(x) (WORLDTOUR ? (x ## WIDE) : (x))
120
121 // Uncomment the following to remove calls to a.nasm functions with the GL renderers
122 // so that debugging with valgrind --smc-check=none is possible:
123 //#define DEBUG_VALGRIND_NO_SMC
124
125 #include "_rts.h"
126 #include "actors.h"
127 #include "common_game.h"
128 #include "config.h"
129 #include "control.h"
130 #include "function.h"
131 #include "game.h"
132 #include "gamedef.h"
133 #include "gamedefs.h"
134 #include "gameexec.h"
135 #include "gamevars.h"
136 #include "global.h"
137 #include "inv.h"
138 #include "macros.h"
139 #include "music.h"
140 #include "namesdyn.h"
141 #include "network.h"
142 #include "player.h"
143 #include "quotes.h"
144 #include "rts.h"
145 #include "sector.h"
146 #include "sounds.h"
147 #include "soundsdyn.h"
148 #include "text.h"
149
G_TileHasActor(int const tileNum)150 static inline int32_t G_TileHasActor(int const tileNum)
151 {
152 return g_tile[tileNum].execPtr!=NULL;
153 }
154
G_DefaultActorHealthForTile(int const tileNum)155 static inline int32_t G_DefaultActorHealthForTile(int const tileNum)
156 {
157 return G_TileHasActor(tileNum) ? g_tile[tileNum].execPtr[0] : 0;
158 }
159
160 #endif
161