



#ifndef __DUALSHOCK_H__
#define __DUALSHOCK_H__


#include "global.h"
#include <islpad.h>


#define DSHOCK_MAXEVENT		10
#define DSHOCK_IDX_ROUND(idx)	(idx % DSHOCK_MAXEVENT)
#define DSHOCK_IDX_NEXT(idx)	(idx + 1) % DSHOCK_MAXEVENT
#define DSHOCK_IDX_PREV(idx)	(idx + DSHOCK_MAXEVENT - 1) % DSHOCK_MAXEVENT


/*#define SHOCK_RUMBLE1(queue)		dsEvent_Add(0, 0, 1, 300, 300, 30, queue)
#define SHOCK_RUMBLE2(queue)		dsEvent_Add(0, 0, 1, 600, 600, 50, queue)
#define SHOCK_RUMBLE3(queue)		dsEvent_Add(0, 0, 1, 900, 900, 70, queue)
#define SHOCK_BUZZ(queue)			dsEvent_Add(1, 18, 0, 0, 0, 0, queue)
#define SHOCK_BUZZ1(queue)			dsEvent_Add(1, 40, 0, 0, 0, 0, queue)
#define SHOCK_BUZZ2(queue)			dsEvent_Add(1, 75, 0, 0, 0, 0, queue) */


#define SHOCK_RUMBLE_START						\
		{										\
		dsEvent_Add(0, 0, 1, 50, 200, 110, 1);	\
		dsEvent_Add(0, 0, 1, 0, 0, 2, 1);	\
		}

#define SHOCK_RUMBLE_END						\
		{										\
		dsEvent_Add(0, 0, 1, 0, 0, 2, 0);		\
		}


#define SHOCK_SHARP								\
		{										\
		dsEvent_Add(1, 5, 0, 0, 0, 0, 1);		\
		}

#define SHOCK_LONG								\
		{										\
		dsEvent_Add(1, 60, 0, 0, 0, 0, 1);		\
		}



		

		

typedef struct _DSHOCK_EVENT
{
	int buzzer, speed, time;				// Values for the buzzer motor
	int motor, startSpeed, endSpeed, endTime;
	int queue, done;
} DSHOCK_EVENT;



extern DSHOCK_EVENT dShockEvents[DSHOCK_MAXEVENT];
extern int dsCurEvent, dsNumEvents;

int dsEvent_Init(void);
int dsEvent_Add(int buzzer, int time, int motor, int startSpeed, int endSpeed, int endTime, int queue);
int dsEvent_IsFinished(DSHOCK_EVENT *ev);
int dsEvent_Update(void);


#endif		// __DUALSHOCK_H__
