#ifndef __ENGINE_H__
#define __ENGINE_H__


#include "loadsnd.h"


enum
{
	ENG_SQUARE,
	ENG_CROSS,
	ENG_CIRCLE,
	ENG_TRIANGLE,
	ENG_NUM_BUTTONS
};




typedef struct
{
	long	frameCount;
	int		active;
	int		changeTime;
	VECTOR	target;
	VECTOR	oldTarget;
	VECTOR	camPos;
	VECTOR	oldCamPos;
	int		justChangedFlag;
	int		bikerSpeed;
	int		pumperSpeed;
	int		oilerSpeed;
	int		oilerCount;
	int		oilerAng;
	int		bikerCurrentAction;
	int		bikerLastAction;
	int		oilerCurrentAction;
	int		oilerLastAction;
	int		cogGearsFrame;
	int		pumperCurrentAction;
	int		pumperLastAction;
	int		gauge;
	int		gameTimer;
	int		gameState;

	TextureType *texture[ENG_NUM_BUTTONS];				
	TextureType *inTexture[ENG_NUM_BUTTONS];				
	TextureType *icons[3];

	TextureType *arrow;

	char buttonStates[6];

	SfxSampleType *pSamples[NUM_ENGINE_SAMPLES];
	int		loopSampleNum;


}ENGINECTRL;



enum	// the current state of the game
{
	ENGINE_FADEIN,
	ENGINE_INTRO,
	ENGINE_RUNNING,
	ENGINE_FINISHING_TIMEUP,
	ENGINE_FINISHING_ROCKY,
	ENGINE_FINISHING_SUCCEED,
	ENGINE_BRONZE_SUCCESS,
	ENGINE_SILVER_SUCCESS,
	ENGINE_GOLD_SUCCESS,
	ENGINE_FAILED,
	ENGINE_FADEOUT,
};

enum	// who the focus is on
{
	OILER_ACTIVE,
	PUMPER_ACTIVE,
	COGBIKE_ACTIVE,
	MAX_ENGINE_ACTORS
};

enum	// actions for the biker
{
	ACTION_BIKER_IDLE,
	ACTION_BIKER_SLOW,
	ACTION_BIKER_FAST,
	MAX_BIKER_ACTIONS
};

enum	// actions for the oiler
{
	ACTION_OILER_IDLE,
	ACTION_OILER_SLOW,
	ACTION_OILER_FAST,
	MAX_OILER_ACTIONS
};

enum	// actions for the pumper
{
	ACTION_PUMPER_IDLE,
	ACTION_PUMPER_SLOW,
	ACTION_PUMPER_FAST,
	MAX_PUMPER_ACTIONS
};


void	engineStart(void);
void	engineDraw(void);
void	engineCycle(void);
void	engineEnd(void);
void	engineCamera(void);
void	oilerUpdate(void);
void	bikerUpdate(void);
void	pumperUpdate(void);
void	powerBars(void);
//void	baseBar(int x1,int y1);
void	powerGuage(int x1,int y1);

void engDrawIntro();
void engDrawFail();
void engDrawGoldSuccess();
void engDrawSilverSuccess();
void engDrawBronzeSuccess();

void engPrintDebug();
void engineFree();
void engineReset();
void engineRestart();
void engineExit();


void engineUpdateAnims();

#endif