2 ===========================================================================
5 Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company.
7 This file is part of the Doom 3 GPL Source Code (?Doom 3 Source Code?).
9 Doom 3 Source Code is free software: you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation, either version 3 of the License, or
12 (at your option) any later version.
14 Doom 3 Source Code is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
19 You should have received a copy of the GNU General Public License
20 along with Doom 3 Source Code. If not, see <http://www.gnu.org/licenses/>.
22 In addition, the Doom 3 Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 Source Code. If not, please request a copy in writing from id Software at the address below.
24 If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
26 ===========================================================================
29 #include "../../../idlib/precompiled.h"
35 ==============================================================================
39 Save out name.line for qe3 to read
40 ==============================================================================
48 Finds the shortest possible chain of portals
49 that leads from the outside leaf to a specifically
53 void LeakFile (tree_t *tree)
62 if (!tree->outside_node.occupied)
65 common->Printf ("--- LeakFile ---\n");
68 // write the points to the file
70 sprintf( filename, "%s.lin", dmapGlobals.mapFileBase );
71 ospath = fileSystem->RelativePathToOSPath( filename );
72 linefile = fopen( ospath, "w" );
74 common->Error( "Couldn't open %s\n", filename.c_str() );
78 node = &tree->outside_node;
79 while (node->occupied > 1)
82 uPortal_t *p, *nextportal;
86 // find the best portal exit
87 next = node->occupied;
88 for (p=node->portals ; p ; p = p->next[!s])
90 s = (p->nodes[0] == node);
91 if (p->nodes[s]->occupied
92 && p->nodes[s]->occupied < next)
95 nextnode = p->nodes[s];
96 next = nextnode->occupied;
100 mid = nextportal->winding->GetCenter();
101 fprintf (linefile, "%f %f %f\n", mid[0], mid[1], mid[2]);
104 // add the occupant center
105 node->occupant->mapEntity->epairs.GetVector( "origin", "", mid );
107 fprintf (linefile, "%f %f %f\n", mid[0], mid[1], mid[2]);
108 common->Printf ("%5i point linefile\n", count+1);