struct.h 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. #ifndef STRUCT_H
  2. #define STRUCT_H
  3. //constants
  4. #define PI 3.14159265
  5. #define SIN_60 0.866025404
  6. #define COS_60 0.5
  7. #define true 1
  8. #define false 0
  9. #define bool unsigned char
  10. //macros
  11. #define abs(x) x>0 ? x : -x
  12. typedef enum Pattern_Enum Pattern_Enum;
  13. typedef struct Camera Camera;
  14. typedef struct Wall Wall;
  15. typedef struct Line Line;
  16. typedef struct Level Level;
  17. struct Level{
  18. //for the level generation
  19. Pattern_Enum available_patterns[][];
  20. int nb_patterns;
  21. //for the camera rotation
  22. int change_interval; //5 seconds most of the time, but who knows...
  23. int change_precision; //to add a bit of randomness to the intervals
  24. float change_probability; //sometimes, there can be no change at all
  25. float max_speed;
  26. float min_speed;
  27. float fast_spin_probability; //very low, there sometimes is a slightly faster spin for one second, then a normal spin. This is the number that allow us to generate it
  28. };
  29. //the camera is defined by its center
  30. // ! and not by its upper left corner !
  31. //and an angle
  32. struct Camera{
  33. int cX;
  34. int cY;
  35. int angle;
  36. unsigned float zoom;
  37. float speed;
  38. };
  39. //a simple obstacle structure
  40. //d is the distance from the lowest face of the trapeze to the center of the screen
  41. //h is the thickness of the wall
  42. //line indicates the line that contains this obstacle
  43. //id is self explanatory
  44. //nxt is used by the linked list
  45. struct Wall{
  46. float d;
  47. int h;
  48. int id;
  49. int line;
  50. Wall *nxt;
  51. };
  52. #endif