#include<ultra64.h>

extern Vtx MC_RailWay_DOWN_v[];

extern unsigned char MC_RailWayTX01_CI8_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 */


/* ======== g7 ======== */

Gfx MC_RailWay_DOWN[]={

	gsDPSetTextureLUT(G_TT_RGBA16),
	gsDPLoadTLUT_pal256(&MC_RailWayTX01_CI8_txt[1024]),
	gsDPLoadTextureBlock(MC_RailWayTX01_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_RailWay_DOWN_v[0], 14, 0),
	gsSP1Triangle(0, 1, 2, 0),
	gsSP1Triangle(3, 4, 5, 0),
	gsSP1Triangle(5, 6, 3, 0),
	gsSP1Triangle(7, 8, 9, 0),
	gsSP1Triangle(10, 11, 12, 0),
	gsSP1Triangle(12, 13, 10, 0),
	gsSPVertex(&MC_RailWay_DOWN_v[14], 14, 0),
	gsSP1Triangle(0, 4, 5, 0),
	gsSP1Triangle(1, 6, 5, 0),
	gsSP1Triangle(2, 7, 8, 0),
	gsSP1Triangle(2, 8, 9, 0),
	gsSP1Triangle(2, 9, 10, 0),
	gsSP1Triangle(3, 11, 12, 0),
	gsSP1Triangle(3, 12, 13, 0),
	gsDPPipeSync(),
        gsDPSetTextureLUT(G_TT_NONE),
	gsSPEndDisplayList(),
}; /* g7 */ 

#undef G_CC_PRIMSHADE

#undef gs_Nin_LoadTextureImage

#undef gs_Nin_SetUpTileDescrip

/* 28 vertices */
Vtx MC_RailWay_DOWN_v[]={
	{ 110,-90,0,0, 1163, 1008, 120,0,0,255 },   /* v0 used p115/V1 2 times */
	{ 110,-90,-1800,0, 911, -5127, 117,25,-1,255 },   /* v1 used p115/V2 2 times */
	{ 110,0,0,0, 911, 1024, 120,11,-1,255 },   /* v2 used p115/V3 2 times */
	{ 110,0,0,0, 894, -1023, 120,11,-1,255 },   /* v3 used p113/V1 2 times */
	{ 110,0,600,0, 894, 1024, 120,0,0,255 },   /* v4 used p113/V2 2 times */
	{ 110,-90,600,0, 1153, 1024, 120,0,0,255 },   /* v5 used p113/V3 2 times */
	{ 110,-90,0,0, 1153, -1023, 120,0,0,255 },   /* v6 used p105/V2 2 times */
	{ -110,0,0,0, 911, 1024, -119,11,-1,255 },   /* v7 used p119/V1 2 times */
	{ -110,-90,-1800,0, 911, -5127, -116,25,-1,255 },   /* v8 used p119/V2 2 times */
	{ -110,-90,0,0, 1163, 1008, -119,0,0,255 },   /* v9 used p119/V3 2 times */
	{ -110,-90,600,0, 1153, 1024, -119,0,0,255 },   /* v10 used p120/V1 4 times */
	{ -110,0,600,0, 894, 1024, -119,0,0,255 },   /* v11 used p120/V2 2 times */
	{ -110,0,0,0, 894, -1023, -119,11,-1,255 },   /* v12 used p120/V3 4 times */
	{ -110,-90,0,0, 1153, -1023, -119,0,0,255 },   /* v13 used p121/V2 2 times */
	{ -94,-60,-1800,0, 1043, -5120, -16,119,-6,255 },   /* v14 used p82/V1 2 times */
	{ -110,-90,-1800,0, 877, -5120, -116,25,-1,255 },   /* v15 used p81/V1 2 times */
	{ -94,30,0,0, 0, 1024, -21,118,-6,255 },   /* v16 used p76/V1 4 times */
	{ 94,30,0,0, 1043, 1024, 52,108,-5,255 },   /* v17 used p78/V1 4 times */
	{ -110,-90,-1800,0, 877, -5120, -116,25,-1,255 },   /* v18 used p82/V2 2 times */
	{ -94,30,0,0, 1043, 1024, -21,118,-6,255 },   /* v19 used p82/V3 4 times */
	{ -110,0,0,0, 877, 1024, -119,11,-1,255 },   /* v20 used p81/V2 2 times */
	{ 0,30,0,0, 512, 1024, 0,120,0,255 },   /* v21 used p76/V2 2 times */
	{ 94,30,0,0, 1024, 1024, 52,108,-5,255 },   /* v22 used p76/V3 2 times */
	{ 94,-60,-1800,0, 1024, -5120, 9,120,-6,255 },   /* v23 used p76/V4 4 times */
	{ -94,-60,-1800,0, 0, -5120, -16,119,-6,255 },   /* v24 used p75/V3 2 times */
	{ 110,0,0,0, 877, 1024, 120,11,-1,255 },   /* v25 used p78/V2 2 times */
	{ 110,-90,-1800,0, 877, -5120, 117,25,-1,255 },   /* v26 used p78/V3 4 times */
	{ 94,-60,-1800,0, 1043, -5120, 9,120,-6,255 },   /* v27 used p77/V3 2 times */
};


/*   0 vertices */
/*   1 Materials */

#define	LDIRX	0
#define	LDIRY	0
#define	LDIRZ	120
#define	AMBDIV	1
