2 Copyright (C) 1999-2006 Id Software, Inc. and contributors.
3 For a list of contributors, see the accompanying CONTRIBUTORS file.
5 This file is part of GtkRadiant.
7 GtkRadiant is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2 of the License, or
10 (at your option) any later version.
12 GtkRadiant is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with GtkRadiant; if not, write to the Free Software
19 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
34 #ifdef NDEBUG // Don't show in a Release build
35 #pragma warning(disable : 4305) // truncate from double to float
36 #pragma warning(disable : 4244) // conversion from double to float
37 #pragma warning(disable : 4018) // signed/unsigned mismatch
41 #define MAX_PORTALS 32768
43 #define PORTALFILE "PRT1"
45 #define ON_EPSILON 0.1
53 #define MAX_POINTS_ON_WINDING 64
54 #define MAX_POINTS_ON_FIXED_WINDING 12
58 qboolean original; // don't free, it's part of the portal
60 vec3_t points[MAX_POINTS_ON_FIXED_WINDING]; // variable sized
63 winding_t *NewWinding (int points);
64 void FreeWinding (winding_t *w);
65 winding_t *CopyWinding (winding_t *w);
68 typedef enum {stat_none, stat_working, stat_done} vstatus_t;
71 plane_t plane; // normal pointing into neighbor
74 vec3_t origin; // for fast clip testing
79 byte *portalfront; // [portals], preliminary
80 byte *portalflood; // [portals], intermediate
81 byte *portalvis; // [portals], final
83 int nummightsee; // bit count on portalflood for sort
86 typedef struct seperating_plane_s
88 struct seperating_plane_s *next;
89 plane_t plane; // from portal is on positive side
93 typedef struct passage_s
95 struct passage_s *next;
96 int from, to; // leaf numbers
100 #define MAX_PORTALS_ON_LEAF 128
101 typedef struct leaf_s
105 portal_t *portals[MAX_PORTALS_ON_LEAF];
109 typedef struct pstack_s
111 byte mightsee[MAX_PORTALS/8]; // bit string
112 struct pstack_s *next;
114 portal_t *portal; // portal exiting
118 winding_t windings[3]; // source, pass, temp in any order
128 pstack_t pstack_head;
133 extern int numportals;
134 extern int portalclusters;
136 extern portal_t *portals;
137 extern leaf_t *leafs;
139 extern int c_portaltest, c_portalpass, c_portalcheck;
140 extern int c_portalskip, c_leafskip;
141 extern int c_vistest, c_mighttest;
144 extern byte *vismap, *vismap_p, *vismap_end; // past visfile
146 extern int testlevel;
148 extern byte *uncompressed;
150 extern int leafbytes, leaflongs;
151 extern int portalbytes, portallongs;
154 void LeafFlow (int leafnum);
157 void BasePortalVis (int portalnum);
158 void BetterPortalVis (int portalnum);
159 void PortalFlow (int portalnum);
161 extern portal_t *sorted_portals[MAX_MAP_PORTALS*2];
163 int CountBits (byte *bits, int numbits);
165 //=============================================================================
169 extern char *mapname;