#ifndef	__COMMON_H__
#define	__COMMON_H__

#define	RGBA2COL( _r, _g, _b, _a )	( ( ((unsigned int)(_a)) <<24) | ( ((unsigned int)(_r))<<16) | ( ((unsigned int)(_g))<<8) | ((unsigned int)(_b)) )

#define	LOCAL_MATRIX_ALIGN	8
#define	ALLOC_LOCAL_MATRIX_SPACE(_num_)		Float	_LocalMatrixSpace[16 * (_num_) + LOCAL_MATRIX_ALIGN/4 - 1]
#define	ALIGNED_LOCAL_MATRIX_SPACE	( (Float *)( ( ((unsigned int)&_LocalMatrixSpace) + (LOCAL_MATRIX_ALIGN-1) ) &\
											     (~(LOCAL_MATRIX_ALIGN-1)) ) )
#define	GET_LOCAL_MATRIX_PTR(_idx_)	(ALIGNED_LOCAL_MATRIX_SPACE + 16*(_idx_) )


extern NJS_MATRIX		*pTmpMat;

#define	CHARA_OBJECT	object_zou02_model_model
#define	CHARA_TEXLIST	texlist_zou02_model
#define	CHARA_MOTION	motion_zou02_model
extern	NJS_CNK_OBJECT	CHARA_OBJECT[];
extern	NJS_TEXLIST		CHARA_TEXLIST[];
extern	NJS_MOTION		CHARA_MOTION[];

#define	UFOMAN_ID		16
#define	UFOMAN_OBJECT	object_ufo_man_world_1_1_1_world_1_1_1
#define	UFOMAN_TEXLIST	texlist_ufo_man_world_1_1_1
#define	UFOMAN_MOTION	motion_ufo_man_world_1_1_1
#define	UFOMAN_SHAPE	cshape_motion_ufo_man_world_1_1_1
#define	UFOMAN_CAMERA	shape06a_cam_int1
#define	UFOMAN_CAMOTION	motion_shape06a_cam_int1
#define	UFOMAN_SHAPELIST cshapelist_ufo_man_world_1_1_1

extern	NJS_CNK_OBJECT	UFOMAN_OBJECT[];
extern	NJS_TEXLIST		UFOMAN_TEXLIST[];
extern	NJS_MOTION		UFOMAN_MOTION[];
extern	NJS_MOTION		UFOMAN_SHAPE[];
extern	NJS_CAMERA		UFOMAN_CAMERA[];
extern	NJS_MOTION		UFOMAN_CAMOTION[];
extern	NJS_CSHAPELIST	UFOMAN_SHAPELIST[];


//#define	GRID100_MODEL	model_grid2_grid2
//extern	NJS_CNK_MODEL	GRID100_MODEL[];


#define	CHARA_POS_X		(0.0f)
#define	CHARA_POS_Y		(-27.4f)
#define	CHARA_POS_Z		(-50.0f)



enum {
	STATE_ATTACH	= 0,
	STATE_DETACH,
	STATE_RUN
};

int		MakeMotionCameraMatrix( const NJS_CNK_OBJECT *obj, const NJS_MOTION *motion, Float frame, int ObjID );


void	DrawPlane( NJS_POINT3 *pStartPos, Uint32 color1, Uint32 color2 );
void	DrawLine( float x1, float y1, float z1, float x2, float y2, float z2, Uint32 color );
void	DrawWorldAxis( void );


void	ManualDemo( int State );
void	WalkDemo( int State );
void	UFOManDemo( int State );
void	UFOManDemo2( int State );



#endif	/*__COMMON_H__*/
