#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],17,0),
	gsSP1Triangle(0, 1, 2, 0),
	gsSP1Quadrangle(3, 6, 4, 5, 0),
	gsSP2Triangles(2, 6, 0, 0, 1, 0, 5, 0),
	gsSP2Triangles(7, 8, 4, 0, 4, 9, 5, 0),
	gsSP2Triangles(7, 4, 6, 0, 8, 9, 4, 0),
	gsSP2Triangles(5, 10, 11, 0, 11, 1, 5, 0),
	gsSP2Triangles(10, 5, 9, 0, 1, 11, 12, 0),
	gsSP2Triangles(12, 2, 1, 0, 9, 8, 10, 0),
	gsSP2Triangles(13, 8, 14, 0, 8, 13, 15, 0),
	gsSP2Triangles(8, 7, 14, 0, 10, 8, 15, 0),
	gsSP2Triangles(2, 7, 6, 0, 11, 10, 15, 0),
	gsSP2Triangles(12, 16, 2, 0, 11, 16, 12, 0),
	gsSP2Triangles(16, 13, 14, 0, 13, 16, 15, 0),
	gsSP2Triangles(2, 16, 14, 0, 16, 11, 15, 0),
	gsSP1Triangle(7, 2, 14, 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},	/* 0 */
	{   -80,    40,     0,     0,  -512,   512,   -94,    73,    -6,   255},	/* 1 */
	{   -60,   -20,    80,     0,  -384,     0,   -49,   -17,   106,   255},	/* 2 */
	{     0,    80,    40,     0,     0,   256,   -46,   103,    38,   255},	/* 3 */
	{    80,    80,    40,     0,   512,   256,    77,    83,    39,   255},	/* 4 */
	{    20,    80,   -40,     0,   128,   768,   -12,    93,   -75,   255},	/* 5 */
	{    40,    80,    60,     0,   256,   128,     0,    45,   110,   255},	/* 6 */
	{    60,   -20,    80,     0,   384,     0,    48,     6,   109,   255},	/* 7 */
	{   120,     0,     0,     0,   768,   512,   120,    10,     0,   255},	/* 8 */
	{    80,    60,   -20,     0,   512,   640,    77,    64,   -66,   255},	/* 9 */
	{    60,   -20,   -80,     0,   384,  1024,    44,    24,  -109,   255},	/* 10 */
	{   -60,   -20,   -80,     0,  -384,  1024,   -48,   -16,  -108,   255},	/* 11 */
	{  -100,   -60,     0,     0,  -640,   512,  -106,   -53,     0,   255},	/* 12 */
	{   100,  -100,     0,     0,   640,   512,    85,   -84,     0,   255},	/* 13 */
	{    80,   -80,    56,     0,   512,   153,    34,   -67,    92,   255},	/* 14 */
	{    80,   -80,   -56,     0,   512,   870,    34,   -67,   -93,   255},	/* 15 */
	{     0,  -120,     0,     0,     0,   512,   -29,  -115,     0,   255},	/* 16 */
};


/*   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, 0x2, 
	0xc, 0x11, 0xd, 0xc, 0x12, 0x13, 0x12, 0x14, 0x15, 0x6, 0x16, 0xa, 0xa, 0xb, 0xc, 0xc, 
	0x17, 0x17, 0x2, 0xc, 0xf, 0x18, 0x18, 0x19, 0x18, 0x14, 0x6, 0xf, 0x9, 0x10, 0xb, 0x1a, 
	0x1b, 0x17, 0x17, 0x17, 0x1b, 0x15, 0x1c, 0x1c, 0x18, 0x14, 0x1d, 0x6, 0x1e, 0xa, 0x10, 0x1f, 
	0x20, 0x17, 0x1f, 0x1f, 0x21, 0x15, 0x14, 0x19, 0x22, 0x1d, 0x6, 0x6, 0xf, 0x9, 0x9, 0x8, 
	0x1f, 0x23, 0x6, 0x5, 0x6, 0x1d, 0x12, 0x13, 0x1d, 0x23, 0x5, 0x1f, 0x1f, 0x1f, 0xf, 0x16, 
	0x16, 0x24, 0x25, 0x26, 0x27, 0x24, 0x23, 0x15, 0x7, 0x5, 0x28, 0x1a, 0x4, 0x1a, 0x1a, 0x17, 
	0x4, 0x29, 0x2a, 0x2b, 0x2b, 0x25, 0x2c, 0x5, 0x7, 0x2c, 0x2d, 0x4, 0x3, 0x2e, 0x29, 0x2e, 
	0x1, 0x2f, 0x3, 0x3, 0x2a, 0x30, 0x2d, 0x1f, 0x8, 0x8, 0x20, 0x4, 0x3, 0x3, 0x2e, 0x31, 
	0x2f, 0x32, 0x29, 0x33, 0x3, 0x3, 0x1a, 0xf, 0x34, 0x8, 0x7, 0x6, 0x28, 0x1a, 0x3, 0x1, 
	0x2f, 0x32, 0x32, 0x35, 0x35, 0x33, 0x4, 0xf, 0x36, 0x37, 0x13, 0x7, 0xf, 0x20, 0x3, 0x31, 
	0x32, 0x38, 0x38, 0x2f, 0x39, 0x33, 0x17, 0x8, 0x8, 0xf, 0xf, 0xf, 0x17, 0x3, 0x29, 0x31, 
	0x2f, 0x3a, 0x2f, 0x3b, 0x39, 0x29, 0xf, 0x8, 0xf, 0xf, 0x1f, 0x1b, 0x1a, 0x3, 0x31, 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, 
};

