int main(int argc, char **argv) { // Create the game window and initalise the VIDEO subsystem GameWindow gwd; gwd.InitVideo(); gwd.SetBackground((GXColor){ 0, 30, 0, 255 }); // Initialise Wiimote WPAD_Init(); // Enable SD card stuff fatInitDefault(); // Create a rectangle representing the net and set its properties Quad net; net.SetPosition(320-2, 0); net.SetWidth(4); net.SetHeight(480); net.SetFillColor((GXColor){ 0, 255, 0, 255 }); // Create the two score boxes (x position, y position, width) ScoreBox firstScoreBox(35, 10, 250); ScoreBox secondScoreBox(355, 10, 250); // Create and spawn the first player Player firstPlayer; firstPlayer.spawn(0, 100); // Create and spawn the second player Player secondPlayer; secondPlayer.spawn(510, 610); // Create and spawn the ball (-3 seems like a good initial speed!) Ball theBall; theBall.spawn(-3); // Player 2 A.I. is turned on by default bool AImode = true; // This is the game's run loop. It is executed several times per second. while(1) { // Look for new Wii controllers WPAD_ScanPads(); // Handle controller events // Quit the game (break out of the runloop) if HOME is pressed if(WPAD_ButtonsDown(WPAD_CHAN_0)&WPAD_BUTTON_HOME) break; // Player 1 Controls if(WPAD_ButtonsHeld(WPAD_CHAN_0)&WPAD_BUTTON_DOWN) firstPlayer.pushDown(); if(WPAD_ButtonsHeld(WPAD_CHAN_0)&WPAD_BUTTON_UP) firstPlayer.pushUp(); if(WPAD_ButtonsHeld(WPAD_CHAN_0)&WPAD_BUTTON_LEFT) firstPlayer.pushLeft(); if(WPAD_ButtonsHeld(WPAD_CHAN_0)&WPAD_BUTTON_RIGHT) firstPlayer.pushRight(); // Player 2 Controls if(WPAD_ButtonsDown(WPAD_CHAN_1)&WPAD_BUTTON_PLUS) AImode = !AImode; // If AI is enabled, control Player 2 using the following code. if ( AImode ) { // Player 2 AI if (theBall.getYcoord()+10 < secondPlayer.getYcoord()+32) secondPlayer.pushUp(); else if (theBall.getYcoord()+10 > secondPlayer.getYcoord()+32) secondPlayer.pushDown(); } // If AI is disabled, let the Wii remote control Player 2. else { if(WPAD_ButtonsHeld(WPAD_CHAN_1)&WPAD_BUTTON_DOWN) secondPlayer.pushDown(); if(WPAD_ButtonsHeld(WPAD_CHAN_1)&WPAD_BUTTON_UP) secondPlayer.pushUp(); if(WPAD_ButtonsHeld(WPAD_CHAN_1)&WPAD_BUTTON_LEFT) secondPlayer.pushLeft(); if(WPAD_ButtonsHeld(WPAD_CHAN_1)&WPAD_BUTTON_RIGHT) secondPlayer.pushRight(); } // Handle all the game objects net.Draw(); // Draw the net firstScoreBox.Draw(); // Draw the first score box secondScoreBox.Draw(); // Draw the second score box // Draw the ball, then react if it bounced off the side of the screen. switch (theBall.Draw()) { // If the ball hit the left side of the screen... case -1: // Player 1 has failed if (secondScoreBox.incrementScore() == false) return 0; theBall.spawn(-3); // Reset ball going left firstPlayer.spawn(0, 100); break; // If the ball hit the right side of the screen... case +1: // Player 2 has failed if (firstScoreBox.incrementScore() == false) return 0; theBall.spawn(3); // Reset ball going rightward secondPlayer.spawn(510, 610); break; // If neither of the above cases happened... default: // Nobody failed! :) break; } firstPlayer.Draw(); // Draw Player 1 secondPlayer.Draw(); // Draw Player 2 // Tell the ball where each player is, so that it can react // to them if they are touching. theBall.deflectFromPlayer(&firstPlayer); theBall.deflectFromPlayer(&secondPlayer); // Draw the buffer to the screen and reset it. gwd.Flush(); // Increase our count of how many frames have been drawn. g_ticks++; } // The program has finished, so we return to the loader. return 0; }
int main(int argc, char **argv){ fatInitDefault();//Initialize the front SD for loading images // Create the game window and initalise the VIDEO subsystem gwd.InitVideo(); WPAD_Init(); //Initialize the Wiimote MP3Player_Init(); //Initialze the MP3 Player WPAD_SetDataFormat(WPAD_CHAN_0, WPAD_FMT_BTNS_ACC_IR);//Allows us to use the Wiimote pointer WPAD_SetPowerButtonCallback(doPadPowerOff);//Set up power button iball->LoadImage("/apps/Wiibreaker/data/ball.png"); ibrick->LoadImage("/apps/Wiibreaker/data/brick.png"); ibrick2->LoadImage("/apps/Wiibreaker/data/black.png"); ibrick3->LoadImage("/apps/Wiibreaker/data/blue.png"); ibrick4->LoadImage("/apps/Wiibreaker/data/gray.png"); ibrick5->LoadImage("/apps/Wiibreaker/data/green.png"); ibrick6->LoadImage("/apps/Wiibreaker/data/orange.png"); ibrick7->LoadImage("/apps/Wiibreaker/data/red.png"); ipaddle->LoadImage("/apps/Wiibreaker/data/paddle.png"); background1->LoadImage("/apps/Wiibreaker/data/background1.png"); background2->LoadImage("/apps/Wiibreaker/data/background2.png"); background3->LoadImage("/apps/Wiibreaker/data/background3.png"); pointer->LoadImage("/apps/Wiibreaker/data/pointer.png"); shutdown = false; for(int i = 0; i < 30; i++){ brick[i] = new Sprite(); } ball->SetImage(iball); paddle->SetImage(ipaddle); Pointer->SetImage(pointer); LoadHighscores(); while(true){ firsthit = false; rows = 0; reset = 1; Menu(); score = 0; lives = 3; helpescape = 0; if(quit == 1) break; ballx = 320 - (ball->GetWidth()/2); bally = 300; holdball = 0; balldir = rand() % 2 + 1; if(controlscheme == 0 || controlscheme == 2) paddle->SetRotation(0); if(controlscheme == 0 || controlscheme == 2) paddlex = 320 - (paddle->GetWidth()/2); if(controlscheme == 0 || controlscheme == 2) paddley = 400; if(controlscheme == 1) paddle->SetPosition(0, 0); wait = 0; if(mode == 3) leveleditor(); for(;;) { WPAD_ScanPads(); Background->Draw(); if(reset == 1 && wait == 0){ bricksetup(); resetb(); } for(int i = 0; i < 30; i++){ if(alive[i] == true){ brick[i]->SetPosition(brickx[i], bricky[i]); brick[i]->Draw(); } } updateball(); ball->SetPosition(ballx, bally); ball->Draw(); //Get Controller Input if(controlscheme == 0){ WPAD_Expansion(WPAD_CHAN_0, &exp); exp.type = WPAD_EXP_NUNCHUK; //Get rid of controller interference WPADData* data = WPAD_Data(WPAD_CHAN_0); switch (data->exp.type) { case WPAD_EXP_NUNCHUK: if(WPAD_ButtonsHeld(WPAD_CHAN_0)&WPAD_NUNCHUK_BUTTON_C) paddlex -= 8; if(WPAD_ButtonsHeld(WPAD_CHAN_0)&WPAD_NUNCHUK_BUTTON_Z) paddlex += 8; break; case WPAD_EXP_CLASSIC: if(WPAD_ButtonsHeld(WPAD_CHAN_0)&WPAD_CLASSIC_BUTTON_LEFT) paddlex -= 8; if(WPAD_ButtonsHeld(WPAD_CHAN_0)&WPAD_CLASSIC_BUTTON_RIGHT) paddlex += 8; break; } if((WPAD_ButtonsHeld(WPAD_CHAN_0)&WPAD_BUTTON_LEFT)||(WPAD_ButtonsHeld(WPAD_CHAN_0)&WPAD_BUTTON_UP) || ((exp.nunchuk.js.ang>=270-45 && exp.nunchuk.js.ang<=270+45) && exp.nunchuk.js.mag>=0.9)) paddlex -= 8; if((WPAD_ButtonsHeld(WPAD_CHAN_0)&WPAD_BUTTON_RIGHT)||(WPAD_ButtonsHeld(WPAD_CHAN_0)&WPAD_BUTTON_DOWN) || ((exp.nunchuk.js.ang>=90-45 && exp.nunchuk.js.ang<=90+45) && exp.nunchuk.js.mag>=0.9)) paddlex += 8; if(paddlex < 0) paddlex = 0; if(paddlex + paddle->GetWidth() > 640) paddlex = 640 - paddle->GetWidth(); paddle->SetPosition(paddlex, paddley); } if(controlscheme == 1){ // Infrared calculation - The X and Y of the wiimote sprite ir_t ir; // The struct for infrared WPAD_IR(WPAD_CHAN_0, &ir); // Let's get our infrared data // Give our sprite the positions and the angle. paddle->SetPosition(ir.sx-WSP_POINTER_CORRECTION_X, ir.sy-WSP_POINTER_CORRECTION_Y); // We use these constants to translate the position correctly to the screen paddle->Move(-((f32)paddle->GetWidth()/2), -((f32)paddle->GetHeight()/2)); // And these to make our image appear at the center of this position. paddle->SetRotation(ir.angle/2); // Set angle/2 to translate correctly } if(controlscheme == 2){ if(wait == 0){ WPAD_Expansion(WPAD_BALANCE_BOARD, &exp2);//Get data from the attached expansion (the balance board in this case) exp2.type = WPAD_EXP_WIIBOARD; x = exp2.wb.x; //Left Movements if(x < -4)//-4 paddlex -= 4; if(x < -8)//-7 paddlex -= 5; if(x < -13)//-9 paddlex -= 6; if(x < -15)//-11 paddlex -= 7; if(x < -18)//-13 paddlex -= 8; //Right Movements if(x > 4) paddlex += 4; if(x > 8) paddlex += 5; if(x > 13) paddlex += 6; if(x > 15) paddlex += 7; if(x > 18) paddlex += 8; if(paddlex < 0) paddlex = 0; if(paddlex + paddle->GetWidth() > 640) paddlex = 640 - paddle->GetWidth(); } paddle->SetPosition(paddlex, paddley); } if((WPAD_ButtonsDown(WPAD_CHAN_0)&WPAD_BUTTON_PLUS) || (WPAD_ButtonsDown(WPAD_CHAN_0)&WPAD_CLASSIC_BUTTON_PLUS)) pausegame(); paddle->Draw(); if((WPAD_ButtonsDown(WPAD_CHAN_0)&WPAD_BUTTON_HOME) || (WPAD_ButtonsDown(WPAD_CHAN_0)&WPAD_CLASSIC_BUTTON_HOME)) break; if(shutdown == true) SYS_ResetSystem( SYS_POWEROFF, 0, 0 ); if(rumblecounter == 7){ WPAD_Rumble(WPAD_CHAN_0, 0); rumblecounter = 0; } if(rumblecounter != 0) rumblecounter++; if(controlscheme == 2) wait++; if(wait > 1) wait = 0; gwd.Flush(); checkforreset(); if(lives <= 0) break; if(holdball < 15) holdball++; if(sound && !MP3Player_IsPlaying()){ MP3Player_Stop(); if(sound == 1){ MP3Player_PlayBuffer(Peter_de_Man___Lightwaves_d090128_mp3, Peter_de_Man___Lightwaves_d090128_mp3_size, NULL); } if(sound == 2){ MP3Player_PlayBuffer(Peter_de_Man___Cyborgs_Trip_d090128_mp3, Peter_de_Man___Cyborgs_Trip_d090128_mp3_size, NULL); } } } WPAD_Rumble(WPAD_CHAN_0, 0); switch(mode){ case 1: switch(controlscheme){ case 0: if(score > scores[0]) scores[0] = score; break; case 1: if(score > scores[1]) scores[1] = score; break; case 2: if(score > scores[2]) scores[2] = score; break; } break; case 2: switch(controlscheme){ case 0: if(score > scores[3]) scores[3] = score; break; case 1: if(score > scores[4]) scores[4] = score; break; case 2: if(score > scores[5]) scores[5] = score; break; } break; } SaveHighscores(); } return 0; }
void Menu(){ bool firstmp3 = false; print.setFont(font_ttf, font_ttf_size); print.setSize(32); print.setColor(Color::Color(255,40,40)); Text.SetPosition(100, 50); Text.SetImage(&print); while(true){ WPAD_ScanPads(); if(rows == 2) Background->Draw(); if(background != 0 && rows == 2) print.setColor(Color::Color(0,0,0)); if(background == 0 || rows != 2) print.setColor(Color::Color(0,255,255)); print.printf(" WiiBreaker\n\n"); if(background == 0 || rows != 2) print.setColor(Color::Color(255,40,40)); print.printf("Press A or Z to start\n"); print.printf("HOME to quit\n\n"); if(rows == 0){ print.printf("-->"); switch(mode){ case 1: print.printf(" Brickbreaker\n"); break; case 2: print.printf(" WiiBreaker\n"); break; case 3: print.printf(" Level Editor\n"); break; } } if(rows != 0){ switch(mode){ case 1: print.printf(" Brickbreaker\n"); break; case 2: print.printf(" WiiBreaker\n"); break; case 3: print.printf(" Level Editor\n"); break; } } if(rows == 1){ print.printf("-->"); switch(controlscheme){ case 0: print.printf(" Controls: Buttons\n"); break; case 1: print.printf(" Controls: IR Sensor\n"); break; case 2: print.printf(" Controls: Balance Board\n"); break; } } if(rows != 1){ switch(controlscheme){ case 0: print.printf(" Controls: Buttons\n"); break; case 1: print.printf(" Controls: IR Sensor\n"); break; case 2: print.printf(" Controls: Balance Board\n"); break; } } if(rows == 2){ print.printf("-->"); switch(background){ case 0: print.printf(" No Background\n"); Background->SetTransparency(0); break; case 1: print.printf(" Background 1\n"); Background->SetImage(background1); Background->SetTransparency(0xff); break; case 2: print.printf(" Background 2\n"); Background->SetImage(background2); break; case 3: print.printf(" Background 3\n"); Background->SetImage(background3); Background->SetTransparency(0xff); break; } } if(rows != 2){ switch(background){ case 0: print.printf(" No Background\n"); Background->SetTransparency(0); break; case 1: print.printf(" Background 1\n"); Background->SetImage(background1); Background->SetTransparency(0xff); break; case 2: print.printf(" Background 2\n"); Background->SetImage(background2); break; case 3: print.printf(" Background 3\n"); Background->SetImage(background3); Background->SetTransparency(0xff); break; } } if(rows == 3){ print.printf("-->"); switch(sound){ case 0: print.printf(" Music Off\n\n"); if(firstmp3 == true){ MP3Player_Stop(); firstmp3 = false; } break; case 1: print.printf(" Lightwaves\n\n"); if(firstmp3 == true){ MP3Player_Stop(); MP3Player_PlayBuffer(Peter_de_Man___Lightwaves_d090128_mp3, Peter_de_Man___Lightwaves_d090128_mp3_size, NULL); firstmp3 = false; } break; case 2: print.printf(" Cyborgs Trip\n\n"); if(firstmp3 == true){ MP3Player_Stop(); MP3Player_PlayBuffer(Peter_de_Man___Cyborgs_Trip_d090128_mp3, Peter_de_Man___Cyborgs_Trip_d090128_mp3_size, NULL); firstmp3 = false; } break; } } if(rows != 3){ switch(sound){ case 0: print.printf(" Music Off\n\n"); break; case 1: print.printf(" Lightwaves\n\n"); break; case 2: print.printf(" Cyborgs Trip\n\n"); } } print.printf("Score: %d\n", score); if(mode != 3){ switch(mode){ case 1: switch(controlscheme){ case 0: print.printf("HighScore: %d\n\n", scores[0]); break; case 1: print.printf("HighScore: %d\n\n", scores[1]); break; case 2: print.printf("HighScore: %d\n\n", scores[2]); break; } break; case 2: switch(controlscheme){ case 0: print.printf("HighScore: %d\n\n", scores[3]); break; case 1: print.printf("HighScore: %d\n\n", scores[4]); break; case 2: print.printf("HighScore: %d\n\n", scores[5]); break; } break; } } print.flush(); Text.Draw(); print.clear(); print.reset(); if(sound && !MP3Player_IsPlaying()){ MP3Player_Stop(); if(sound == 1){ MP3Player_PlayBuffer(Peter_de_Man___Lightwaves_d090128_mp3, Peter_de_Man___Lightwaves_d090128_mp3_size, NULL); } if(sound == 2){ MP3Player_PlayBuffer(Peter_de_Man___Cyborgs_Trip_d090128_mp3, Peter_de_Man___Cyborgs_Trip_d090128_mp3_size, NULL); } } WPAD_Expansion(WPAD_CHAN_0, &exp); exp.type = WPAD_EXP_NUNCHUK; if((WPAD_ButtonsDown(WPAD_CHAN_0)&WPAD_BUTTON_A) || (WPAD_ButtonsDown(WPAD_CHAN_0)&WPAD_NUNCHUK_BUTTON_Z) || (WPAD_ButtonsDown(WPAD_CHAN_0)&WPAD_CLASSIC_BUTTON_A)) break; if((WPAD_ButtonsDown(WPAD_CHAN_0)&WPAD_BUTTON_RIGHT) || (WPAD_ButtonsDown(WPAD_CHAN_0)&WPAD_CLASSIC_BUTTON_RIGHT) || ((exp.nunchuk.js.ang>=90-45 && exp.nunchuk.js.ang<=90+45) && exp.nunchuk.js.mag>=0.9)){ if(rows == 0) mode++; if(rows == 2) background++; if(rows == 1) controlscheme++; if(rows == 3){ sound++; firstmp3 = true; } } if((WPAD_ButtonsDown(WPAD_CHAN_0)&WPAD_BUTTON_LEFT) || (WPAD_ButtonsDown(WPAD_CHAN_0)&WPAD_CLASSIC_BUTTON_LEFT) || ((exp.nunchuk.js.ang>=270-45 && exp.nunchuk.js.ang<=270+45) && exp.nunchuk.js.mag>=0.9)){ if(rows == 0) mode--; if(rows == 2) background--; if(rows == 1) controlscheme--; if(rows == 3){ firstmp3 = true; sound--; } } if(mode > 3) mode = 1; if(mode < 1) mode = 3; if(sound < 0) sound = 2; if(sound > 2) sound = 0; if(background < 0) background = 3; if(background > 3) background = 0; if(controlscheme < 0) controlscheme = 2; if(controlscheme > 2) controlscheme = 0; if((WPAD_ButtonsDown(WPAD_CHAN_0)&WPAD_BUTTON_UP) || ((exp.nunchuk.js.ang>=315 || exp.nunchuk.js.ang<=45) && exp.nunchuk.js.mag>=.9) || (WPAD_ButtonsDown(WPAD_CHAN_0)&WPAD_CLASSIC_BUTTON_UP)) rows --; if((WPAD_ButtonsDown(WPAD_CHAN_0)&WPAD_BUTTON_DOWN) || ((exp.nunchuk.js.ang>=180-45 && exp.nunchuk.js.ang<=180+45) && exp.nunchuk.js.mag>=.9) || (WPAD_ButtonsDown(WPAD_CHAN_0)&WPAD_CLASSIC_BUTTON_DOWN)) rows ++; if(rows < 0) rows = 3; if(rows > 3) rows = 0; if((WPAD_ButtonsDown(WPAD_CHAN_0)&WPAD_BUTTON_HOME) || (WPAD_ButtonsDown(WPAD_CHAN_0)&WPAD_CLASSIC_BUTTON_HOME)){ quit = true; break; } if(shutdown == true) SYS_ResetSystem( SYS_POWEROFF, 0, 0 ); gwd.Flush(); } gwd.Flush(); }
void leveleditor(){ bool quiteditor = false; while(true){ if(quiteditor == true) break; resetb(); estartoff = false; while(true){ WPAD_ScanPads(); for(int i = 0; i < 30; i++){ if(selected[i] == true){ brickx[i] = Pointer->GetX(); bricky[i] = Pointer->GetY(); } } if(WPAD_ButtonsDown(WPAD_CHAN_0)&WPAD_BUTTON_A){ for(int i = 0; i < 30; i++){ if(Pointer->CollidesWith(brick[i])){ if(ibrick == brick[i]->GetImage()) Pointer->SetImage(ibrick); if(ibrick2 == brick[i]->GetImage()) Pointer->SetImage(ibrick2); if(ibrick3 == brick[i]->GetImage()) Pointer->SetImage(ibrick3); if(ibrick4 == brick[i]->GetImage()) Pointer->SetImage(ibrick4); if(ibrick5 == brick[i]->GetImage()) Pointer->SetImage(ibrick5); if(ibrick6 == brick[i]->GetImage()) Pointer->SetImage(ibrick6); if(ibrick7 == brick[i]->GetImage()) Pointer->SetImage(ibrick7); selected[i] = true; break; } } } if(WPAD_ButtonsHeld(WPAD_CHAN_0)&WPAD_BUTTON_UP){ for(int i = 0; i < 30; i++){ if(selected[i] == true){ brick[i]->SetImage(ibrick); Pointer->SetImage(ibrick); brickc[i] = 1; } } } if(WPAD_ButtonsHeld(WPAD_CHAN_0)&WPAD_BUTTON_RIGHT){ for(int i = 0; i < 30; i++){ if(selected[i] == true){ brick[i]->SetImage(ibrick3); Pointer->SetImage(ibrick3); brickc[i] = 3; } } } if(WPAD_ButtonsHeld(WPAD_CHAN_0)&WPAD_BUTTON_DOWN){ for(int i = 0; i < 30; i++){ if(selected[i] == true){ brick[i]->SetImage(ibrick5); Pointer->SetImage(ibrick5); brickc[i] = 5; } } } if(WPAD_ButtonsHeld(WPAD_CHAN_0)&WPAD_BUTTON_LEFT){ for(int i = 0; i < 30; i++){ if(selected[i] == true){ brick[i]->SetImage(ibrick7); Pointer->SetImage(ibrick7); brickc[i] = 7; } } } if((WPAD_ButtonsHeld(WPAD_CHAN_0)&WPAD_BUTTON_UP) && (WPAD_ButtonsHeld(WPAD_CHAN_0)&WPAD_BUTTON_RIGHT)){ for(int i = 0; i < 30; i++){ if(selected[i] == true){ brick[i]->SetImage(ibrick2); Pointer->SetImage(ibrick2); brickc[i] = 2; } } } if((WPAD_ButtonsHeld(WPAD_CHAN_0)&WPAD_BUTTON_DOWN) && (WPAD_ButtonsHeld(WPAD_CHAN_0)&WPAD_BUTTON_RIGHT)){ for(int i = 0; i < 30; i++){ if(selected[i] == true){ brick[i]->SetImage(ibrick4); Pointer->SetImage(ibrick4); brickc[i] = 4; } } } if((WPAD_ButtonsHeld(WPAD_CHAN_0)&WPAD_BUTTON_DOWN) && (WPAD_ButtonsHeld(WPAD_CHAN_0)&WPAD_BUTTON_LEFT)){ for(int i = 0; i < 30; i++){ if(selected[i] == true){ brick[i]->SetImage(ibrick6); Pointer->SetImage(ibrick6); brickc[i] = 6; } } } if(WPAD_ButtonsHeld(WPAD_CHAN_0)&WPAD_BUTTON_B){ for(int i = 0; i < 30; i++){ if(selected[i] == true){ Pointer->SetImage(pointer); selected[i] = false; } } } if((WPAD_ButtonsDown(WPAD_CHAN_0)&WPAD_BUTTON_1) && (WPAD_ButtonsDown(WPAD_CHAN_0)&WPAD_BUTTON_2)){ estartoff = true; resetb(); estartoff = false; } if(WPAD_ButtonsDown(WPAD_CHAN_0)&WPAD_BUTTON_HOME){ quiteditor = true; break; } if(WPAD_ButtonsDown(WPAD_CHAN_0)&WPAD_BUTTON_MINUS) SavePattern(); if(WPAD_ButtonsDown(WPAD_CHAN_0)&WPAD_BUTTON_PLUS) LoadPattern(); ir_t ir; // The struct for infrared WPAD_IR(WPAD_CHAN_0, &ir); // Let's get our infrared data Pointer->SetPosition(ir.sx-WSP_POINTER_CORRECTION_X, ir.sy-WSP_POINTER_CORRECTION_Y); Pointer->Move(-((f32)Pointer->GetWidth()/2), -((f32)Pointer->GetHeight()/2)); Pointer->Draw(); for(int i = 0; i < 30; i++){ brick[i]->SetPosition(brickx[i], bricky[i]); brick[i]->Draw(); } if(shutdown == true) SYS_ResetSystem( SYS_POWEROFF, 0, 0 ); if(sound && !MP3Player_IsPlaying()){ MP3Player_Stop(); if(sound == 1){ MP3Player_PlayBuffer(Peter_de_Man___Lightwaves_d090128_mp3, Peter_de_Man___Lightwaves_d090128_mp3_size, NULL); } if(sound == 2){ MP3Player_PlayBuffer(Peter_de_Man___Cyborgs_Trip_d090128_mp3, Peter_de_Man___Cyborgs_Trip_d090128_mp3_size, NULL); } } gwd.Flush(); } } }