#include<ultra64.h>

extern Vtx TI_Tolehammer_Base_v[];
extern Vtx TI_Tolehammer_Base_vmcur[];
extern Tri TI_Tolehammer_Base_tri[];
extern Mtx TI_Tolehammer_Base_matrix[];

extern unsigned short TI_Catapira02_txt[];
extern unsigned short TI_Duct03_txt[];
extern unsigned short TI_Paint01_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 */


/* ======== TI_Tolehammer_Base ======== */

Gfx TI_Tolehammer_Base[]={

	gs_Nin_SetUpTileDescrip(G_IM_FMT_RGBA,G_IM_SIZ_16b,16,16,0,0,G_TX_WRAP,4,0,G_TX_WRAP,4,0),
	gs_Nin_LoadTextureImage(TI_Duct03_txt,G_IM_FMT_RGBA,G_IM_SIZ_16b,16,16,0,7),


	gsSPVertex(&TI_Tolehammer_Base_v[0],6,0),
	gsSP2Triangles(0, 1, 2, 0, 3, 4, 5, 0),
	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(TI_Paint01_txt,G_IM_FMT_RGBA,G_IM_SIZ_16b,16,16,0,7),


	gsSPVertex(&TI_Tolehammer_Base_v[6],4,0),
	gsSP2Triangles(0, 1, 2, 0, 0, 2, 3, 0),
	gs_Nin_SetUpTileDescrip(G_IM_FMT_RGBA,G_IM_SIZ_16b,16,16,0,0,G_TX_WRAP,4,0,G_TX_WRAP,4,0),
	gs_Nin_LoadTextureImage(TI_Catapira02_txt,G_IM_FMT_RGBA,G_IM_SIZ_16b,16,16,0,7),

	gsSPVertex(&TI_Tolehammer_Base_v[10],12,0),
	gsSP2Triangles(0, 1, 2, 0, 3, 2, 4, 0),
	gsSP2Triangles(2, 3, 0, 0, 4, 5, 3, 0),
	gsSP2Triangles(6, 7, 8, 0, 8, 9, 10, 0),
	gsSP2Triangles(7, 11, 8, 0, 5, 4, 1, 0),
	gsSP1Triangle(8, 10, 6, 0),
	gsSPEndDisplayList(),
}; /* TI_Tolehammer_Base */ 

#undef G_CC_PRIMSHADE

#undef gs_Nin_LoadTextureImage

#undef gs_Nin_SetUpTileDescrip

/* 26 vertices */
Vtx TI_Tolehammer_Base_v[]={
	{     0,     0,    93,     0,  -181,   512,   104,   -13,    56,   255},	/* 0 */
	{    86,     0,  -133,     0,  1141,   512,   108,   -33,    40,   255},	/* 1 */
	{    71,   101,   -10,     0,   355,     2,   106,    14,    54,   255},	/* 2 */
	{   -86,     0,  -133,     0,  1141,   512,  -107,   -33,    40,   255},	/* 3 */
	{     0,     0,    93,     0,  -181,   512,  -104,   -14,    56,   255},	/* 4 */
	{   -71,   101,   -10,     0,   355,     2,  -105,    14,    53,   255},	/* 5 */
	{     0,     0,    93,     0,   511,   511,  -104,   -14,    56,   255},	/* 6 */
	{    71,   101,   -10,     0,   511,     0,   106,    14,    54,   255},	/* 7 */
	{    -1,   133,    58,     0,     0,     0,   -47,    75,    79,   255},	/* 8 */
	{   -71,   101,   -10,     0,     0,   511,  -105,    14,    53,   255},	/* 9 */
	{   -12,   393,   104,     0,   513, -1039,  -119,     0,     0,   255},	/* 10 */
	{     0,   169,   -33,     0,   512,   639,   104,    27,   -54,   255},	/* 11 */
	{   -12,   159,   -15,     0,   255,   636,  -119,     0,     0,   255},	/* 12 */
	{     0,   383,   121,     0,   258, -1042,   -59,   -51,    89,   255},	/* 13 */
	{    12,   159,   -15,     0,   256,   636,   104,    27,   -54,   255},	/* 14 */
	{    12,   393,   104,     0,   515, -1039,   120,     0,    -1,   255},	/* 15 */
	{    -1,   133,    58,     0,   142,   511,   -47,    75,    79,   255},	/* 16 */
	{    71,   101,   -10,     0,   426,   511,   106,    14,    54,   255},	/* 17 */
	{     0,   188,   -38,     0,   142,   146,    83,    79,    35,   255},	/* 18 */
	{   -47,   141,   -73,     0,   426,   146,   -89,    78,    16,   255},	/* 19 */
	{   -71,   101,   -10,     0,   426,   511,  -105,    14,    53,   255},	/* 20 */
	{    47,   141,   -73,     0,   426,   146,    90,    78,    16,   255},	/* 21 */
};


