#include<ultra64.h>

extern Vtx SN_gannseki_v[];

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


/* ======== g2 ======== */

Gfx SN_gannseki[]={

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

	gsSPVertex(&SN_gannseki_v[0], 16, 0),
	gsSP1Triangle(0, 1, 2, 0),
	gsSP1Triangle(0, 3, 4, 0),
	gsSP1Triangle(0, 5, 3, 0),
	gsSP1Triangle(6, 5, 0, 0),
	gsSP1Triangle(1, 0, 4, 0),
	gsSP1Triangle(7, 8, 3, 0),
	gsSP1Triangle(3, 9, 4, 0),
	gsSP1Triangle(7, 3, 5, 0),
	gsSP1Triangle(8, 9, 3, 0),
	gsSP1Triangle(4, 10, 11, 0),
	gsSP1Triangle(11, 1, 4, 0),
	gsSP1Triangle(10, 4, 9, 0),
	gsSP1Triangle(1, 11, 12, 0),
	gsSP1Triangle(12, 2, 1, 0),
	gsSP1Triangle(9, 8, 10, 0),
	gsSP1Triangle(13, 8, 14, 0),
	gsSP1Triangle(8, 13, 15, 0),
	gsSP1Triangle(8, 7, 14, 0),
	gsSP1Triangle(10, 8, 15, 0),
	gsSP1Triangle(2, 7, 5, 0),
	gsSPVertex(&SN_gannseki_v[6], 2, 0),
	gsSPVertex(&SN_gannseki_v[10], 1, 2),
	gsSPVertex(&SN_gannseki_v[12], 2, 3),
	gsSPVertex(&SN_gannseki_v[16], 8, 5),
	gsSP1Triangle(5, 2, 9, 0),
	gsSP1Triangle(3, 6, 10, 0),
	gsSP1Triangle(7, 6, 3, 0),
	gsSP1Triangle(6, 4, 11, 0),
	gsSP1Triangle(4, 6, 12, 0),
	gsSP1Triangle(0, 6, 8, 0),
	gsSP1Triangle(6, 5, 9, 0),
	gsSP1Triangle(1, 0, 8, 0),
	gsDPPipeSync(),
        gsDPSetTextureLUT(G_TT_NONE),
	gsSPEndDisplayList(),
}; /* g2 */ 

#undef G_CC_PRIMSHADE

#undef gs_Nin_LoadTextureImage

#undef gs_Nin_SetUpTileDescrip

