

#ifndef __SUBGAME_H__
#define __SUBGAME_H__

#include "global.h"


#define LAUNCHGAME_CAMPOS		2
#define LAUNCHGAME_CAMLOOK		1



enum
{
	FAIL,
	BRONZE,
	SILVER,
	GOLD,
};





extern int subGameRestart;

#define SUBGAME_DEBRISDISTANCE 50000

#define RAND_FREQ(x) (1000 + utilRandomInt(x) - (x/2))


extern int SUB_BAR_BAR_WIDTH;
extern ACTOR *myactor;


enum
{
	SG_SEESAW,
	SG_CATAPULT,
	SG_FIREWORKS,
	SG_ENGINE,
	SG_WINGS,
	SG_CONSTRUCT,
	SG_EGGLAYING,
	NUM_SUBGAMES,
};


//typedef struct _LAUNCH_GAME_DATA
//{
//	int	state, aimMoveState;
//	int	aimXRot, aimYRot, aimXMove, aimYMove, aimXAccel, aimYAccel;
//	
//	ACTOR * flyActor, * walkOffActors[5];
//	PSIMODEL * chickenModels[3];
//} LAUNCH_GAME_DATA;





#define	SUBGAME_MOVESTATE_UP		1
#define	SUBGAME_MOVESTATE_DOWN		2
#define	SUBGAME_MOVESTATE_LEFT		4
#define	SUBGAME_MOVESTATE_RIGHT		8


extern int SFX_PITCH_RAND;


//void launchGame_Controls(LAUNCH_GAME_DATA *gd);
//void launchGame_MoveAim(LAUNCH_GAME_DATA *gd);
//void launchGame_SetupCamera(void);


void subgameInitPowerBar();
void subgameDrawPowerBar(int x, int y, int inpower);

//void sgStartCameraMove(VECTOR *targetPos, VECTOR *targetLook, int numFrames);
//int  sgUpdateCameraMove();


int drawClippedSpriteOverlay(TextureType *spr, int x, int y, int depth, short clipLeft, short clipRight, short clipTop, short clipBottom);
int drawClippedSpriteOverlayColour(TextureType *spr, int x, int y, int depth, short clipLeft, short clipRight, short clipTop, short clipBottom, ULONG colour);

int getWorldPosOfBone(ACTOR* actor, char *bone, VECTOR *res);
void moveActorTowardsCamera(ACTOR* actor, int dist);
int overlaySizeableSprite(TextureType *spr, int x, int y, int w, int h, int depth, unsigned long colour);
int drawVertScrollOverlay(TextureType *spr, int x, int y, int vPos, int depth);

void initCricketScores(int x, int y, int numBronze, int numSilver, int numGold, int depth);
void drawCricketScores(int x, int y, int num);
int PrintFixedDepth3DSprite(TextureType *spr,VERT *vect,SHORT scale, unsigned long colour, long depth);

void initStopWatch(int x, int y, int fov);
void drawStopWatch(int time);
void freeStopWatch();

void DrawDirectionArrows(TextureType *rarrow, int yPos);


void initFowler(int fov, int subgame);
void startFowler(int medal);
void fowlerDraw();
void freeFowler();
void resetStopWatch();
void resetCricketScores();
void makeFowlerSpeak();
//void fowlerSetMedalSfx(int medal);







#endif