#ifndef PARTICLE_H
#define PARTICLE_H

#include "hud.h"
#include "cl_util.h"
#include "util_vector.h"
#include "const.h"
#include "entity_state.h"
#include "cl_entity.h"
#include "triangleapi.h"

#define SetDraw( a ) draw = static_cast <void (Particle::*)()> (a)
#define SetThink( a ) think = static_cast <void (Particle::*)(float timeDiff)> (a)

/**
 * Particle
 * Handles the physics and drawing of a single particle
 * @author Herwin van Welbergen
 */
class Particle
{
public:	
	/**
	 * Constructor
	 * @param TO LAZY TO WRITE DO THIS LATER
	 */
	Particle(HSPRITE sprite);

	/**
	 * Constructor
	 * @param TO LAZY TO WRITE DO THIS LATER
	 */
	Particle(vec3_t position, HSPRITE sprite);

	/**
	 * Destructor
	 */
	~Particle();
	
	/**
	 * Draws the particle
	 * @param timeDiff time difference since the last draw
	 */
	void defaultDraw();
	
	/**
	 * Calls the currently used think function
	 * @param timeDiff time difference since last draw
	 */
	void doThink(float timeDiff);
	
	/**
	 * Calls the currently used draw function
	 * @param timeDiff time difference since last draw
	 */ 
	void doDraw();

	void DrawWorldSprite( int RenderMode, TRICULLSTYLE tricullstyle, float a, int frame);
	
	/**
	 * Default think function
	 * @param timeDiff time difference since last draw
	 */
	void defaultThink(float timeDiff);
	
	vec3_t position;
	vec3_t color;
	vec3_t startColor;
	float m_flSize;
	float m_flLifeTime;
	float m_flMaxLifeTime;	
	float m_flStartTime;	
	int m_fEnabled;
	vec3_t startPosition;
	vec3_t endPosition;
	int m_iFrame;
	int m_iRenderMode;
	float m_flRotation;
	float m_flRotationSpeed;
protected:
	///think function pointer
	void (Particle::*think)(float time);
	
	///draw function pointer
	void (Particle::*draw)();
	HSPRITE m_hsprSprite;
	

};
#endif
