]> git.xonotic.org Git - xonotic/darkplaces.git/blob - model_vbsp.h
Add missing include guards. Formatting improvement
[xonotic/darkplaces.git] / model_vbsp.h
1 /*
2 Copyright (C) 2021 David Knapp (Cloudwalk)
3
4 This program is free software; you can redistribute it and/or
5 modify it under the terms of the GNU General Public License
6 as published by the Free Software Foundation; either version 2
7 of the License, or (at your option) any later version.
8
9 This program 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.
12
13 See the GNU General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
18
19 */
20
21 #ifndef MODEL_VBSP_H
22 #define MODEL_VBSP_H
23
24 #include "qtypes.h"
25 #include "qdefs.h"
26
27 /*
28  * The Valve BSP format, used by Source engine, has some interesting
29  * advantages, but makes it quite messy.
30  *
31  * Notably, it supports version numbers for its lumps. Some games may introduce
32  * new features to a lump and increment its version number while leaving the
33  * VBSP version number the same.
34  */
35
36 // Content flags
37 #define HL2CONTENTS_NONE 0
38 #define HL2CONTENTS_SOLID 0x1
39 #define HL2CONTENTS_WINDOW 0x2
40 #define HL2CONTENTS_AUX 0x4
41 #define HL2CONTENTS_GRATE 0x8
42 #define HL2CONTENTS_SLIME 0x10
43 #define HL2CONTENTS_WATER 0x20
44 #define HL2CONTENTS_MIST 0x40
45 #define HL2CONTENTS_OPAQUE 0x80
46 #define HL2CONTENTS_TESTFOGVOLUME 0x100
47 #define HL2CONTENTS_TEAM1 0x800
48 #define HL2CONTENTS_TEAM2 0x1000
49 #define HL2CONTENTS_IGNORE_NODRAW_OPAQUE 0x2000
50 #define HL2CONTENTS_MOVEABLE 0x4000
51 #define HL2CONTENTS_AREAPORTAL 0x8000
52 #define HL2CONTENTS_PLAYERCLIP 0x10000
53 #define HL2CONTENTS_MONSTERCLIP 0x20000
54 #define HL2CONTENTS_CURRENT_0 0x40000
55 #define HL2CONTENTS_CURRENT_90 0x80000
56 #define HL2CONTENTS_CURRENT_180 0x100000
57 #define HL2CONTENTS_CURRENT_270 0x200000
58 #define HL2CONTENTS_CURRENT_UP 0x400000
59 #define HL2CONTENTS_CURRENT_DOWN 0x800000
60 #define HL2CONTENTS_ORIGIN 0x1000000
61 #define HL2CONTENTS_MONSTER 0x2000000
62 #define HL2CONTENTS_DEBRIS 0x4000000
63 #define HL2CONTENTS_DETAIL 0x8000000
64 #define HL2CONTENTS_TRANSLUCENT 0x10000000
65 #define HL2CONTENTS_LADDER 0x20000000
66 #define HL2CONTENTS_HITBOX 0x40000000
67
68 // Lumps
69
70 #define HL2HEADER_LUMPS 64
71
72 #define HL2LUMP_ENTITIES 0
73 #define HL2LUMP_PLANES 1
74 #define HL2LUMP_TEXDATA 2
75 #define HL2LUMP_VERTEXES 3
76 #define HL2LUMP_VISIBILITY 4
77 #define HL2LUMP_NODES 5
78 #define HL2LUMP_TEXINFO 6
79 #define HL2LUMP_FACES 7
80 #define HL2LUMP_LIGHTING 8
81 #define HL2LUMP_OCCLUSION 9
82 #define HL2LUMP_LEAFS 10
83 #define HL2LUMP_FACEIDS 11
84 #define HL2LUMP_EDGES 12
85 #define HL2LUMP_SURFEDGES 13
86 #define HL2LUMP_MODELS 14
87 #define HL2LUMP_WORLDLIGHTS 15
88 #define HL2LUMP_LEAFFACES 16
89 #define HL2LUMP_LEAFBRUSHES 17
90 #define HL2LUMP_BRUSHES 18
91 #define HL2LUMP_BRUSHSIDES 19
92 #define HL2LUMP_AREAS 20
93 #define HL2LUMP_AREAPORTALS 21
94 // These are unused in VBSP 20
95 #define HL2LUMP_PORTALS 22 // VBSP 19
96 #define HL2LUMP_PROPCOLLISION 22 // VBSP 21+
97 #define HL2LUMP_CLUSTERS 23 // VBSP 19
98 #define HL2LUMP_PROPHULLS 23 // VBSP 21+
99 #define HL2LUMP_PORTALVERTS 24 // VBSP 19
100 #define HL2LUMP_PROPHULLVERTS 24 // VBSP 21+
101 #define HL2LUMP_CLUSTERPORTALS 25 // VBSP 19
102 #define HL2LUMP_PROPTRIS 25 // VBSP 21+
103 // End unused
104 #define HL2LUMP_DISPINFO 26
105 #define HL2LUMP_ORIGINALFACES 27
106 #define HL2LUMP_PHYSDISP 28 // VBSP 20+ only
107 #define HL2LUMP_PHYSCOLLIDE 29
108 #define HL2LUMP_VERTNORMALS 30
109 #define HL2LUMP_VERTNORMALINDICES 31
110 #define HL2LUMP_DISP_LIGHTMAP_ALPHAS 32
111 #define HL2LUMP_DISP_VERTS 33
112 #define HL2LUMP_DISP_LIGHTMAP_SAMPLE_POSITIONS 34
113 #define HL2LUMP_GAME_LUMP 35
114 #define HL2LUMP_LEAFWATERDATA 36
115 #define HL2LUMP_PRIMITIVES 37
116 #define HL2LUMP_PRIMVERTS 38
117 #define HL2LUMP_PRIMINDICES 39
118 #define HL2LUMP_PAKFILE 40
119 #define HL2LUMP_CLIPPORTALVERTS 41
120 #define HL2LUMP_CUBEMAPS 42
121 #define HL2LUMP_TEXDATA_STRING_DATA 43
122 #define HL2LUMP_TEXDATA_STRING_TABLE 44
123 #define HL2LUMP_OVERLAYS 45
124 #define HL2LUMP_LEAFMINDISTTOWATER 46
125 #define HL2LUMP_FACE_MACRO_TEXTURE_INFO 47
126 #define HL2LUMP_DISP_TRIS 48
127 #define HL2LUMP_PHYSCOLLIDESURFACE 49 // VBSP 19 and 20
128 #define HL2LUMP_PROP_BLOB 49 // VBSP 21+
129 // Everything from here is VBSP 20+ only
130 #define HL2LUMP_WATEROVERLAYS 50
131 #define HL2LUMP_LEAF_AMBIENT_INDEX_HDR 51
132 #define HL2LUMP_LEAF_AMBIENT_INDEX 52
133 #define HL2LUMP_LIGHTING_HDR 53
134 #define HL2LUMP_WORLDLIGHTS_HDR 54
135 #define HL2LUMP_LEAF_AMBIENT_LIGHTING_HDR 55
136 #define HL2LUMP_LEAF_AMBIENT_LIGHTING 56
137 #define HL2LUMP_XZIPPAKFILE 57
138 #define HL2LUMP_FACES_HDR 58
139 #define HL2LUMP_MAP_FLAGS 59
140 #define HL2LUMP_OVERLAY_FADES 60
141 #define HL2LUMP_OVERLAY_SYSTEM_LEVELS 61
142 // VBSP 21+
143 #define HL2LUMP_PHYSLEVEL 62
144 #define HL2LUMP_DISP_MULTIBLEND 63
145
146 typedef struct hl2lump_s
147 {
148         int32_t fileofs, filelen;
149         int32_t version;
150         int32_t id;
151 } hl2lump_t;
152
153 typedef struct hl2dheader_s
154 {
155         int32_t id;
156         int32_t version;
157         hl2lump_t lumps[HL2HEADER_LUMPS];
158         int32_t revision;
159 } hl2dheader_t;
160
161 #endif