collision.h 1.0 KB

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