Debian Codegraph @

physics/collide.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/lib/collide.h $
21 * $Revision: 15 $
22 * $Date: 6/10/99 6:41p $
23 * $Author: Chris $
24 *
25 * Descent III collide code
26 *
27 * $Log: /DescentIII/Main/lib/collide.h $
28 *
29 * 15 6/10/99 6:41p Chris
30 * Added ned_physics support
31 *
32 * 14 4/23/99 9:22p Matt
33 * Changed weapons to keep going after breaking glass.
34 *
35 * 13 4/14/99 3:59a Jeff
36 * fixed case mismatches in #includes
37 *
38 * 12 1/29/99 5:09p Chris
39 * Made changes for ROCKS
40 *
41 * 11 1/01/99 4:10p Chris
42 * Added some const parameters, improved ray cast object collide/rejection
43 * code
44 *
45 * 10 10/09/98 7:47p Chris
46 * Added ObjSetDeadFlag
47 *
48 * 9 6/15/98 7:01a Chris
49 * Cleaned out DII stuff and added new PhysicsSim extern's
50 *
51 * 8 5/07/98 2:22p Chris
52 * Hit die dot
53 *
54 * 7 5/05/98 3:42p Chris
55 * Code cleanup and fixed the collide_XXX_with_wall code. The wall_normal
56 * was know by fvi; so, it is passed to the function (instead of
57 * generating it again)
58 *
59 * 6 2/05/98 2:02p Chris
60 * Fixed the hitseg and hitwall in collide_object_with_wall and
61 * scrape_object_with_wall
62 *
63 * 5 10/21/97 4:15p Chris
64 * Incremental integration of the fvi/physics/collide code
65 *
66 * 4 10/20/97 11:55a Chris
67 * Added some support for the new collide system.
68 *
69 * 3 9/17/97 10:59a Chris
70 * Added a new way to compute radi
71 *
72 * 2 9/15/97 5:17a Chris
73 * Removed the Explosion Vclips since they do not play correctly in
74 * Hardware
75 * Added support for building collisons.
76 * working on SPhere to non-moving sphere collisions
77 *
78 * 5 3/15/97 1:29p Chris
79 *
80 * $NoKeywords: $
81 */
82
83 #ifndef COLLIDE_H
84 #define COLLIDE_H
85
86 #include <cstdint>
87
88 #include "findintersection.h"
89 #include "object.h"
90 #include "vecmat.h"
91
92 extern uint8_t CollisionResult[MAX_OBJECT_TYPES][MAX_OBJECT_TYPES];
93 extern uint8_t CollisionRayResult[MAX_OBJECT_TYPES];
94
95 void CollideInit();
96 void collide_two_objects(object *A, object *B, vector *collision_point, vector *collision_normal,
97 fvi_info *hit_info = nullptr);
98
99 // Process a collision between an object and a wall
100 // Returns true if the object hits the wall, and false if should keep going though the wall (for breakable glass)
101 bool collide_object_with_wall(object *A, float hitspeed, int hitseg, int hitwall, vector *hitpt, vector *wall_normal,
102 float hit_dot);
103
104 extern void FindHitpointUV(float *u, float *v, vector *point, room *rp, int facenum);
105
106 void ConvertEulerToAxisAmount(vector *e, vector *n, float *w);
107 void ConvertAxisAmountToEuler(vector *n, float *w, vector *e);
108
109 void bump_obj_against_fixed(object *obj, vector *collision_point, vector *collision_normal);
110
111 #ifndef NED_PHYSICS
112 #define RESULT_NOTHING 0
113 #define RESULT_CHECK_SPHERE_SPHERE 1
114 #define RESULT_CHECK_SPHERE_POLY 2
115 #define RESULT_CHECK_POLY_SPHERE 3
116 #define RESULT_CHECK_BBOX_POLY 4
117 #define RESULT_CHECK_POLY_BBOX 5
118 #define RESULT_CHECK_BBOX_BBOX 6
119 #define RESULT_CHECK_BBOX_SPHERE 7
120 #define RESULT_CHECK_SPHERE_BBOX 8
121 #define RESULT_CHECK_SPHERE_ROOM 9
122 #define RESULT_CHECK_BBOX_ROOM 10
123 #endif
124
125 #endif