/****************************************************************************
*
* LARA.H
*
* PROGRAMMER : Chris
*    VERSION : 00.00
*    CREATED : 03/06/98
*   MODIFIED : 03/06/98
*       TABS : 5
*
* DESCRIPTION
*	Header file for LARA.C
*
*****************************************************************************/

#ifndef _LARA_H
#define _LARA_H

#ifdef __cplusplus
extern "C" {
#endif

/*---------------------------------------------------------------------------
 *	Import Headers
\*--------------------------------------------------------------------------*/

#ifdef PSX_VERSION
#include "../spec_psx/typedefs.h"
#include "../spec_psx/3d_gen.h"
#else
#include "..\specific\stypes.h"
#endif

#include "items.h"
#include "collide.h"
#include "effects.h"
#include "larafire.h"
#include "box.h"
#include "draw.h"

/*---------------------------------------------------------------------------
 *	Constants
\*--------------------------------------------------------------------------*/

#define ONE_DEGREE 182		// stick these somewhere better
#define GRAVITY 6
#define SQUARE(A) ((A)*(A))
#define FASTFALL_SPEED 128

/*---------------------------------------------------------------------------
 *	Type Definitions
\*--------------------------------------------------------------------------*/

typedef struct lara_info {
	sint16 item_number;
	sint16 gun_status;
	sint16 gun_type;
	sint16 request_gun_type;
	sint16 last_gun_type;
	sint16 calc_fallspeed;
	sint16 water_status;
	sint16 climb_status;
	sint16 pose_count;
	sint16 hit_frame;
	sint16 hit_direction;
	sint16 air;
	sint16 dive_count;
	sint16 death_count;
	sint16 current_active;		// Underwater current
	sint16 current_xvel;		//
	sint16 current_yvel;          // Underwater current velocities.
	sint16 current_zvel;          //
	sint16 spaz_effect_count;     // Effects can make lara spaz
	sint16 flare_age;			// How old is the flare in Lara's hand?
	sint16 skidoo;				// flag whether Lara is skidooing
	sint16 weapon_item;			// dummy item used for new weapon control
	sint16 back_gun;			// object number of gun that Lara has on her back currently
	sint16 flare_frame;
	sint16 poisoned;			// Number of hits to take off Laras energy when poisoned (max val is ?).
	sint16 electric;			// Electrocuted ?
	uint16 flare_control_left:1;
	uint16 flare_control_right:1;
	uint16 extra_anim:1;		// 1 if Lara is running an anim from another project (LARA_EXTRA usually)
	uint16 look:1;				// 1 if OK for Lara to LookLeftRight
	uint16 burn:1;				// lara's botty is hot
	uint16 keep_ducked:1;		// can't get out of duck
	uint16 CanMonkeySwing:1;
	uint16 MineL:1;
	uint16 MineR:1;
	uint16 BurnGreen:1;			// Shot by Willard Boss ?
	uint16 IsDucked:1;			// In a duck animation
	uint16 has_fired:1;			// Has she fired a gun recently?
	sint32 water_surface_dist;					// <0 if Lara's origin is below water)
	PHD_VECTOR last_pos;
	FX_INFO	*spaz_effect;
	int		mesh_effects;							// Used for Special Effects
	sint16	*mesh_ptrs[15];
	ITEM_INFO	*target;
	PHD_ANGLE	target_angles[2];
	PHD_ANGLE   turn_rate;
	PHD_ANGLE	move_angle;
	PHD_ANGLE	head_y_rot,head_x_rot,head_z_rot;
	PHD_ANGLE	torso_y_rot,torso_x_rot,torso_z_rot;
	LARA_ARM	left_arm,right_arm;
	AMMO_INFO	pistols;
	AMMO_INFO	magnums;
	AMMO_INFO	uzis;
	AMMO_INFO	shotgun;
	AMMO_INFO	harpoon;
	AMMO_INFO	rocket;
	AMMO_INFO	grenade;
	AMMO_INFO	m16;
	CREATURE_INFO *creature;		// lara uses baddie AI for water current
} LARA_INFO;

/*---------------------------------------------------------------------------
 *	Prototypes
\*--------------------------------------------------------------------------*/

extern LARA_INFO lara;
extern ITEM_INFO *lara_item;

extern int health_bar_timer;
extern uint16 DashTimer;

extern char GotJointPos[];
extern char IsJointUnderwater[];

extern void LaraAboveWater(ITEM_INFO *item, COLL_INFO *coll);

extern void LookUpDown();
extern void LookLeftRight();
extern void ResetLook();

extern void GetLaraJointAbsPosition(PHD_VECTOR *vec, int joint);
extern void GetLaraHandAbsPosition(PHD_VECTOR *vec, int leftright);
extern void GetLJAInt(ITEM_INFO *item, PHD_VECTOR *vec, sint16 *frame1, sint16 *frame2, int frac, int rate);
extern void GetLHAInt(ITEM_INFO *item, PHD_VECTOR *vec, sint16 *frame1, sint16 *frame2, int frac, int rate, long leftright);

extern void ControlDeathSlide(sint16 item_number);
extern void DeathSlideCollision(sint16 item_number, ITEM_INFO *laraitem, COLL_INFO *coll);

#ifdef __cplusplus
}
#endif

#endif
