/***************************************************************************
 *
 * playgfx.h
 *
 ***************************************************************************
 *
 * interface between game and 3d engine
 *
 ***************************************************************************/

#ifndef PLAYGFX_H_INCLUDED
#define PLAYGFX_H_INCLUDED

/*
 * includes
 */

#include "ult_64.h"
#include "main.h"
#include "lfptypes.h"
#include "define.h"
#include "anim.h"
#include "resman.h"
#include "teamdata.h"
#include "misc.h"


/*
 * defines
 */

#define BODY_THIN			0
#define BODY_REGULAR	1
#define BODY_THICK		2
#define BODY_TYPES		3

#define HAND_OPEN		0
#define HAND_FIST		1
#define HAND_POINT	2
#define HAND_TYPES	3

#define HEAD_REGULAR	0
#define HEAD_BLOCK		1
#define HEAD_CREWCUT	2
#define HEAD_HAIR			3
#define HEAD_THIN			4
#define HEAD_TYPES		5

#define MESH_HEAD		0
#define MESH_BODY		1
#define MESH_LHAND	2
#define MESH_RHAND	3
#define MESH_COUNT	4

#define DETAIL_LOW			0
#define DETAIL_MEDIUM		1
#define DETAIL_HIGH			2
#define DETAIL_EXTREME	3
#define DETAIL_LEVELS		4

#define TEXSET_LOW			0
#define TEXSET_HIGH			1
#define TEXSET_EXTREME	2
#define TEXSET_COUNT		3

#define MTL_LO_HTOP			0
#define MTL_LO_HFACE		1
#define MTL_LO_SHOULDR	2
#define MTL_LO_TORSO		3
#define MTL_LO_BICEP		4
#define MTL_LO_FOREARM	5
#define MTL_LO_HAND			6
#define MTL_LO_PELVIS		7
#define MTL_LO_LTHIGH		8
#define MTL_LO_RTHIGH		9
#define MTL_LO_CALF			10
#define MTL_LO_FOOT			11
#define MTL_LO_OBICEP		12
#define MTL_LO_OFOREARM	13
#define MTL_LO_OCALF		14

#define MTL_HI_HTOP			0
#define MTL_HI_HFACE		1
#define MTL_HI_ABDOMEN	2
#define MTL_HI_CHEST		3
#define MTL_HI_SIDE			4
#define MTL_HI_LSIDE		5
#define MTL_HI_BACK			6
#define MTL_HI_LOWBACK	7
#define MTL_HI_SHOULDR	8
#define MTL_HI_BICEP		9
#define MTL_HI_FOREARM	10
#define MTL_HI_HAND			11
#define MTL_HI_FIST			12
#define MTL_HI_WAIST		13
#define MTL_HI_PELVIS		14
#define MTL_HI_UPPANTS	15
#define MTL_HI_LTHIGH		16
#define MTL_HI_RTHIGH		17
#define MTL_HI_KNEE			18
#define MTL_HI_CALF			19
#define MTL_HI_FOOT			20
#define MTL_HI_OBICEP		21
#define MTL_HI_OFOREARM	22
#define MTL_HI_OKNEE		23
#define MTL_HI_OCALF		24

#define MTL_EX_HTOP			0
#define MTL_EX_HFRONT		1
#define MTL_EX_HBACK		2
#define MTL_EX_HSIDE		3
#define MTL_EX_ABDOMEN	4
#define MTL_EX_CHEST		5
#define MTL_EX_SIDE			6
#define MTL_EX_LSIDE		7
#define MTL_EX_BACK			8
#define MTL_EX_LOWBACK	9
#define MTL_EX_SHOULDR	10
#define MTL_EX_BICEP		11
#define MTL_EX_FOREARM	12
#define MTL_EX_HAND			13
#define MTL_EX_FIST			14
#define MTL_EX_WAIST		15
#define MTL_EX_PELVIS		16
#define MTL_EX_UPPANTS	17
#define MTL_EX_LTHIGH		18
#define MTL_EX_RTHIGH		19
#define MTL_EX_KNEE			20
#define MTL_EX_CALF			21
#define MTL_EX_FOOT			22
#define MTL_EX_OBICEP		23
#define MTL_EX_OFOREARM	24
#define MTL_EX_OKNEE		25
#define MTL_EX_OCALF		26

#define PG_FOCUS_ALL	0
#define PG_FOCUS_BACK	1
#define PG_FOCUS_FACE	2


// Enums...

enum
{
	HEAD_HEAD,
	HEAD_JAW,
	HEAD_MOUTH,
	HEAD_LOWER_LIP,
	HEAD_UPPER_LIP,
	HEAD_EYES,
	HEAD_BROW,
	HEAD_NODES
} EHeadNodes;

typedef enum EFaceAnim
{
	FACEANIM_NONE,
	FACEANIM_BLINK,
	FACEANIM_CHEW,
	FACEANIM_GOLDFISH,
	FACEANIM_GRIT,
	FACEANIM_SMILEA,
	FACEANIM_SMILEB,
	FACEANIM_SNEER,
	FACEANIM_YELLA,
	FACEANIM_YELLB,
	FACEANIM_YELLC
} EFaceAnim;


/*
 * typedefs
 */

typedef struct _animDef
{
//	int *mainId;
	anim *a;
//	int *ballId;
	anim *b;
	char loopFlag;
	char rootFlag;
	char fistFlag;
	s8 pad;
} animDef;

typedef struct _animLegDef
{
//	int *mainId;
	anim *a;
//	char loopFlag;
	s32 loopFlag;
} animLegDef;


typedef struct SMeshInfo
{
	u32
		*TexCoords;
	u16
		*Commands;
} SMeshInfo;

typedef struct SPlayerInfo
{
	s8
		Active,
		Display,
		DetailLevel,
		TextureSet;
	u16
		FaceAnim,
		FaceFrame,
		FaceRate,
		pad;
	RGBA16
		*Palette;
	Gfx
		*GfxList;
	SMaterial
		*MtlLists[TEXSET_COUNT];
	u8
		*HeadModel,
		*NodeLists[DETAIL_LEVELS][MAX_BONES],
		*HeadNodes[HEAD_NODES];
	vector16
		HeadBases[HEAD_NODES];
	SMeshInfo
		MeshLists[DETAIL_LEVELS][MESH_COUNT];
} SPlayerInfo;

/*
 * structures
 */

/*
 * globals
 */

extern vector16
	BoneOffs[MAX_BONES];

extern const s8
	ParentList[MAX_BONES];

extern SPlayerInfo
	PlayerInfos[10];


extern int bigHeadMode;

extern animDef *playerAnims;
extern animLegDef *legAnims;


/*
 * function prototypes
 */

void
	SetupBoneOffs(),
	PlayGfx_SetFaceAnim( s32 pnum, EFaceAnim anim, s32 time );


void PlayGfxOpenAnims();
void PlayGfxCloseAnims();


extern int PlayGfxEvalBall(playert *plyr,int *bx,int *by,int *bz);

extern void EvaluateAngles(playert *plyr,int *lf,int *rf, int ik);


#endif
