
#ifndef BALL_H_
#define BALL_H_

#ifdef __cplusplus
extern "C" {
#endif

#include "../factory/coord.h"
#include "../factory/particle.h"
#include "../factory/vertex.h"
#include "../util/collide.h"
#include "../util/mobile.h"

#define BALL_ANGLE_DEVIATE		0.75f
#define BALL_ANGLE_GRAVITY		(COORD_PI / -2.0f)
#define BALL_ANGLE_INITIAL		(COORD_PI / 2.0f)
#define BALL_ANGLE_RANDOM		(COORD_PI / 16.0f)

#define BALL_DELAY_SPARK		25
#define BALL_DELAY_TRAIL		25

#define BALL_FACTOR_ROLL		250.0f
#define BALL_FACTOR_SLOW		0.95f
#define BALL_FACTOR_TRAIL 	 	100.0f

#define BALL_QUADRIC_SLICE		16

#define BALL_SIZE_RADIUS		0.5f

#define BALL_SPEED_INITIAL		0.01f
#define BALL_SPEED_MIN			0.01f
#define BALL_SPEED_TRAIL		0.04f

#define BALL_STATE_ONESHOT		0x01
#define BALL_STATE_TRAVERSE		0x02

struct	s_ball
{
	struct s_coord		coord;
	float				effect;
	struct s_mobile		mobile;
	GLUquadricObj*		quadric;
	char				state;
	GLuint				texture;
	float				weight;
};

//char	ball_collide (struct s_ball*, float, float, float, float, float, float);
char	ball_collide (struct s_ball*, float, float, float, float, float, float, float, float);
void	ball_define (struct s_ball*, float, float, float, GLuint, GLUquadricObj*);
void	ball_draw (struct s_ball*);
void	ball_loop (struct s_ball*, struct s_particle*);
void	ball_move (struct s_ball*);
void	ball_type (struct s_ball*, float, GLuint);

#ifdef __cplusplus
}
#endif

#endif
