DisplayList.h 8.22 KB
/*********************************************************************
$B#V#I8!::$G;HMQ$9$k%G%#%9%W%l%$%j%9%HC#(B
*********************************************************************/
/* initialize the RSP state: */
static Gfx rspinit_dl[] = 
{
  gsSPClearGeometryMode(G_SHADE | G_SHADING_SMOOTH | G_CULL_BOTH |
			G_FOG | G_LIGHTING | G_TEXTURE_GEN |
			G_TEXTURE_GEN_LINEAR | G_LOD ),
  gsSPTexture(0, 0, 0, 0, G_OFF),
  gsSPSetGeometryMode(G_SHADE | G_SHADING_SMOOTH),
  gsSPEndDisplayList(),
};

/* initialize the RDP state: */
static Gfx rdpinit_dl[] = 
{
  gsDPSetCycleType(G_CYC_1CYCLE),
  gsDPPipelineMode(G_PM_1PRIMITIVE),
  gsDPSetTextureLOD(G_TL_TILE),
  gsDPSetTextureLUT(G_TT_NONE),
  gsDPSetTextureDetail(G_TD_CLAMP),
  gsDPSetTexturePersp(G_TP_PERSP),
  gsDPSetTextureFilter(G_TF_BILERP),
  gsDPSetTextureConvert(G_TC_FILT),
  gsDPSetCombineMode(G_CC_SHADE, G_CC_SHADE),
  gsDPSetCombineKey(G_CK_NONE),
  gsDPSetAlphaCompare(G_AC_NONE),
  gsDPSetRenderMode(G_RM_OPA_SURF, G_RM_OPA_SURF2),
  gsDPPipeSync(),
  gsSPEndDisplayList(),
};

/* $B#T#w#i#r#l8!::$G;HMQ$9$k#D#LC#(B */
static Vtx twirl1[] =  {
        {   -7, -21, 0, 0, ( 0 << 6), ( 0 << 6), 0xff, 0, 0, 0xff },
        {    7, -21, 0, 0, (31 << 6), ( 0 << 6), 0xff, 0, 0, 0xff },
        {    7,  -7, 0, 0, ( 0 << 6), ( 0 << 6), 0xff, 0, 0, 0xff },
        {   -7,  -7, 0, 0, (31 << 6), ( 0 << 6), 0xff, 0, 0, 0xff },
	   					       	
        {   -7,   7, 0, 0, ( 0 << 6), ( 0 << 6), 0, 0xff, 0, 0xff },
        {    7,   7, 0, 0, (31 << 6), ( 0 << 6), 0, 0xff, 0, 0xff },
        {    7,  21, 0, 0, ( 0 << 6), ( 0 << 6), 0, 0xff, 0, 0xff },
        {   -7,  21, 0, 0, (31 << 6), ( 0 << 6), 0, 0xff, 0, 0xff },
	   					       	
        {  -21,  -7, 0, 0, ( 0 << 6), ( 0 << 6), 0, 0, 0xff, 0xff },
        {   -7,  -7, 0, 0, (31 << 6), ( 0 << 6), 0, 0, 0xff, 0xff },
        {   -7,   7, 0, 0, ( 0 << 6), ( 0 << 6), 0, 0, 0xff, 0xff },
        {  -21,   7, 0, 0, (31 << 6), ( 0 << 6), 0, 0, 0xff, 0xff },
	   					       	
	   					       	
        {    7,  -7, 0, 0, ( 0 << 6), ( 0 << 6), 0xff, 0xff, 0, 0xff },
        {   21,  -7, 0, 0, (31 << 6), ( 0 << 6), 0xff, 0xff, 0, 0xff },
        {   21,   7, 0, 0, ( 0 << 6), ( 0 << 6), 0xff, 0xff, 0, 0xff },
        {    7,   7, 0, 0, (31 << 6), ( 0 << 6), 0xff, 0xff, 0, 0xff },
};

Gfx TwirlFigure1[] = {
  gsSPVertex(&twirl1, 16, 0),

  gsSP1Triangle(0, 1, 2, 0),
  gsSP1Triangle(0, 2, 3, 0),

  gsSP1Triangle(4, 5, 6, 0),
  gsSP1Triangle(4, 6, 7, 0),

  gsSP1Triangle(8, 9,  10, 0),
  gsSP1Triangle(8, 10, 11, 0),

  gsSP1Triangle(12, 13, 14, 0),
  gsSP1Triangle(12, 14, 15, 0),
  gsSPEndDisplayList(),
};

