SpaceShip.h 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. #ifndef SPACESHIP_H
  2. #define SPACESHIP_H
  3. #include "HitManager.h"
  4. #include <string>
  5. #include <fstream>
  6. #include <queue>
  7. #include "Shot/Part.h"
  8. #define SHIELD_MAX_DELAY 10000
  9. #define SHIELD_MIN_DELAY 1000
  10. #define SHIELD_REGEN 10
  11. #define SHIELD_1_EARN_DELAY 350
  12. #define SHIELD_1_EARN_HP 3000
  13. #define SHIELD_2_EARN_DELAY 500
  14. #define SHIELD_2_EARN_HP 30000
  15. /**
  16. Jovian Hersemeule
  17. Description du SpaceShip :
  18. Contient toutes les données relatives au vaisseau spatial,
  19. sa structure, sa vie, ses armes, ses modules ...
  20. **/
  21. struct Actor;
  22. struct Laser;
  23. class SpaceShip
  24. {
  25. /// Méthodes
  26. public:
  27. SpaceShip();
  28. SpaceShip( bool ally );
  29. virtual ~SpaceShip();
  30. void giveHitManager( HitManager* theHitManager );
  31. void setPos( Sint16 x, Sint16 y );
  32. SDL_Rect* getPos();
  33. SDL_Rect getHeartPos();
  34. bool getIsAlive();
  35. SDL_Rect* getHitBox();
  36. virtual void loadShape( std::string path );
  37. virtual Uint32 countCPU();
  38. bool hasShield();
  39. bool hasWeapon( int weapId );
  40. virtual void draw( SDL_Surface* screen );
  41. virtual void fire( int weapId );
  42. virtual void update(); // Met à jour la structure du vaisseau ( collisions )
  43. protected:
  44. void destroyTabs();
  45. void integrity();
  46. void resetShields();
  47. /// Attributs
  48. protected:
  49. Uint16 m_heartX;
  50. Uint16 m_heartY;
  51. const bool m_ally;
  52. SDL_Rect m_pos; // Hitbox du vaisseau
  53. Uint16 m_shH;
  54. Uint16 m_shW;
  55. char** m_shape; // Tableau
  56. Uint8** m_solid; // Tableau
  57. HitManager* m_hiter;
  58. std::vector<Actor> m_act[SHOT_NB]; // Les différentes armes du vaisseau
  59. Uint32 m_loading[SHOT_NB]; // Les recharges des armes
  60. Uint16 m_shieldLeft;
  61. Uint16 m_shieldMax;
  62. Uint32 m_shieldLast; // Date de dernier contact
  63. Uint32 m_shieldDelay;
  64. std::vector<Actor> m_shields;
  65. std::vector<Laser> m_lasers;
  66. };
  67. #endif // SPACESHIP_H