UFO: Alien Invasion
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
trace.cpp
Go to the documentation of this file.
1 
7 /*
8 Copyright (C) 1997-2001 Id Software, Inc.
9 
10 This program is free software; you can redistribute it and/or
11 modify it under the terms of the GNU General Public License
12 as published by the Free Software Foundation; either version 2
13 of the License, or (at your option) any later version.
14 
15 This program is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
18 
19 See the GNU General Public License for more details.
20 
21 You should have received a copy of the GNU General Public License
22 along with this program; if not, write to the Free Software
23 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
24 
25 */
26 
27 
28 #include "shared.h"
29 #include "../bsp.h"
30 #include "bspfile.h"
31 
38 void MakeTracingNodes (int levels)
39 {
40  /* Release any memory we have for existing tnodes, just in case. */
42 
43  /* allocate memory for the tnodes structure */
45  curTile->numtheads = 0;
46 
47  for (int i = 0; i < levels; i++) {
48  const dBspModel_t* model = &curTile->models[i];
49  if (!model->numfaces && i != LEVEL_LIGHTCLIP && i != LEVEL_ACTORCLIP)
50  continue;
51  if (model->headnode < 0) /* empty models have headnode -1 */
52  continue;
55  curTile->numtheads++;
56  assert(curTile->numtheads < LEVEL_MAX);
57  TR_BuildTracingNode_r(curTile, &tnode, model->headnode, i);
58  }
59 }
60 
65 void CloseTracingNodes (void)
66 {
68  curTile->tnodes = nullptr;
69 }
int thead[LEVEL_MAX]
Definition: typedefs.h:450
#define Mem_AllocTypeN(type, n)
Definition: mem.h:38
dBspModel_t models[MAX_MAP_MODELS]
Definition: typedefs.h:468
#define LEVEL_ACTORCLIP
Definition: defines.h:352
Data for line tracing (?)
Definition: typedefs.h:69
tnode_t * tnodes
Definition: typedefs.h:448
int numtheads
Definition: typedefs.h:449
void TR_BuildTracingNode_r(TR_TILE_TYPE *tile, tnode_t **tnode, int32_t nodenum, int level)
Definition: tracing.cpp:122
int32_t headnode
Definition: typedefs.h:357
dMapTile_t * curTile
Definition: bsp.cpp:32
int numfaces
Definition: typedefs.h:358
int theadlevel[LEVEL_MAX]
Definition: typedefs.h:451
void MakeTracingNodes(int levels)
Use the bsp node structure to reconstruct efficient tracing structures that are used for fast visibil...
Definition: trace.cpp:38
QGL_EXTERN GLint i
Definition: r_gl.h:113
int numnodes
Definition: typedefs.h:483
void CloseTracingNodes(void)
Definition: trace.cpp:65
#define Mem_Free(ptr)
Definition: mem.h:35
#define LEVEL_LIGHTCLIP
Definition: defines.h:349
#define LEVEL_MAX
Definition: defines.h:353