static Vtx twirl2[] =  {

        {   0, -21, 0, 0, ( 0 << 6), ( 0 << 6), 0xff, 0, 0, 0xff       },
        {  21,   0, 0, 0, ( 0 << 6), ( 0 << 6), 0xff, 0, 0, 0xff       },
        {   0,  21, 0, 0, ( 0 << 6), ( 0 << 6), 0xff, 0, 0, 0xff       },
        { -21,   0, 0, 0, ( 0 << 6), ( 0 << 6), 0xff, 0, 0, 0xff       },
        { -17, -17, 0, 0, ( 0 << 6), ( 0 << 6), 0, 0xff, 0xff, 0xff       },
        {  17, -17, 0, 0, ( 0 << 6), ( 0 << 6), 0, 0xff, 0xff, 0xff       },
        {  17,  17, 0, 0, ( 0 << 6), ( 0 << 6), 0, 0xff, 0xff, 0xff       },
        { -17,  17, 0, 0, ( 0 << 6), ( 0 << 6), 0, 0xff, 0xff, 0xff       },

};

Gfx TwirlFigure2[] = {
  gsSPVertex(&twirl2,  8, 0),
  gsSP1Triangle(0, 1, 2, 0),
  gsSP1Triangle(0, 2, 3, 0),

  gsSP1Triangle(4, 5, 6, 0),
  gsSP1Triangle(4, 6, 7, 0),


  gsSPEndDisplayList(),
};

static Vtx twirl3[] =  {

        { -21, -21, 0, 0, ( 0 << 6), ( 0 << 6), 0xff, 0, 0xff, 0xff       },
        {  21, -21, 0, 0, ( 0 << 6), ( 0 << 6), 0xff, 0, 0xff, 0xff       },
        {  21,  21, 0, 0, ( 0 << 6), ( 0 << 6), 0xff, 0, 0xff, 0xff       },
        { -21,  21, 0, 0, ( 0 << 6), ( 0 << 6), 0xff, 0, 0xff, 0xff       },
							     
        {   0, -21, 0, 0, ( 0 << 6), ( 0 << 6), 0xff, 0, 0xff, 0xff       },
        {  21,   0, 0, 0, ( 0 << 6), ( 0 << 6), 0xff, 0, 0xff, 0xff       },
        {   0,  21, 0, 0, ( 0 << 6), ( 0 << 6), 0xff, 0, 0xff, 0xff       },
        { -21,   0, 0, 0, ( 0 << 6), ( 0 << 6), 0xff, 0, 0xff, 0xff       },
};

Gfx TwirlFigure3[] = {
  gsSPVertex(&twirl3,  8, 0),
  gsSP1Triangle(1, 5, 4, 0),
  gsSP1Triangle(5, 2, 6, 0),
  gsSP1Triangle(6, 3, 7, 0),
  gsSP1Triangle(7, 0, 4, 0),

  gsSPEndDisplayList(),
};

static Vtx twirl4[] =  {

        {    -21, -21, 0, 0, ( 0 << 6), ( 0 << 6), 0xff, 0xff, 0, 0xff    },
        {     21, -21, 0, 0, ( 0 << 6), ( 0 << 6), 0xff, 0xff, 0, 0xff    },
        {     21,  21, 0, 0, ( 0 << 6), ( 0 << 6), 0xff, 0xff, 0, 0xff    },

        {     17,  21, 0, 0, ( 0 << 6), ( 0 << 6), 0, 0, 0xff, 0xff       },
        {    -21,  21, 0, 0, ( 0 << 6), ( 0 << 6), 0, 0, 0xff, 0xff       },
        {    -21, -17, 0, 0, ( 0 << 6), ( 0 << 6), 0, 0, 0xff, 0xff       },
};

Gfx TwirlFigure4[] = {
  gsSPVertex(&twirl4,  6, 0),

  gsSP1Triangle(0, 1, 2, 0),
  gsSP1Triangle(3, 4, 5, 0),

  gsSPEndDisplayList(),
};

/* $B:{Ln$5$s$N8!::%W%m%0%i%`$G;HMQ$9$k%G%#%9%W%l%$%j%9%HC#(B */
static Vp vp = {
    320*2, 240*2, G_MAXZ/2, 0,  /* scale */
    320*2, 240*2, G_MAXZ/2, 0,  /* translate */
};

#define USE_MIPMAP  /* $B%_%C%W%^%C%W$r;HMQ$9$k$h(B */

