#include<ultra64.h>

extern Vtx MC_Gate_v[];

extern unsigned short MC_Gake_txt[];
extern unsigned char MC_PointTX01_CI8_txt[];
extern unsigned short MC_TX02_txt[];



#define gs_Nin_LoadTextureImage(timg,fmt,siz,width,height,tmem,tt)	\
	gsDPSetTextureImage(fmt,siz,1,timg),	\
	gsDPTileSync(),	\
	gsDPSetTile(fmt,siz,0,tmem,tt,0,0,0,0,0,0,0),	\
	gsDPLoadSync(),	\
	gsDPLoadBlock(tt,0,0,width*height-1,CALC_DXT(width,siz##_BYTES))

#define gs_Nin_SetUpTileDescrip(fmt,siz,width,height,tmem,tt,cs,ms,ss,ct,mt,st)	\
	gsDPTileSync(),	\
	gsDPSetTile(fmt,siz,((((width)*siz##_LINE_BYTES)+7)>>3),tmem,tt,0,ct,mt,st,cs,ms,ss),	\
	gsDPSetTileSize(tt,0,0,(width-1)<<G_TEXTURE_IMAGE_FRAC,(height-1)<<G_TEXTURE_IMAGE_FRAC)

#define G_CC_PRIMSHADE PRIMITIVE,0,SHADE,0,0,0,0,SHADE

/* main display list */


/* ======== o2 ======== */

Gfx MC_Gate[]={

	gs_Nin_SetUpTileDescrip(G_IM_FMT_RGBA,G_IM_SIZ_16b,32,64,0,0,G_TX_WRAP,5,0,G_TX_WRAP,6,0),
	gs_Nin_LoadTextureImage(MC_Gake_txt,G_IM_FMT_RGBA,G_IM_SIZ_16b,32,64,0,7),


	gsSPVertex(&MC_Gate_v[0],8,0),
	gsSP1Quadrangle(0, 1, 2, 3, 0),
	gsSP1Quadrangle(4, 5, 6, 7, 0),
	gs_Nin_SetUpTileDescrip(G_IM_FMT_RGBA,G_IM_SIZ_16b,32,32,0,0,G_TX_WRAP,5,0,G_TX_WRAP,5,0),
	gs_Nin_LoadTextureImage(MC_TX02_txt,G_IM_FMT_RGBA,G_IM_SIZ_16b,32,32,0,7),


	gsSPVertex(&MC_Gate_v[8],20,0),
	gsSP1Quadrangle(0, 1, 2, 3, 0),
	gsSP1Quadrangle(4, 5, 6, 7, 0),
	gsSP1Quadrangle(8, 9, 10, 11, 0),
	gsSP1Quadrangle(12, 13, 14, 15, 0),
	gsSP1Quadrangle(16, 17, 18, 19, 0),
	gsDPLoadTLUT_pal256(&MC_PointTX01_CI8_txt[256]),
	gsDPLoadTextureBlock(MC_PointTX01_CI8_txt,G_IM_FMT_CI,G_IM_SIZ_8b,16,16,0,G_TX_WRAP,G_TX_WRAP,4,4,0,0),
	gsDPSetTextureLUT(G_TT_RGBA16),

	gsSPVertex(&MC_Gate_v[28],18,0),
	gsSP1Quadrangle(0, 1, 2, 3, 0),
	gsSP1Triangle(4, 1, 0, 0),
	gsSP1Quadrangle(5, 6, 7, 8, 0),
	gsSP1Quadrangle(9, 10, 11, 12, 0),
	gsSP1Quadrangle(13, 14, 15, 16, 0),
	gsSP1Triangle(13, 16, 17, 0),
	gsDPPipeSync(),
        gsDPSetTextureLUT(G_TT_NONE),
	gsSPEndDisplayList(),
}; /* o2 */ 

#undef G_CC_PRIMSHADE

#undef gs_Nin_LoadTextureImage

#undef gs_Nin_SetUpTileDescrip

/* 46 vertices */
Vtx MC_Gate_v[]={
	{  -160,     0,  -170,     0,  1976,  2048,   120,     0,     0,   255},	/* 0 */
	{  -160,   220,  -170,     0,  1988,  1024,   120,     0,     0,   255},	/* 1 */
	{  -160,   220,   170,     0,    83,  1024,   120,     0,     0,   255},	/* 2 */
	{  -160,     0,   170,     0,    71,  2048,   120,     0,     0,   255},	/* 3 */
	{   160,     0,   170,     0,    71,  2048,  -119,     0,     0,   255},	/* 4 */
	{   160,   220,   170,     0,    83,  1024,  -119,     0,     0,   255},	/* 5 */
	{   160,   220,  -170,     0,  1988,  1024,  -119,     0,     0,   255},	/* 6 */
	{   160,     0,  -170,     0,  1976,  2048,  -119,     0,     0,   255},	/* 7 */
	{   240,   380,   170,     0,   -95,    72,   118,    21,     0,   255},	/* 8 */
	{   240,     0,   170,     0,  -106,   764,   120,     0,     0,   255},	/* 9 */
	{   240,     0,  -170,     0,  1154,   764,   120,     0,     0,   255},	/* 10 */
	{   240,   380,  -170,     0,  1164,    72,   118,    21,     0,   255},	/* 11 */
	{  -160,   220,   170,     0,   120,   990,     0,     0,   119,   255},	/* 12 */
	{   160,   220,   170,     0,  1927,   990,     0,     0,   119,   255},	/* 13 */
	{   160,   440,   170,     0,  1927,     0,     0,     0,   119,   255},	/* 14 */
	{  -160,   440,   170,     0,   120,     0,     0,     0,   119,   255},	/* 15 */
	{  -160,   440,   170,     0,   105,  1024,   -17,   119,     0,   255},	/* 16 */
	{   160,   440,   170,     0,   892,  1024,    18,   119,     0,   255},	/* 17 */
	{   160,   440,  -170,     0,   892,   -99,    18,   119,     0,   255},	/* 18 */
	{  -160,   440,  -170,     0,   105,   -99,   -17,   119,     0,   255},	/* 19 */
	{  -240,   380,  -170,     0,  1164,    72,  -117,    21,     0,   255},	/* 20 */
	{  -240,     0,  -170,     0,  1154,   764,  -119,     0,     0,   255},	/* 21 */
	{  -240,     0,   170,     0,  -106,   764,  -119,     0,     0,   255},	/* 22 */
	{  -240,   380,   170,     0,   -95,    72,  -117,    21,     0,   255},	/* 23 */
	{  -160,   220,   170,     0,   105,   -56,     0,  -119,     0,   255},	/* 24 */
	{  -160,   220,  -170,     0,   105,  1032,     0,  -119,     0,   255},	/* 25 */
	{   160,   220,  -170,     0,   892,  1032,     0,  -119,     0,   255},	/* 26 */
	{   160,   220,   170,     0,   892,   -56,     0,  -119,     0,   255},	/* 27 */
	{  -160,   220,   170,     0,   419,  -395,     0,     0,   119,   255},	/* 28 */
	{  -240,   380,   170,     0,    79, -1026,     0,     0,   119,   255},	/* 29 */
	{  -240,     0,   170,     0,    76,   469,     0,     0,   119,   255},	/* 30 */
	{  -160,     0,   170,     0,   418,   470,     0,     0,   119,   255},	/* 31 */
	{  -160,   440,   170,     0,   420, -1262,     0,     0,   119,   255},	/* 32 */
	{  -160,   440,  -170,     0,   412,  -925,   -17,   119,     0,   255},	/* 33 */
	{  -240,   380,  -170,     0,    82,  -925,  -117,    21,     0,   255},	/* 34 */
	{  -240,   380,   170,     0,    82,   413,  -117,    21,     0,   255},	/* 35 */
	{  -160,   440,   170,     0,   412,   413,   -17,   119,     0,   255},	/* 36 */
	{   160,   440,   170,     0,    85,   393,    18,   119,     0,   255},	/* 37 */
	{   240,   380,   170,     0,   426,   393,   118,    21,     0,   255},	/* 38 */
	{   240,   380,  -170,     0,   426,  -945,   118,    21,     0,   255},	/* 39 */
	{   160,   440,  -170,     0,    85,  -945,    18,   119,     0,   255},	/* 40 */
	{   160,   220,   170,     0,    95,  -393,     0,     0,   119,   255},	/* 41 */
	{   160,     0,   170,     0,    94,   472,     0,     0,   119,   255},	/* 42 */
	{   240,     0,   170,     0,   422,   472,     0,     0,   119,   255},	/* 43 */
	{   240,   380,   170,     0,   424, -1023,     0,     0,   119,   255},	/* 44 */
	{   160,   440,   170,     0,    96, -1260,     0,     0,   119,   255},	/* 45 */
};


/*   0 vertices */
/*   1 Materials */

#define	LDIRX	0
#define	LDIRY	0
#define	LDIRZ	120
#define	AMBDIV	1
