UFO: Alien Invasion
Toggle main menu visibility
Loading...
Searching...
No Matches
trace.cpp
Go to the documentation of this file.
1
6
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. */
41
CloseTracingNodes
();
42
43
/* allocate memory for the tnodes structure */
44
tnode_t
* tnode =
curTile
->tnodes =
Mem_AllocTypeN
(
tnode_t
,
curTile
->numnodes + 1);
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
;
53
curTile
->thead[
curTile
->numtheads] = tnode -
curTile
->tnodes;
54
curTile
->theadlevel[
curTile
->numtheads] =
i
;
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
{
67
Mem_Free
(
curTile
->tnodes);
68
curTile
->tnodes =
nullptr
;
69
}
bsp.h
bspfile.h
LEVEL_MAX
#define LEVEL_MAX
Definition
defines.h:353
LEVEL_LIGHTCLIP
#define LEVEL_LIGHTCLIP
Definition
defines.h:349
LEVEL_ACTORCLIP
#define LEVEL_ACTORCLIP
Definition
defines.h:352
Mem_Free
#define Mem_Free(ptr)
Definition
mem.h:35
Mem_AllocTypeN
#define Mem_AllocTypeN(type, n)
Definition
mem.h:38
i
QGL_EXTERN GLint i
Definition
r_gl.h:113
dBspModel_t
Definition
typedefs.h:354
dBspModel_t::headnode
int32_t headnode
Definition
typedefs.h:357
dBspModel_t::numfaces
int numfaces
Definition
typedefs.h:358
tnode_t
Data for line tracing (?).
Definition
typedefs.h:69
curTile
dMapTile_t * curTile
Definition
bsp.cpp:32
shared.h
CloseTracingNodes
void CloseTracingNodes(void)
Definition
trace.cpp:65
MakeTracingNodes
void MakeTracingNodes(int levels)
Use the bsp node structure to reconstruct efficient tracing structures that are used for fast visibil...
Definition
trace.cpp:38
TR_BuildTracingNode_r
void TR_BuildTracingNode_r(TR_TILE_TYPE *tile, tnode_t **tnode, int32_t nodenum, int level)
Definition
tracing.cpp:122
src
tools
ufo2map
common
trace.cpp
Generated on __DATE__ __TIME__ for UFO: Alien Invasion by
1.17.0