
/********************
	hover.h
 ********************/


/*******************************************************************************
	DEFINE
*******************************************************************************/

/***********************************************
	GHOST
***********************************************/
#define GHOST_BF_SIZE2	(3*2557)

/***********************************************
	VARIABLE
***********************************************/
#define	my_hover	0
#define your_hover	1

/***********************************************
	BUTTON
***********************************************/
#define	ACCEL_BT	(CONT_A|CONT_G)
#define	JUMP_BT		(CONT_B)
#define SLIP_BT		(CONT_R)

/*******************************************************
	ANIMATION
*******************************************************/
#define	RIDING_AN		AN_MAX
#define	FREE_AN			(AN_MAX+1)
#define	HANG_AN			(AN_MAX+2)
#define	DIVE_AN			(AN_MAX+3)

#define	BASE_AN_ID_RIDE		0
#define	BASE_AN_ID_STAND	1
#define	BASE_AN_ID_RIGHT	2
#define	BASE_AN_ID_LEFT		3
#define	BASE_AN_ID_DIVE		4
#define	BASE_AN_ID_DOL_RIDE	5
#define	BASE_AN_ID_DOL_RIGHT	6
#define	BASE_AN_ID_DOL_LEFT	7
#define	BASE_AN_ID_DOL_DIVE	8

#define HANDSTAND_START_CT	23	/* ryouashisoroetetachiagattatokoro */
#define HANDSTAND_POSE_CT	30	/* kaikyakushitekimeteirutokoro */
#define HANDSTAND_END_CT	37	/* ryouashisoroeteorihajimerutokoro */

#define BACKWARD_CROSSGRIP_CT	23	/* gyakunitsukamutokoro */
#define BACKWARD_TURN0_CT	25	/* ushironimawattatokoro */
#define BACKWARD_POSE_CT	45	/* kimeteirutokoro */
#define BACKWARD_RELEASEGRIP_CT	60	/* modorutokinitewohanasutokoro */
#define BACKWARD_TURN1_CT	61	/* ushirokaramodorihajimerutokoro */
#define BACKWARD_REGRIP_CT	84	/* tsukaminaosutokoro */

#define FOOTSTRETCH_STEP_CT	25	/* ichidokihonshiseinimodorutoko */

#define BOARD_GRIP_CT		56	/* handoruwotsukandatokoro */
#define BOARD_STEP_CT		77	/* migiashiwotsukutokoro */

#define SPINJUMP_POSE_CT	23	/* kimeteirutokoro */
#define SPINJUMP_STEPSTART_CT	24	/* futsuuorihajime */
#define SPINJUMP_STEPEND_CT	37	/* futsuuorita */
#define SPINJUMP_BACKSTART_CT	40	/* bakkuorihijime */
#define SPINJUMP_BACKEND_CT	61	/* bakkuorita */

#define	BOARD_TYPE_TERRIBLE	0
#define	BOARD_TYPE_SLIGHT	1

/***********************************************
	SHELL DATA
***********************************************/
#define	S_PMAX			12
#define	S_LMAX			66

#define	BOAT_R			(39.0f)
#define	SPHERE_R		(12.0f)
#define	SPHERE_YOFS		(2.0f)
#define	SPHERE0_ZOFS		(27.0f)
#define	SPHERE1_ZOFS		(9.0f)
#define	SPHERE2_ZOFS		(-9.0f)
#define	SPHERE3_ZOFS		(-27.0f)

/***********************************************
	POINT INDEX
***********************************************/
#define MAN_POINTS	19
#define ALL_POINTS	25
#define MAN_LINES	22

#define PI_HEAD		0
#define PI_NECK		1
#define PI_WAIST	2
#define PI_LSHOULDER	3
#define PI_LELBOW	4
#define PI_LWRIST	5
#define PI_LHAND	6
#define PI_LHIP		7
#define PI_LKNEE	8
#define PI_LHEEL	9
#define PI_LTOE		10
#define PI_RSHOULDER	11
#define PI_RELBOW	12
#define PI_RWRIST	13
#define PI_RHAND	14
#define PI_RHIP		15
#define PI_RKNEE	16
#define PI_RHEEL	17
#define PI_RTOE		18

#define PI_BODY		19
#define PI_ARM		20
#define PI_HANDLE	21
#define PI_LGRIP	22
#define PI_RGRIP	23
#define PI_BOW		24

/***********************************************
	POINT MODE
***********************************************/
#define	PM_ANIM_FIX	0
#define	PM_ANIM_FREE	1
#define	PM_LGRIP	2
#define	PM_RGRIP	3
#define	PM_STEP		4
#define	PM_BOARD	5

/***********************************************
	HANDLE MODE
***********************************************/
#define HM_ANIM_FIX	0
#define HM_ANIM_FREE	1


/***********************************************
	ROLLING MODE
***********************************************/
#define RM_NONE		0
#define RM_RIGHT	1
#define RM_LEFT		2
#define RM_FRONT	3
#define RM_BACK		4


