#include<ultra64.h>

extern Vtx ZO_border_v[];
extern Vtx ZO_border_vmcur[];
extern Tri ZO_border_tri[];
extern Mtx ZO_border_matrix[];

extern unsigned short ZO_border_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 */


/* ======== DXFdata ======== */

Gfx ZO_border[]={

	gs_Nin_SetUpTileDescrip(G_IM_FMT_RGBA,G_IM_SIZ_16b,16,16,0,0,G_TX_CLAMP,4,0,G_TX_CLAMP,4,0),
	gs_Nin_LoadTextureImage(ZO_border_TX02_txt,G_IM_FMT_RGBA,G_IM_SIZ_16b,16,16,0,7),

	gsSPVertex(&ZO_border_v[0], 15, 0),
	gsSP1Triangle(0, 1, 2, 0),
	gsSP1Triangle(3, 4, 5, 0),
	gsSP1Triangle(6, 7, 8, 0),
	gsSP1Triangle(9, 10, 11, 0),
	gsSP1Triangle(12, 13, 14, 0),
	gsSPVertex(&ZO_border_v[15], 5, 0),
	gsSPVertex(&ZO_border_v[22], 10, 5),
	gsSP1Triangle(0, 5, 6, 0),
	gsSP1Triangle(1, 7, 8, 0),
	gsSP1Triangle(2, 9, 10, 0),
	gsSP1Triangle(3, 11, 12, 0),
	gsSP1Triangle(4, 13, 14, 0),
	gsSPVertex(&ZO_border_v[20], 2, 0),
	gsSPVertex(&ZO_border_v[32], 4, 2),
	gsSP1Triangle(0, 2, 3, 0),
	gsSP1Triangle(1, 4, 5, 0),
	gsSPEndDisplayList(),
}; /* DXFdata */ 

#undef G_CC_PRIMSHADE

#undef gs_Nin_LoadTextureImage

#undef gs_Nin_SetUpTileDescrip

/* 36 vertices */
Vtx ZO_border_v[]={
	{ -14,40,-14,0, 256, -302, -59,85,-60,255 },   /* v0 used p21/V1 1 times */
	{ -16,20,-39,0, -209, 512, -59,85,-60,255 },   /* v1 used p21/V2 1 times */
	{ -39,20,-16,0, 721, 512, -59,85,-60,255 },   /* v2 used p21/V3 1 times */
	{ 39,-20,16,0, 721, 512, 60,-84,59,255 },   /* v3 used p23/V1 1 times */
	{ 16,-20,39,0, -209, 512, 60,-84,59,255 },   /* v4 used p23/V2 1 times */
	{ 14,-40,14,0, 256, -302, 60,-84,59,255 },   /* v5 used p23/V3 1 times */
	{ -16,-20,39,0, 721, 512, -59,-84,59,255 },   /* v6 used p24/V1 1 times */
	{ -39,-20,16,0, -209, 512, -59,-84,59,255 },   /* v7 used p24/V2 1 times */
	{ -14,-40,14,0, 256, -302, -59,-84,59,255 },   /* v8 used p24/V3 1 times */
	{ -39,-20,-16,0, 721, 512, -59,-84,-60,255 },   /* v9 used p25/V1 1 times */
	{ -16,-20,-39,0, -209, 512, -59,-84,-60,255 },   /* v10 used p25/V2 1 times */
	{ -14,-40,-14,0, 256, -302, -59,-84,-60,255 },   /* v11 used p25/V3 1 times */
	{ 16,-20,-39,0, 721, 512, 60,-84,-60,255 },   /* v12 used p26/V1 1 times */
	{ 39,-20,-16,0, -209, 512, 60,-84,-60,255 },   /* v13 used p26/V2 1 times */
	{ 14,-40,-14,0, 256, -302, 60,-84,-60,255 },   /* v14 used p26/V3 1 times */
	{ 14,40,-14,0, 256, -302, 60,85,-60,255 },   /* v15 used p19/V1 1 times */
	{ 0,23,42,0, 256, -302, 0,0,119,255 },   /* v16 used p5/V1 1 times */
	{ 42,23,0,0, 256, -302, 120,0,0,255 },   /* v17 used p14/V1 1 times */
	{ 0,23,-42,0, 256, -302, 0,0,-120,255 },   /* v18 used p15/V1 1 times */
	{ -42,23,0,0, 256, -302, -119,0,0,255 },   /* v19 used p16/V1 1 times */
	{ -14,40,14,0, 256, -302, -59,85,59,255 },   /* v20 used p17/V1 1 times */
	{ 14,40,14,0, 256, -302, 60,85,59,255 },   /* v21 used p18/V1 1 times */
	{ 39,20,-16,0, -209, 512, 60,85,-60,255 },   /* v22 used p19/V2 1 times */
	{ 16,20,-39,0, 721, 512, 60,85,-60,255 },   /* v23 used p19/V3 1 times */
	{ -16,-5,42,0, -209, 512, 0,0,119,255 },   /* v24 used p5/V2 1 times */
	{ 16,-5,42,0, 721, 512, 0,0,119,255 },   /* v25 used p5/V3 1 times */
	{ 42,-5,16,0, -209, 512, 120,0,0,255 },   /* v26 used p14/V2 1 times */
	{ 42,-5,-16,0, 721, 512, 120,0,0,255 },   /* v27 used p14/V3 1 times */
	{ 16,-5,-42,0, -209, 512, 0,0,-120,255 },   /* v28 used p15/V2 1 times */
	{ -16,-5,-42,0, 721, 512, 0,0,-120,255 },   /* v29 used p15/V3 1 times */
	{ -42,-5,-16,0, -209, 512, -119,0,0,255 },   /* v30 used p16/V2 1 times */
	{ -42,-5,16,0, 721, 512, -119,0,0,255 },   /* v31 used p16/V3 1 times */
	{ -39,20,16,0, -209, 512, -59,85,59,255 },   /* v32 used p17/V2 1 times */
	{ -16,20,39,0, 721, 512, -59,85,59,255 },   /* v33 used p17/V3 1 times */
	{ 16,20,39,0, -209, 512, 60,85,59,255 },   /* v34 used p18/V2 1 times */
	{ 39,20,16,0, 721, 512, 60,85,59,255 },   /* v35 used p18/V3 1 times */
};


