#include<ultra64.h>

extern Vtx MC_SigSwitch_BoxL_v[];
extern Lights1 MC_SigSwitch_BoxL_material[];

extern unsigned char MC_GimicTX02_CI8_txt[];
extern unsigned short MC_InnerTEX01_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

Gfx MC_SigSwitch_BoxL[]={

	gsDPSetTextureLUT(G_TT_RGBA16),
	gsDPLoadTLUT_pal256(&MC_GimicTX02_CI8_txt[1024]),
	gsDPLoadTextureBlock(MC_GimicTX02_CI8_txt,G_IM_FMT_CI,G_IM_SIZ_8b,32,32,0,G_TX_WRAP,G_TX_WRAP,5,5,0,0),

	gsSPVertex(&MC_SigSwitch_BoxL_v[0], 16, 0),
	gsSP1Triangle(0, 1, 2, 0),
	gsSP1Triangle(3, 0, 2, 0),
	gsSP1Triangle(4, 5, 6, 0),
	gsSP1Triangle(5, 7, 6, 0),
	gsSP1Triangle(8, 9, 10, 0),
	gsSP1Triangle(9, 11, 10, 0),
	gsSP1Triangle(12, 13, 14, 0),
	gsSP1Triangle(13, 15, 14, 0),
	gsDPSetTextureLUT(G_TT_NONE),
	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_InnerTEX01_txt,G_IM_FMT_RGBA,G_IM_SIZ_16b,32,32,0,7),

	gsSPVertex(&MC_SigSwitch_BoxL_v[16], 4, 0),
	gsSP1Triangle(0, 1, 2, 0),
	gsSP1Triangle(3, 0, 2, 0),
	gsSPEndDisplayList(),
};

#undef G_CC_PRIMSHADE

#undef gs_Nin_LoadTextureImage

#undef gs_Nin_SetUpTileDescrip

/* 20 vertices */
Vtx MC_SigSwitch_BoxL_v[]={
	{ 60,-60,90,0, 1170, -93, 0,-119,0,255 },   /* v0 used p215/V1 4 times */
	{ -60,-60,90,0, 1170, 1023, -84,-84,0,255 },   /* v1 used p215/V2 2 times */
	{ -60,-60,-90,0, -146, 1024, 0,-119,0,255 },   /* v2 used p215/V3 4 times */
	{ 60,-60,-90,0, -146, -93, 0,-119,0,255 },   /* v3 used p214/V1 2 times */
	{ -60,-60,-90,0, 1170, 1126, -119,0,0,255 },   /* v4 used p220/V1 2 times */
	{ -60,-60,90,0, -146, 1126, -84,-84,0,255 },   /* v5 used p221/V1 4 times */
	{ -60,60,-90,0, 1170, -102, -119,0,0,255 },   /* v6 used p221/V3 4 times */
	{ -60,60,90,0, -146, -102, -119,0,0,255 },   /* v7 used p221/V2 2 times */
	{ -60,60,-90,0, -146, -102, 0,120,0,255 },   /* v8 used p216/V1 2 times */
	{ -60,60,90,0, 1170, -102, 0,120,0,255 },   /* v9 used p216/V2 2 times */
	{ 60,60,-90,0, -146, 1126, 0,120,0,255 },   /* v10 used p216/V3 2 times */
	{ 60,60,90,0, 1170, 1126, 0,120,0,255 },   /* v11 used p217/V2 2 times */
	{ 60,-60,90,0, 1170, 1126, 120,0,0,255 },   /* v12 used p218/V1 2 times */
	{ 60,-60,-90,0, -146, 1126, 120,0,0,255 },   /* v13 used p219/V1 4 times */
	{ 60,60,90,0, 1170, -102, 120,0,0,255 },   /* v14 used p219/V3 4 times */
	{ 60,60,-90,0, -146, -102, 120,0,0,255 },   /* v15 used p219/V2 2 times */
	{ 60,-60,90,0, 0, 1024, 0,0,119,255 },   /* v16 used p212/V1 2 times */
	{ 60,60,90,0, 0, -1023, 0,0,119,255 },   /* v17 used p212/V2 2 times */
	{ -60,60,90,0, 2048, -1023, 0,0,119,255 },   /* v18 used p212/V3 2 times */
	{ -60,-60,90,0, 2048, 1023, -99,0,66,255 },   /* v19 used p213/V1 2 times */
};


/*   0 vertices */
/*   1 Materials */

#define	LDIRX	0
#define	LDIRY	0
#define	LDIRZ	120
#define	AMBDIV	1