/***********************************************
	FOOT STRETCH MODE
***********************************************/
#define FSM_RIGHT	0
#define FSM_RIGHTLEFT	1
#define FSM_LEFT	2
#define FSM_LEFTRIGHT	3


/***********************************************
	FACE PANEL MODE
***********************************************/
#define HD_UP		0
#define HD_DOWN		1


/***********************************************
	FACE PANEL MODE
***********************************************/
#define FPM_NORMAL	0
#define FPM_HANG	1
#define FPM_DROWN	2


/***********************************************
	CRSOBJ TYPE
***********************************************/
#define	COT_ETC		0
#define	COT_ICE		1
#define	COT_ICE_BREAK	2


/***********************************************
	ACROBAT MODE
***********************************************/
#define	AM_NONE		0
#define	AM_HANDSTAND	1
#define	AM_BACKWARD	2
#define	AM_LEFTROLL	3
#define	AM_RIGHTROLL	4
#define	AM_BACKROLL	5
#define	AM_ROLLSUCCEED	6
#define	AM_ROLLSUCFAIL	7
#define	AM_ROLLFAIL	8
#define	AM_SPINJUMP	9
#define	AM_SPINBACK	10
#define	AM_SUBMARINE	11


/*******************************************************************************
	TYPEDEF
*******************************************************************************/

/***********************************************
	MATRIX
***********************************************/
typedef struct {
	MtxVector	ManLfoot ;
	MtxVector	ManLshin ;
	MtxVector	ManLthigh ;
	MtxVector	ManRfoot ;
	MtxVector	ManRshin ;
	MtxVector	ManRthigh ;
	MtxVector	ManWaist ;
	MtxVector	ManHead ;
	MtxVector	ManLhand ;
	MtxVector	ManLfarm ;
	MtxVector	ManLuarm ;
	MtxVector	ManRhand ;
	MtxVector	ManRfarm ;
	MtxVector	ManRuarm ;
	MtxVector	ManChest ;
	MtxVector	SkiHandle ;
	MtxVector	SkiArm ;
	MtxVector	SkiBody ;
} JetSkiMtx ;

/***********************************************
	MAN POINT
***********************************************/
typedef struct {
	int		mode ;

	Fxyz		pos ;
	Fxyz		pos2 ;
	Fxyz		vec ;
} ManPoint ;

typedef struct {
	ManPoint	*p1 ;		/* point index */
	ManPoint	*p2 ;
	float		length1 ;	/* length * f */
} ManLine ;

/***********************************************
	SPHERE
***********************************************/
typedef struct {
	float		px ;
	float		py ;
	float		pz ;
	float		vx ;
	float		vy ;
	float		vz ;
	Point		*p1 ;
	Point		*p2 ;
	Point		*p3 ;
} BodySphere ;

