HitManager.h 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. #ifndef HITMANAGER_H
  2. #define HITMANAGER_H
  3. // Basiques
  4. #include <iostream>
  5. #include <cmath>
  6. #include <deque>
  7. #include <vector>
  8. // SDL
  9. #include <SDL.h>
  10. #undef main
  11. #include <SDL/SDL_gfxPrimitives.h>
  12. // Combat
  13. #include "Shot.h"
  14. // Nombre de projectiles différents
  15. #define SHOT_NB 9
  16. // Identifiants
  17. #define PART_ID 0
  18. #define GUN_ID 1
  19. #define CUTTER_ID 2
  20. #define DISPER_ID 3
  21. #define PHOTO_ID 4
  22. #define MISSILE_ID 5
  23. #define BREXIT_ID 6
  24. #define HECTO_ID 7
  25. #define SNIPER_ID 8
  26. // Noms
  27. #define PART_NAME "Part"
  28. #define GUN_NAME "Gun"
  29. #define CUTTER_NAME "Cutter"
  30. #define DISPER_NAME "Disper"
  31. #define PHOTO_NAME "ProtoSeeker"
  32. #define MISSILE_NAME "Missile Launcher"
  33. #define BREXIT_NAME "Brexit Launcher"
  34. #define HECTO_NAME "Hecto Combustion"
  35. #define SNIPER_NAME "Sniper Rifle"
  36. #define ACTOR_NAME { PART_NAME, GUN_NAME, CUTTER_NAME, DISPER_NAME, PHOTO_NAME, MISSILE_NAME, BREXIT_NAME, HECTO_NAME, SNIPER_NAME }
  37. // Délais
  38. #define GUN_DECAY 256
  39. #define CUTTER_DECAY 272
  40. #define DISPER_DECAY 200
  41. #define PHOTO_DECAY 100
  42. #define MISSILE_DECAY 800
  43. #define BREXIT_DECAY 106
  44. #define HECTO_DECAY 350
  45. #define SNIPER_DECAY 700
  46. #define ACTOR_DECAY { 0, GUN_DECAY, CUTTER_DECAY, DISPER_DECAY, PHOTO_DECAY, MISSILE_DECAY, BREXIT_DECAY, HECTO_DECAY, SNIPER_DECAY }
  47. // Charges CPU
  48. #define PART_CPU 1
  49. #define GUN_CPU 20
  50. #define CUTTER_CPU 22
  51. #define DISPER_CPU 24
  52. #define PHOTO_CPU 22
  53. #define MISSILE_CPU 70
  54. #define BREXIT_CPU 27
  55. #define HECTO_CPU 56
  56. #define SNIPER_CPU 50
  57. #define ACTOR_CPU { PART_CPU, GUN_CPU, CUTTER_CPU, DISPER_CPU, PHOTO_CPU, MISSILE_CPU, BREXIT_CPU, HECTO_CPU, SNIPER_CPU }
  58. #define SHIELD_CPU 30
  59. /**
  60. Jovian Hersemeule
  61. Description du HitManager :
  62. Le HitManager contient toutes les données à propos des projectiles tirés
  63. par les entittés du jeu. Elle affiche les tirs, les fait bouger, les créé,
  64. les détruit, et permet aux entités de tester la collision.
  65. **/
  66. class HitManager
  67. {
  68. /// Méthodes
  69. public:
  70. HitManager();
  71. virtual ~HitManager();
  72. virtual void draw( SDL_Surface* screen );
  73. virtual void addShot( Shot* tir );
  74. virtual void triggerWeapon( int weapId, Sint16 x, Sint16 y, bool ally = false );
  75. virtual Sint32 absorb( bool isAlly, const Uint16 dimH, const Uint16 dimW, const SDL_Rect& hitbox );
  76. virtual bool colide( bool isAlly, Uint8** solid, const Uint16 dimH, const Uint16 dimW, const SDL_Rect& hitbox );
  77. virtual void update();
  78. virtual void clean();
  79. unsigned int getDecay( unsigned int weapId );
  80. void setNearPt( SDL_Rect nearPt );
  81. void setNearAxe( SDL_Rect nearAxe );
  82. void setNearAlly( SDL_Rect nearAlly );
  83. /// Attributs
  84. protected:
  85. SDL_Rect m_window;
  86. std::deque<Shot*> m_shots;
  87. SDL_Rect m_nearPt;
  88. SDL_Rect m_nearAxe;
  89. SDL_Rect m_nearAlly;
  90. };
  91. #endif // HITMANAGER_H