/*
Header file for CIslandPerson class
 */

#ifndef _ISLANDPERSON_H_
#define _ISLANDPERSON_H_

#include "camera.h"
#include "3Dpoint.h"
#include "BoundingBox/BoundingBoxTree.h"

#define GOD 4
#define MAN 5
#define WOMAN 6
#define GIRL 7
#define BOY 8

class CIslandPerson : public CObject
{
	public:
	void SetHeight(double height){m_dHeight = height;};
	void Draw();
	BOOL m_bShiftIsDown;
	void SetInitialPosition(double x, double y, double z);
	
	double * GetPointOfViewMatrix(void);
		CIslandPerson(int id);
		CIslandPerson();
		virtual ~CIslandPerson();
		CIslandPerson* MoveOrTurnInDirection(int nDirection, BOOL bKeyUp, CBoundingBoxTree* boundingBoxTree, CBoundingBoxTree* boundingBoxTreeGround, CList<CIslandPerson*, CIslandPerson*> *otherPeople);
		int GetID(){return m_nID;};
		void SetID(int id){m_nID = id;};
		CBoundingBox GetBoundingBoxGlobal(void);
		BOOL operator==(CIslandPerson person);
		// Overrides
	// ClassWizard generated virtual function overrides
	//{{AFX_VIRTUAL(CIslandDoc)
	public:
	virtual void Serialize(CArchive& ar);
	//}}AFX_VIRTUAL

	protected:
	CIslandPerson* CheckForPeopleCollision(CList<CIslandPerson*, CIslandPerson*> *otherPeople);
	BOOL CheckSideForCollision(CBoundingBoxTree *tree, BOOL bSide);
	BOOL CheckForBodyCollision(CBoundingBoxTree* tree);
	BOOL CheckSideForPersonCollision(CIslandPerson* person,BOOL bSide);
	double m_dFootTranslation;
	int m_nID;
		CCamera m_camera;
		//he is drawn according to this matrix
		double m_positionMatrix[16];
		void RecalculateMatrices();
		CBoundingBox m_boundingBox;
		double m_dHeight;
		//get the points representing our back
		C3DPoint GetMoveToPointBack(int nLevel/*1,2,3*/, BOOL bRight, BOOL bUseTranslation);
		C3DPoint GetGlobalPointBack(int nLevel/*1,2,3*/, BOOL bRight, BOOL bUseTranslation);
		C3DPoint GetMoveToPointFront(int nLevel/*1,2,3*/, BOOL bRight, BOOL bUseTranslation);
		C3DPoint GetGlobalPointFront(int nLevel/*1,2,3*/, BOOL bRight, BOOL bUseTranslation);
		
};

#endif // _ISLANDPERSON_H_
