types.h 757 B

123456789101112131415161718192021222324252627282930313233343536
  1. #ifndef _types_h
  2. #define _types_h
  3. #include <stdint.h>
  4. #include <math.h>
  5. //#include "constants.h"
  6. #define UID_null 0
  7. // Entity types (legend applies to level.h)
  8. #define E_FLOOR 0x0 // . (also null)
  9. #define E_WALL 0xF // #
  10. #define E_PLAYER 0x1 // P
  11. #define E_ENEMY 0x2 // E
  12. #define E_DOOR 0x4 // D
  13. #define E_LOCKEDDOOR 0x5 // L
  14. #define E_EXIT 0x7 // X
  15. // collectable entities >= 0x8
  16. #define E_MEDIKIT 0x8 // M
  17. #define E_KEY 0x9 // K
  18. #define E_FIREBALL 0xA // not in map
  19. typedef uint16_t UID;
  20. typedef uint8_t EType;
  21. typedef struct Coords {
  22. double x;
  23. double y;
  24. } Coords;
  25. UID create_uid(EType type, uint8_t x, uint8_t y);
  26. EType uid_get_type(UID uid);
  27. Coords create_coords(double x, double y);
  28. uint8_t coords_distance(Coords* a, Coords* b);
  29. #endif