/****************************************************************************
*
* ANIM.H
*
* PROGRAMMER : Chris
*    VERSION : 00.00
*    CREATED : 01/06/98
*   MODIFIED : 01/06/98
*       TABS : 5
*
* DESCRIPTION
*	Header file containing animation related structures and defintions
*
*****************************************************************************/

#ifndef _ANIM_H
#define _ANIM_H


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

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

#include "items.h"
#include "collide.h"

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

#ifdef __cplusplus
extern "C" {
#endif


enum command_types {
	COMMAND_NULL=0,
	COMMAND_MOVE_ORIGIN,
	COMMAND_JUMP_VELOCITY,
	COMMAND_ATTACK_READY,
	COMMAND_DEACTIVATE,
	COMMAND_SOUND_FX,
	COMMAND_EFFECT
};

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

typedef struct {
	sint32 x;
	sint32 y;
	sint32 z;
	sint16 room_number;
	sint16 box_number;
}GAME_VECTOR;

typedef struct {
	sint32 x;
	sint32 y;
	sint32 z;
	sint16 data;
	sint16 flags;
}OBJECT_VECTOR;

typedef struct	{
	sint16 *frame_ptr;            // pointer to animation frame data
	sint16 interpolation;		   // amount of interpolation
	sint16 current_anim_state;
	sint32 velocity;
	sint32 acceleration;
	sint16 frame_base;
	sint16 frame_end;
	sint16 jump_anim_num;
	sint16 jump_frame_num;
	sint16 number_changes;
	sint16 change_index;
	sint16 number_commands;
	sint16 command_index;
}ANIM_STRUCT;

typedef struct	{
	sint16 goal_anim_state;
	sint16 number_ranges;
	sint16 range_index;
}CHANGE_STRUCT;

typedef struct	{
	sint16 start_frame;
	sint16 end_frame;
	sint16 link_anim_num;
	sint16 link_frame_num;
}RANGE_STRUCT;


/******************************************************************************/

/* Definitions of object types e.g. WOLF */
typedef struct object_info {
	sint16 		nmeshes;						// -ve nmeshes => sprite
	sint16 		mesh_index;
	sint32 		bone_index;
	sint16 		*frame_base;
	void 		(*initialise)(sint16 item_number);
	void 		(*control)(sint16 item_number);
	void 		(*floor)(ITEM_INFO *item, sint32 x, sint32 y, sint32 z, sint32 *height);
	void 		(*ceiling)(ITEM_INFO *item, sint32 x, sint32 y, sint32 z, sint32 *height);
   	void 		(*draw_routine)( ITEM_INFO *item );
	void  		(*collision)( sint16 item_num, ITEM_INFO *laraitem, COLL_INFO *coll );
	sint16 		anim_index;
	sint16 		hit_points;
	sint16		pivot_length;		// Replacement for 'head_size': distance from centre to neck rotation
	sint16 		radius;
	sint16 		shadow_size;		// Size of Shadow ( -1 if none )
	uint16 		bite_offset;		// Offset into table of BITE_INFO structures for enemies that fire weapons. (Table in DRAW.C, set up bite_offset in SETUP.C).
	uint16 		loaded:1;			// Is this Object Loaded on this Level
	uint16		intelligent:1;		// Does this Object need AI info??
	uint16		non_lot:1;		// Does this creature not use LOT system (e.g. Compys)
	uint16		save_position:1;
	uint16		save_hitpoints:1;
	uint16		save_flags:1;
	uint16		save_anim:1;
	uint16		semi_transparent:1;	// is Sprite object semi transparent
	uint16		water_creature:1;	// is this is water based baddie? needed for SFX in shallow water
} OBJECT_INFO;

typedef struct static_info {
	sint16 	mesh_number;
	sint16	flags;										// Flags for collision and stuff.
	sint16 	x_minp,x_maxp,y_minp,y_maxp,z_minp,z_maxp;	// Draw bounds
	sint16  x_minc,x_maxc,y_minc,y_maxc,z_minc,z_maxc;  // Collision Bounds
} STATIC_INFO;

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

/* -------- declared in DRAW.C */

extern OBJECT_INFO objects[];
extern STATIC_INFO static_objects[];

extern sint32 *bones;
extern ANIM_STRUCT *anims;
extern RANGE_STRUCT *ranges;
extern CHANGE_STRUCT *changes;
extern sint16 **meshes, *commands, *frames;


#ifdef __cplusplus
}
#endif


#endif
