1 /**
2  * @file
3  * @brief Battlescape grid functions
4  */
5 
6 /*
7 Copyright (C) 1997-2001 Id Software, Inc.
8 
9 This program is free software; you can redistribute it and/or
10 modify it under the terms of the GNU General Public License
11 as published by the Free Software Foundation; either version 2
12 of the License, or (at your option) any later version.
13 
14 This program 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.
17 
18 See the GNU General Public License for more details.
19 
20 You should have received a copy of the GNU General Public License
21 along with this program; if not, write to the Free Software
22 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
23 
24 */
25 
26 #pragma once
27 
28 typedef struct pathing_s {
29 	/* TUs needed to move to this cell for the current actor */
30 	byte area[ACTOR_MAX_STATES][PATHFINDING_HEIGHT][PATHFINDING_WIDTH][PATHFINDING_WIDTH];
31 	byte areaStored[ACTOR_MAX_STATES][PATHFINDING_HEIGHT][PATHFINDING_WIDTH][PATHFINDING_WIDTH];
32 
33 	/* Indicates where the actor would have moved from to get to the cell */
34 	dvec_t areaFrom[ACTOR_MAX_STATES][PATHFINDING_HEIGHT][PATHFINDING_WIDTH][PATHFINDING_WIDTH];
35 
36 	/* forbidden list */
37 	pos_t** fblist;	/**< pointer to forbidden list (entities are standing here) */
38 	int fblength;	/**< length of forbidden list (amount of entries) */
39 } pathing_t;
40 
41 /*==========================================================
42 GRID ORIENTED MOVEMENT AND SCANNING
43 ==========================================================*/
44 
45 void Grid_RecalcRouting(mapTiles_t* mapTiles, Routing &routing, const char* name, const GridBox &box, const char** list);
46 void Grid_RecalcBoxRouting(mapTiles_t* mapTiles, Routing &routing, const GridBox &box, const char** list);
47 void Grid_CalcPathing(const Routing &routing, const actorSizeEnum_t actorSize, pathing_t* path, const pos3_t from, int distance, byte**  fb_list, int fb_length);
48 bool Grid_FindPath(const Routing &routing, const actorSizeEnum_t actorSize, pathing_t* path, const pos3_t from, const pos3_t targetPos, byte crouchingState, int maxTUs, byte**  fb_list, int fb_length);
49 void Grid_MoveStore(pathing_t* path);
50 pos_t Grid_MoveLength(const pathing_t* path, const pos3_t to, byte crouchingState, bool stored);
51 int Grid_MoveNext(const pathing_t* path, const pos3_t toPos, byte crouchingState);
52 unsigned int Grid_Ceiling(const Routing &routing, const actorSizeEnum_t actorSize, const pos3_t pos);
53 int Grid_Floor(const Routing &routing, const actorSizeEnum_t actorSize, const pos3_t pos);
54 int Grid_GetTUsForDirection(const int dir, const int crouched);
55 pos_t Grid_Fall(const Routing &routing, const actorSizeEnum_t actorSize, const pos3_t pos);
56 bool Grid_ShouldUseAutostand (const pathing_t* path, const pos3_t toPos);
57 void Grid_PosToVec(const Routing &routing, const actorSizeEnum_t actorSize, const pos3_t pos, vec3_t vec);
58