/*****************************************************************************
Name            :   ant.h
C Author        :   Stel Michael
Created         :   28 June 1993


Copyright       :   1992 by VideoLogic Limited. All rights reserved.
		    No part of this software, either material or conceptual
		    may be copied or distributed, transmitted, transcribed,
		    stored in a retrieval system or translated into any
		    human or computer language in any form by any means,
		    electronic, mechanical, manual or other-wise, or
		    disclosed to third parties without the express written
		    permission of VideoLogic Limited, HomePark Estate,
		    King's Langley, Hertfordshire, WD4 8LZ, U.K.

Description     :   Prototypes for ant.cpp

Program Type    :   Microsoft Visual C++ V2	
*****************************************************************************/


#ifdef Cplusplus 
#define CKEYWORD "C"
#else
#define CKEYWORD
#endif

#define MAXANTS 2

/* Data Strusture for ant legs */

typedef	struct	{
		int		status;
		float 	velocity;
		float	thigh_y;
		float	thigh_z;
		float	calf_y;
		int		hip_transform;
		int		knee_transform; 
		float	spinx;
		float 	spiny;
		float 	spinz;
		} leg;


/* Data Structure for ant body */

typedef	struct	{
		long	id;					// group id for whole of ant
		int		status;				// status of ant       
		int		cheststate;
		int		tailstate;  
		int		basestate;
		int		frames;
		float	velocity;			// ant's walking velocity
		float	pos[3];				//	position of ant
		float	orient[3];			// direction of ant    
		float 	activate_dis;		// distance from dome before becoming active
		int		body_transform[7]; 	//	transform names for body parts
		float	mandible_ang;		// opening angle of ants mandibles
		float  	tail_ang;			// angle of tail from its origin position
		float	ant_ang;			// direction ant is facing
		leg		left_legs[3];		// leg structures for three left legs
		leg		right_legs[3];		// right three legs
		} gi_ant;							 


extern CKEYWORD gi_ant* Create_Ant(float pos[3], float orient[3],float activate);
extern CKEYWORD void Animate_Ant(gi_ant *a_ptr,ControlledObject *craft,int ant);
extern CKEYWORD int	 Walk_ant(gi_ant far 	*a_ptr,int ant);
extern CKEYWORD void Snap_mandibles(gi_ant *a_ptr);
extern CKEYWORD void Wiggle_tail(gi_ant *a_ptr);      

extern CKEYWORD void	Adjust_Direction(gi_ant *a_ptr,float pos[3],int ant);
extern CKEYWORD int	Explode_Ant(gi_ant	*a_ptr,int justhit);

#define	TWOPI (2.0f * PI)
#define	NUMANTS	2


/* defines for body parts */

#define	BASE	0
#define	TAIL	1
#define	CHEST	2
#define	NECK	3
#define	HEAD	4
#define	JAWA	5
#define	JAWB	6


/* defines for ant states */
                 
#define STILL		0
#define	WALKING		1 
#define WALKABOUT 	2

#define HIT			7          
#define EXPLODING 	8
#define DEAD		9


/* defines for leg states */

#define	ONGROUND	0
#define	LIFTING		1	
#define FLYING		2
#define INSEA		3

#define	BACKLEG_Y_OFF		(PI / 8.0f)
#define	FRONTLEG_Y_OFF		(-PI / 8.0f)
											
#define	HIP_Z_REST			(PI / 8.0f)
#define	KNEE_Z_REST			(-PI / 12.0f)

#define	HIP_Y_LIMIT			(PI / 6.0f)
#define	MAND_Y_LIMIT		(PI / 6.0f)
#define	MAX_THIGH_Z			(PI / 4.0f)

#define TAIL_X_REST			(-PI/24.0f)
#define	TAIL_X_LIMIT		(PI/ 12.0f)
#define	MAX_TAIL_X			(PI/16.0f)

#define	ANT_DAMP			(PI/64.0f)		
#define ANT_TURN_RATE		0.03f

