]> git.xonotic.org Git - xonotic/darkplaces.git/blob - model_vbsp.h
cl_main: Fix double free of meshentities texture pool when running gamedir
[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 #define VBSPVERSION ('V' + 'B' * 256 + 'S' * 65536 + 'P' * 16777216)
37
38 // Content flags
39 #define HL2CONTENTS_NONE 0
40 #define HL2CONTENTS_SOLID 0x1
41 #define HL2CONTENTS_WINDOW 0x2
42 #define HL2CONTENTS_AUX 0x4
43 #define HL2CONTENTS_GRATE 0x8
44 #define HL2CONTENTS_SLIME 0x10
45 #define HL2CONTENTS_WATER 0x20
46 #define HL2CONTENTS_MIST 0x40
47 #define HL2CONTENTS_OPAQUE 0x80
48 #define HL2CONTENTS_TESTFOGVOLUME 0x100
49 #define HL2CONTENTS_TEAM1 0x800
50 #define HL2CONTENTS_TEAM2 0x1000
51 #define HL2CONTENTS_IGNORE_NODRAW_OPAQUE 0x2000
52 #define HL2CONTENTS_MOVEABLE 0x4000
53 #define HL2CONTENTS_AREAPORTAL 0x8000
54 #define HL2CONTENTS_PLAYERCLIP 0x10000
55 #define HL2CONTENTS_MONSTERCLIP 0x20000
56 #define HL2CONTENTS_CURRENT_0 0x40000
57 #define HL2CONTENTS_CURRENT_90 0x80000
58 #define HL2CONTENTS_CURRENT_180 0x100000
59 #define HL2CONTENTS_CURRENT_270 0x200000
60 #define HL2CONTENTS_CURRENT_UP 0x400000
61 #define HL2CONTENTS_CURRENT_DOWN 0x800000
62 #define HL2CONTENTS_ORIGIN 0x1000000
63 #define HL2CONTENTS_MONSTER 0x2000000
64 #define HL2CONTENTS_DEBRIS 0x4000000
65 #define HL2CONTENTS_DETAIL 0x8000000
66 #define HL2CONTENTS_TRANSLUCENT 0x10000000
67 #define HL2CONTENTS_LADDER 0x20000000
68 #define HL2CONTENTS_HITBOX 0x40000000
69
70 // Lumps
71
72 #define HL2HEADER_LUMPS 64
73
74 #define HL2LUMP_ENTITIES 0
75 #define HL2LUMP_PLANES 1
76 #define HL2LUMP_TEXDATA 2
77 #define HL2LUMP_VERTEXES 3
78 #define HL2LUMP_VISIBILITY 4
79 #define HL2LUMP_NODES 5
80 #define HL2LUMP_TEXINFO 6
81 #define HL2LUMP_FACES 7
82 #define HL2LUMP_LIGHTING 8
83 #define HL2LUMP_OCCLUSION 9
84 #define HL2LUMP_LEAFS 10
85 #define HL2LUMP_FACEIDS 11
86 #define HL2LUMP_EDGES 12
87 #define HL2LUMP_SURFEDGES 13
88 #define HL2LUMP_MODELS 14
89 #define HL2LUMP_WORLDLIGHTS 15
90 #define HL2LUMP_LEAFFACES 16
91 #define HL2LUMP_LEAFBRUSHES 17
92 #define HL2LUMP_BRUSHES 18
93 #define HL2LUMP_BRUSHSIDES 19
94 #define HL2LUMP_AREAS 20
95 #define HL2LUMP_AREAPORTALS 21
96 // These are unused in VBSP 20
97 #define HL2LUMP_PORTALS 22 // VBSP 19
98 #define HL2LUMP_PROPCOLLISION 22 // VBSP 21+
99 #define HL2LUMP_CLUSTERS 23 // VBSP 19
100 #define HL2LUMP_PROPHULLS 23 // VBSP 21+
101 #define HL2LUMP_PORTALVERTS 24 // VBSP 19
102 #define HL2LUMP_PROPHULLVERTS 24 // VBSP 21+
103 #define HL2LUMP_CLUSTERPORTALS 25 // VBSP 19
104 #define HL2LUMP_PROPTRIS 25 // VBSP 21+
105 // End unused
106 #define HL2LUMP_DISPINFO 26
107 #define HL2LUMP_ORIGINALFACES 27
108 #define HL2LUMP_PHYSDISP 28 // VBSP 20+ only
109 #define HL2LUMP_PHYSCOLLIDE 29
110 #define HL2LUMP_VERTNORMALS 30
111 #define HL2LUMP_VERTNORMALINDICES 31
112 #define HL2LUMP_DISP_LIGHTMAP_ALPHAS 32
113 #define HL2LUMP_DISP_VERTS 33
114 #define HL2LUMP_DISP_LIGHTMAP_SAMPLE_POSITIONS 34
115 #define HL2LUMP_GAME_LUMP 35
116 #define HL2LUMP_LEAFWATERDATA 36
117 #define HL2LUMP_PRIMITIVES 37
118 #define HL2LUMP_PRIMVERTS 38
119 #define HL2LUMP_PRIMINDICES 39
120 #define HL2LUMP_PAKFILE 40
121 #define HL2LUMP_CLIPPORTALVERTS 41
122 #define HL2LUMP_CUBEMAPS 42
123 #define HL2LUMP_TEXDATA_STRING_DATA 43
124 #define HL2LUMP_TEXDATA_STRING_TABLE 44
125 #define HL2LUMP_OVERLAYS 45
126 #define HL2LUMP_LEAFMINDISTTOWATER 46
127 #define HL2LUMP_FACE_MACRO_TEXTURE_INFO 47
128 #define HL2LUMP_DISP_TRIS 48
129 #define HL2LUMP_PHYSCOLLIDESURFACE 49 // VBSP 19 and 20
130 #define HL2LUMP_PROP_BLOB 49 // VBSP 21+
131 // Everything from here is VBSP 20+ only
132 #define HL2LUMP_WATEROVERLAYS 50
133 #define HL2LUMP_LEAF_AMBIENT_INDEX_HDR 51
134 #define HL2LUMP_LEAF_AMBIENT_INDEX 52
135 #define HL2LUMP_LIGHTING_HDR 53
136 #define HL2LUMP_WORLDLIGHTS_HDR 54
137 #define HL2LUMP_LEAF_AMBIENT_LIGHTING_HDR 55
138 #define HL2LUMP_LEAF_AMBIENT_LIGHTING 56
139 #define HL2LUMP_XZIPPAKFILE 57
140 #define HL2LUMP_FACES_HDR 58
141 #define HL2LUMP_MAP_FLAGS 59
142 #define HL2LUMP_OVERLAY_FADES 60
143 #define HL2LUMP_OVERLAY_SYSTEM_LEVELS 61
144 // VBSP 21+
145 #define HL2LUMP_PHYSLEVEL 62
146 #define HL2LUMP_DISP_MULTIBLEND 63
147
148 typedef struct hl2lump_s
149 {
150         int32_t fileofs, filelen;
151         int32_t version;
152         int32_t id;
153 } hl2lump_t;
154
155 typedef struct hl2dheader_s
156 {
157         int32_t ident;
158         int32_t version;
159         hl2lump_t lumps[HL2HEADER_LUMPS];
160         int32_t revision;
161 } hl2dheader_t;
162
163 #endif