Debian Codegraph @

Descent3/gamepath.h

raw symbols SCIP
1 /*
2 * Descent 3
3 * Copyright (C) 2024 Parallax Software
4 *
5 * This program is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation, either version 3 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17
18 --- HISTORICAL COMMENTS FOLLOW ---
19
20 * $Logfile: /DescentIII/main/gamepath.h $
21 * $Revision: 12 $
22 * $Date: 10/08/98 4:23p $
23 * $Author: Kevin $
24 *
25 * Header for gamepath.cpp
26 *
27 * $Log: /DescentIII/main/gamepath.h $
28 *
29 * 12 10/08/98 4:23p Kevin
30 * Changed code to comply with memory library usage. Always use mem_malloc
31 * , mem_free and mem_strdup
32 *
33 * 11 2/10/98 10:48a Matt
34 * Moved editor code from gamepath.cpp to epath.cpp
35 *
36 */
37
38 #ifndef GAME_PATH_H
39 #define GAME_PATH_H
40
41 #include "stdlib.h"
42 #include "pstypes.h"
43 #include "pserror.h"
44 #include "vecmat.h"
45 #include "3d.h"
46 #include "manage.h"
47 #include "mem.h"
48 // chrishack -- this could be dynamically allocated at the beginning of a level
49 // MAX_NODES_PER_PATH is big and so is MAX_GAME_PATHS
50
51 #define MAX_GAME_PATHS 300
52 #define MAX_NODES_PER_PATH 100
53
54 struct node {
55 vector pos; // where this node is in the world
56 int roomnum; // what room?
57 int flags; // if this point lives over the terrain, etc
58 vector fvec;
59 vector uvec;
60 };
61
62 class game_path {
63 public:
64 game_path() {
65 num_nodes = 0;
66 pathnodes = NULL;
67 used = false;
68 }
69 ~game_path() {
70 if (used)
71 mem_free(pathnodes);
72 used = false;
73 }
74
75 node *pathnodes;
76 int num_nodes; // how many nodes in this path?
77 char name[PAGENAME_LEN]; // the name of this path
78 uint8_t flags; // special properties of this path
79 bool used; // if this path is in use
80 };
81
82 extern game_path GamePaths[MAX_GAME_PATHS];
83 extern int Num_game_paths;
84
85 void InitGamePaths();
86
87 // searches through GamePath index and returns index of path matching name
88 // returns -1 if not found
89 int FindGamePathName(const char *name);
90
91 #endif