//================================================================ // #include's //================================================================ #include #include "Mypad.h" #include "Header.h" #include "Rand.h" //================================================================ // #define's //================================================================ #define BLOCK_ADDRESS 0x80090000 #define BACKGROUND_ADDRESS 0x80091214 #define FONT_ADDRESS 0x800c1228 #define WELL_ADDRESS 0x800c6e48 #define ROY_ADDRESS 0x800ca488 #define BEN_ADDRESS 0x800cc9cc #define MENU_ADDRESS 0x800cef10 #define LOGO_ADDRESS 0x800d0c30 #define GAMEOVER_ADDRESS 0x800d2c44 #define OT_LENGTH 3 /* Ordering table number*/ #define PACKETMAX 2048 /* Max GPU packets */ #define PACKETMAX2 (PACKETMAX*24) #ifndef TRUE #define TRUE 1 #define FALSE 0 #endif #define scaleRotate(_s,_x,_y,_r) (_s)->scalex += (_x), (_s)->scaley += (_y), (_s)->rotate += (_r) #define setRGB(_s,_r,_g,_b) (_s)->r = (_r), (_s)->g = (_g), (_s)->b = (_b) #define NO_BLOCK 128 //================================================================ // Global variables //================================================================ GsIMAGE SpriteTextureInfo; GsIMAGE BackGroundTextureInfo; GsOT WorldOT[2]; // Ordering table related variables GsOT_TAG OTTags[2][1<>2); logo.r = logo.g = logo.b = i>>1; logo.scalex = ONE + (255-i)*80; logo.scaley = ONE + (255-i)*80; logo.rotate = (255-i) * 8192; GsSortSprite(&logo, &WorldOT[activeBuff], 0); DrawSync(0); VSync(0); GsSwapDispBuff(); setRECT(&rect,0,(1-activeBuff)*256,384,256); LoadImage(&rect, BackGroundTextureInfo.pixel); DrawSync(0); GsDrawOt(&WorldOT[activeBuff]); } logo.x = 192; logo.y = 34; logo.u = 0; logo.v = 128; logo.w = 64; logo.h = 64; logo.mx = 32; logo.my = 32; logo.scalex = ONE; logo.scaley = ONE; logo.rotate = 0; do { pad = PadRead(); activeBuff = GsGetActiveBuff(); GsSetWorkBase((PACKET *)packetArea[activeBuff]); GsClearOt(0, 0, &WorldOT[activeBuff]); if ((pad & PADLup)==0 && (pad & PADLdown)==0) repeat = 0; if (option == 1) { if (pad & PADLleft) players = 1; if (pad & PADLright) players = 2; } if (pad & PADLX) { if (option == 0) { if (pad & PADLleft) GsDISPENV.screen.x--; if (pad & PADLright) GsDISPENV.screen.x++; if (pad & PADLup) GsDISPENV.screen.y--; if (pad & PADLdown) GsDISPENV.screen.y++; } if (option == 2) { do { pad = PadRead(); } while ((pad & PADLX) != 0); PlayGame(players); break; } if (option == 3) { CoolFade(16, -512, 128, 190, 126); exit(0); } } else { if (pad & PADLup) { if (repeat == 0) { repeat = 16; if (--option<0) option = 3; } else repeat--; } if (pad & PADLdown) { if (repeat == 0) { repeat = 16; if (++option>3) option = 0; } else repeat--; } } wellsprite.scalex = ONE; wellsprite.x = 11; wellsprite.y = 27; GsSortSprite(&wellsprite, &WorldOT[activeBuff], 5); wellsprite.scalex = -ONE; wellsprite.x = 373; wellsprite.y = 27; GsSortSprite(&wellsprite, &WorldOT[activeBuff], 5); GsSortSprite(&logo, &WorldOT[activeBuff], 0); for (i=0; i<4; i++) { if (i == option) menu.r = menu.g = menu.b = 128; else menu.r = menu.g = menu.b = 48; menu.x = 192; menu.y = i*24+104; menu.v = i*18; GsSortSprite(&menu, &WorldOT[activeBuff], 0); } if (option == 1) font.r = font.g = font.b = 128; else font.r = font.g = font.b = 64; font.x = 210; font.y = 127; font.u = players*16; GsSortSprite(&font, &WorldOT[activeBuff], 0); DrawSync(0); VSync(0); GsSwapDispBuff(); setRECT(&rect,0,(1-activeBuff)*256,384,256); LoadImage(&rect, BackGroundTextureInfo.pixel); DrawSync(0); GsDrawOt(&WorldOT[activeBuff]); } while (1); } while (1); } //================================================================ // Game Function //================================================================ void PlayGame(int players) { blocks blockPair1, nextBlockPair1; blocks blockPair2, nextBlockPair2; RECT rect; int frame1 = 0; int frame2 = 0; int i, player, y; // Loop variable int activeBuff; // Display buffer pointer int rotate1 = 0, rotate2 = 0; // Block orientation int padLRCount1 = 0, padRotCount1 = 0; // Controller repeat delays int padLRCount2 = 0, padRotCount2 = 0; int frameEnded; u_long pad; int event1 = 0; // Event id int event2 = 0; // 0 = normal // 1 = dropping // 2 = smashing for (i = 0; i < 2; i++) { chain[i] = 0; downFlag[i] = 0; toDrop[i] = 0; blackOffset[i] = 0; } GsClearOt(0,0,&WorldOT[0]); GsClearOt(0,0,&WorldOT[1]); InitWell(); gameOver = 0; numSmashed = 0; NewBlockPair(&nextBlockPair1, 1); NewBlockPair(&blockPair1, 1); NewBlockPair(&nextBlockPair2, 2); NewBlockPair(&blockPair2, 2); //================================================================ // Main Loop //================================================================ do { pad = PadRead(); activeBuff = GsGetActiveBuff(); GsSetWorkBase((PACKET *)packetArea[activeBuff]); GsClearOt(0, 0, &WorldOT[activeBuff]); // PLAYER 1 // If everything is normal if (event1 == 0) { frame1++; DealWithButtonPresses1(pad, &blockPair1, &padLRCount1, &padRotCount1, &rotate1, &frame1); if (frame1 >= 32) { frame1 = 0; blockPair1.y1++; blockPair1.y2++; } } // Check for block collisions if (frame1==0 && event1==0 && (well[blockPair1.x1][blockPair1.y1]!=NO_BLOCK || well[blockPair1.x2][blockPair1.y2]!=NO_BLOCK)) { padLRCount1 = 0; padRotCount1 = 0; frame1 = 0; rotate1 = 0; well[blockPair1.x1][blockPair1.y1-1] = blockPair1.col1; well[blockPair1.x2][blockPair1.y2-1] = blockPair1.col2; blockPair1 = nextBlockPair1; NewBlockPair(&nextBlockPair1, 1); // Drop the blocks event1 = DropBlocks(1); } else { if (event1 == 1) event1= DropBlocks(1); } // PLAYER 2 if (players == 2) { // If everything is normal if (event2 == 0) { // Fall delay frame2++; DealWithButtonPresses2(pad, &blockPair2, &padLRCount2, &padRotCount2, &rotate2, &frame2); if (frame2 >= 32) { frame2 = 0; blockPair2.y1++; blockPair2.y2++; } } // Check for block collisions if (frame2==0 && event2==0 && (well[blockPair2.x1][blockPair2.y1]!=NO_BLOCK || well[blockPair2.x2][blockPair2.y2]!=NO_BLOCK)) { padLRCount2 = 0; padRotCount2 = 0; frame2 = 0; rotate2 = 0; well[blockPair2.x1][blockPair2.y1-1] = blockPair2.col1; well[blockPair2.x2][blockPair2.y2-1] = blockPair2.col2; blockPair2 = nextBlockPair2; NewBlockPair(&nextBlockPair2, 2); // Drop the blocks event2 = DropBlocks(2); } else { if (event2 == 1) event2 = DropBlocks(2); } } // Draw well boundries wellsprite.scalex = ONE; wellsprite.x = 11; wellsprite.y = 27; GsSortSprite(&wellsprite, &WorldOT[activeBuff], 5); wellsprite.scalex = -ONE; wellsprite.x = 373; wellsprite.y = 27; GsSortSprite(&wellsprite, &WorldOT[activeBuff], 5); // Draw Characters player1.x = 156; player1.y = 240; GsSortSprite(&player1, &WorldOT[activeBuff], 6); player2.scalex = -ONE; player2.x = 228; player2.y = 240; GsSortSprite(&player2, &WorldOT[activeBuff], 7); GsSortSprite(&logo, &WorldOT[activeBuff], 0); DrawBlockPair(&block, &blockPair1, &nextBlockPair1, &blockPair2, &nextBlockPair2, activeBuff, event1, event2); DrawWell(&block, activeBuff); frameEnded = 0; for (i=0; i8) smash.x += 108-21; smash.y = smashedBlocks.y[i]*16+32+8; smash.u = smashedBlocks.col[i]*16; smash.scalex = smashedBlocks.frame[i]*512+4096; smash.scaley = smashedBlocks.frame[i]*512+4096; smash.rotate = smashedBlocks.frame[i]*4096*8; smash.r = smash.g = smash.b = 128-smashedBlocks.frame[i]*4; GsSortSprite(&smash, &WorldOT[activeBuff], 0); smashedBlocks.frame[i]++; if (smashedBlocks.frame[i] == 32) frameEnded++; if (smashedBlocks.frame[i] == 16) { if (smashedBlocks.player[i] == 0) event1 = 1; else event2 = 1; } } if (frameEnded) { numSmashed -= frameEnded; MoveLeft(frameEnded); } // Draw counter blocks for (player=0; player<2; player++) { i = toDrop[player]; y = 236; block.x = 18+player*333; block.scalex = 4096; block.scaley = 4096; block.u = 16; while (i>5) { y -= 8; block.y = y; GsSortSprite(&block, &WorldOT[activeBuff], 0); i -= 6; y -= 8; } block.x = 26+player*325; block.scalex = 2048; block.scaley = 2048; block.u = 48; while (i>0) { block.y = y; GsSortSprite(&block, &WorldOT[activeBuff], 0); i--; y -= 8; } } block.scalex = 4096; block.scaley = 4096; //font.x = 160; //font.y = 128; //font.u = 0; //font.v = 0; //GsSortSprite(&font, &WorldOT[activeBuff], 0); vSync = VSync(-1); VSync(0); GsSwapDispBuff(); setRECT(&rect,0,(1-activeBuff)*256,384,256); LoadImage(&rect, BackGroundTextureInfo.pixel); DrawSync(0); GsDrawOt(&WorldOT[activeBuff]); // FntPrint(0,"%d\t%d\n", chain[0], chain[1]); // FntFlush(-1); } while (!gameOver); GameOver(gameOver); CoolFade(16, 512, 128, 192, 128); } //================================================================ // Functions //================================================================ void MoveLeft(int shift) { int i; for (i=0; ix = x*16 + 21; block->y = y*16 + 32; block->u = blockCol*16; GsSortSprite(block, &WorldOT[activeBuff], 1); } } for (x=9; x<15; x++) { blockCol = well[x][y]; if (blockCol != NO_BLOCK) { block->x = x*16 + 108; block->y = y*16 + 32; block->u = blockCol*16; GsSortSprite(block, &WorldOT[activeBuff], 1); } } } } void DrawBlockPair(GsSPRITE *block, blocks *blockPair1, blocks *nextBlockPair1, blocks *blockPair2, blocks *nextBlockPair2, int activeBuff, int event1, int event2) { if (event1 == 0) { block->x = blockPair1->x1*16+21; block->y = blockPair1->y1*16+32; block->u = blockPair1->col1*16; GsSortSprite(block, &WorldOT[activeBuff], 1); block->x = blockPair1->x2*16+21; block->y = blockPair1->y2*16+32; block->u = blockPair1->col2*16; GsSortSprite(block, &WorldOT[activeBuff], 1); if (vSync & 1) { block->u = 128; GsSortSprite(block, &WorldOT[activeBuff], 0); } } if (event2 == 0) { block->x = blockPair2->x1*16+108; block->y = blockPair2->y1*16+32; block->u = blockPair2->col1*16; GsSortSprite(block, &WorldOT[activeBuff], 1); block->x = blockPair2->x2*16+108; block->y = blockPair2->y2*16+32; block->u = blockPair2->col2*16; GsSortSprite(block, &WorldOT[activeBuff], 1); if (vSync & 1) { block->u = 128; GsSortSprite(block, &WorldOT[activeBuff], 0); } } block->x = 16; block->y = 32; block->u = nextBlockPair1->col1*16; GsSortSprite(block, &WorldOT[activeBuff], 1); block->x = 16; block->y = 48; block->u = nextBlockPair1->col2*16; GsSortSprite(block, &WorldOT[activeBuff], 1); block->x = 384-31; block->y = 32; block->u = nextBlockPair2->col1*16; GsSortSprite(block, &WorldOT[activeBuff], 1); block->x = 384-31; block->y = 48; block->u = nextBlockPair2->col2*16; GsSortSprite(block, &WorldOT[activeBuff], 1); } int DropBlocks(int player) { int x, y, flag=0; int offset; offset = (player-1)*8; if (toDrop[player-1]>5) { toDrop[player-1] -= 6; MoveUp(player); } for (y=12; y>0; y--) { for (x=1+offset; x<=6+offset; x++) { if ((well[x][y]==NO_BLOCK) && (well[x][y-1]!=NO_BLOCK)) { well[x][y] = well[x][y-1]; well[x][y-1] = NO_BLOCK; flag = 1; } } } if (flag == 0) flag = SmashBlocks(player); if (flag == 0) { if (well[offset+4][0]!=NO_BLOCK || well[offset+4][1]!=NO_BLOCK) gameOver = player; } return(flag); } int SmashBlocks(int player) { int x, y, col, count, flag=0; int offset = (player-1)*8; int checkWell[8][14]; int checkWell2[8][14]; int tempWell[8][14]; // Initialise checking well and temporary well for (y=0; y<14; y++) { for (x=0; x<8; x++) { checkWell2[x][y] = 0; tempWell[x][y] = well[x+offset][y]; } } for (y=0; y<13; y++) { for (x=1; x<=6; x++) { col = tempWell[x][y]; if (col>0 && col!=NO_BLOCK) { count = 0; if (tempWell[x+1][y] == col) count++; if (tempWell[x-1][y] == col) count++; if (tempWell[x][y+1] == col) count++; if (y>0 && tempWell[x][y-1] == col) count++; checkWell[x][y] = count; } } } for (y=0; y<13; y++) { for (x=1; x<=6; x++) { col = tempWell[x][y]; if (col>0 && col!=NO_BLOCK) { count = checkWell[x][y]; if (tempWell[x+1][y] == col) count += checkWell[x+1][y]; if (tempWell[x-1][y] == col) count += checkWell[x-1][y]; if (tempWell[x][y+1] == col) count += checkWell[x][y+1]; if (y>0 && tempWell[x][y-1] == col) count += checkWell[x][y-1]; checkWell2[x][y] = count; } } } count = 0; for (y=0; y<13; y++) { for (x=1; x<=6; x++) { col = tempWell[x][y]; flag &= 2; if (col>0 && col!=NO_BLOCK){ if (checkWell2[x][y]>4) flag |= 1; if (tempWell[x+1][y]==col && checkWell2[x+1][y]>4) flag |= 1; if (tempWell[x-1][y]==col && checkWell2[x-1][y]>4) flag |= 1; if (tempWell[x][y+1]==col && checkWell2[x][y+1]>4) flag |= 1; if (y>0 && tempWell[x][y-1]==col && checkWell2[x][y-1]>4) flag |= 1; if (flag & 1) { if (tempWell[x+1][y]==0) { AddSmashed(x+1, y, 0, offset); tempWell[x+1][y] = NO_BLOCK; } if (tempWell[x-1][y]==0) { AddSmashed(x-1, y, 0, offset); tempWell[x-1][y] = NO_BLOCK; } if (tempWell[x][y+1]==0) { AddSmashed(x, y+1, 0, offset); tempWell[x][y+1] = NO_BLOCK; } if (y>0 && tempWell[x][y-1]==0) { AddSmashed(x, y-1, 0, offset); tempWell[x][y-1] = NO_BLOCK; } count++; AddSmashed(x, y, col, offset); flag |= 2; } } } } if (flag & 2) { chain[player-1]++; toDrop[2-player] += (count-3)*chain[player-1]; } else chain[player-1] = 0; downFlag[player-1] = 1; return(flag & 2); } void AddSmashed(int x, int y, int col, int offset) { if (x>0 && x<7 && y>=0 && y<13) { well[x+offset][y] = NO_BLOCK; smashedBlocks.x[numSmashed] = x+offset; smashedBlocks.y[numSmashed] = y; smashedBlocks.col[numSmashed] = col; smashedBlocks.frame[numSmashed] = 0; smashedBlocks.player[numSmashed] = offset>>3; numSmashed++; } } void InitWell(void) { int x,y; // Clear well for (y=0; y<14; y++) { for (x=0; x<16; x++) well[x][y] = NO_BLOCK; } // Set up sides of well for (y=0; y<14; y++) { well[0][y] = 8; well[7][y] = 8; well[8][y] = 8; well[15][y] = 8; } // Set up base of well for (x=0; x<16; x++) well[x][13] = 8; } // I know it uses a lot of call by references, but it neatens up the main loop so I can't be arsed void DealWithButtonPresses1(int pad, blocks *blockPair, int *padLRCount, int *padRotCount, int *rotate, int *frame) { blocks tempBlockPair; int tempRotate; tempBlockPair = *blockPair; tempRotate = *rotate; if (*padLRCount == 0) { // Move block pair left if (pad & PADLleft) { blockPair->x1--; blockPair->x2--; } // Move block pair right if (pad & PADLright) { blockPair->x1++; blockPair->x2++; } } if (*padRotCount == 0) { // Rotate block pair clockwise if (pad & PADLX) { tempRotate = (tempRotate+1) & 3; switch(tempRotate) { case 0: blockPair->x1 = blockPair->x2 ; blockPair->y1 = blockPair->y2-1;break; case 1: blockPair->x1 = blockPair->x2-1; blockPair->y1 = blockPair->y2 ;break; case 2: blockPair->x1 = blockPair->x2 ; blockPair->y1 = blockPair->y2+1;break; case 3: blockPair->x1 = blockPair->x2+1; blockPair->y1 = blockPair->y2 ;break; } } // Rotate block pair anti-clockwise if (pad & PADLO) { tempRotate = (tempRotate-1) & 3; switch(tempRotate) { case 0: blockPair->x1 = blockPair->x2 ; blockPair->y1 = blockPair->y2-1;break; case 1: blockPair->x1 = blockPair->x2-1; blockPair->y1 = blockPair->y2 ;break; case 2: blockPair->x1 = blockPair->x2 ; blockPair->y1 = blockPair->y2+1;break; case 3: blockPair->x1 = blockPair->x2+1; blockPair->y1 = blockPair->y2 ;break; } } } if (well[blockPair->x1][blockPair->y1]!=NO_BLOCK || well[blockPair->x2][blockPair->y2]!=NO_BLOCK) *blockPair = tempBlockPair; else *rotate = tempRotate; // Drop block pair if (pad & PADLdown) { if (downFlag[0]==0) { *frame = 0; blockPair->y1++; blockPair->y2++; } } else downFlag[0]=0; // Repeat delay handler (left & right) if ((pad & PADLleft) || (pad & PADLright)) *padLRCount = (*padLRCount+1) & 7; else *padLRCount = 0; // Repeat delay handler (X & O) if ((pad & PADLX) || (pad & PADLO)) *padRotCount = (*padRotCount+1) & 7; else *padRotCount = 0; } // I know it uses a lot of call by references, but it neatens up the main loop so I can't be arsed void DealWithButtonPresses2(int pad, blocks *blockPair, int *padLRCount, int *padRotCount, int *rotate, int *frame) { blocks tempBlockPair; int tempRotate; tempBlockPair = *blockPair; tempRotate = *rotate; if (*padLRCount == 0) { // Move block pair left if (pad & PADRleft) { blockPair->x1--; blockPair->x2--; } // Move block pair right if (pad & PADRright) { blockPair->x1++; blockPair->x2++; } } if (*padRotCount == 0) { // Rotate block pair clockwise if (pad & PADRX) { tempRotate = (tempRotate+1) & 3; switch(tempRotate) { case 0: blockPair->x1 = blockPair->x2 ; blockPair->y1 = blockPair->y2-1;break; case 1: blockPair->x1 = blockPair->x2-1; blockPair->y1 = blockPair->y2 ;break; case 2: blockPair->x1 = blockPair->x2 ; blockPair->y1 = blockPair->y2+1;break; case 3: blockPair->x1 = blockPair->x2+1; blockPair->y1 = blockPair->y2 ;break; } } // Rotate block pair anti-clockwise if (pad & PADRO) { tempRotate = (tempRotate-1) & 3; switch(tempRotate) { case 0: blockPair->x1 = blockPair->x2 ; blockPair->y1 = blockPair->y2-1;break; case 1: blockPair->x1 = blockPair->x2-1; blockPair->y1 = blockPair->y2 ;break; case 2: blockPair->x1 = blockPair->x2 ; blockPair->y1 = blockPair->y2+1;break; case 3: blockPair->x1 = blockPair->x2+1; blockPair->y1 = blockPair->y2 ;break; } } } if (well[blockPair->x1][blockPair->y1]!=NO_BLOCK || well[blockPair->x2][blockPair->y2]!=NO_BLOCK) *blockPair = tempBlockPair; else *rotate = tempRotate; // Drop block pair if (pad & PADRdown) { if (downFlag[1]==0) { *frame = 0; blockPair->y1++; blockPair->y2++; } } else downFlag[1]=0; // Repeat delay handler (left & right) if ((pad & PADRleft) || (pad & PADRright)) *padLRCount = (*padLRCount+1) & 7; else *padLRCount = 0; // Repeat delay handler (X & O) if ((pad & PADRX) || (pad & PADRO)) *padRotCount = (*padRotCount+1) & 7; else *padRotCount = 0; } void CoolFade(u_long scale, long rotate, u_long length, short x, short y) { int i, j; int activeBuff = GsGetActiveBuff(); GsSPRITE leftSprite, rightSprite; RECT rect; u_long row[160]; // Now using seperate sprites for each area of the screen leftSprite.attribute = (1<<25)+(1<<30); leftSprite.x = x; leftSprite.y = y; leftSprite.w = 256; leftSprite.h = 256; leftSprite.u = 0; leftSprite.v = 0; leftSprite.mx = 192; leftSprite.my = 128; leftSprite.scalex = ONE; leftSprite.scaley = ONE; leftSprite.rotate = 0; rightSprite.attribute = (1<<25)+(1<<30); rightSprite.x = x; rightSprite.y = y; rightSprite.w = 128; rightSprite.h = 256; rightSprite.u = 0; rightSprite.v = 0; rightSprite.mx = -64; rightSprite.my = 128; rightSprite.scalex = ONE; rightSprite.scaley = ONE; rightSprite.rotate = 0; setRGB(&leftSprite, 128, 128, 128); setRGB(&rightSprite, 128, 128, 128); setRECT(&rect, 0, activeBuff<<8, 384, 256); MoveImage(&rect, 0, (1-activeBuff)<<8); // For every y value in each frame buffer (buffer 0 is 0->255, buffer 1 is 256->511) // grab a row of pixels and set the transparency bit. Not a quick as the old method :( // but uses much less memory :) setRECT(&rect, 0, 0, 320, 1); for (j=0; j<512; j++) { rect.y = j; StoreImage(&rect, row); DrawSync(0); for (i=0; i<160; i++) row[i] |= (1<<15) + (1<<31); LoadImage(&rect, row); DrawSync(0); } for (i=0; i>1)) { setRGB(&leftSprite, 127, 127, 127); setRGB(&rightSprite, 127, 127, 127); } scaleRotate(&leftSprite, scale, scale, rotate); scaleRotate(&rightSprite, scale, scale, rotate); leftSprite.tpage = GetTPage(2,3,0,activeBuff<<8); GsSortSprite(&leftSprite, &WorldOT[activeBuff], 0); rightSprite.tpage = GetTPage(2,3,256,activeBuff<<8); GsSortSprite(&rightSprite, &WorldOT[activeBuff], 0); DrawSync(0); VSync(0); GsSwapDispBuff(); GsDrawOt(&WorldOT[activeBuff]); } } void GameOver(int player) { int count, y, v=0, h=-13, i; int activeBuff, frameEnded; RECT rect; if (player == 1) weight.x = 156; else weight.x = 228; for (count=0; count<100; count++) { activeBuff = GsGetActiveBuff(); GsSetWorkBase((PACKET *)packetArea[activeBuff]); GsClearOt(0, 0, &WorldOT[activeBuff]); h += v; v += 1; if (h>240) h = 240; // Draw well boundries wellsprite.scalex = ONE; wellsprite.x = 11; wellsprite.y = 27; GsSortSprite(&wellsprite, &WorldOT[activeBuff], 5); wellsprite.scalex = -ONE; wellsprite.x = 373; wellsprite.y = 27; GsSortSprite(&wellsprite, &WorldOT[activeBuff], 5); // Draw Characters player1.x = 156; player1.y = 240; GsSortSprite(&player1, &WorldOT[activeBuff], 6); player2.scalex = -ONE; player2.x = 228; player2.y = 240; GsSortSprite(&player2, &WorldOT[activeBuff], 6); GsSortSprite(&logo, &WorldOT[activeBuff], 0); DrawWell(&block, activeBuff); frameEnded = 0; for (i=0; i8) smash.x += 108-21; smash.y = smashedBlocks.y[i]*16+32+8; smash.u = smashedBlocks.col[i]*16; smash.scalex = smashedBlocks.frame[i]*512+4096; smash.scaley = smashedBlocks.frame[i]*512+4096; smash.rotate = smashedBlocks.frame[i]*4096*8; smash.r = smash.g = smash.b = 128-smashedBlocks.frame[i]*4; GsSortSprite(&smash, &WorldOT[activeBuff], 0); smashedBlocks.frame[i]++; if (smashedBlocks.frame[i] == 32) frameEnded++; if (smashedBlocks.frame[i] == 16) { } } if (frameEnded) { numSmashed -= frameEnded; MoveLeft(frameEnded); } // Draw counter blocks for (player=0; player<2; player++) { i = toDrop[player]; y = 236; block.x = 18+player*333; block.scalex = 4096; block.scaley = 4096; block.u = 16; while (i>5) { y -= 8; block.y = y; GsSortSprite(&block, &WorldOT[activeBuff], 0); i -= 6; y -= 8; } block.x = 26+player*325; block.scalex = 2048; block.scaley = 2048; block.u = 48; while (i>0) { block.y = y; GsSortSprite(&block, &WorldOT[activeBuff], 0); i--; y -= 8; } } block.scalex = 4096; block.scaley = 4096; weight.y = h; GsSortSprite(&weight, &WorldOT[activeBuff], 0); VSync(0); GsSwapDispBuff(); setRECT(&rect,0,(1-activeBuff)*256,384,256); LoadImage(&rect, BackGroundTextureInfo.pixel); DrawSync(0); GsDrawOt(&WorldOT[activeBuff]); } } u_long PadRead(void) { return(~(*(bb0+3) | *(bb0+2) << 8 | *(bb1+3) << 16 | *(bb1+2) << 24)); }