map.h
[voxelands-alt.git] / inc / collision.h
blobb5f31644515df5a035630bd23750516fa2a18fd4
1 #ifndef _COLLISION_H_
2 #define _COLLISION_H_
4 #include "common.h"
6 enum {
7 COLLISION_FALL,
8 COLLISION_NODE
9 };
11 #ifndef _HAVE_COLLISIONINFO_TYPE
12 #define _HAVE_COLLISIONINFO_TYPE
13 typedef struct collisioninfo_s {
14 struct collisioninfo_s *prev;
15 struct collisioninfo_s *next;
16 int type;
17 float speed;
18 pos_t pos;
19 v3_t speed_o;
20 v3_t speed_n;
21 } collisioninfo_t;
22 #endif
24 #ifndef _HAVE_COLLISIONRESULT_TYPE
25 #define _HAVE_COLLISIONRESULT_TYPE
26 typedef struct collisionresult_s {
27 uint8_t touching_ground;
28 uint8_t in_liquid;
29 uint8_t touching_lethal;
30 uint8_t collides;
31 uint8_t collides_xz;
32 uint8_t standing_on_unloaded;
33 collisioninfo_t *collisions;
34 } collisionresult_t;
35 #endif
37 #ifndef _HAVE_COLLISIONBLOCK_TYPE
38 #define _HAVE_COLLISIONBLOCK_TYPE
39 typedef struct collisionblock_s {
40 pos_t pos;
41 aabox_t box;
42 uint8_t is_unloaded;
43 uint8_t is_stepup;
44 } collisionblock_t;
45 #endif
47 collisionresult_t *collision_move(float pos_max_d, aabox_t *box, float stepheight, float dtime, v3_t *pos, v3_t *speed, v3_t accel);
48 void collision_free(collisionresult_t *r);
50 #endif