
enum
{
//	FIXEDCAM,
	HUTCAM,
	ROTCAM,
	RAILCAMAXIS,
	RAILCAM,
//	LOOKCAM,
	MAXCAMERAMODES
};

typedef struct tagCHARACTER * CHARACTERHANDLE;
typedef struct tagENEMY * ENEMYHANDLE;
typedef struct tagCAMINFO * CAMINFOHANDLE;
//int characterNickAndFetcherHandler(CHARACTER *pC, MOVEDATA *);


#define		FIXEDPOS		1
#define		FIXEDPOSSNAP	2
#define		FIXEDLOOK		4
#define		FIXEDLOOKSNAP	8
#define		FIXEDROT		16
#define		CHANGEHEIGHT	32
#define		CHANGEDISTANCE	64
#define		NOSWEEPLOOK		128

#define		ALLFIXEDTYPES	(FIXEDPOS+FIXEDPOSSNAP+FIXEDLOOK+FIXEDLOOKSNAP+FIXEDROT)
//#define		FIXEDTYPES	(FIXEDPOS+FIXEDPOSSNAP+FIXEDLOOK+FIXEDLOOKSNAP)

#define		ALLPOSTYPES		(FIXEDPOS|FIXEDPOSSNAP)
#define		ALLLOOKTYPES	(FIXEDLOOK|FIXEDLOOKSNAP)

#define		OUTSIDE	0
#define		INSIDE	1
//#define		FASTSPEEDNOLIFT	2

#define		UPDATEPOSITION	1
#define		JUSTLEFTCASE	2
typedef struct _CAMVARS
{
	VECTOR	oldActorPos;	// Should get this from actor control struct

	VECTOR	camMovePos;
	VECTOR	viewMovePos;	// used with camera cases

	VECTOR	camMovePosSnap;
	VECTOR	viewMovePosSnap;	// used with camera cases

	VECTOR	startCamPos;
	VECTOR	startViewPos;
//	VECTOR	startViewPos;
	VECTOR	camAtStart;
	VECTOR	camAfterStart;
	VECTOR	camAfterCase;	
	VECTOR	camAfterInterp;// these 5 vectors store the position of the cam at various stages of the pipe line
	VECTOR	camAtEnd;

	VECTOR	interpCamPos;
	VECTOR	interpCamView;

	int		caseSpecials;
	int		tweedySpecial;	// special case to make cam look at door when mrs tweedy enters 
	int		tweedyHoldTime;
	int		flipFlop;
	int		timeTillNextChange;

	int		posCaseOnTime;	// used for timed cases
	int		lookCaseOnTime;
	int		posCaseToHold;
	int		lookCaseToHold;

	int		justStartedTimer;	// To stop the mad camera at the start of the level

	int		camStartAngle;
	int		camTransitionSpeed;

	int		caseDistance;
	int		caseHeight;

	VECTOR	railCamPoint;
	int		railCamAxis;
	int		railCamDirection;

	int		camDistance;
	int		camHeight;
	int		normalHeight;
	int		requiredHeight;
	int		objectHeight;
	int		actualHeight;

	int		camType;
	int		lastCamType;
	
	int		lookCamFacing;
	int		lookCamHeight;

	int		camTypeChanged;
	VECTOR	camRealPos;		// When changing main modes these hold the real positions of the camera
	VECTOR	camRealView;

	int		currentRailDist;
	int		currentRailPoint;	// used with none aligned rail cam
	int		currentRailCamNum;
	int		railTargetRail;
	int		railCamYOffset;	// quick rail target height bodge for Barry  
	int		railCamVel;
//	int		railCamDirection;

	int		lookDistance;
	int		requiredDistance;
	int		oldRequiredDistance;
	int		actualDistance;
	int		offsetDistance;
	int		lookHeight;
	int		swingDirection;
	int		holdPositionFlag;
	VECTOR	camPos2;
	VECTOR	holdPosition;
	VECTOR	camVel;
	int		camAngle;
	int		inactiveTime;
	int		fixedAngle;

//	ACTOR	*targetModel;
//	CHARACTERHANDLE	targetChar;
	ENEMYHANDLE		targetEnemy;	// not actually an enemy just the way it works

	int		targetRadius;
	int		numActorHits;		// Used when checking collisions

	VECTOR	targetCamPos;		// Where the cam wants to be in "look" mode	and when changing cam types;
	VECTOR	targetViewPos;		// as above but for view point

//	VECTOR	camPosAtTargetChange;

	int		timer;				// for use with interpolation between normal and look
	int		posChange;
	int		posChangeOn;

	int		timerTar;				// for use with interpolation between normal and look
	int		tarChange;
	int		tarChangeOn;

	int		flags;
	int		sweepFlag;
	int		firstSweep;
	int		sweepNum;	// if sweep cam cased this holds the number/tag to match up to the data
	int		area;
	int		lastFlags;
	int		quadrant;
	int		lastQuadrant;

	int		offGroundFlag;
	int		offGroundPos;

	int		special;
	int		specialTime;
	int		specialDirection;
	int		specialDist;

	int		specialOveride;
	VECTOR	specialPos;
	VECTOR	specialView;
}CAMVARS;

typedef struct _RAILDATA
{
	int		numPoints;
	int		currentPoint;
	int		direction;
	VECTOR	*pointData;
}RAILDATA1;

extern	RAILDATA1	railData;

extern	CAMVARS	camVars;		// temp colision stuff

extern	COLLDATA	cameraColl;
void	initCamera(void);
void	upDateCamera(void);
void	checkObstructionsFixed(int *dist,CAMVARS *CamVars);
void	checkObstructionsRotate(CAMVARS *CamVars);
void	checkObstructionsRotate2(CAMVARS *CamVars);
void	standardCamera(CAMVARS *CamVars);
void	swingCameraInside(CAMVARS *CamVars);
void	swingCameraOutside(CAMVARS *CamVars);
//void	checkBoxSides(int *position,int *camPosition);
ULONG*	checkBoxSides(int *position,int *camPosition);
void	updateTimers(void);
void	findMovePositions(int *position,int *camPosition,COLLBOX* pBox1);
int		findQuadrant(VECTOR	camPos,VECTOR actorPos);
void	findSwingDirection(VECTOR	camPos,VECTOR actorPos);
void	railCamera(void);
void	caseHandler(void);
void	changeCamMode(int mode);
void	CamModesAllowed(void);
//void	lookCamera(void);
int		findPointToUse(VECTOR actorPos,VECTOR camPos);

void	railCamNoneAligned(void);
void	lookAlongRail(int	startPointNum,int firstNum);

UBYTE	intersectLines(long x1,long y1,long x2,long y2,long x3,long y3,long x4,long y4, long *x,long *y);
int		targetCharCollTest(COLLDATA	*collData);

void	caminfoLinkBFF(CAMINFOHANDLE info);

void	showRailLines(void);
void	camTargetChange(void);
void	hutCamera(void);
void	tweedyCaseHandler(void);

//void	camPosChange(void);