#include<ultra64.h>

extern Vtx SkiHandle_3b_v[];
extern Vtx SkiHandle_3b_vmcur[];
extern Tri SkiHandle_3b_tri[];
extern Lights1 SkiHandle_3b_material[];
extern Mtx SkiHandle_3b_matrix[];

extern unsigned short Sj4_arm_b_txt[];
extern unsigned short Sj4_arm_f_txt[];
extern unsigned short Sj4_handle_txt[];
extern unsigned short Sj4_in_f1_txt[];
extern unsigned short Sj4_in_f2_txt[];
extern unsigned short Sj4_in_floor_txt[];
extern unsigned short Sj4_in_top_txt[];
extern unsigned short Sj4_side_fL_txt[];
extern unsigned short Sj4_side_fR_txt[];
extern unsigned short Sj4_side_rL_txt[];
extern unsigned short Sj4_side_rR_txt[];
extern unsigned short Sj4_top_c_txt[];
extern unsigned short Sj4_top_f_txt[];
extern unsigned short Sj4_ura_c_txt[];
extern unsigned short Sj4_ura_f_txt[];
extern unsigned short Sj4_ura_rear_txt[];
extern unsigned short Sj4_ura_s2_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 ======== */


/* ======== g1 ======== */


/* ======== db ======== */

Gfx SkiHandle_3b_model[]={

	gsSPTexture(65535, 65535,0, 0, 1),
	gsDPPipeSync(),
	gsDPSetCombineMode(G_CC_MODULATERGBDECALA,G_CC_PASS2),

	gs_Nin_SetUpTileDescrip(G_IM_FMT_RGBA,G_IM_SIZ_16b,16,16,0,0,G_TX_CLAMP,4,0,G_TX_MIRROR,4,0),
	gs_Nin_LoadTextureImage(Sj4_handle_txt,G_IM_FMT_RGBA,G_IM_SIZ_16b,16,16,0,7),

	gsSPVertex(&SkiHandle_3b_v[0], 7, 0),
	gsSP1Triangle(0, 1, 2, 0),
	gsSP1Triangle(3, 2, 1, 0),
	gsSP1Triangle(2, 4, 0, 0),
	gsSP1Triangle(2, 3, 4, 0),
	gsSP1Triangle(0, 4, 5, 0),
	gsSP1Triangle(5, 4, 3, 0),
	gsSP1Triangle(3, 0, 6, 0),
	gsSP1Triangle(5, 6, 0, 0),
	gsSP1Triangle(1, 0, 3, 0),
	gsSP1Triangle(6, 5, 3, 0),
	gsSPEndDisplayList(),
}; /* db */ 

Gfx SkiHandle_3b_modelT[] = {
	gsSPEndDisplayList()
};

#undef G_CC_PRIMSHADE

#undef gs_Nin_LoadTextureImage

#undef gs_Nin_SetUpTileDescrip

/* 7 vertices */
Vtx SkiHandle_3b_v[]={
	{ 9,-11,0,0, 544, 0,  103,-60,0,255 },   /* v0 used p5/V3 6 times */
	{ 35,-11,-127,0, 544, -483,  -54,-102,-27,255 },   /* v1 used p4/V1 3 times */
	{ 35,10,-127,0, -10, -483,  62,103,-3,255 },   /* v2 used p5/V1 4 times */
	{ -10,0,0,0, 267, 0,  -119,0,0,255 },   /* v3 used p4/V3 6 times */
	{ 9,10,0,0, -10, 0,  59,105,0,255 },   /* v4 used p5/V2 4 times */
	{ 35,10,127,0, -10, 483,  62,103,4,255 },   /* v5 used p3/V2 4 times */
	{ 35,-11,127,0, 544, 483,  -54,-102,28,255 },   /* v6 used p3/V1 3 times */
};


