UFO: Alien Invasion
Loading...
Searching...
No Matches
defines.h
Go to the documentation of this file.
1
5
6/*
7All original material Copyright (C) 2002-2025 UFO: Alien Invasion.
8
9Copyright (C) 1997-2001 Id Software, Inc.
10
11This program is free software; you can redistribute it and/or
12modify it under the terms of the GNU General Public License
13as published by the Free Software Foundation; either version 2
14of the License, or (at your option) any later version.
15
16This program is distributed in the hope that it will be useful,
17but WITHOUT ANY WARRANTY; without even the implied warranty of
18MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
19
20See the GNU General Public License for more details.
21
22You should have received a copy of the GNU General Public License
23along with this program; if not, write to the Free Software
24Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
25
26*/
27
28#pragma once
29
36
37/* if a brush just barely pokes onto the other side, let it slide by without chopping */
38#define PLANESIDE_EPSILON 0.001
39
40/* if you increase this, you also have to change the aircraft buy/sell menu scripts */
41#define MAX_ACTIVETEAM 12
42
44#define LEAFNODE -1
45#define PLANENUM_LEAF -1
46
47/* bsp constants */
48#define TEXINFO_NODE -1 /* side is already on a node */
49#define MAXEDGES 20
50
51#define TEAM_DEFAULT 1
52
54#define DEBUG_ALL 0x07FE
55#define DEBUG_SHARED 0x02
56#define DEBUG_ENGINE 0x04
57#define DEBUG_SYSTEM 0x08
58#define DEBUG_COMMANDS 0x10
59#define DEBUG_CLIENT 0x20
60#define DEBUG_SERVER 0x40
61#define DEBUG_GAME 0x80
62#define DEBUG_RENDERER 0x0100
63#define DEBUG_SOUND 0x0200
64#define DEBUG_EVENTSYS 0x0400
65/* note that routing is not included in DEBUG_ALL (too much output) */
66#define DEBUG_ROUTING 0x1000
67
68#define NONE -1
69#define NONE_AMMO 0
70
71/* Timeunits for the various actions. */
72#define TU_CROUCH 3
73#define TU_TURN 1
74#define TU_MOVE_STRAIGHT 2
75#define TU_MOVE_DIAGONAL 3
76#define TU_MOVE_CLIMB 4
77#define TU_MOVE_FALL 0
78#define TU_DOOR_ACTION 1
79#define TU_CROUCH_MOVING_FACTOR 1.5
80#define TU_FLYING_MOVING_FACTOR 2
81
82/* Move/Routing values */
83#define MAX_ROUTE_TUS (ROUTING_NOT_REACHABLE - 1)
84#define MAX_ROUTE (MAX_ROUTE_TUS / TU_MOVE_STRAIGHT + 1)
85
86/* door states */
87#define STATE_OPENED 0
88#define STATE_CLOSED 1
89
90#define MAX_STRING_CHARS 1024 /* max length of a string passed to Cmd_TokenizeString */
91/* common/cmd.c */
92#define MAX_STRING_TOKENS 80 /* max tokens resulting from Cmd_TokenizeString */
93
94/* ALL */
95#define MAX_TEXPATH 32
96
97/* per-level limits */
98#define MAX_TEAMS 8
99#define MAX_EDICTS 1024 /* must change protocol to increase more */
100#define MAX_MODELS 256 /* these are sent over the net as bytes */
101
102#define INITIAL_HP 100
103
104/* game print flags */
105#define PRINT_NONE -1 /* suppress printing */
106#define PRINT_CHAT 0 /* chat messages */
107#define PRINT_HUD 1 /* translated hud strings */
108#define PRINT_CONSOLE 2 /* critical messages goes to the game console */
109
110#define ERR_FATAL 0 /* exit the entire game with a popup window */
111#define ERR_DROP 1 /* print to console and disconnect from game */
112#define ERR_DISCONNECT 2 /* don't kill server */
113
114/* substract this from the ent->pos[z] to get the ground position */
115#define GROUND_DELTA 28
116
117/* substract this from the ent->pos[z] to get the selection circles' z position */
118#define SELECTION_DELTA 30
119
120/* important units */
121#define UNIT_SIZE 32
122#define UNIT_HEIGHT 64
123/* player height - 12 to be able to walk trough doors
124 * UNIT_HEIGHT is the height of one level */
125#define PLAYER_HEIGHT (UNIT_HEIGHT - 16)
126#define QUANT 4
127/* WALL_SIZE is the distance a wall may protrude from the edge of a cell without interfeeting with an actor entering the cell */
128#define WALL_SIZE 5
129
134#define MAX_MAP_MODELS 1024
135#define MAX_MAP_BRUSHES 16384
136#define MAX_MAP_ENTITIES 2048
137#define MAX_MAP_ENTSTRING 0x40000
138#define MAX_MAP_TEXINFO 16384
139#define MAX_MAP_PLANES 65536
140#define MAX_MAP_NODES 65536
141#define MAX_MAP_BRUSHSIDES 65536
142#define MAX_MAP_LEAFS 65536
143#define MAX_MAP_VERTS 65536
144#define MAX_MAP_FACES 65536
145#define MAX_MAP_LEAFBRUSHES 65536
146#define MAX_MAP_EDGES 128000
147#define MAX_MAP_SURFEDGES 256000
148#define MAX_MAP_LIGHTING 0x1000000
149/* WIDTH * WIDTH * 4 */
150#define MAX_MAP_ROUTING 0x100000
151
152#define MAX_LEAFS 1024
153
154#if defined(COMPILE_MAP)
155 #define MAX_MAPTILES 1
156#elif defined(COMPILE_UFO)
157 #define MAX_MAPTILES 64
158#endif
159
160#define MAX_MOD_KNOWN 512
161
163#define MAX_KEY 32
164#define MAX_VALUE 1024
165
167#define LUMP_ENTITIES 0
168#define LUMP_PLANES 1
169#define LUMP_VERTEXES 2
170#define LUMP_ROUTING 3
171#define LUMP_NODES 4
172#define LUMP_TEXINFO 5
173#define LUMP_FACES 6
174#define LUMP_LIGHTING_NIGHT 7
175#define LUMP_LIGHTING_DAY 8
176#define LUMP_LEAFS 9
177#define LUMP_LEAFBRUSHES 10
178#define LUMP_EDGES 11
179#define LUMP_SURFEDGES 12
180#define LUMP_MODELS 13
181#define LUMP_BRUSHES 14
182#define LUMP_BRUSHSIDES 15
183#define LUMP_NORMALS 16
184#define HEADER_LUMPS 17
185
186#define SIDE_FRONT 0
187#define SIDE_ON 2
188#define SIDE_BACK 1
189
191#define PLANE_X 0
192#define PLANE_Y 1
193#define PLANE_Z 2
194
196#define PLANE_ANYX 3
197#define PLANE_ANYY 4
198#define PLANE_ANYZ 5
199#define PLANE_NONE 6
200
201#define AXIAL(p) ((p)->type < PLANE_ANYX)
202
204
205#define ANGLE_UP -1
206#define ANGLE_DOWN -2
207
208/*
209==============================================================
210COLLISION DETECTION
211==============================================================
212*/
213
221
223#define CONTENTS_SOLID 0x0001
224#define CONTENTS_WINDOW 0x0002
225#define CONTENTS_LADDER 0x0004
226#define CONTENTS_WATER 0x0020
228
229/* ufo2map/map.c, ufo2map/portals.c */
230#define LAST_VISIBLE_CONTENTS 0x80
231
232#define CONTENTS_LEVEL_ALL 0xFF00
233#define CONTENTS_LEVEL_1 0x0100
234#define CONTENTS_LEVEL_2 0x0200
235#define CONTENTS_LEVEL_3 0x0400
236#define CONTENTS_LEVEL_4 0x0800
237#define CONTENTS_LEVEL_5 0x1000
238#define CONTENTS_LEVEL_6 0x2000
239#define CONTENTS_LEVEL_7 0x4000
240#define CONTENTS_LEVEL_8 0x8000
241
243#define CONTENTS_ACTORCLIP 0x00010000
244#define CONTENTS_PASSABLE 0x00020000
245#define CONTENTS_TERRAIN 0x00040000
246#define CONTENTS_LIGHTCLIP 0x00080000
247#define CONTENTS_ACTOR 0x00800000
248#define CONTENTS_ORIGIN 0x01000000
249#define CONTENTS_WEAPONCLIP 0x02000000
250#define CONTENTS_DEADACTOR 0x04000000
251#define CONTENTS_DETAIL 0x08000000
252#define CONTENTS_TRANSLUCENT 0x10000000
253
254#define SURF_LIGHT 0x00000001
255#define SURF_SLICK 0x00000002
256#define SURF_WARP 0x00000008
257#define SURF_BLEND33 0x00000010
258#define SURF_BLEND66 0x00000020
259#define SURF_FLOWING 0x00000040
260#define SURF_NODRAW 0x00000080
261#define SURF_HINT 0x00000100
262#define SURF_SKIP 0x00000200
263#define SURF_PHONG 0x00000400
264#define SURF_BURN 0x00000800
265#define SURF_FOOTSTEP 0x00001000
266#define SURF_ORIGIN 0x00002000
267#define SURF_FOLIAGE 0x00004000
268#define SURF_ALPHATEST 0x02000000
269
270/* content masks */
271#define MASK_ALL (-1)
272#define MASK_SOLID (CONTENTS_SOLID | CONTENTS_WINDOW)
273#define MASK_IMPASSABLE (MASK_SOLID | CONTENTS_ACTORCLIP)
274#define MASK_PASSABLE (CONTENTS_PASSABLE | CONTENTS_WATER)
275#define MASK_SHOT (CONTENTS_SOLID | CONTENTS_ACTOR | CONTENTS_WEAPONCLIP | CONTENTS_WINDOW)
276#define MASK_SMOKE_AND_FIRE (MASK_SOLID | CONTENTS_WATER | CONTENTS_WEAPONCLIP)
277#define MASK_VISIBILILITY (CONTENTS_SOLID | CONTENTS_WATER)
278#define MASK_CLIP (CONTENTS_ACTORCLIP | CONTENTS_WEAPONCLIP | CONTENTS_LIGHTCLIP)
279#define MASK_NO_LIGHTCLIP (MASK_ALL &~(CONTENTS_LEVEL_ALL | CONTENTS_LIGHTCLIP))
280
281/*============================================================== */
282
283#define ROUTING_NOT_REACHABLE 0xFF
284#define ROUTING_UNREACHABLE -1
285
286/* Battlescape map dimensions (WIDTH*WIDTH*HEIGHT) */
288#define MAX_WORLD_WIDTH 4096
290#define GRID_WIDTH (MAX_WORLD_WIDTH / UNIT_SIZE)
292#define PATHFINDING_WIDTH (GRID_WIDTH * 2)
294#define PATHFINDING_HEIGHT 8
296#define CELL_HEIGHT (UNIT_HEIGHT / QUANT)
298#define ACTOR_MAX_HEIGHT (PLAYER_HEIGHT / QUANT)
299
300/* NOTE: this only allows quadratic units */
301#define ACTOR_SIZE_INVALID 0
302#define ACTOR_SIZE_NORMAL 1
303#define ACTOR_SIZE_2x2 2
304#define ACTOR_SIZE_3x3 3
305#define ACTOR_MAX_SIZE (ACTOR_SIZE_2x2)
306//#define ACTOR_MAX_SIZE (ACTOR_SIZE_3x3)
307
308/* Maximum falling distance in QUANT units (model units / QUANT) */
309#define PATHFINDING_MAX_FALL 16
310/* The height of the box where we don't need the full actor's torso width */
311#define PATHFINDING_LEGROOMHEIGHT 4
312/* Minimum step-up height in QUANT units (model units/QUANT)
313 * Note that 4 is the minimum to rise one cell every 4 moved horizontally. */
314#define PATHFINDING_MIN_STEPUP 2
315/* Minimum step-up height in QUANT units (model units/QUANT)
316 * Note that 4 is the minimum to rise one cell every 4 moved horizontally. */
317#define PATHFINDING_MAX_STEPUP 4
318/* A stepup value indicating that there is no way to enter the cell. */
319#define PATHFINDING_NO_STEPUP (2 * CELL_HEIGHT)
320/* Minimum height for an opening to be an opening in step units (model units/QUANT)
321 * Must be larger than PATHFINDING_MAX_STEPUP!!
322 */
323#define PATHFINDING_MIN_OPENING 6
325#define PATHFINDING_MICROSTEP_SIZE 4
328#define PATHFINDING_MICROSTEP_SKIP 2
329
330/* DIRECTION constants- define "odd" directions */
331#define DIRECTION_CLIMB_UP 8
332#define DIRECTION_CLIMB_DOWN 9
333#define DIRECTION_STAND_UP 10
334#define DIRECTION_CROUCH 11
335#define DIRECTION_FALL 13
336
337
338#define ACTOR_MAX_STATES 2
339
348#define LEVEL_LASTVISIBLE 255
349#define LEVEL_LIGHTCLIP 256
350#define LEVEL_LASTLIGHTBLOCKING 256
351#define LEVEL_WEAPONCLIP 257
352#define LEVEL_ACTORCLIP 258
353#define LEVEL_MAX 259
354#define NUM_REGULAR_MODELS (LEVEL_ACTORCLIP + 1)
355
356/* TestLine level masks */
357#define TL_FLAG_NONE 0x0000
358#define TL_FLAG_REGULAR_LEVELS 0x00FF
359#define TL_FLAG_ACTORCLIP 0x0100
360#define TL_FLAG_WEAPONCLIP 0x0200
361#define TL_FLAG_ALL 0x0300
362
363#define LIGHTMAP_NIGHT 0
364#define LIGHTMAP_DAY 1
365#define LIGHTMAP_MAX 2
366
367#define PSIDE_FRONT 1
368#define PSIDE_BACK 2
369#define PSIDE_BOTH (PSIDE_FRONT|PSIDE_BACK)
370#define PSIDE_FACING 4
371
372#define MAX_TOKEN_CHARS 256 /* max length of an individual token */
373
374#define ON_EPSILON 0.1
375
376/* 1/32 epsilon to keep floating point happy */
377#define DIST_EPSILON (0.03125)
378#define DIST_EPSILON2 (0.0625125) /* DIST_EPSILON * 2 + small bit more */
379
380#define MAP_DIST_EPSILON 0.01
381#define NORMAL_EPSILON 0.00001
382
383#define MAX_MAP_SIDES (MAX_MAP_BRUSHES*6)
384#define MAX_MAP_TEXTURES 1024
385
386#define MAX_MAP_LIGHTMAP (512 * 512)
387
388#define MAP_SIZE_OFFSET 100