/***********************************************
	BOAT
***********************************************/
typedef struct {
	Object		obj ;
	Point		point[S_PMAX] ;
	Line		line[S_LMAX] ;
	float		length[S_LMAX] ;
	float		point_feel[S_PMAX] ;

	ManPoint	mpoint[ALL_POINTS] ;
	ManLine		mline[MAN_LINES] ;

	OSContPad	pad_data ;
	Controller	controller ;

	int		analog_stick_x ;

	int		performance_number ;
	int		boat_number ;
	int		performance_handling ;
	int		performance_gear ;
	int		performance_grip ;

	float		body_vx ;
	float		body_vy ;
	float		body_vz ;
	float		body_ax ;
	float		body_ay ;
	float		body_az ;
	float		body_speed ;
	float		max_speed ;

	float		screw_al ;
	float		screw_al_plus ;
	float		screw_Zx ;
	float		screw_Zy ;
	float		screw_Zz ;
	float		screw_Xx ;
	float		screw_Xy ;
	float		screw_Xz ;

	float		screw_angle_base ;
	float		screw_accel_max ;
	float		screw_accel_min ;
	float		screw_accel_base ;
	float		accel_percent_min ;
	float		accel_percent_max ;
	float		max_accel_speed ;
	float		acal_xmult0 ;
	float		acal_ymult0 ;
	float		acal_xmult1 ;
	float		acal_ymult1 ;

	float		old_gpx ;
	float		old_gpy ;
	float		old_gpz ;

	float		warp_vx ;
	float		warp_vz ;

	float		uturn_accel ;

	float		slide_speed ;

	float		waist_yofs ;
	float		waist_height ;
	Fxyz		waist_ofs ;

	Fxyz		foot_pos ;
	Fxyz		foot_vec ;
	Fxyz		foot_acc ;

	float		buoy_hit_power ;
	float		pole_hit_power ;
	float		hover_hit_power ;
	float		wall_hit_power ;
	float		recpipe_hit_power ;
	float		prism_hit_power ;
	float		crsobj_hit_power ;

	int		anim_no ;
	int		anim_count ;
	int		next_anim_no ;
	int		next_anim_count ;
	ushort		next_anim_keep_fg ;

	ushort		accel_bt ;

	int		handle_mode ;

	int		pause_count ;
	int		onehand_count ;
	int		drop_count ;

	int		sea_contact_points ;
	ushort		sea_contact_hold ;
	ushort		sea_contact_trig ;
	ushort		sea_contact_release ;
	ushort		sea_contact_old ;
	ushort		man_sea_contact_old ;
	ushort		man_sea_contact_now ;

	JetSkiMtx	mtx[3] ;
	int		old_mtx_id ;
	int		now_mtx_id ;
	int		next_mtx_id ;
	float		anim_level ;
	float		anim_level_a ;

	float		ground_Zx ;
	float		ground_Zz ;
	float		ground_Xx ;
	float		ground_Xz ;

	ushort		crash_camera_recover_fg ;
	short		guts_pose_fg ;

	MtxVector	hair[6] ;
	Fxyz		hair_vec[6] ;

	float		gravity_Yslide_mult ;
	float		gravity_Fslide_mult ;
	float		gravity_Bslide_mult ;

	int		hang_count ;
	float		accel_mult ;

	int		board_type ;

	float		sang_limit_speed ;
	float		sang_max_percent ;

	float		screw_angle ;

	float		waist_slide_mult ;
	float		gravity_Xslide_mult ;
	float		gravity_Xslide_mult_base ;

	int		rolling_mode ;

	int		stick_time_left ;
	int		stick_time_right ;
	int		stick_time_up ;
	int		stick_time_down ;

	float		rolling_power ;

	int		guts_count ;

	float		hit_nx ;
	float		hit_ny ;
	float		hit_nz ;

	int		face_panel_mode ;

	float		stickY_gravity ;

	int		dive_count ;

	float		stickX_gravity ;

	float		after_push ;

	float		obj_sea_offset ;

	float		bend_level ;

	short		move_fg ;
	short		jumpdai_fg ;

	float		screw_Zl ;
	float		screw_Xl ;

	float		water_hdamp ;

	float		rolling_dist ;

	int		stick_time_down_aoff ;

	ushort		stick_trig  ;
	ushort		stick_hold  ;
	ushort		stick_Lturn_count ;
	ushort		stick_Rturn_count ;
	ushort		stick_trig_old ;
	ushort		stick_trig_off_count ;
	ushort		stick_X_fg ;

	ushort		hdamp_up_fg ;

	short		acrobat_command ;
	short		acrobat_mode_rq ;
	short		acrobat_mode ;
	short		land_check_fg ;

	ushort		free_fg ;
	ushort		feel_up_fg ;

	BodySphere	sphere[4] ;

	float		free_buoy_power ;
	float		free_pole_power ;
	float		free_wall_power ;
	float		free_prism_power ;
	float		free_recpipe_power ;
	float		free_hover_power ;

	int		stuck_count ;

	float		waist_slide_level ;
	float		waist_elastic_y ;
	float		waist_elastic_z ;

	int		footstretch_mode ;

	int		guts_pose_number ;

	ushort		dolphin_fg ;
	ushort		enemy_fg ;

	int		ground_count ;

	int		rolling_count ;

	int		crsobj_type ;

	int		air_count ;

	ushort		hang_fg ;

	short		rolling_count_fg ;

	int		ending_count ;

	int		dolphin_anim_no ;
	int		dolphin_anim_count ;

	short		head_direction ;
	short		head_direction_old ;


	short		vibration_sw ;

	short		vibration_old ;
} Boat ;


typedef struct {
	int		ghost_course ;
	int		ghost_data_goal_size2 ;
	int		ghost_data_all_size2 ;
	int		ghost_data_goal_time ;
	short		spad ;
	short		ghost_data_BF[GHOST_BF_SIZE2] ;
} GhostData ;


/*******************************************************************************
	VARIABLE
*******************************************************************************/
extern GhostData	ghost ;
extern short		ghost_save_BF[], *ghost_save_pt, *ghost_data_pt ;
extern int		ghost_save_all_size2, ghost_save_goal_size2, ghost_save_goal_time ;
extern int		ghost_data_sw, ghost_disp_sw ;
extern int		ghost_enable_sw ;

extern Gfx		init_hover_GL[], hover_shell_GL[] ;

extern Boat		hover[] ;

extern int		boat_max ;

extern ushort		auto_control_fg ;

extern ushort		vs_boost_fg ;

extern int		push_frequency ;
extern int		push_amplitude ;

extern int		dolphin_fg ;

#if SOUND_SW
extern NA_Playersound_	sound_na_player1 ;
extern NA_Playersound_	sound_na_player2 ;
#endif


/*******************************************************************************
	FUNCTION
*******************************************************************************/
extern void		init_hover( void ) ;
extern void		move_hover( void ) ;
extern Gfx		*make_hover_glist( Gfx *gp ) ;
extern Gfx		*make_hair_glist( Gfx *gp ) ;
extern Gfx		*make_hover_shadow_glist( Gfx *gp ) ;
extern void		trans_hover( Boat *one, float tx, float ty, float tz ) ;
extern void		trans_obj_point( Boat *one, float tx, float ty, float tz ) ;
extern void		init_hover_position( int number, Mtx *mtx, int warp_fg ) ;
extern int		correct_stick( float f ) ;
extern void		ghost_enable( void ) ;
