#include<ultra64.h>

extern Vtx SN_ishi_v[];

extern unsigned char SN_ishi_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_ishi[]={

	gsDPSetTextureLUT(G_TT_RGBA16),
	gsDPLoadTLUT_pal256(&SN_ishi_CI8_txt[64]),
	gsDPLoadTextureBlock(SN_ishi_CI8_txt,G_IM_FMT_CI,G_IM_SIZ_8b,8,8,0,G_TX_WRAP,G_TX_WRAP,3,3,0,0),

	gsSPVertex(&SN_ishi_v[0], 14, 0),
	gsSP1Triangle(0, 1, 2, 0),
	gsSP1Triangle(3, 4, 0, 0),
	gsSP1Triangle(5, 1, 0, 0),
	gsSP1Triangle(5, 0, 6, 0),
	gsSP1Triangle(7, 1, 5, 0),
	gsSP1Triangle(2, 1, 7, 0),
	gsSP1Triangle(8, 3, 2, 0),
	gsSP1Triangle(2, 3, 9, 0),
	gsSP1Triangle(10, 3, 11, 0),
	gsSP1Triangle(7, 12, 3, 0),
	gsSP1Triangle(11, 3, 13, 0),
	gsSPVertex(&SN_ishi_v[5], 3, 0),
	gsSPVertex(&SN_ishi_v[11], 1, 3),
	gsSPVertex(&SN_ishi_v[14], 2, 4),
	gsSP1Triangle(3, 4, 5, 0),
	gsSP1Triangle(5, 1, 3, 0),
	gsSP1Triangle(0, 5, 4, 0),
	gsSP1Triangle(1, 5, 0, 0),
	gsSP1Triangle(4, 2, 0, 0),
	gsDPPipeSync(),
        gsDPSetTextureLUT(G_TT_NONE),
	gsSPEndDisplayList(),
}; /* g2 */ 

#undef G_CC_PRIMSHADE

#undef gs_Nin_LoadTextureImage

#undef gs_Nin_SetUpTileDescrip

/* 16 vertices */
Vtx SN_ishi_v[]={
	{ 30,-10,-40,0, 192, 192, 40,-7,-113,255 },   /* v0 used p159/V1 4 times */
	{ 60,0,0,0, 448, 320, 114,38,0,255 },   /* v1 used p159/V2 4 times */
	{ 50,-50,0,0, 320, -64, 58,-57,-87,255 },   /* v2 used p159/V3 4 times */
	{ 0,-60,0,0, 0, -128, -9,-81,-87,255 },   /* v3 used p160/V2 6 times */
	{ -30,-10,-40,0, -64, 320, -42,9,-112,255 },   /* v4 used p158/V2 2 times */
	{ 20,40,0,0, 128, 640, 0,106,-56,255 },   /* v5 used p163/V1 6 times */
	{ -30,-10,-40,0, -64, 320, -42,9,-112,255 },   /* v6 used p162/V2 6 times */
	{ 30,-10,40,0, 192, 192, 40,-7,112,255 },   /* v7 used p148/V2 8 times */
	{ 30,-10,40,0, 192, 192, 40,-7,112,255 },   /* v8 used p155/V1 2 times */
	{ 30,-10,-40,0, 192, 192, 40,-7,-113,255 },   /* v9 used p161/V3 2 times */
	{ -30,-10,-40,0, -64, 320, -42,9,-112,255 },   /* v10 used p160/V1 2 times */
	{ -50,-30,0,0, -320, 64, -106,-53,0,255 },   /* v11 used p160/V3 4 times */
	{ -30,-10,40,0, -64, 320, -42,9,111,255 },   /* v12 used p157/V2 2 times */
	{ -30,-10,40,0, -64, 320, -42,9,111,255 },   /* v13 used p154/V3 2 times */
	{ -30,-10,40,0, -64, 320, -42,9,111,255 },   /* v14 used p147/V3 6 times */
	{ -40,20,0,0, -384, 448, -84,85,0,255 },   /* v15 used p162/V1 4 times */
};


/*   0 vertices */
/*   1 Materials */

#define	LDIRX	0
#define	LDIRY	0
#define	LDIRZ	120
#define	AMBDIV	1
/* 8 x 8  G_IM_SIZ_16b G_IM_FMT_RGBA  */
unsigned char SN_ishi_CI8_txt[] = {
	0x0, 0x0, 0x1, 0x2, 0x2, 0x1, 0x1, 0x3, 
	0x3, 0x3, 0x0, 0x1, 0x2, 0x4, 0x5, 0x3, 
	0x2, 0x2, 0x6, 0x7, 0x8, 0x8, 0x9, 0xa, 
	0xb, 0x3, 0x5, 0x7, 0x8, 0x4, 0xc, 0x6, 
	0x0, 0x6, 0xd, 0xe, 0xf, 0x1, 0x4, 0xa, 
	0x8, 0x8, 0x10, 0x11, 0x12, 0x1, 0x2, 0x2, 
	0x4, 0x3, 0x3, 0x2, 0x13, 0x14, 0x2, 0x1, 
	0x1, 0xa, 0x3, 0x2, 0xa, 0x0, 0x1, 0x1, 

/* 24colors */
0x61, 0x1, 0xA9, 0x1, 0x62, 0x1, 0x3A, 0x1, 0xD0, 0x81, 0x52, 0x1, 0x2, 0x1, 0xB0, 0x41, 0xF0, 0x1, 0x69, 0x81, 0x81, 0x1, 0x12, 0x1, 0xA8, 0x81, 0x89, 0x1, 0xA1, 0x1, 0xB8, 0xC1, 
0xD0, 0x1, 0x71, 0x41, 0xB0, 0xC1, 0x39, 0x1, 0xA0, 0x1, 0xFF, 0xFE, 0xFF, 0xFE, 0xFF, 0xFE, };

