/*
	Asteroids
    Copyright (C) 2006  Darragh Coy.

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/

/*##############################################################################

Header name: Particle.hpp

##############################################################################*/

#ifndef PARTICLE_HPP
#define PARTICLE_HPP

   /****************************************************************************
   Defines
   ****************************************************************************/
   
      #define PAR_MAX_PARTICLES      2048                 // Maximum number of particles
      #define PAR_EXPLOSION_SCATTER  16                   // Amount of initial dispersion between particles in explosion
      #define PAR_EXPLOSION_AMT      128                  // Number of particles in a 'explosion'
      #define PAR_MAX_SPEED          160.0f               // Maximum particle speed      
      #define PAR_MIN_SPEED          64.0f                // Minimum particle speed
      #define PAR_MIN_TIME           0.25f                // Minimum particle time
      #define PAR_MAX_TIME           1.00f                // Maximum particle time   
      #define PAR_MAX_TIME_DIVIDE    (1.0f/PAR_MAX_TIME)  // Quick multiplier that divides by particle time: divides are slow!
      #define PAR_PARTICLE_SIZE      2.00f                // particle size when drawn  

   /****************************************************************************
   Includes
   ****************************************************************************/
      
      #include <Windows.h>	   // Windows
      #include <gl/gl.h>       // GL drawing functions
      #include <stdlib.h>      // rand function
      #include "Vec2D.h"       // Vector functions
      #include "Timer.h"       // Timing functions
      #include "Particle.h"    // Particle functions
   
   /****************************************************************************
   Externs
   ****************************************************************************/   
   
      //..
      
   /****************************************************************************
   Structs and enums
   ****************************************************************************/
      
      // Particle structure
      
      struct Particle_t 
      {
        Vec2D_t      position;
        Vec2D_t      velocity;
        bool         active;
        double       timeleft;
      };

   /****************************************************************************
   Prototypes
   ****************************************************************************/   

      void Particle_Init ();       // Initialise all particles
      void Particle_Move ();       // Move all active particles  
      void Particle_Draw ();       // Draw all active particles                                                                        
      
      // Shift all particles in by a certain amount
      
      void Particle_Shift ( float x , float y );
      
      // Create a particle 'explosion' around a point
      
      void Particle_Explosion ( Vec2D_t * center );
   
#endif
