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

#ifndef _LARAFIRE_H
#define _LARAFIRE_H

/*---------------------------------------------------------------------------
 *	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 "anim.h"

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

#define DONT_TARGET	(-16384)	// set item->hit_points to disable targetting

enum lara_arm_states  {
	LA_LOCKOFF,
	LA_LOCKON,
	LA_RECOIL
};

enum lara_gun_states {
	LG_ARMLESS,
	LG_HANDSBUSY,
	LG_DRAW,
	LG_UNDRAW,
	LG_READY,
	LG_SPECIAL
};

enum lara_gun_types {
	LG_UNARMED=0,
	LG_PISTOLS,
	LG_MAGNUMS,
	LG_UZIS,
	LG_SHOTGUN,
	LG_M16,
	LG_ROCKET,
	LG_GRENADE,
	LG_HARPOON,
	LG_FLARE,
	LG_SKIDOO,
	NUM_WEAPONS
};

#define NUM_SG_SHELLS	2	// 2 shells in a box

#define GUN_AMMO_CLIP	16	// How many bullets in Each Clip
#define MAGNUM_AMMO_CLIP	5	// Pickup is Two clips at a time
#define UZI_AMMO_CLIP	20
#define SHOTGUN_AMMO_CLIP 6	// all these blasted in one go
#define HARPOON_AMMO_CLIP 3
#define M16_AMMO_CLIP	30
#define ROCKET_AMMO_CLIP	1
#define GRENADE_AMMO_CLIP	1

//#if defined(PSX_VERSION) && defined(JAPAN)
#define FLARE_AMMO_BOX	8
//#else
//#define FLARE_AMMO_BOX	6
//#endif

#define GUN_AMMO_QTY	(GUN_AMMO_CLIP*2)		// How many bullets are in each pickup!
#define MAGNUM_AMMO_QTY	(MAGNUM_AMMO_CLIP*2)	// Pickup is Two clips at a time
#define UZI_AMMO_QTY	(UZI_AMMO_CLIP*2)
#define SHOTGUN_AMMO_QTY	(SHOTGUN_AMMO_CLIP*NUM_SG_SHELLS)   // all these blasted in one go
#define FLARE_AMMO_QTY	FLARE_AMMO_BOX
#define HARPOON_AMMO_QTY	HARPOON_AMMO_CLIP
#define M16_AMMO_QTY	(M16_AMMO_CLIP*2)
#define ROCKET_AMMO_QTY	ROCKET_AMMO_CLIP
#define GRENADE_AMMO_QTY	(GRENADE_AMMO_CLIP*2)

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

typedef struct lara_arm {
	sint16 *frame_base;
	sint16 frame_number;
	sint16 anim_number;
	sint16 lock;
	PHD_ANGLE	y_rot,x_rot,z_rot;
	sint16 flash_gun;
}LARA_ARM;

typedef struct	{
	PHD_ANGLE	lock_angles[4];	// Min/Max for Y,X rots
	PHD_ANGLE	left_angles[4];	// Min/Max for Left arm Aim
	PHD_ANGLE	right_angles[4];	// Min/Max for Right arm Aim
	PHD_ANGLE aim_speed;		// Speed at which arms lockon
	PHD_ANGLE	shot_accuracy;		// Random angle range for Shot
	sint16 gun_height;			// Height of Gun from Source Origin
	sint16 target_dist;			// Target distance
	char damage;				// Amount of Damage Done
	char recoil_frame;			// Recoil frame for pistol-type guns
	char flash_time;			// How long GunFlash lasts
	char draw_frame;			// Draw frame for mesh-swap
	sint16 sample_num;			// Sample number for Weapon
}WEAPON_INFO;

typedef struct	ammo_info {
	int ammo;
}AMMO_INFO;

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

extern WEAPON_INFO weapons[];

extern void LaraGun();
extern void InitialiseNewWeapon();

extern ITEM_INFO *find_nearest_target_info( sint32 *fdist, sint32 maxdist, PHD_ANGLE *outangles, PHD_ANGLE *inangles );
extern int find_target_info( ITEM_INFO *item, sint32 maxdist, PHD_ANGLE *outangles, PHD_ANGLE *inangles );
extern void find_target_point( ITEM_INFO *item, GAME_VECTOR *target );

extern void LaraTargetInfo( WEAPON_INFO *winfo );
extern void LaraGetNewTarget( WEAPON_INFO *winfo );

extern void AimWeapon( WEAPON_INFO *winfo, LARA_ARM *arm );
extern int FireWeapon( int weapon_type, ITEM_INFO *target, ITEM_INFO *src, PHD_ANGLE *angles );

extern int WeaponObject(int weapon_type);

extern void HitTarget( ITEM_INFO *item, GAME_VECTOR *hitpos, int damage );

extern void SmashItem(sint16 item_number, int weapon_type);
extern	void	DoProperDetection(short item_number, long x, long y, long z, long xv, long yv, long zv);


#ifdef PSX_VERSION
#define ANALOG_CONTROL
#ifdef ANALOG_CONTROL
#define VIBRATE(a, l, s, d, len)	SetupPadVibration(0, a, l, s, d, len)
#define RUMBLE(a, l, s, d, len)	SetupPadVibration(1, a, l, s, d, len)
#else
#define VIBRATE(a, l, s, d, len)
#define RUMBLE(a, l, s, d, len)
#endif

extern void SetupPadVibration(sint16, sint16, sint16, sint16, sint16, sint16);

#else
#define VIBRATE(a, l, s, d, len)
#define RUMBLE(a, l, s, d, len)
#endif







#endif

