2 Copyright (C) 1999-2007 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
28 #include "globaldefs.h"
34 #if GDEF_COMPILER_MSVC
35 #ifdef NDEBUG // Don't show in a Release build
36 #pragma warning(disable : 4305) // truncate from double to float
37 #pragma warning(disable : 4244) // conversion from double to float
38 #pragma warning(disable : 4018) // signed/unsigned mismatch
42 #define MAX_PORTALS 32768
44 #define PORTALFILE "PRT1"
46 #define ON_EPSILON 0.1
54 #define MAX_POINTS_ON_WINDING 64
55 #define MAX_POINTS_ON_FIXED_WINDING 12
59 qboolean original; // don't free, it's part of the portal
61 vec3_t points[MAX_POINTS_ON_FIXED_WINDING]; // variable sized
64 winding_t *NewWinding( int points );
65 void FreeWinding( winding_t *w );
66 winding_t *CopyWinding( winding_t *w );
69 typedef enum {stat_none, stat_working, stat_done} vstatus_t;
72 plane_t plane; // normal pointing into neighbor
75 vec3_t origin; // for fast clip testing
80 byte *portalfront; // [portals], preliminary
81 byte *portalflood; // [portals], intermediate
82 byte *portalvis; // [portals], final
84 int nummightsee; // bit count on portalflood for sort
87 typedef struct seperating_plane_s
89 struct seperating_plane_s *next;
90 plane_t plane; // from portal is on positive side
94 typedef struct passage_s
96 struct passage_s *next;
97 int from, to; // leaf numbers
101 #define MAX_PORTALS_ON_LEAF 128
102 typedef struct leaf_s
106 portal_t *portals[MAX_PORTALS_ON_LEAF];
110 typedef struct pstack_s
112 byte mightsee[MAX_PORTALS / 8]; // bit string
113 struct pstack_s *next;
115 portal_t *portal; // portal exiting
119 winding_t windings[3]; // source, pass, temp in any order
129 pstack_t pstack_head;
134 extern int numportals;
135 extern int portalclusters;
137 extern portal_t *portals;
138 extern leaf_t *leafs;
140 extern int c_portaltest, c_portalpass, c_portalcheck;
141 extern int c_portalskip, c_leafskip;
142 extern int c_vistest, c_mighttest;
145 extern byte *vismap, *vismap_p, *vismap_end; // past visfile
147 extern int testlevel;
149 extern byte *uncompressed;
151 extern int leafbytes, leaflongs;
152 extern int portalbytes, portallongs;
155 void LeafFlow( int leafnum );
158 void BasePortalVis( int portalnum );
159 void BetterPortalVis( int portalnum );
160 void PortalFlow( int portalnum );
162 extern portal_t *sorted_portals[MAX_MAP_PORTALS * 2];
164 int CountBits( byte *bits, int numbits );
166 //=============================================================================
170 extern char *mapname;