/* 24 vertices */
Vtx SN_gannseki_v[]={
	{ 0,80,40,0, 0, 256, -46,103,38,255 },   /* v0 used p701/V1 5 times */
	{ -80,40,0,0, -512, 512, -94,73,-6,255 },   /* v1 used p700/V2 5 times */
	{ -60,-20,80,0, -384, 0, -49,-17,106,255 },   /* v2 used p684/V2 3 times */
	{ 80,80,40,0, 512, 256, 77,83,39,255 },   /* v3 used p701/V2 6 times */
	{ 20,80,-40,0, 128, 768, -12,93,-75,255 },   /* v4 used p701/V3 6 times */
	{ 40,80,60,0, 256, 128, 0,45,110,255 },   /* v5 used p702/V2 4 times */
	{ -60,-20,80,0, -384, 0, -49,-17,106,255 },   /* v6 used p704/V1 3 times */
	{ 60,-20,80,0, 384, 0, 48,6,109,255 },   /* v7 used p706/V1 5 times */
	{ 120,0,0,0, 768, 512, 120,10,0,255 },   /* v8 used p699/V2 7 times */
	{ 80,60,-20,0, 512, 640, 77,64,-66,255 },   /* v9 used p699/V1 8 times */
	{ 60,-20,-80,0, 384, 1024, 44,24,-109,255 },   /* v10 used p699/V3 5 times */
	{ -60,-20,-80,0, -384, 1024, -48,-16,-108,255 },   /* v11 used p700/V1 3 times */
	{ -100,-60,0,0, -640, 512, -106,-53,0,255 },   /* v12 used p697/V3 4 times */
	{ 100,-100,0,0, 640, 512, 85,-84,0,255 },   /* v13 used p696/V1 4 times */
	{ 80,-80,56,0, 512, 153, 34,-67,92,255 },   /* v14 used p687/V3 4 times */
	{ 80,-80,-56,0, 512, 870, 34,-67,-93,255 },   /* v15 used p694/V3 2 times */
	{ -60,-20,-80,0, -384, 1024, -48,-16,-108,255 },   /* v16 used p692/V1 2 times */
	{ 0,-120,0,0, 0, 512, -29,-115,0,255 },   /* v17 used p696/V2 6 times */
	{ -60,-20,-80,0, -384, 1024, -48,-16,-108,255 },   /* v18 used p695/V1 2 times */
	{ 80,-80,56,0, 512, 153, 34,-67,92,255 },   /* v19 used p690/V3 2 times */
	{ 80,-80,-56,0, 512, 870, 34,-67,-93,255 },   /* v20 used p692/V3 2 times */
	{ -60,-20,80,0, -384, 0, -49,-17,106,255 },   /* v21 used p686/V3 2 times */
	{ 80,-80,56,0, 512, 153, 34,-67,92,255 },   /* v22 used p685/V3 2 times */
	{ 80,-80,-56,0, 512, 870, 34,-67,-93,255 },   /* v23 used p696/V3 2 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 char SN_ganseki_CI8_txt[] = {
	0x0, 0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8, 0x9, 0xa, 0xb, 0xb, 0xc, 0xc, 0xc, 
	0xd, 0xe, 0xc, 0xf, 0x6, 0x7, 0x7, 0x7, 0x6, 0x9, 0xa, 0x10, 0xb, 0xc, 0xc, 0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x31, 0x3c, 
	0x31, 0x3c, 0x2f, 0x3d, 0x3e, 0x3, 0x1f, 0x8, 0xf, 0x16, 0x16, 0x17, 0x1a, 0x4, 0x1, 0x3c, 
	0x3c, 0x3c, 0x3d, 0x39, 0x33, 0x4, 0x5, 0x7, 0xf, 0x9, 0xa, 0xa, 0x3f, 0xb, 0x2, 0x2, 

/* 64colors */
0x40, 0x81, 0x48, 0xC3, 0x50, 0xC3, 0x51, 0x5, 0x59, 0x5, 0x79, 0x87, 0x81, 0x87, 0x89, 0x87, 0x81, 0x45, 0x71, 0x3, 0x69, 0x3, 0x60, 0xC3, 0x58, 0xC3, 0x48, 0x83, 0x40, 0x83, 0x79, 0x45, 
0x68, 0xC3, 0x59, 0x3, 0x91, 0xC9, 0x91, 0xC7, 0x92, 0x9, 0x89, 0xC7, 0x71, 0x5, 0x69, 0x5, 0x9A, 0xB, 0x9A, 0x4B, 0x61, 0x5, 0x69, 0x45, 0xA2, 0x8D, 0x89, 0xC9, 0x79, 0x5, 0x71, 0x45, 
0x71, 0x47, 0x79, 0x47, 0x92, 0xB, 0x81, 0xC7, 0x81, 0xC9, 0x69, 0x87, 0x71, 0x89, 0x79, 0xC9, 0x69, 0x47, 0x48, 0xC5, 0x59, 0x45, 0x61, 0x47, 0x71, 0x87, 0x61, 0x45, 0x50, 0xC5, 0x30, 0x83, 
0x59, 0x47, 0x40, 0xC3, 0x28, 0x83, 0x49, 0x5, 0x79, 0x3, 0x41, 0x5, 0x89, 0x45, 0x89, 0x85, 0x20, 0x83, 0x38, 0xC5, 0x20, 0x43, 0x30, 0xC3, 0x38, 0x83, 0x38, 0xC3, 0x40, 0xC5, 0x61, 0x3, 
};