/*   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 TI_Bolt01_txt[] = {
	0x49c9, 0x4187, 0x4187, 0x3903, 0x4187, 0x3945, 0x4187, 0x4987, 0x4987, 0x4187, 0x4987, 0x51c9, 0x4145, 0x4987, 0x4145, 0x4145, 
	0x4187, 0x4987, 0x6311, 0xcef1, 0xd731, 0xc6ad, 0x6b95, 0x4187, 0x49c9, 0x6b93, 0xbe69, 0xd72d, 0xe777, 0x524b, 0x3903, 0x4187, 
	0x4187, 0x62cf, 0xdf31, 0x849b, 0x5b51, 0x6351, 0xbe69, 0xe7b3, 0xdf2f, 0xb5e5, 0x6393, 0x6351, 0xa5a5, 0xcf31, 0x524b, 0x4187, 
	0x4145, 0xbe29, 0x8cdd, 0x4a8b, 0x52cd, 0x52cd, 0x530f, 0x5b0f, 0x6351, 0x6393, 0x6b93, 0x6393, 0x6bd5, 0x9d63, 0x951f, 0x3945, 
	0x4145, 0x7c59, 0x52cd, 0x52cd, 0x530f, 0x3a49, 0x10c1, 0x8c1, 0x8c1, 0x1941, 0x428b, 0x6b93, 0x6bd5, 0x7417, 0x7c59, 0x3945, 
	0x4145, 0x6b93, 0x530f, 0x530f, 0x428b, 0x2183, 0x1901, 0x4acd, 0x52cd, 0x428b, 0x3207, 0x5b4f, 0x6bd5, 0x7417, 0x6393, 0x4187, 
	0x4145, 0x5b51, 0x6b93, 0x6391, 0x2983, 0x428b, 0x8c1, 0x2143, 0x5b51, 0x5b51, 0x4acb, 0x4a8b, 0x7c19, 0x7c59, 0x5b51, 0x3945, 
	0x4987, 0x530f, 0x7415, 0x6bd5, 0x4a8b, 0x5b51, 0x94dd, 0x41, 0x2183, 0x6391, 0x6393, 0x530f, 0x8cdd, 0x849b, 0x52cd, 0x4187, 
	0x51c9, 0x4acd, 0x849b, 0x7c17, 0x6393, 0x6bd5, 0x7c17, 0xade3, 0x41, 0x3a49, 0x6393, 0x5b51, 0x951f, 0x9d61, 0x4acd, 0x4987, 
	0x4945, 0x530f, 0x94dd, 0x849b, 0xada3, 0x7417, 0x6393, 0x7c59, 0xb5e5, 0x1101, 0x29c5, 0xa5a3, 0x951f, 0xa5a3, 0x530d, 0x4145, 
	0x4187, 0x5b0f, 0x9d61, 0x9d61, 0xade5, 0xc669, 0x7c17, 0x6393, 0x6393, 0x9d21, 0xcef1, 0xada5, 0xa5a3, 0x9d61, 0x6351, 0x4145, 
	0x4187, 0x4acd, 0x94dd, 0xb627, 0xc6ab, 0xbe67, 0xdf2f, 0xdf73, 0xd733, 0xceaf, 0xb627, 0xb5e7, 0xade5, 0xa561, 0x52cd, 0x4103, 
	0x49c9, 0x2183, 0x530f, 0x9d61, 0xceab, 0xada3, 0xa5a1, 0x951f, 0x9d1f, 0x9d61, 0xb5e5, 0xc669, 0xb5e5, 0x6393, 0x3a07, 0x4103, 
	0x4187, 0x3185, 0x1101, 0x4a8d, 0x951d, 0x9d61, 0x530f, 0x1101, 0x2141, 0x3a07, 0x94dd, 0x951d, 0x4acd, 0x2983, 0x3985, 0x4145, 
	0x4187, 0x4187, 0x2903, 0x841, 0x10c1, 0x1941, 0x2943, 0x4987, 0x4145, 0x2103, 0x1901, 0x81, 0x8c1, 0x3143, 0x4987, 0x4987, 
	0x49c9, 0x3945, 0x3103, 0x3145, 0x4187, 0x4989, 0x4987, 0x4145, 0x3903, 0x3903, 0x3945, 0x3945, 0x4187, 0x4987, 0x4145, 0x4145, 
};