/*   0 vertices */
/*   1 Materials */

#define	LDIRX	0
#define	LDIRY	0
#define	LDIRZ	120
#define	AMBDIV	1
/* 16 x 16  G_IM_SIZ_16b G_IM_FMT_RGBA  */
unsigned short ZO_border_TX02_txt[] = {
	0x9a4, 0x9a4, 0x9a4, 0x9a4, 0x9a4, 0x9a4, 0x9a4, 0x9a4, 0x9a4, 0x9a4, 0x9a4, 0x9a4, 0x9a4, 0x9a4, 0x9a4, 0x9a4, 
	0x9a4, 0x9a4, 0x9a4, 0x9a4, 0x9a4, 0x3aab, 0x42ed, 0x4b31, 0x4331, 0x3af1, 0x3aad, 0x9a4, 0x9a4, 0x9a4, 0x9a4, 0x9a4, 
	0x9a4, 0x9a4, 0x9a4, 0x9a4, 0x332f, 0x3aed, 0x42ef, 0x4373, 0x4335, 0x3af1, 0x32ef, 0x32ad, 0x9a4, 0x9a4, 0x9a4, 0x9a4, 
	0x9a4, 0x9a4, 0x9a4, 0x2b2f, 0x3371, 0x3bb3, 0x3bb5, 0x3bf7, 0x3bb7, 0x3b75, 0x3331, 0x32ef, 0x2aaf, 0x9a4, 0x9a4, 0x9a4, 
	0x9a4, 0x9a4, 0x33f3, 0x3c77, 0x3c79, 0x3cfb, 0x3d3d, 0x3d3d, 0x3cbd, 0x343b, 0x33b7, 0x3331, 0x32af, 0x2aad, 0x9a4, 0x9a4, 
	0x9a4, 0x5535, 0x457b, 0x45bf, 0x45ff, 0x4e7f, 0x4e7f, 0x467f, 0x3e3f, 0x357f, 0x347d, 0x3bb5, 0x3b31, 0x3aad, 0x3aab, 0x9a4, 
	0x9a4, 0x55fd, 0x4ebf, 0x5f3f, 0x67bf, 0x67ff, 0x67ff, 0x57ff, 0x477f, 0x36bf, 0x357f, 0x3c3b, 0x43b5, 0x3b31, 0x3aad, 0x9a4, 
	0x9a4, 0x6ebf, 0x6fff, 0x77ff, 0x87ff, 0x8fff, 0x87ff, 0x77ff, 0x57ff, 0x3f7f, 0x36bf, 0x3cff, 0x43f7, 0x4333, 0x42ef, 0x9a4, 
	0x9a4, 0x76ff, 0x77ff, 0x8fff, 0xafff, 0xc7ff, 0xafff, 0x97ff, 0x67ff, 0x4fff, 0x3f3f, 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