/******************************************************************************
	ensetcrs.h
******************************************************************************/

#ifndef ENSETCRS_H
#define ENSETCRS_H

#include "endefine.h"

/******************************************************************************
	define constants
******************************************************************************/

enum {
	DT_BUOY_RIGHT = 0,
	DT_BUOY_LEFT,
	DT_BUOY_CHECK,
	DT_BUOY_GOAL,

	DT_BUOY_TURN_R,
	DT_BUOY_TURN_L,

	DT_BUOY_PL_R,
	DT_BUOY_PL_L,
	DT_BUOY_PL_C,

	DT_BUOY_EN_R,
	DT_BUOY_EN_L,
	DT_BUOY_EN_C,
	DT_BUOY_EN_R1,
	DT_BUOY_EN_L1,
	DT_BUOY_EN_C1,
	DT_BUOY_EN_R2,
	DT_BUOY_EN_L2,
	DT_BUOY_EN_C2,
	DT_BUOY_EN_R3,
	DT_BUOY_EN_L3,
	DT_BUOY_EN_C3,
	DT_BUOY_EN_R4,
	DT_BUOY_EN_L4,
	DT_BUOY_EN_C4,

	DT_BUOY_FORK_S,
	DT_BUOY_JOIN,

	DT_BUOY_THR,
	DT_BUOY_THR_C,

	DT_BUOY_WARP,

	DT_BUOY_ST1,
	DT_BUOY_ST2,
	DT_BUOY_ST3,
	DT_BUOY_ST4
};

#define	DT_CRSBUOY_IN	0
#define	DT_CRSBUOY_OUT	1
#define	DT_CRSBUOY_OBS	2
#define	DT_CRSBUOY_OBS2	3
#define	DT_CRSBUOY_XPA	4

enum {
	DT_CRSOBJ_SIGN = 0,
	DT_CRSOBJ_GATE,
	DT_CRSOBJ_MIZUKUSA,
	DT_CRSOBJ_MIZUKUSA2,
	DT_CRSOBJ_HAKO,
	DT_CRSOBJ_MOKUHEN,
	DT_CRSOBJ_BOX,
	DT_CRSOBJ_RING,
	DT_CRSOBJ_DRUM,
	DT_CRSOBJ_ICE,

	DT_CRSOBJ_MAN0,
	DT_CRSOBJ_MAN1,
	DT_CRSOBJ_MAN2,
	DT_CRSOBJ_MAN3,
	DT_CRSOBJ_MAN4,
	DT_CRSOBJ_MAN5,
	DT_CRSOBJ_MAN6,
	DT_CRSOBJ_MAN7,
	DT_CRSOBJ_MAN8,
	DT_CRSOBJ_MAN9,
	DT_CRSOBJ_MAN10,
	DT_CRSOBJ_MAN11
};

/******************************************************************************
 	structures
******************************************************************************/

typedef struct {
	int	xmin, xmax, xsize;
	int	zmin, zmax, zsize;
	int	xblocks, xblocks_s;
	int	zblocks, zblocks_s;
	int	xblock_size, xblock_size_s;
	int	zblock_size, zblock_size_s;
	float	thickness;
	int	block_mode;
} Walldt;

typedef struct {
	int	xmin, zmin;
	int	xmax, zmax;
	int	xsize, zsize;
	int	xblocks, zblocks;
	int	xblocks_s, zblocks_s;
	int	xblock_size, zblock_size;
	int	xblock_size_s, zblock_size_s;
	short	block_mode;
} Prismdt;

typedef struct {
	float	xmin, xmax;
	float	zmin, zmax;
} Crsarea;

/******************************************************************************
	external variables
******************************************************************************/
extern Mtx	mtx_crsobj[CRSOBJ_MAX];

extern Gfx	*pgfx_crs_shape, *pgfx_crs_shapeT;
extern Gfx	*pgfx_crs_shape_nl, *pgfx_crs_shape_nlT;
extern Gfx	*pgfx_crs_shape_an, *pgfx_crs_shape_anT;

extern Gfx	*crs_shape_tbl[];
extern Gfx	*crs_shapeT_tbl[];
extern Gfx	*crs_shape_2p_tbl[];
extern Gfx	*crs_shapeT_2p_tbl[];

/******************************************************************************
	external functions
******************************************************************************/
extern void InitCourse(void);
extern void SetCourse(void);
extern int GetCrsBuoyList(float x, float z, uchar **pplist);
extern int ChkCrsOut(float x, float z);
extern void ChkCrsArea(float x, float z, int *a1, int *a2);
extern int ChkNoArrowArea(float x, float z);

#endif
