#include<ultra64.h>

extern Vtx MC_RailWay_UP_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_UP[]={

	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_UP_v[0], 14, 0),
	gsSP1Triangle(0, 1, 2, 0),
	gsSP1Triangle(1, 3, 2, 0),
	gsSP1Triangle(4, 5, 6, 0),
	gsSP1Triangle(7, 8, 9, 0),
	gsSP1Triangle(10, 11, 12, 0),
	gsSP1Triangle(10, 13, 11, 0),
	gsSPVertex(&MC_RailWay_UP_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_UP_v[]={
	{ 110,0,-1800,0, 1156, 1019, 120,0,0,255 },   /* v0 used p93/V1 2 times */
	{ 110,0,-2400,0, 1155, -1028, 120,0,0,255 },   /* v1 used p93/V2 2 times */
	{ 110,90,-1800,0, 892, 1019, 119,18,0,255 },   /* v2 used p93/V3 2 times */
	{ 110,90,-2400,0, 892, -1028, 120,0,0,255 },   /* v3 used p94/V2 2 times */
	{ 110,0,0,0, 893, 1024, 119,16,0,255 },   /* v4 used p90/V1 2 times */
	{ 110,0,-1800,0, 1186, -5112, 120,0,0,255 },   /* v5 used p90/V2 2 times */
	{ 110,90,-1800,0, 893, -5127, 119,18,0,255 },   /* v6 used p90/V3 2 times */
	{ -110,90,-1800,0, 893, -5127, -118,18,0,255 },   /* v7 used p99/V1 2 times */
	{ -110,0,-1800,0, 1186, -5112, -119,0,0,255 },   /* v8 used p99/V2 2 times */
	{ -110,0,0,0, 893, 1024, -118,16,0,255 },   /* v9 used p99/V3 2 times */
	{ -110,90,-1800,0, 892, 1019, -118,18,0,255 },   /* v10 used p103/V1 4 times */
	{ -110,0,-2400,0, 1155, -1028, -119,0,0,255 },   /* v11 used p103/V2 4 times */
	{ -110,0,-1800,0, 1156, 1019, -119,0,0,255 },   /* v12 used p103/V3 2 times */
	{ -110,90,-2400,0, 892, -1028, -119,0,0,255 },   /* v13 used p104/V2 2 times */
	{ -94,120,-1800,0, 1043, -5120, -16,119,5,255 },   /* v14 used p82/V1 2 times */
	{ -110,90,-1800,0, 877, -5120, -118,18,0,255 },   /* v15 used p81/V1 2 times */
	{ -94,30,0,0, 0, 1024, -21,118,5,255 },   /* v16 used p76/V1 4 times */
	{ 94,30,0,0, 1043, 1024, 52,108,4,255 },   /* v17 used p78/V1 4 times */
	{ -110,90,-1800,0, 877, -5120, -118,18,0,255 },   /* v18 used p82/V2 2 times */
	{ -94,30,0,0, 1043, 1024, -21,118,5,255 },   /* v19 used p82/V3 4 times */
	{ -110,0,0,0, 877, 1024, -118,16,0,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,4,255 },   /* v22 used p76/V3 2 times */
	{ 94,120,-1800,0, 1024, -5120, 9,120,5,255 },   /* v23 used p76/V4 4 times */
	{ -94,120,-1800,0, 0, -5120, -16,119,5,255 },   /* v24 used p75/V3 2 times */
	{ 110,0,0,0, 877, 1024, 119,16,0,255 },   /* v25 used p78/V2 2 times */
	{ 110,90,-1800,0, 877, -5120, 119,18,0,255 },   /* v26 used p78/V3 4 times */
	{ 94,120,-1800,0, 1043, -5120, 9,120,5,255 },   /* v27 used p77/V3 2 times */
};


/*   0 vertices */
/*   1 Materials */

#define	LDIRX	0
#define	LDIRY	0
#define	LDIRZ	120
#define	AMBDIV	1