Gfx floor_setup_dl[] = {
    gsDPPipeSync (),
    gsSPClearGeometryMode(G_SHADE | G_SHADING_SMOOTH | G_CULL_BOTH |
        G_FOG | G_LIGHTING | G_TEXTURE_GEN |
        G_TEXTURE_GEN_LINEAR | G_LOD ),
    gsSPSetGeometryMode(G_ZBUFFER),
    gsDPSetTexturePersp(G_TP_PERSP),
    gsDPSetTextureFilter(G_TF_BILERP),

    /* $B%_%C%W%^%C%W$r;HMQ$9$k>l9g$O$3$A$i(B */
#ifdef USE_MIPMAP
    gsDPSetRenderMode(G_RM_PASS, G_RM_AA_ZB_OPA_SURF2),
    gsSPTexture(0x8000, 0x8000, 5, G_TX_RENDERTILE, G_ON),
    gsDPSetCombineMode(G_CC_TRILERP, G_CC_DECALRGB2),
    gsDPSetTextureDetail (G_TD_CLAMP),

    /* set up all the tiles */
    gsSPDisplayList(RGBA16brickMM_dl),

    gsDPSetTextureLOD(G_TL_LOD),
    gsDPPipelineMode(G_PM_1PRIMITIVE),
    gsDPSetCycleType(G_CYC_2CYCLE),

    /* $B%_%C%W%^%C%W$r;HMQ$7$J$$>l9g$O$3$A$i(B */
#else
    gsDPSetRenderMode(G_RM_AA_ZB_OPA_SURF, G_RM_AA_ZB_OPA_SURF2),
    gsSPTexture(0x8000, 0x8000, 0, G_TX_RENDERTILE, G_ON),
    gsDPSetCombineMode(G_CC_DECALRGB, G_CC_DECALRGB),
    gsDPLoadTextureBlock(RGBA16brick, G_IM_FMT_RGBA, G_IM_SIZ_16b, 32, 32, 0,
       G_TX_WRAP | G_TX_NOMIRROR, G_TX_WRAP | G_TX_NOMIRROR,
       5, 5, G_TX_NOLOD, G_TX_NOLOD),
#endif
    gsSPEndDisplayList(),
};

static Vtx floor_vtx[25] =  {
  { -64, 0, -64, 0, (0 << 6), (0 << 6), 0, 0, 0, 0xff },
  { -32, 0, -64, 0, (31 << 6), (0 << 6), 0, 0, 0, 0xff },
  { 0, 0, -64, 0, (63 << 6), (0 << 6), 0, 0, 0, 0xff },
  { 32, 0, -64, 0, (95 << 6), (0 << 6), 0, 0, 0, 0xff },
  { 64, 0, -64, 0, (127 << 6), (0 << 6), 0, 0, 0, 0xff },
  { -64, 0, -32, 0, (0 << 6), (31 << 6), 0, 0, 0, 0xff },
  { -32, 0, -32, 0, (31 << 6), (31 << 6), 0, 0, 0, 0xff },
  { 0, 0, -32, 0, (63 << 6), (31 << 6), 0, 0, 0, 0xff },
  { 32, 0, -32, 0, (95 << 6), (31 << 6), 0, 0, 0, 0xff },
  { 64, 0, -32, 0, (127 << 6), (31 << 6), 0, 0, 0, 0xff },
  { -64, 0, 0, 0, (0 << 6), (63 << 6), 0, 0, 0, 0xff },
  { -32, 0, 0, 0, (31 << 6), (63 << 6), 0, 0, 0, 0xff },
  { 0, 0, 0, 0, (63 << 6), (63 << 6), 0, 0, 0, 0xff },
  { 32, 0, 0, 0, (95 << 6), (63 << 6), 0, 0, 0, 0xff },
  { 64, 0, 0, 0, (127 << 6), (63 << 6), 0, 0, 0, 0xff },
  { -64, 0, 32, 0, (0 << 6), (95 << 6), 0, 0, 0, 0xff },
  { -32, 0, 32, 0, (31 << 6), (95 << 6), 0, 0, 0, 0xff },
  { 0, 0, 32, 0, (63 << 6), (95 << 6), 0, 0, 0, 0xff },
  { 32, 0, 32, 0, (95 << 6), (95 << 6), 0, 0, 0, 0xff },
  { 64, 0, 32, 0, (127 << 6), (95 << 6), 0, 0, 0, 0xff },
  { -64, 0, 64, 0, (0 << 6), (127 << 6), 0, 0, 0, 0xff },
  { -32, 0, 64, 0, (31 << 6), (127 << 6), 0, 0, 0, 0xff },
  { 0, 0, 64, 0, (63 << 6), (127 << 6), 0, 0, 0, 0xff },
  { 32, 0, 64, 0, (95 << 6), (127 << 6), 0, 0, 0, 0xff },
  { 64, 0, 64, 0, (127 << 6), (127 << 6), 0, 0, 0, 0xff },
};

Gfx floor_geom_dl[] = {

#define floorPatch(a) gsSPVertex(&(floor_vtx[(a)]), 10, 0), \
    gsSP1Triangle(0, 1, 5, 0),          \
    gsSP1Triangle(1, 5, 6, 0),          \
    gsSP1Triangle(1, 2, 6, 0),          \
    gsSP1Triangle(2, 6, 7, 0),          \
    gsSP1Triangle(2, 3, 7, 0),          \
    gsSP1Triangle(3, 7, 8, 0),          \
    gsSP1Triangle(3, 4, 8, 0),          \
    gsSP1Triangle(4, 8, 9, 0)

    floorPatch(0),
    floorPatch(5),
    floorPatch(10),
    floorPatch(15),

    gsSPEndDisplayList(),
};