/*   0 vertices */
/* 16 x 16  G_IM_SIZ_16b G_IM_FMT_RGBA  */
unsigned short Sj4_handle_txt[] = {
	0x11c9, 0x11c9, 0x11c9, 0x11c9, 0x1189, 0x42d3, 0x84a3, 0x84a3, 0x5b99, 0x3ad3, 0x19cb, 0x1189, 0x11c9, 0x11c9, 0x11c9, 0x11c9, 
	0x11c9, 0x11c9, 0x11c9, 0x11c9, 0x1189, 0x42d3, 0x84a3, 0x84a3, 0x5b99, 0x3ad3, 0x19cb, 0x1189, 0x11c9, 0x11c9, 0x11c9, 0x11c9, 
	0x11c9, 0x11c9, 0x11c9, 0x11c9, 0x1189, 0x42d3, 0x84a3, 0x84a3, 0x5b99, 0x3ad3, 0x19cb, 0x1189, 0x11c9, 0x11c9, 0x11c9, 0x11c9, 
	0x11c9, 0x11c9, 0x11c9, 0x11c9, 0x1189, 0x42d3, 0x84a3, 0x84a3, 0x5b99, 0x3ad3, 0x19cb, 0x1189, 0x11c9, 0x11c9, 0x11c9, 0x11c9, 
	0x11c9, 0x11c9, 0x11c9, 0x11c9, 0x1189, 0x42d3, 0x84a3, 0x84a3, 0x5b99, 0x3ad3, 0x19cb, 0x1189, 0x11c9, 0x11c9, 0x11c9, 0x11c9, 
	0x11c9, 0x11c9, 0x11c9, 0x11c9, 0x1189, 0x42d3, 0x84a3, 0x84a3, 0x5b99, 0x3ad3, 0x19cb, 0x1189, 0x11c9, 0x11c9, 0x11c9, 0x11c9, 
	0x11c9, 0x11c9, 0x11c9, 0x11c9, 0x1189, 0x42d3, 0x84e3, 0x84a3, 0x5b99, 0x3ad3, 0x19cb, 0x1189, 0x11c9, 0x11c9, 0x11c9, 0x11c9, 
	0x1189, 0x1189, 0x1189, 0x1189, 0x1189, 0x42d3, 0x84e3, 0x84a3, 0x5b99, 0x3a91, 0x19c9, 0x1187, 0x1189, 0x1189, 0x1189, 0x1189, 
	0x21cb, 0x218b, 0x218b, 0x218b, 0x218b, 0x3a4f, 0x5b17, 0x5317, 0x4293, 0x320f, 0x218b, 0x218b, 0x218b, 0x218b, 0x218b, 0x218b, 
	0xc631, 0xbdef, 0xb5ad, 0xbdef, 0xbdef, 0xb5ad, 0xbdef, 0xbdef, 0xb5ad, 0xbdef, 0xc631, 0xbdef, 0xbdef, 0xc631, 0xbdef, 0xbe31, 
	0xa529, 0x9ce7, 0x8c63, 0x9ce7, 0x9ce7, 0x8c63, 0x9ce7, 0x9ce7, 0x8c63, 0x9ce7, 0x9ce7, 0x8c63, 0x9ce7, 0x9ce7, 0x8c63, 0x9ce7, 
	0xad6b, 0xa529, 0x9ce7, 0xa529, 0xa529, 0x9ce7, 0xa529, 0xa529, 0x9ce7, 0xa529, 0xa529, 0x9ce7, 0xa529, 0xa529, 0x9ce7, 0xa529, 
	0xa529, 0x9ce7, 0x94a5, 0x9ce7, 0xa529, 0x94a5, 0x9ce7, 0xa529, 0x94a5, 0x9ce7, 0xa529, 0x94a5, 0x9ce7, 0xa529, 0x94a5, 0x9ce7, 
	0xa529, 0xa529, 0x94a5, 0xa529, 0xad6b, 0x94a5, 0xa529, 0xad6b, 0x94a5, 0xa529, 0xad6b, 0x94a5, 0xa529, 0xad6b, 0x94a5, 0x9ce7, 
	0xa529, 0xa529, 0x9ce7, 0xa529, 0xad6b, 0x9ce7, 0xa529, 0xad6b, 0x9ce7, 0xa529, 0xad6b, 0x9ce7, 0xa529, 0xad6b, 0x9ce7, 0xa529, 
	0xb5ad, 0xb5ad, 0xad6b, 0xb5ad, 0xbdef, 0xad6b, 0xb5ad, 0xbdef, 0xad6b, 0xb5ad, 0xbdef, 0xad6b, 0xb5ad, 0xbdef, 0xad6b, 0xad6b, 
};

