//----------------------------------------------------------------------------------
// Types and Structures Definition
//----------------------------------------------------------------------------------


typedef struct Paratrooper
{
   int life;
   float  xDrop;
   float  yDrop;
   bool droped;
   bool whichWay;
   Rectangle hitbox;
   Vector2 speed;
   Color color; // yellow or red
}Paratrooper;

typedef struct Aircraft
{
   int life;
   float height;
   float xFirstToJump;
   int numberOfParatroopers;
   Rectangle hitbox;
   Vector2 speed;
   Color color; //black
}Aircraft;

typedef struct Bombshell
{
  float radius;
  float sin;
  float cos;
  bool ammoShot;
  Vector2 position;
  Vector2 speed;
  Color color;
}Bombshell;

typedef struct Bullet
{
  float radius;
  int damageDone;
  float sin;
  float cos;
  bool ammoShot;
  Vector2 position;
  Vector2 speed;
  Color color;
}Bullet;

typedef struct AntiAircraftCanon
{
    float sin;
    float cos;
    Vector2 position;
    Vector2 aimingPosition;
}AntiAircraftCanon;

typedef struct AntiParaCanon
{
    float sin;
    float cos;
    Vector2 position;
    Vector2 aimingPosition;
}AntiParaCanon;

typedef struct Viewfinder
{
  Rectangle up;
  Rectangle down;
  Rectangle left;
  Rectangle right;
  float radius;
  Vector2 center;
  Color color;
}Viewfinder;


//------------------------------------------------------------------------------------
// Module Functions Declaration 
//------------------------------------------------------------------------------------
static void InitGame(void);         // Initialize game
static void UpdateGame(void);       // Update game (one frame)
static void DrawGame(void);         // Draw game (one frame)
static void LoadAudio(void);
static void UnloadAudio(void);       // Unload game

//------------------------------------------------------------------------------------
// Other Functions
//------------------------------------------------------------------------------------

//Initialization functions------------------------------------------------------------
Aircraft InitializeAircraft(void);
AntiAircraftCanon InitializeAntiAircraftCanon(void);
AntiParaCanon InitializeAntiParaCanon(void);
Bombshell InitializeBombshell(void);
Bullet InitializeBullet(void);
Paratrooper InitializeParatrooper(void);
Viewfinder InitializeViewfinder(float decalage);

//Game functions----------------------------------------------------------------------

bool IsRectangleOut(Rectangle rec);
bool IsCircleOut(Vector2 center, float radius);
bool GoDropParatrooper(Aircraft aircraft);
Aircraft MoveAircrafts(Aircraft aircraft);
Bombshell MoveBombshell(Bombshell bombshell);
Bombshell ShootBombshell(Bombshell bombshell);
Bullet MoveBullet(Bullet bullet);
Bullet ShootBullet(Bullet bullet);
Paratrooper DropParatrooperFromAircraft(Paratrooper paratrooper,Aircraft aircraft);
Paratrooper MoveParatrooper(Paratrooper paratrooper);

