#include<ultra64.h>

extern Vtx MAP_ex04_v[];

extern unsigned char MAP_ex04_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 */


/* ======== g1 ======== */

Gfx MAP_ex04[]={

	gsDPLoadTLUT_pal256(&MAP_ex04_CI8_txt[256]),
	gsDPLoadTextureBlock(MAP_ex04_CI8_txt,G_IM_FMT_CI,G_IM_SIZ_8b,16,16,0,G_TX_CLAMP,G_TX_CLAMP,4,4,0,0),
	gsDPSetTextureLUT(G_TT_RGBA16),

	gsSPVertex(&MAP_ex04_v[0],3,0),
	gsSP1Triangle(0, 1, 2, 0),
	gsDPPipeSync(),
        gsDPSetTextureLUT(G_TT_NONE),
	gsSPEndDisplayList(),
}; /* g1 */ 

#undef G_CC_PRIMSHADE

#undef gs_Nin_LoadTextureImage

#undef gs_Nin_SetUpTileDescrip

/* 3 vertices */
Vtx MAP_ex04_v[]={
	{   -40,   -20,     0,     0,  -256,   512,     0,     0,   119,   255},	/* 0 */
	{    40,   -20,     0,     0,   768,   512,     0,     0,   119,   255},	/* 1 */
	{     0,    40,     0,     0,   256,  -256,     0,     0,   119,   255},	/* 2 */
};


/*   0 vertices */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