UFO: Alien Invasion
Toggle main menu visibility
Loading...
Searching...
No Matches
routing.h
Go to the documentation of this file.
1
5
6
/*
7
All original material Copyright (C) 2002-2025 UFO: Alien Invasion.
8
9
Copyright (C) 1997-2001 Id Software, Inc.
10
11
This program is free software; you can redistribute it and/or
12
modify it under the terms of the GNU General Public License
13
as published by the Free Software Foundation; either version 2
14
of the License, or (at your option) any later version.
15
16
This program is distributed in the hope that it will be useful,
17
but WITHOUT ANY WARRANTY; without even the implied warranty of
18
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
19
20
See the GNU General Public License for more details.
21
22
You should have received a copy of the GNU General Public License
23
along with this program; if not, write to the Free Software
24
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
25
26
*/
27
28
#pragma once
29
30
// Should be included here because it is used-in-the-interface, but breaks uforadiant compilation :(
31
//#include "tracing.h"
32
33
/*==============================================================
34
GLOBAL TYPES
35
==============================================================*/
36
37
/* Decide whether we are doing uni- or bidirectional conclusions from our traces.
38
* This constant is used in both a boolean and an integer way,
39
* so it must only be set to 0 or 1 ! */
40
#define RT_IS_BIDIRECTIONAL 0
41
42
/*==============================================================
43
MACROS
44
==============================================================*/
49
/* route - Used by Grid_* only */
51
52
#define RT_CONN_PX(r, actorSize, x, y, z) (r.getConn(actorSize, x, y, z, 0))
53
#define RT_CONN_NX(r, actorSize, x, y, z) (r.getConn(actorSize, x, y, z, 1))
54
#define RT_CONN_PY(r, actorSize, x, y, z) (r.getConn(actorSize, x, y, z, 2))
55
#define RT_CONN_NY(r, actorSize, x, y, z) (r.getConn(actorSize, x, y, z, 3))
56
57
#define RT_CONN_PX_PY(r, actorSize, x, y, z) (r.getConn(actorSize, x, y, z, 4))
58
#define RT_CONN_PX_NY(r, actorSize, x, y, z) (r.getConn(actorSize, x, y, z, 7))
59
#define RT_CONN_NX_PY(r, actorSize, x, y, z) (r.getConn(actorSize, x, y, z, 6))
60
#define RT_CONN_NX_NY(r, actorSize, x, y, z) (r.getConn(actorSize, x, y, z, 5))
61
62
#define RT_STEPUP_PX(r, actorSize, x, y, z) (r.getStepup(actorSize, x, y, z, 0))
63
#define RT_STEPUP_NX(r, actorSize, x, y, z) (r.getStepup(actorSize, x, y, z, 1))
64
#define RT_STEPUP_PY(r, actorSize, x, y, z) (r.getStepup(actorSize, x, y, z, 2))
65
#define RT_STEPUP_NY(r, actorSize, x, y, z) (r.getStepup(actorSize, x, y, z, 3))
66
67
#define RT_STEPUP_PX_PY(r, actorSize, x, y, z) (r.getStepup(actorSize, x, y, z, 4))
68
#define RT_STEPUP_PX_NY(r, actorSize, x, y, z) (r.getStepup(actorSize, x, y, z, 7))
69
#define RT_STEPUP_NX_PY(r, actorSize, x, y, z) (r.getStepup(actorSize, x, y, z, 6))
70
#define RT_STEPUP_NX_NY(r, actorSize, x, y, z) (r.getStepup(actorSize, x, y, z, 5))
71
72
74
/* Surfaces used as floors are rounded up. */
75
#define ModelFloorToQuant(x) (ceil((x) / QUANT))
76
/* Surfaces used as ceilings are rounded down. */
77
#define ModelCeilingToQuant(x) (floor((x) / QUANT))
78
/* Going from QUANT units back to model units returns the approximation of the QUANT unit. */
79
#define QuantToModel(x) ((x) * QUANT)
80
84
#define SizedPosToVec(p, actorSize, v) { \
85
assert(actorSize > ACTOR_SIZE_INVALID); \
86
assert(actorSize <= ACTOR_MAX_SIZE); \
87
v[0] = ((int)p[0] - 128) * UNIT_SIZE + (UNIT_SIZE * actorSize) / 2; \
88
v[1] = ((int)p[1] - 128) * UNIT_SIZE + (UNIT_SIZE * actorSize) / 2; \
89
v[2] = (int)p[2] * UNIT_HEIGHT + UNIT_HEIGHT / 2; \
90
}
91
92
93
/*
94
===============================================================================
95
SHARED EXTERNS (cmodel.c and ufo2map/routing.c)
96
===============================================================================
97
*/
98
99
extern
bool
debugTrace
;
100
101
/*
102
===============================================================================
103
GAME RELATED TRACING
104
===============================================================================
105
*/
106
107
108
int
RT_CheckCell
(
mapTiles_t
*
mapTiles
,
Routing
& routing,
const
int
actorSize,
const
int
x,
const
int
y,
const
int
z,
const
char
** list);
109
void
RT_UpdateConnectionColumn
(
mapTiles_t
*
mapTiles
,
Routing
& routing,
const
int
actorSize,
const
int
x,
const
int
y,
const
int
dir,
const
char
** list =
nullptr
,
const
int
minZ = 0,
const
int
maxZ =
PATHFINDING_HEIGHT
);
110
bool
RT_AllCellsBelowAreFilled
(
const
Routing
& routing,
const
int
actorSize,
const
pos3_t
pos);
111
void
RT_GetMapSize
(
mapTiles_t
*
mapTiles
,
AABB
& mapBox);
112
bool
RT_CanActorStandHere
(
const
Routing
& routing,
const
int
actorSize,
const
pos3_t
pos);
113
114
115
/*
116
==========================================================
117
DEBUGGING CODE
118
==========================================================
119
*/
120
121
#ifdef DEBUG
122
void
RT_DumpWholeMap(
mapTiles_t
*
mapTiles
,
const
Routing
& routing);
123
int
RT_DebugSpecial(
mapTiles_t
*
mapTiles
,
Routing
& routing,
const
int
actorSize,
const
int
x,
const
int
y,
const
int
dir,
const
char
** list);
124
void
RT_DebugPathDisplay (
Routing
& routing,
const
int
actorSize,
int
x,
int
y,
int
z);
125
#endif
126
void
RT_WriteCSVFiles
(
const
Routing
& routing,
const
char
*
baseFilename
,
const
GridBox
& box);
AABB
Definition
aabb.h:42
GridBox
Definition
mathlib.h:120
Routing
Definition
typedefs.h:249
RT_GetMapSize
void RT_GetMapSize(mapTiles_t *mapTiles, AABB &mapBox)
Calculate the map size via model data and store grid size in map_min and map_max. This is done with e...
Definition
routing.cpp:253
RT_CanActorStandHere
bool RT_CanActorStandHere(const Routing &routing, const int actorSize, const pos3_t pos)
Check if an actor can stand(up) in the cell given by pos.
Definition
routing.cpp:237
RT_CheckCell
int RT_CheckCell(mapTiles_t *mapTiles, Routing &routing, const int actorSize, const int x, const int y, const int z, const char **list)
This function looks to see if an actor of a given size can occupy a cell(s) and if so identifies the ...
Definition
routing.cpp:360
debugTrace
bool debugTrace
Definition
routing.cpp:38
RT_WriteCSVFiles
void RT_WriteCSVFiles(const Routing &routing, const char *baseFilename, const GridBox &box)
Definition
routing.cpp:1330
RT_AllCellsBelowAreFilled
bool RT_AllCellsBelowAreFilled(const Routing &routing, const int actorSize, const pos3_t pos)
Check if pos is on solid ground.
Definition
routing.cpp:331
RT_UpdateConnectionColumn
void RT_UpdateConnectionColumn(mapTiles_t *mapTiles, Routing &routing, const int actorSize, const int x, const int y, const int dir, const char **list, const int minZ, const int maxZ)
Routing Function to update the connection between two fields.
Definition
routing.cpp:1292
PATHFINDING_HEIGHT
#define PATHFINDING_HEIGHT
15 max, adjusting above 8 will require a rewrite to the DV code
Definition
defines.h:294
mapTiles_t
Definition
tracing.h:77
mapTiles
mapTiles_t mapTiles
Definition
bsp.cpp:33
baseFilename
char baseFilename[MAX_OSPATH]
Definition
ufo2map.cpp:55
pos3_t
pos_t pos3_t[3]
Definition
ufotypes.h:58
src
common
routing.h
Generated on __DATE__ __TIME__ for UFO: Alien Invasion by
1.18.0