00001 #include <string.h>
00002 #include <stdlib.h>
00003
00004 #include <gccore.h>
00005 #include <wiiuse/wpad.h>
00006 #include <unistd.h>
00007
00008 #include "globals.h"
00009 #include "prototypes.h"
00010 #include "tetris_input.h"
00011
00012 #include "libwiigui/gui.h"
00013 #include "menu.h"
00014 #include "tetris_menu.h"
00015 #include "PowerupUtils.h"
00016
00017
00018 #define ROOT_MENU_MAX_INDEX 6
00019 #define ROOT_MENU_OPTIONS_INDEX 4
00020
00021 #define OPTIONS_MENU_MAX_INDEX 2
00022
00023 enum
00024 {
00025 TCYC_MENU_MP_NONE,
00026 TCYC_MENU_MP_EXIT,
00027 TCYC_MENU_MP_MAIN,
00028 TCYC_MENU_MP_GAME
00029 };
00030
00031 GuiSound *btnSoundOver;
00032 GuiSound *g_heartbeatSound;
00033 GuiSound *g_tetrisCheerSound;
00034
00035 GuiImageData *btnOutline;
00036 GuiImageData *btnOutlineOver;
00037 GuiImageData *btnLargeOutline;
00038 GuiImageData *btnLargeOutlineOver;
00039 GuiImageData *btnData40x40Square;
00040 GuiImageData *btnData40x40SquareOver;
00041 GuiImageData *btnData80x40;
00042 GuiImageData *btnData80x40Over;
00043 GuiImageData *btnDataMinus;
00044 GuiImageData *btnDataMinusOver;
00045 GuiImageData *btnDataPlus;
00046 GuiImageData *btnDataPlusOver;
00047 GuiImageData *tetrisLove;
00048 GuiImageData *grabber[MAX_PLAYERS];
00049 GuiImageData *debug_grabber1;
00050 GuiImageData *debug_grabber2;
00051 GuiImageData *debug_grabber3;
00052 GuiImageData *debug_grabber4;
00053
00054 GuiTrigger *trigA;
00055 GuiTrigger *trigHome;
00056
00057 void TCYC_MenuPlayerProfilesPopup();
00058 void TCYC_MenuMpOptionsPopup();
00059 void TCYC_MenuMpHandicapsPopup();
00060 void TCYC_MenuPowerupsPopup(GuiWindow *parentWindow,
00061 bool isPowerupEnabled[POWERUP_ID_MAX],
00062 PowerupId powerupStartQueue[MAX_ACQUIRED_POWERUPS]);
00063
00064 void TCYC_MenuInit()
00065 {
00066 btnSoundOver = new GuiSound(button_over_pcm, button_over_pcm_size, SOUND_PCM);
00067 g_heartbeatSound = new GuiSound(heartbeat_pcm, heartbeat_pcm_size, SOUND_PCM);
00068 g_tetrisCheerSound = new GuiSound(tetris_cheer_pcm, tetris_cheer_pcm_size, SOUND_PCM);
00069
00070 btnOutline = new GuiImageData(button_png);
00071 btnOutlineOver = new GuiImageData(button_over_png);
00072 btnLargeOutline = new GuiImageData(button_large_png);
00073 btnLargeOutlineOver = new GuiImageData(button_large_over_png);
00074 btnData40x40Square = new GuiImageData(keyboard_key_png);
00075 btnData40x40SquareOver = new GuiImageData(keyboard_key_over_png);
00076 btnData80x40 = new GuiImageData(keyboard_mediumkey_png);
00077 btnData80x40Over = new GuiImageData(keyboard_mediumkey_over_png);
00078 btnDataMinus = new GuiImageData(scrollbar_arrowdown_png);
00079 btnDataMinusOver = new GuiImageData(scrollbar_arrowdown_over_png);
00080 btnDataPlus = new GuiImageData(scrollbar_arrowup_png);
00081 btnDataPlusOver = new GuiImageData(scrollbar_arrowup_over_png);
00082 tetrisLove = new GuiImageData(tetris_love_png);
00083 grabber[0] = new GuiImageData(player1_grab_png);
00084 grabber[1] = new GuiImageData(player2_grab_png);
00085 grabber[2] = new GuiImageData(player3_grab_png);
00086 grabber[3] = new GuiImageData(player4_grab_png);
00087 debug_grabber1 = new GuiImageData(player1_grab_png);
00088 debug_grabber2 = new GuiImageData(player2_grab_png);
00089 debug_grabber3 = new GuiImageData(player3_grab_png);
00090 debug_grabber4 = new GuiImageData(player4_grab_png);
00091
00092 trigA = new GuiTrigger();
00093 trigHome = new GuiTrigger();
00094
00095 trigA->SetSimpleTrigger(-1, WPAD_BUTTON_A | WPAD_CLASSIC_BUTTON_A, PAD_BUTTON_A);
00096 trigHome->SetButtonOnlyTrigger(-1, WPAD_BUTTON_HOME | WPAD_CLASSIC_BUTTON_HOME, 0);
00097 }
00098
00099 void initFileButton(GuiButton &fileBtn, GuiText &fileBtnTxt,
00100 GuiImage &fileBtnImg, GuiImage &fileBtnImgOver)
00101 {
00102 fileBtnTxt.SetWrap(true, btnLargeOutline->GetWidth() - 30);
00103 fileBtn.SetLabel(&fileBtnTxt);
00104 fileBtn.SetImage(&fileBtnImg);
00105 fileBtn.SetImageOver(&fileBtnImgOver);
00106 fileBtn.SetAlignment(ALIGN_LEFT, ALIGN_TOP);
00107 fileBtn.SetPosition(50, 120);
00108 fileBtn.SetSoundOver(btnSoundOver);
00109 fileBtn.SetTrigger(trigA);
00110 fileBtn.SetEffectGrow();
00111 }
00112
00113 void TCYC_MenuStartup()
00114 {
00115 TCYC_MenuInit();
00116
00117 GuiText titleTxt("TetriCycle v0.6b, by calvinss4", 28, (GXColor){255, 255, 255, 255});
00118 titleTxt.SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
00119 titleTxt.SetPosition(0, 50);
00120
00121 GuiText wwwTxt("www.wiibrew.org/wiki/TetriCycle", 28, (GXColor){255, 255, 255, 255});
00122 wwwTxt.SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
00123 wwwTxt.SetPosition(0, 100);
00124
00125 GuiText emailTxt1("Questions or comments:", 28, (GXColor){255, 255, 255, 255});
00126 emailTxt1.SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
00127 emailTxt1.SetPosition(0, 150);
00128
00129 GuiText emailTxt2("TetriCycle[at]gmail.com", 28, (GXColor){255, 255, 255, 255});
00130 emailTxt2.SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
00131 emailTxt2.SetPosition(0, 190);
00132
00133 GuiText scamTxt("If you paid for this you were scammed!", 26, (GXColor){255, 255, 255, 255});
00134 scamTxt.SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
00135 scamTxt.SetPosition(0, 250);
00136
00137 GuiText initTxt("PRESS ANY BUTTON", 30, (GXColor){255, 255, 255, 255});
00138 initTxt.SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
00139 initTxt.SetPosition(0, 300);
00140
00141
00142 GuiWindow w(screenwidth, screenheight);
00143 w.Append(&titleTxt);
00144 w.Append(&wwwTxt);
00145 w.Append(&emailTxt1);
00146 w.Append(&emailTxt2);
00147 w.Append(&scamTxt);
00148 w.Append(&initTxt);
00149
00150 HaltGui();
00151 mainWindow->Append(&w);
00152 ResumeGui();
00153
00154 bool loop = true;
00155 while (loop)
00156 {
00157 for (int i = 0; i < MAX_PLAYERS; ++i)
00158 {
00159 if (WPAD_ButtonsDown(i))
00160 {
00161 loop = false;
00162 break;
00163 }
00164 }
00165 }
00166
00167 HaltGui();
00168 mainWindow->Remove(&w);
00169 }
00170
00171 void TCYC_MenuLoop(int menu)
00172 {
00173 while (menu != TCYC_MENU_EXIT)
00174 {
00175 switch (menu)
00176 {
00177 case TCYC_MENU_MAIN:
00178 menu = TCYC_MenuMain();
00179 break;
00180 case TCYC_MENU_GAME:
00181 menu = TCYC_MenuGame();
00182 break;
00183 default:
00184 menu = TCYC_MENU_EXIT;
00185 break;
00186 }
00187 }
00188 }
00189
00190 int TCYC_MenuMain()
00191 {
00192 int menu = TCYC_MENU_NONE;
00193
00194 GuiText titleTxt("TetriCycle v0.6b, by calvinss4", 28, (GXColor){255, 255, 255, 255});
00195 titleTxt.SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
00196 titleTxt.SetPosition(0, 50);
00197
00198 GuiButton p1Btn(btnData40x40Square->GetWidth(), btnData40x40Square->GetHeight());
00199 GuiText p1BtnTxt("1P", 22, (GXColor){0, 0, 0, 255});
00200 GuiImage p1BtnImg(btnData40x40Square);
00201 GuiImage p1BtnImgOver(btnData40x40SquareOver);
00202
00203 p1Btn.SetAlignment(ALIGN_LEFT, ALIGN_TOP);
00204 p1Btn.SetPosition(50, 100);
00205 p1Btn.SetLabel(&p1BtnTxt);
00206 p1Btn.SetImage(&p1BtnImg);
00207 p1Btn.SetImageOver(&p1BtnImgOver);
00208 p1Btn.SetSoundOver(btnSoundOver);
00209 p1Btn.SetTrigger(trigA);
00210 p1Btn.SetEffectGrow();
00211
00212 GuiButton p2Btn(btnData40x40Square->GetWidth(), btnData40x40Square->GetHeight());
00213 GuiText p2BtnTxt("2P", 22, (GXColor){0, 0, 0, 255});
00214 GuiImage p2BtnImg(btnData40x40Square);
00215 GuiImage p2BtnImgOver(btnData40x40SquareOver);
00216
00217 p2Btn.SetAlignment(ALIGN_LEFT, ALIGN_TOP);
00218 p2Btn.SetPosition(50 + btnData40x40Square->GetWidth(), 100);
00219 p2Btn.SetLabel(&p2BtnTxt);
00220 p2Btn.SetImage(&p2BtnImg);
00221 p2Btn.SetImageOver(&p2BtnImgOver);
00222 p2Btn.SetSoundOver(btnSoundOver);
00223 p2Btn.SetTrigger(trigA);
00224 p2Btn.SetEffectGrow();
00225
00226 GuiButton p3Btn(btnData40x40Square->GetWidth(), btnData40x40Square->GetHeight());
00227 GuiText p3BtnTxt("3P", 22, (GXColor){0, 0, 0, 255});
00228 GuiImage p3BtnImg(btnData40x40Square);
00229 GuiImage p3BtnImgOver(btnData40x40SquareOver);
00230
00231 p3Btn.SetAlignment(ALIGN_LEFT, ALIGN_TOP);
00232 p3Btn.SetPosition(50 + 2 * btnData40x40Square->GetWidth(), 100);
00233 p3Btn.SetLabel(&p3BtnTxt);
00234 p3Btn.SetImage(&p3BtnImg);
00235 p3Btn.SetImageOver(&p3BtnImgOver);
00236 p3Btn.SetSoundOver(btnSoundOver);
00237 p3Btn.SetTrigger(trigA);
00238 p3Btn.SetEffectGrow();
00239
00240 GuiButton p4Btn(btnData40x40Square->GetWidth(), btnData40x40Square->GetHeight());
00241 GuiText p4BtnTxt("4P", 22, (GXColor){0, 0, 0, 255});
00242 GuiImage p4BtnImg(btnData40x40Square);
00243 GuiImage p4BtnImgOver(btnData40x40SquareOver);
00244
00245 p4Btn.SetAlignment(ALIGN_LEFT, ALIGN_TOP);
00246 p4Btn.SetPosition(50 + 3 * btnData40x40Square->GetWidth(), 100);
00247 p4Btn.SetLabel(&p4BtnTxt);
00248 p4Btn.SetImage(&p4BtnImg);
00249 p4Btn.SetImageOver(&p4BtnImgOver);
00250 p4Btn.SetSoundOver(btnSoundOver);
00251 p4Btn.SetTrigger(trigA);
00252 p4Btn.SetEffectGrow();
00253
00254 GuiButton profileBtn(btnOutline->GetWidth(), btnOutline->GetHeight());
00255 GuiText profileBtnTxt("Player Profiles", 22, (GXColor){0, 0, 0, 255});
00256 GuiImage profileBtnImg(btnOutline);
00257 GuiImage profileBtnImgOver(btnOutlineOver);
00258
00259 profileBtn.SetAlignment(ALIGN_LEFT, ALIGN_TOP);
00260 profileBtn.SetPosition(50 + 4 * btnData40x40Square->GetWidth() + 10, 100 - 6);
00261 profileBtn.SetLabel(&profileBtnTxt);
00262 profileBtn.SetImage(&profileBtnImg);
00263 profileBtn.SetImageOver(&profileBtnImgOver);
00264 profileBtn.SetSoundOver(btnSoundOver);
00265 profileBtn.SetTrigger(trigA);
00266 profileBtn.SetEffectGrow();
00267
00268 GuiButton mpOptionsBtn(btnOutline->GetWidth(), btnOutline->GetHeight());
00269 GuiText mpOptionsBtnTxt("MP Options", 22, (GXColor){0, 0, 0, 255});
00270 GuiImage mpOptionsBtnImg(btnOutline);
00271 GuiImage mpOptionsBtnImgOver(btnOutlineOver);
00272
00273 mpOptionsBtn.SetAlignment(ALIGN_LEFT, ALIGN_TOP);
00274 mpOptionsBtn.SetPosition(50 + 4 * btnData40x40Square->GetWidth() + 10 + btnOutline->GetWidth(), 100 - 6);
00275 mpOptionsBtn.SetLabel(&mpOptionsBtnTxt);
00276 mpOptionsBtn.SetImage(&mpOptionsBtnImg);
00277 mpOptionsBtn.SetImageOver(&mpOptionsBtnImgOver);
00278 mpOptionsBtn.SetSoundOver(btnSoundOver);
00279 mpOptionsBtn.SetTrigger(trigA);
00280 mpOptionsBtn.SetEffectGrow();
00281
00282 GuiButton mpHandicapsBtn(btnOutline->GetWidth(), btnOutline->GetHeight());
00283 GuiText mpHandicapsBtnTxt("MP Handicaps", 22, (GXColor){0, 0, 0, 255});
00284 GuiImage mpHandicapsBtnImg(btnOutline);
00285 GuiImage mpHandicapsBtnImgOver(btnOutlineOver);
00286
00287 mpHandicapsBtn.SetAlignment(ALIGN_LEFT, ALIGN_TOP);
00288 mpHandicapsBtn.SetPosition(50 + 4 * btnData40x40Square->GetWidth() + 10 + btnOutline->GetWidth(), 100 - 6 + btnOutline->GetHeight());
00289 mpHandicapsBtn.SetLabel(&mpHandicapsBtnTxt);
00290 mpHandicapsBtn.SetImage(&mpHandicapsBtnImg);
00291 mpHandicapsBtn.SetImageOver(&mpHandicapsBtnImgOver);
00292 mpHandicapsBtn.SetSoundOver(btnSoundOver);
00293 mpHandicapsBtn.SetTrigger(trigA);
00294 mpHandicapsBtn.SetEffectGrow();
00295
00296 GuiButton returnBtn(btnOutline->GetWidth(), btnOutline->GetHeight());
00297 GuiText returnBtnTxt("Return to loader", 20, (GXColor){0, 0, 0, 255});
00298 GuiImage returnBtnImg(btnOutline);
00299 GuiImage returnBtnImgOver(btnOutlineOver);
00300
00301 returnBtn.SetAlignment(ALIGN_RIGHT, ALIGN_BOTTOM);
00302 returnBtn.SetPosition(-50 - btnOutline->GetWidth(), -50);
00303 returnBtn.SetLabel(&returnBtnTxt);
00304 returnBtn.SetImage(&returnBtnImg);
00305 returnBtn.SetImageOver(&returnBtnImgOver);
00306 returnBtn.SetSoundOver(btnSoundOver);
00307 returnBtn.SetTrigger(trigA);
00308 returnBtn.SetTrigger(trigHome);
00309 returnBtn.SetEffectGrow();
00310
00311 GuiButton exitBtn(btnOutline->GetWidth(), btnOutline->GetHeight());
00312 GuiText exitBtnTxt("Exit to Wii menu", 20, (GXColor){0, 0, 0, 255});
00313 GuiImage exitBtnImg(btnOutline);
00314 GuiImage exitBtnImgOver(btnOutlineOver);
00315
00316 exitBtn.SetAlignment(ALIGN_RIGHT, ALIGN_BOTTOM);
00317 exitBtn.SetPosition(-50, -50);
00318 exitBtn.SetLabel(&exitBtnTxt);
00319 exitBtn.SetImage(&exitBtnImg);
00320 exitBtn.SetImageOver(&exitBtnImgOver);
00321 exitBtn.SetSoundOver(btnSoundOver);
00322 exitBtn.SetTrigger(trigA);
00323 exitBtn.SetTrigger(trigHome);
00324 exitBtn.SetEffectGrow();
00325
00326 GuiButton heartBtn(150, 150);
00327 heartBtn.SetAlignment(ALIGN_CENTRE, ALIGN_MIDDLE);
00328 heartBtn.SetPosition(0, 25);
00329 heartBtn.SetSoundOver(btnSoundOver);
00330 heartBtn.SetTrigger(trigA);
00331
00332
00333 GuiText playfieldTxt("Edit Playfield:", 24, (GXColor){255, 255, 255, 255});
00334 playfieldTxt.SetAlignment(ALIGN_LEFT, ALIGN_TOP);
00335 playfieldTxt.SetPosition(50, 260);
00336
00337 GuiButton edit1PBtn(btnData40x40Square->GetWidth(), btnData40x40Square->GetHeight());
00338 GuiText edit1PBtnTxt("1P", 22, (GXColor){0, 0, 0, 255});
00339 GuiImage edit1PBtnImg(btnData40x40Square);
00340 GuiImage edit1PBtnImgOver(btnData40x40SquareOver);
00341
00342 edit1PBtn.SetAlignment(ALIGN_LEFT, ALIGN_TOP);
00343 edit1PBtn.SetPosition(50, 290);
00344 edit1PBtn.SetLabel(&edit1PBtnTxt);
00345 edit1PBtn.SetImage(&edit1PBtnImg);
00346 edit1PBtn.SetImageOver(&edit1PBtnImgOver);
00347 edit1PBtn.SetSoundOver(btnSoundOver);
00348 edit1PBtn.SetTrigger(trigA);
00349 edit1PBtn.SetEffectGrow();
00350
00351 GuiButton edit2PBtn(btnData40x40Square->GetWidth(), btnData40x40Square->GetHeight());
00352 GuiText edit2PBtnTxt("2P", 22, (GXColor){0, 0, 0, 255});
00353 GuiImage edit2PBtnImg(btnData40x40Square);
00354 GuiImage edit2PBtnImgOver(btnData40x40SquareOver);
00355
00356 edit2PBtn.SetAlignment(ALIGN_LEFT, ALIGN_TOP);
00357 edit2PBtn.SetPosition(50 + btnData40x40Square->GetWidth(), 290);
00358 edit2PBtn.SetLabel(&edit2PBtnTxt);
00359 edit2PBtn.SetImage(&edit2PBtnImg);
00360 edit2PBtn.SetImageOver(&edit2PBtnImgOver);
00361 edit2PBtn.SetSoundOver(btnSoundOver);
00362 edit2PBtn.SetTrigger(trigA);
00363 edit2PBtn.SetEffectGrow();
00364
00365 GuiButton edit3PBtn(btnData40x40Square->GetWidth(), btnData40x40Square->GetHeight());
00366 GuiText edit3PBtnTxt("3P", 22, (GXColor){0, 0, 0, 255});
00367 GuiImage edit3PBtnImg(btnData40x40Square);
00368 GuiImage edit3PBtnImgOver(btnData40x40SquareOver);
00369
00370 edit3PBtn.SetAlignment(ALIGN_LEFT, ALIGN_TOP);
00371 edit3PBtn.SetPosition(50 + 2 * btnData40x40Square->GetWidth(), 290);
00372 edit3PBtn.SetLabel(&edit3PBtnTxt);
00373 edit3PBtn.SetImage(&edit3PBtnImg);
00374 edit3PBtn.SetImageOver(&edit3PBtnImgOver);
00375 edit3PBtn.SetSoundOver(btnSoundOver);
00376 edit3PBtn.SetTrigger(trigA);
00377 edit3PBtn.SetEffectGrow();
00378
00379 GuiButton edit4PBtn(btnData40x40Square->GetWidth(), btnData40x40Square->GetHeight());
00380 GuiText edit4PBtnTxt("4P", 22, (GXColor){0, 0, 0, 255});
00381 GuiImage edit4PBtnImg(btnData40x40Square);
00382 GuiImage edit4PBtnImgOver(btnData40x40SquareOver);
00383
00384 edit4PBtn.SetAlignment(ALIGN_LEFT, ALIGN_TOP);
00385 edit4PBtn.SetPosition(50 + 3 * btnData40x40Square->GetWidth(), 290);
00386 edit4PBtn.SetLabel(&edit4PBtnTxt);
00387 edit4PBtn.SetImage(&edit4PBtnImg);
00388 edit4PBtn.SetImageOver(&edit4PBtnImgOver);
00389 edit4PBtn.SetSoundOver(btnSoundOver);
00390 edit4PBtn.SetTrigger(trigA);
00391 edit4PBtn.SetEffectGrow();
00392
00393
00394
00395 HaltGui();
00396 GuiWindow w(screenwidth, screenheight);
00397 w.Append(&titleTxt);
00398 w.Append(&p1Btn);
00399 w.Append(&p2Btn);
00400 w.Append(&p3Btn);
00401 w.Append(&p4Btn);
00402 w.Append(&profileBtn);
00403 w.Append(&mpOptionsBtn);
00404 w.Append(&mpHandicapsBtn);
00405 w.Append(&returnBtn);
00406 w.Append(&exitBtn);
00407 w.Append(&heartBtn);
00408 w.Append(&playfieldTxt);
00409 w.Append(&edit1PBtn);
00410 w.Append(&edit2PBtn);
00411 w.Append(&edit3PBtn);
00412 w.Append(&edit4PBtn);
00413
00414 #ifdef HW_RVL
00415
00416 #endif
00417
00418 mainWindow->Append(&w);
00419
00420 ResumeGui();
00421
00422 while (menu == TCYC_MENU_NONE)
00423 {
00424 usleep(THREAD_SLEEP);
00425
00426 if (p1Btn.GetState() == STATE_CLICKED)
00427 {
00428 g_options.players = 1;
00429 menu = TCYC_MENU_GAME;
00430 }
00431 else if (p2Btn.GetState() == STATE_CLICKED)
00432 {
00433 g_options.players = 2;
00434 menu = TCYC_MENU_GAME;
00435 }
00436 else if (p3Btn.GetState() == STATE_CLICKED)
00437 {
00438 g_options.players = 3;
00439 menu = TCYC_MENU_GAME;
00440 }
00441 else if (p4Btn.GetState() == STATE_CLICKED)
00442 {
00443 g_options.players = 4;
00444 menu = TCYC_MENU_GAME;
00445 }
00446 else if (profileBtn.GetState() == STATE_CLICKED)
00447 {
00448 profileBtn.ResetState();
00449 TCYC_MenuPlayerProfilesPopup();
00450 }
00451 else if (mpOptionsBtn.GetState() == STATE_CLICKED)
00452 {
00453 mpOptionsBtn.ResetState();
00454 TCYC_MenuMpOptionsPopup();
00455 }
00456 else if (mpHandicapsBtn.GetState() == STATE_CLICKED)
00457 {
00458 mpHandicapsBtn.ResetState();
00459 TCYC_MenuMpHandicapsPopup();
00460 }
00461 else if (returnBtn.GetState() == STATE_CLICKED)
00462 {
00463 exit(0);
00464 }
00465 else if (exitBtn.GetState() == STATE_CLICKED)
00466 {
00467 SYS_ResetSystem(SYS_RETURNTOMENU, 0, 0);
00468 }
00469 else if (heartBtn.GetState() == STATE_CLICKED)
00470 {
00471 heartBtn.ResetState();
00472
00473 GuiWindow heart(screenwidth, screenheight);
00474 GuiImageData tetrisHeartPink(tetris_heart_pink_png);
00475 GuiImage heartBg(&tetrisHeartPink);
00476
00477
00478 GuiText thanks("Thank you fans!", 24, (GXColor){0, 0, 0, 255});
00479 thanks.SetAlignment(ALIGN_RIGHT, ALIGN_BOTTOM);
00480 thanks.SetPosition(-20, -55);
00481
00482 GuiText sig("-Cale", 24, (GXColor){0, 0, 0, 255});
00483 sig.SetAlignment(ALIGN_RIGHT, ALIGN_BOTTOM);
00484 sig.SetPosition(-20, -25);
00485
00486 heart.Append(&heartBg);
00487 heart.Append(&thanks);
00488 heart.Append(&sig);
00489
00490 HaltGui();
00491 mainWindow->DisableChildren();
00492 mainWindow->Append(&heart);
00493 mainWindow->ChangeFocus(&heart);
00494 ResumeGui();
00495
00496 bgMusic->SetVolume(20);
00497
00498 bool loop = true;
00499 while (loop)
00500 {
00501 if (!g_heartbeatSound->IsPlaying())
00502 g_heartbeatSound->Play();
00503
00504 for (int i = 0; i < MAX_PLAYERS; ++i)
00505 {
00506 if (WPAD_ButtonsDown(i))
00507 {
00508 loop = false;
00509 break;
00510 }
00511 }
00512 }
00513
00514 g_heartbeatSound->Stop();
00515 bgMusic->SetVolume(50);
00516
00517 HaltGui();
00518 mainWindow->Remove(&heart);
00519 mainWindow->SetState(STATE_DEFAULT);
00520 ResumeGui();
00521 }
00522 else if (edit1PBtn.GetState() == STATE_CLICKED)
00523 {
00524 g_options.players = 1;
00525 menu = TCYC_MENU_GAME;
00526 g_isEditMode = true;
00527 }
00528 else if (edit2PBtn.GetState() == STATE_CLICKED)
00529 {
00530 g_options.players = 2;
00531 menu = TCYC_MENU_GAME;
00532 g_isEditMode = true;
00533 }
00534 else if (edit3PBtn.GetState() == STATE_CLICKED)
00535 {
00536 g_options.players = 3;
00537 menu = TCYC_MENU_GAME;
00538 g_isEditMode = true;
00539 }
00540 else if (edit4PBtn.GetState() == STATE_CLICKED)
00541 {
00542 g_options.players = 4;
00543 menu = TCYC_MENU_GAME;
00544 g_isEditMode = true;
00545 }
00546 }
00547
00548 HaltGui();
00549 mainWindow->Remove(&w);
00550 return menu;
00551 }
00552
00553
00554
00555
00556 int TCYC_MenuGame()
00557 {
00558 mainWindow->Remove(bgImg);
00559
00560 do
00561 {
00562 TetriCycle_main();
00563 }
00564 while (g_tcycMenu == TCYC_MENU_GAME);
00565
00566 mainWindow->Append(bgImg);
00567 ResetVideo_Menu();
00568 if (!g_isEditMode)
00569 bgMusic->Play();
00570 g_isEditMode = false;
00571
00572 return TCYC_MENU_MAIN;
00573 }
00574
00575 void TCYC_MenuPlayerProfilesPopup()
00576 {
00577 static const int PADDING_TOP = 12;
00578 GXColor helpTxtColor = (GXColor){0, 170, 0, 255};
00579 GXColor blackColor = (GXColor){0, 0, 0, 255};
00580
00581 int player = 0;
00582 char playerBuf[7+1+1] = "PLAYER ";
00583 sprintf(playerBuf + 7, "%d", player + 1);
00584
00585 bool isNormalRotation[MAX_PLAYERS];
00586 bool isShakeEnabled[MAX_PLAYERS];
00587 bool isShadowEnabled[MAX_PLAYERS];
00588 bool isPreviewEnabled[MAX_PLAYERS];
00589
00590 for (int i = 0; i < MAX_PLAYERS; ++i)
00591 {
00592 isNormalRotation[i] = g_players[i].isNormalRotation;
00593 isShakeEnabled[i] = g_players[i].isShakeEnabled;
00594 isShadowEnabled[i] = g_players[i].isShadowEnabled;
00595 isPreviewEnabled[i] = g_players[i].isPreviewEnabled;
00596 }
00597
00598
00599 GuiWindow promptWindow(screenwidth - 100, screenheight - 100);
00600 promptWindow.SetAlignment(ALIGN_CENTRE, ALIGN_MIDDLE);
00601 promptWindow.SetPosition(0, 0);
00602
00603 GuiSound btnSoundOver(button_over_pcm, button_over_pcm_size, SOUND_PCM);
00604 GuiTrigger trigA;
00605 trigA.SetSimpleTrigger(-1, WPAD_BUTTON_A | WPAD_CLASSIC_BUTTON_A, PAD_BUTTON_A);
00606
00607 GuiImage profilesBgImg(screenwidth - 100, screenheight - 100, (GXColor){170, 170, 170, 255});
00608
00609 GuiText titleTxt("Player Profiles", 30, blackColor);
00610 titleTxt.SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
00611 titleTxt.SetPosition(0, 15);
00612
00613
00614 GuiButton playerLeftArrowBtn(btnData40x40Square->GetWidth(), btnData40x40Square->GetHeight());
00615 GuiText playerLeftArrowBtnTxt("<", 22, blackColor);
00616 GuiText playerLeftArrowBtnTxtOver("<", 22, helpTxtColor);
00617 GuiImage playerLeftArrowBtnImg(btnData40x40Square);
00618 GuiImage playerLeftArrowBtnImgOver(btnData40x40SquareOver);
00619
00620 playerLeftArrowBtn.SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
00621 playerLeftArrowBtn.SetPosition(-80, 60);
00622 playerLeftArrowBtn.SetLabel(&playerLeftArrowBtnTxt);
00623 playerLeftArrowBtn.SetLabelOver(&playerLeftArrowBtnTxtOver);
00624 playerLeftArrowBtn.SetImage(&playerLeftArrowBtnImg);
00625 playerLeftArrowBtn.SetImageOver(&playerLeftArrowBtnImgOver);
00626 playerLeftArrowBtn.SetSoundOver(&btnSoundOver);
00627 playerLeftArrowBtn.SetTrigger(&trigA);
00628 playerLeftArrowBtn.SetEffectGrow();
00629
00630
00631 GuiButton playerRightArrowBtn(btnData40x40Square->GetWidth(), btnData40x40Square->GetHeight());
00632 GuiText playerRightArrowBtnTxt(">", 22, blackColor);
00633 GuiText playerRightArrowBtnTxtOver(">", 22, helpTxtColor);
00634 GuiImage playerRightArrowBtnImg(btnData40x40Square);
00635 GuiImage playerRightArrowBtnImgOver(btnData40x40SquareOver);
00636
00637 playerRightArrowBtn.SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
00638 playerRightArrowBtn.SetPosition(80, 60);
00639 playerRightArrowBtn.SetLabel(&playerRightArrowBtnTxt);
00640 playerRightArrowBtn.SetLabelOver(&playerRightArrowBtnTxtOver);
00641 playerRightArrowBtn.SetImage(&playerRightArrowBtnImg);
00642 playerRightArrowBtn.SetImageOver(&playerRightArrowBtnImgOver);
00643 playerRightArrowBtn.SetSoundOver(&btnSoundOver);
00644 playerRightArrowBtn.SetTrigger(&trigA);
00645 playerRightArrowBtn.SetEffectGrow();
00646
00647
00648 GuiText playerTxt(playerBuf, 22, blackColor);
00649 playerTxt.SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
00650 playerTxt.SetPosition(0, 60 + PADDING_TOP);
00651
00652
00653 GuiButton rotationTxtBtn((9 + 1) * 11, 22);
00654 GuiText rotationTxtBtnTxt("rotation:", 22, blackColor);
00655 GuiText rotationTxtBtnTxtOver("rotation:", 22, helpTxtColor);
00656
00657 rotationTxtBtn.SetAlignment(ALIGN_LEFT, ALIGN_TOP);
00658 rotationTxtBtn.SetPosition(20, 60 + PADDING_TOP + 1 * 40);
00659 rotationTxtBtn.SetLabel(&rotationTxtBtnTxt);
00660 rotationTxtBtn.SetLabelOver(&rotationTxtBtnTxtOver);
00661 rotationTxtBtn.SetSoundOver(&btnSoundOver);
00662 rotationTxtBtn.SetTrigger(&trigA);
00663
00664
00665 GuiButton rotationLeftArrowBtn(btnData40x40Square->GetWidth(), btnData40x40Square->GetHeight());
00666 GuiText rotationLeftArrowBtnTxt("<", 22, blackColor);
00667 GuiText rotationLeftArrowBtnTxtOver("<", 22, helpTxtColor);
00668 GuiImage rotationLeftArrowBtnImg(btnData40x40Square);
00669 GuiImage rotationLeftArrowBtnImgOver(btnData40x40SquareOver);
00670
00671 rotationLeftArrowBtn.SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
00672 rotationLeftArrowBtn.SetPosition(-80, 60 + 1 * 40);
00673 rotationLeftArrowBtn.SetLabel(&rotationLeftArrowBtnTxt);
00674 rotationLeftArrowBtn.SetLabelOver(&rotationLeftArrowBtnTxtOver);
00675 rotationLeftArrowBtn.SetImage(&rotationLeftArrowBtnImg);
00676 rotationLeftArrowBtn.SetImageOver(&rotationLeftArrowBtnImgOver);
00677 rotationLeftArrowBtn.SetSoundOver(&btnSoundOver);
00678 rotationLeftArrowBtn.SetTrigger(&trigA);
00679 rotationLeftArrowBtn.SetEffectGrow();
00680
00681
00682 GuiButton rotationRightArrowBtn(btnData40x40Square->GetWidth(), btnData40x40Square->GetHeight());
00683 GuiText rotationRightArrowBtnTxt(">", 22, blackColor);
00684 GuiText rotationRightArrowBtnTxtOver(">", 22, helpTxtColor);
00685 GuiImage rotationRightArrowBtnImg(btnData40x40Square);
00686 GuiImage rotationRightArrowBtnImgOver(btnData40x40SquareOver);
00687
00688 rotationRightArrowBtn.SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
00689 rotationRightArrowBtn.SetPosition(80, 60 + 1 * 40);
00690 rotationRightArrowBtn.SetLabel(&rotationRightArrowBtnTxt);
00691 rotationRightArrowBtn.SetLabelOver(&rotationRightArrowBtnTxtOver);
00692 rotationRightArrowBtn.SetImage(&rotationRightArrowBtnImg);
00693 rotationRightArrowBtn.SetImageOver(&rotationRightArrowBtnImgOver);
00694 rotationRightArrowBtn.SetSoundOver(&btnSoundOver);
00695 rotationRightArrowBtn.SetTrigger(&trigA);
00696 rotationRightArrowBtn.SetEffectGrow();
00697
00698
00699 GuiText rotationTxt(isNormalRotation[player] ? "normal" : "reverse", 22, blackColor);
00700 rotationTxt.SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
00701 rotationTxt.SetPosition(0, 60 + PADDING_TOP + 1 * 40);
00702
00703
00704
00705 GuiButton shadowTxtBtn((9 + 1) * 11, 22);
00706 GuiText shadowTxtBtnTxt("shadow:", 22, blackColor);
00707 GuiText shadowTxtBtnTxtOver("shadow:", 22, helpTxtColor);
00708
00709 shadowTxtBtn.SetAlignment(ALIGN_LEFT, ALIGN_TOP);
00710 shadowTxtBtn.SetPosition(20, 60 + PADDING_TOP + 2 * 40);
00711 shadowTxtBtn.SetLabel(&shadowTxtBtnTxt);
00712 shadowTxtBtn.SetLabelOver(&shadowTxtBtnTxtOver);
00713 shadowTxtBtn.SetSoundOver(&btnSoundOver);
00714 shadowTxtBtn.SetTrigger(&trigA);
00715
00716
00717 GuiButton shadowLeftArrowBtn(btnData40x40Square->GetWidth(), btnData40x40Square->GetHeight());
00718 GuiText shadowLeftArrowBtnTxt("<", 22, blackColor);
00719 GuiText shadowLeftArrowBtnTxtOver("<", 22, helpTxtColor);
00720 GuiImage shadowLeftArrowBtnImg(btnData40x40Square);
00721 GuiImage shadowLeftArrowBtnImgOver(btnData40x40SquareOver);
00722
00723 shadowLeftArrowBtn.SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
00724 shadowLeftArrowBtn.SetPosition(-80, 60 + 2 * 40);
00725 shadowLeftArrowBtn.SetLabel(&shadowLeftArrowBtnTxt);
00726 shadowLeftArrowBtn.SetLabelOver(&shadowLeftArrowBtnTxtOver);
00727 shadowLeftArrowBtn.SetImage(&shadowLeftArrowBtnImg);
00728 shadowLeftArrowBtn.SetImageOver(&shadowLeftArrowBtnImgOver);
00729 shadowLeftArrowBtn.SetSoundOver(&btnSoundOver);
00730 shadowLeftArrowBtn.SetTrigger(&trigA);
00731 shadowLeftArrowBtn.SetEffectGrow();
00732
00733
00734 GuiButton shadowRightArrowBtn(btnData40x40Square->GetWidth(), btnData40x40Square->GetHeight());
00735 GuiText shadowRightArrowBtnTxt(">", 22, blackColor);
00736 GuiText shadowRightArrowBtnTxtOver(">", 22, helpTxtColor);
00737 GuiImage shadowRightArrowBtnImg(btnData40x40Square);
00738 GuiImage shadowRightArrowBtnImgOver(btnData40x40SquareOver);
00739
00740 shadowRightArrowBtn.SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
00741 shadowRightArrowBtn.SetPosition(80, 60 + 2 * 40);
00742 shadowRightArrowBtn.SetLabel(&shadowRightArrowBtnTxt);
00743 shadowRightArrowBtn.SetLabelOver(&shadowRightArrowBtnTxtOver);
00744 shadowRightArrowBtn.SetImage(&shadowRightArrowBtnImg);
00745 shadowRightArrowBtn.SetImageOver(&shadowRightArrowBtnImgOver);
00746 shadowRightArrowBtn.SetSoundOver(&btnSoundOver);
00747 shadowRightArrowBtn.SetTrigger(&trigA);
00748 shadowRightArrowBtn.SetEffectGrow();
00749
00750
00751 GuiText shadowTxt(isShadowEnabled[player] ? "on" : "off", 22, blackColor);
00752 shadowTxt.SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
00753 shadowTxt.SetPosition(0, 60 + PADDING_TOP + 2 * 40);
00754
00755
00756
00757 GuiButton previewTxtBtn((9 + 1) * 11, 22);
00758 GuiText previewTxtBtnTxt("preview:", 22, blackColor);
00759 GuiText previewTxtBtnTxtOver("preview:", 22, helpTxtColor);
00760
00761 previewTxtBtn.SetAlignment(ALIGN_LEFT, ALIGN_TOP);
00762 previewTxtBtn.SetPosition(20, 60 + PADDING_TOP + 3 * 40);
00763 previewTxtBtn.SetLabel(&previewTxtBtnTxt);
00764 previewTxtBtn.SetLabelOver(&previewTxtBtnTxtOver);
00765 previewTxtBtn.SetSoundOver(&btnSoundOver);
00766 previewTxtBtn.SetTrigger(&trigA);
00767
00768
00769 GuiButton previewLeftArrowBtn(btnData40x40Square->GetWidth(), btnData40x40Square->GetHeight());
00770 GuiText previewLeftArrowBtnTxt("<", 22, blackColor);
00771 GuiText previewLeftArrowBtnTxtOver("<", 22, helpTxtColor);
00772 GuiImage previewLeftArrowBtnImg(btnData40x40Square);
00773 GuiImage previewLeftArrowBtnImgOver(btnData40x40SquareOver);
00774
00775 previewLeftArrowBtn.SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
00776 previewLeftArrowBtn.SetPosition(-80, 60 + 3 * 40);
00777 previewLeftArrowBtn.SetLabel(&previewLeftArrowBtnTxt);
00778 previewLeftArrowBtn.SetLabelOver(&previewLeftArrowBtnTxtOver);
00779 previewLeftArrowBtn.SetImage(&previewLeftArrowBtnImg);
00780 previewLeftArrowBtn.SetImageOver(&previewLeftArrowBtnImgOver);
00781 previewLeftArrowBtn.SetSoundOver(&btnSoundOver);
00782 previewLeftArrowBtn.SetTrigger(&trigA);
00783 previewLeftArrowBtn.SetEffectGrow();
00784
00785
00786 GuiButton previewRightArrowBtn(btnData40x40Square->GetWidth(), btnData40x40Square->GetHeight());
00787 GuiText previewRightArrowBtnTxt(">", 22, blackColor);
00788 GuiText previewRightArrowBtnTxtOver(">", 22, helpTxtColor);
00789 GuiImage previewRightArrowBtnImg(btnData40x40Square);
00790 GuiImage previewRightArrowBtnImgOver(btnData40x40SquareOver);
00791
00792 previewRightArrowBtn.SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
00793 previewRightArrowBtn.SetPosition(80, 60 + 3 * 40);
00794 previewRightArrowBtn.SetLabel(&previewRightArrowBtnTxt);
00795 previewRightArrowBtn.SetLabelOver(&previewRightArrowBtnTxtOver);
00796 previewRightArrowBtn.SetImage(&previewRightArrowBtnImg);
00797 previewRightArrowBtn.SetImageOver(&previewRightArrowBtnImgOver);
00798 previewRightArrowBtn.SetSoundOver(&btnSoundOver);
00799 previewRightArrowBtn.SetTrigger(&trigA);
00800 previewRightArrowBtn.SetEffectGrow();
00801
00802
00803 GuiText previewTxt(isPreviewEnabled[player] ? "on" : "off", 22, blackColor);
00804 previewTxt.SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
00805 previewTxt.SetPosition(0, 60 + PADDING_TOP + 3 * 40);
00806
00807
00808
00809 GuiButton shakeTxtBtn((7 + 1) * 11, 22);
00810 GuiText shakeTxtBtnTxt("shake:", 22, blackColor);
00811 GuiText shakeTxtBtnTxtOver("shake:", 22, helpTxtColor);
00812
00813 shakeTxtBtn.SetAlignment(ALIGN_LEFT, ALIGN_TOP);
00814 shakeTxtBtn.SetPosition(20, 60 + PADDING_TOP + 4 * 40);
00815 shakeTxtBtn.SetLabel(&shakeTxtBtnTxt);
00816 shakeTxtBtn.SetLabelOver(&shakeTxtBtnTxtOver);
00817 shakeTxtBtn.SetSoundOver(&btnSoundOver);
00818 shakeTxtBtn.SetTrigger(&trigA);
00819
00820
00821 GuiButton shakeLeftArrowBtn(btnData40x40Square->GetWidth(), btnData40x40Square->GetHeight());
00822 GuiText shakeLeftArrowBtnTxt("<", 22, blackColor);
00823 GuiText shakeLeftArrowBtnTxtOver("<", 22, helpTxtColor);
00824 GuiImage shakeLeftArrowBtnImg(btnData40x40Square);
00825 GuiImage shakeLeftArrowBtnImgOver(btnData40x40SquareOver);
00826
00827 shakeLeftArrowBtn.SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
00828 shakeLeftArrowBtn.SetPosition(-80, 60 + 4 * 40);
00829 shakeLeftArrowBtn.SetLabel(&shakeLeftArrowBtnTxt);
00830 shakeLeftArrowBtn.SetLabelOver(&shakeLeftArrowBtnTxtOver);
00831 shakeLeftArrowBtn.SetImage(&shakeLeftArrowBtnImg);
00832 shakeLeftArrowBtn.SetImageOver(&shakeLeftArrowBtnImgOver);
00833 shakeLeftArrowBtn.SetSoundOver(&btnSoundOver);
00834 shakeLeftArrowBtn.SetTrigger(&trigA);
00835 shakeLeftArrowBtn.SetEffectGrow();
00836
00837
00838 GuiButton shakeRightArrowBtn(btnData40x40Square->GetWidth(), btnData40x40Square->GetHeight());
00839 GuiText shakeRightArrowBtnTxt(">", 22, blackColor);
00840 GuiText shakeRightArrowBtnTxtOver(">", 22, helpTxtColor);
00841 GuiImage shakeRightArrowBtnImg(btnData40x40Square);
00842 GuiImage shakeRightArrowBtnImgOver(btnData40x40SquareOver);
00843
00844 shakeRightArrowBtn.SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
00845 shakeRightArrowBtn.SetPosition(80, 60 + 4 * 40);
00846 shakeRightArrowBtn.SetLabel(&shakeRightArrowBtnTxt);
00847 shakeRightArrowBtn.SetLabelOver(&shakeRightArrowBtnTxtOver);
00848 shakeRightArrowBtn.SetImage(&shakeRightArrowBtnImg);
00849 shakeRightArrowBtn.SetImageOver(&shakeRightArrowBtnImgOver);
00850 shakeRightArrowBtn.SetSoundOver(&btnSoundOver);
00851 shakeRightArrowBtn.SetTrigger(&trigA);
00852 shakeRightArrowBtn.SetEffectGrow();
00853
00854
00855 GuiText shakeTxt(isShakeEnabled[player] ? "on" : "off", 22, blackColor);
00856 shakeTxt.SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
00857 shakeTxt.SetPosition(0, 60 + PADDING_TOP + 4 * 40);
00858
00859
00860
00861 GuiButton confirmBtn(btnData40x40Square->GetWidth(), btnData40x40Square->GetHeight());
00862 GuiText confirmBtnTxt("OK", 22, (GXColor){0, 0, 255, 255});
00863 GuiImage confirmBtnImg(btnData40x40Square);
00864 GuiImage confirmBtnImgOver(btnData40x40SquareOver);
00865
00866 confirmBtn.SetAlignment(ALIGN_RIGHT, ALIGN_BOTTOM);
00867 confirmBtn.SetPosition(-10, -10);
00868 confirmBtn.SetLabel(&confirmBtnTxt);
00869 confirmBtn.SetImage(&confirmBtnImg);
00870 confirmBtn.SetImageOver(&confirmBtnImgOver);
00871 confirmBtn.SetSoundOver(&btnSoundOver);
00872 confirmBtn.SetTrigger(&trigA);
00873 confirmBtn.SetEffectGrow();
00874
00875
00876 GuiButton cancelBtn(btnData40x40Square->GetWidth(), btnData40x40Square->GetHeight());
00877 GuiText cancelBtnTxt("X", 22, (GXColor){255, 0, 0, 255});
00878 GuiImage cancelBtnImg(btnData40x40Square);
00879 GuiImage cancelBtnImgOver(btnData40x40SquareOver);
00880
00881 cancelBtn.SetAlignment(ALIGN_RIGHT, ALIGN_TOP);
00882 cancelBtn.SetPosition(-10, 10);
00883 cancelBtn.SetLabel(&cancelBtnTxt);
00884 cancelBtn.SetImage(&cancelBtnImg);
00885 cancelBtn.SetImageOver(&cancelBtnImgOver);
00886 cancelBtn.SetSoundOver(&btnSoundOver);
00887 cancelBtn.SetTrigger(&trigA);
00888 cancelBtn.SetEffectGrow();
00889
00890
00891 GuiButton helpBtn(btnData40x40Square->GetWidth(), btnData40x40Square->GetHeight());
00892 GuiText helpBtnTxt("?", 22, helpTxtColor);
00893 GuiImage helpBtnImg(btnData40x40Square);
00894 GuiImage helpBtnImgOver(btnData40x40SquareOver);
00895
00896 helpBtn.SetAlignment(ALIGN_LEFT, ALIGN_BOTTOM);
00897 helpBtn.SetPosition(10, -10);
00898 helpBtn.SetLabel(&helpBtnTxt);
00899 helpBtn.SetImage(&helpBtnImg);
00900 helpBtn.SetImageOver(&helpBtnImgOver);
00901 helpBtn.SetSoundOver(&btnSoundOver);
00902 helpBtn.SetTrigger(&trigA);
00903 helpBtn.SetEffectGrow();
00904
00905
00906 promptWindow.Append(&profilesBgImg);
00907 promptWindow.Append(&titleTxt);
00908 promptWindow.Append(&playerLeftArrowBtn);
00909 promptWindow.Append(&playerRightArrowBtn);
00910 promptWindow.Append(&playerTxt);
00911
00912 promptWindow.Append(&rotationTxtBtn);
00913 promptWindow.Append(&rotationLeftArrowBtn);
00914 promptWindow.Append(&rotationRightArrowBtn);
00915 promptWindow.Append(&rotationTxt);
00916
00917 promptWindow.Append(&shakeTxtBtn);
00918 promptWindow.Append(&shakeLeftArrowBtn);
00919 promptWindow.Append(&shakeRightArrowBtn);
00920 promptWindow.Append(&shakeTxt);
00921
00922 promptWindow.Append(&shadowTxtBtn);
00923 promptWindow.Append(&shadowLeftArrowBtn);
00924 promptWindow.Append(&shadowRightArrowBtn);
00925 promptWindow.Append(&shadowTxt);
00926
00927 promptWindow.Append(&previewTxtBtn);
00928 promptWindow.Append(&previewLeftArrowBtn);
00929 promptWindow.Append(&previewRightArrowBtn);
00930 promptWindow.Append(&previewTxt);
00931
00932 promptWindow.Append(&confirmBtn);
00933 promptWindow.Append(&cancelBtn);
00934 promptWindow.Append(&helpBtn);
00935
00936 promptWindow.SetEffect(EFFECT_SLIDE_TOP | EFFECT_SLIDE_IN, 50);
00937 HaltGui();
00938
00939
00940 mainWindow->SetState(STATE_DISABLED);
00941 mainWindow->Append(&promptWindow);
00942 mainWindow->ChangeFocus(&promptWindow);
00943 ResumeGui();
00944
00945 while (true)
00946 {
00947 usleep(THREAD_SLEEP);
00948
00949 if (confirmBtn.GetState() == STATE_CLICKED)
00950 {
00951 for (int i = 0; i < MAX_PLAYERS; ++i)
00952 {
00953 g_players[i].isNormalRotation = isNormalRotation[i];
00954 g_players[i].isShakeEnabled = isShakeEnabled[i];
00955 g_players[i].isShadowEnabled = isShadowEnabled[i];
00956 g_players[i].isPreviewEnabled = isPreviewEnabled[i];
00957 }
00958
00959 break;
00960 }
00961 else if (cancelBtn.GetState() == STATE_CLICKED)
00962 {
00963 break;
00964 }
00965 else if (helpBtn.GetState() == STATE_CLICKED)
00966 {
00967 helpBtn.ResetState();
00968
00969 WindowPrompt(
00970 "HINT",
00971 "The option menu text is clickable. Click on it for more information!",
00972 "OK",
00973 NULL,
00974 &promptWindow);
00975 }
00976
00977 else if (playerLeftArrowBtn.GetState() == STATE_CLICKED)
00978 {
00979 HaltGui();
00980 playerLeftArrowBtn.SetState(STATE_SELECTED);
00981 player--;
00982 if (player < 0)
00983 player = MAX_PLAYERS - 1;
00984
00985 sprintf(playerBuf + 7, "%d", player + 1);
00986 playerTxt.SetText(playerBuf);
00987 rotationTxt.SetText(isNormalRotation[player] ? "normal" : "reverse");
00988 shakeTxt.SetText(isShakeEnabled[player] ? "on" : "off");
00989 shadowTxt.SetText(isShadowEnabled[player] ? "on" : "off");
00990 previewTxt.SetText(isPreviewEnabled[player] ? "on" : "off");
00991 ResumeGui();
00992 }
00993 else if (playerRightArrowBtn.GetState() == STATE_CLICKED)
00994 {
00995 HaltGui();
00996 playerRightArrowBtn.SetState(STATE_SELECTED);
00997 player++;
00998 if (player >= MAX_PLAYERS)
00999 player = 0;
01000
01001 sprintf(playerBuf + 7, "%d", player + 1);
01002 playerTxt.SetText(playerBuf);
01003 rotationTxt.SetText(isNormalRotation[player] ? "normal" : "reverse");
01004 shakeTxt.SetText(isShakeEnabled[player] ? "on" : "off");
01005 shadowTxt.SetText(isShadowEnabled[player] ? "on" : "off");
01006 previewTxt.SetText(isPreviewEnabled[player] ? "on" : "off");
01007 ResumeGui();
01008 }
01009
01010 else if (rotationTxtBtn.GetState() == STATE_CLICKED)
01011 {
01012 rotationTxtBtn.ResetState();
01013
01014 WindowPrompt(
01015 "ROTATION",
01016 "The direction in which the tetris cylinder rotates. "
01017 "Set it to reverse if you're too used to regular tetris.",
01018 "OK",
01019 NULL,
01020 &promptWindow);
01021 }
01022 else if (rotationLeftArrowBtn.GetState() == STATE_CLICKED
01023 || rotationRightArrowBtn.GetState() == STATE_CLICKED)
01024 {
01025 HaltGui();
01026 rotationLeftArrowBtn.ResetState();
01027 rotationRightArrowBtn.ResetState();
01028 isNormalRotation[player] = !isNormalRotation[player];
01029 rotationTxt.SetText(isNormalRotation[player] ? "normal" : "reverse");
01030 ResumeGui();
01031 }
01032
01033 else if (shakeTxtBtn.GetState() == STATE_CLICKED)
01034 {
01035 shakeTxtBtn.ResetState();
01036
01037 WindowPrompt(
01038 "SHAKE",
01039 "Tetris pieces can also be dropped by performing a vertical shake "
01040 "motion with the wiimote.",
01041 "OK",
01042 NULL,
01043 &promptWindow);
01044 }
01045 else if (shakeLeftArrowBtn.GetState() == STATE_CLICKED
01046 || shakeRightArrowBtn.GetState() == STATE_CLICKED)
01047 {
01048 HaltGui();
01049 shakeLeftArrowBtn.ResetState();
01050 shakeRightArrowBtn.ResetState();
01051 isShakeEnabled[player] = !isShakeEnabled[player];
01052 shakeTxt.SetText(isShakeEnabled[player] ? "on" : "off");
01053 ResumeGui();
01054 }
01055
01056 else if (shadowTxtBtn.GetState() == STATE_CLICKED)
01057 {
01058 shadowTxtBtn.ResetState();
01059
01060 WindowPrompt(
01061 "SHADOW",
01062 "Shows where the current piece will drop.",
01063 "OK",
01064 NULL,
01065 &promptWindow);
01066 }
01067 else if (shadowLeftArrowBtn.GetState() == STATE_CLICKED
01068 || shadowRightArrowBtn.GetState() == STATE_CLICKED)
01069 {
01070 HaltGui();
01071 shadowLeftArrowBtn.ResetState();
01072 shadowRightArrowBtn.ResetState();
01073 isShadowEnabled[player] = !isShadowEnabled[player];
01074 shadowTxt.SetText(isShadowEnabled[player] ? "on" : "off");
01075 ResumeGui();
01076 }
01077
01078 else if (previewTxtBtn.GetState() == STATE_CLICKED)
01079 {
01080 previewTxtBtn.ResetState();
01081
01082 WindowPrompt(
01083 "PREVIEW",
01084 "Shows the next piece.",
01085 "OK",
01086 NULL,
01087 &promptWindow);
01088 }
01089 else if (previewLeftArrowBtn.GetState() == STATE_CLICKED
01090 || previewRightArrowBtn.GetState() == STATE_CLICKED)
01091 {
01092 HaltGui();
01093 previewLeftArrowBtn.ResetState();
01094 previewRightArrowBtn.ResetState();
01095 isPreviewEnabled[player] = !isPreviewEnabled[player];
01096 previewTxt.SetText(isPreviewEnabled[player] ? "on" : "off");
01097 ResumeGui();
01098 }
01099 }
01100
01101 promptWindow.SetEffect(EFFECT_SLIDE_TOP | EFFECT_SLIDE_OUT, 50);
01102 while(promptWindow.GetEffect() > 0) usleep(THREAD_SLEEP);
01103 HaltGui();
01104 mainWindow->Remove(&promptWindow);
01105 mainWindow->SetState(STATE_DEFAULT);
01106 ResumeGui();
01107 }
01108
01109 void TCYC_MenuMpOptionsPopup()
01110 {
01111 static const int PADDING_TOP = 8;
01112 GXColor helpTxtColor = (GXColor){0, 170, 0, 255};
01113 GXColor blackColor = (GXColor){0, 0, 0, 255};
01114
01115 int maxLines = g_options.maxLines;
01116 char maxLinesBuf[3+1];
01117 sprintf(maxLinesBuf, "%d", maxLines);
01118 char defMaxLinesBuf[3+1];
01119 sprintf(defMaxLinesBuf, "%d", DEFAULT_MAX_PLAYLINES);
01120
01121 int attackRate = g_options.attackRate;
01122 char attackRateBuf[2+1];
01123 sprintf(attackRateBuf, "%d", attackRate);
01124 char defAttackRateBuf[2+1];
01125 sprintf(defAttackRateBuf, "%d", DEFAULT_ATTACK_RATE);
01126
01127 int powerupRate = g_options.powerupRate;
01128 char powerupRateBuf[2+1];
01129 sprintf(powerupRateBuf, "%d", powerupRate);
01130 char defPowerupRateBuf[2+1];
01131 sprintf(defPowerupRateBuf, "%d", DEFAULT_POWERUP_RATE);
01132
01133 bool isPowerupEnabled[POWERUP_ID_MAX];
01134 memcpy(isPowerupEnabled, g_options.isPowerupEnabled, sizeof(g_options.isPowerupEnabled));
01135
01136 PowerupId powerupStartQueue[MAX_ACQUIRED_POWERUPS];
01137 memcpy(powerupStartQueue, g_options.powerupStartQueue, sizeof(g_options.powerupStartQueue));
01138
01139
01140 GuiWindow promptWindow(screenwidth - 100, screenheight - 100);
01141 promptWindow.SetAlignment(ALIGN_CENTRE, ALIGN_MIDDLE);
01142 promptWindow.SetPosition(0, 0);
01143
01144 GuiSound btnSoundOver(button_over_pcm, button_over_pcm_size, SOUND_PCM);
01145
01146
01147 GuiTrigger trigA;
01148 trigA.SetSimpleTrigger(-1, WPAD_BUTTON_A | WPAD_CLASSIC_BUTTON_A, PAD_BUTTON_A);
01149
01150
01151
01152 GuiImage mpOptBgImg(screenwidth - 100, screenheight - 100, (GXColor){170, 170, 170, 255});
01153
01154 GuiText titleTxt("Multiplayer Options", 30, blackColor);
01155 titleTxt.SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
01156 titleTxt.SetPosition(0, 15);
01157
01158
01159 GuiButton linesTxtBtn((10 + 1) * 11, 22);
01160 GuiText linesTxtBtnTxt("max lines:", 22, blackColor);
01161 GuiText linesTxtBtnTxtOver("max lines:", 22, helpTxtColor);
01162
01163 linesTxtBtn.SetAlignment(ALIGN_LEFT, ALIGN_TOP);
01164 linesTxtBtn.SetPosition(10, 60 + PADDING_TOP);
01165 linesTxtBtn.SetLabel(&linesTxtBtnTxt);
01166 linesTxtBtn.SetLabelOver(&linesTxtBtnTxtOver);
01167 linesTxtBtn.SetSoundOver(&btnSoundOver);
01168 linesTxtBtn.SetTrigger(&trigA);
01169
01170
01171 GuiText linesTxt(maxLines ? maxLinesBuf : "off", 22, blackColor);
01172 linesTxt.SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
01173 linesTxt.SetPosition(-20, 60 + PADDING_TOP);
01174
01175
01176
01177 GuiButton linesDefaultBtn(btnData40x40Square->GetWidth(), btnData40x40Square->GetHeight());
01178 GuiText linesDefaultBtnTxt(defMaxLinesBuf, 22, blackColor);
01179 GuiText linesDefaultBtnTxtOver(defMaxLinesBuf, 22, helpTxtColor);
01180 GuiImage linesDefaultBtnImg(btnData40x40Square);
01181 GuiImage linesDefaultBtnImgOver(btnData40x40SquareOver);
01182
01183 linesDefaultBtn.SetAlignment(ALIGN_RIGHT, ALIGN_TOP);
01184 linesDefaultBtn.SetPosition(-10 - 2 * btnData40x40Square->GetWidth(), 60);
01185 linesDefaultBtn.SetLabel(&linesDefaultBtnTxt);
01186 linesDefaultBtn.SetLabelOver(&linesDefaultBtnTxtOver);
01187 linesDefaultBtn.SetImage(&linesDefaultBtnImg);
01188 linesDefaultBtn.SetImageOver(&linesDefaultBtnImgOver);
01189 linesDefaultBtn.SetSoundOver(&btnSoundOver);
01190 linesDefaultBtn.SetTrigger(&trigA);
01191 linesDefaultBtn.SetEffectGrow();
01192
01193
01194 GuiButton linesMinusBtn(btnData40x40Square->GetWidth(), btnData40x40Square->GetHeight());
01195 GuiText linesMinusBtnTxt("-", 22, blackColor);
01196 GuiText linesMinusBtnTxtOver("-", 22, helpTxtColor);
01197 GuiImage linesMinusBtnImg(btnData40x40Square);
01198 GuiImage linesMinusBtnImgOver(btnData40x40SquareOver);
01199
01200 linesMinusBtn.SetAlignment(ALIGN_RIGHT, ALIGN_TOP);
01201 linesMinusBtn.SetPosition(-10 - btnData40x40Square->GetWidth(), 60);
01202 linesMinusBtn.SetLabel(&linesMinusBtnTxt);
01203 linesMinusBtn.SetLabelOver(&linesMinusBtnTxtOver);
01204 linesMinusBtn.SetImage(&linesMinusBtnImg);
01205 linesMinusBtn.SetImageOver(&linesMinusBtnImgOver);
01206 linesMinusBtn.SetSoundOver(&btnSoundOver);
01207 linesMinusBtn.SetTrigger(&trigA);
01208 linesMinusBtn.SetEffectGrow();
01209
01210
01211 GuiButton linesPlusBtn(btnData40x40Square->GetWidth(), btnData40x40Square->GetHeight());
01212 GuiText linesPlusBtnTxt("+", 22, blackColor);
01213 GuiText linesPlusBtnTxtOver("+", 22, helpTxtColor);
01214 GuiImage linesPlusBtnImg(btnData40x40Square);
01215 GuiImage linesPlusBtnImgOver(btnData40x40SquareOver);
01216
01217 linesPlusBtn.SetAlignment(ALIGN_RIGHT, ALIGN_TOP);
01218 linesPlusBtn.SetPosition(-10, 60);
01219 linesPlusBtn.SetLabel(&linesPlusBtnTxt);
01220 linesPlusBtn.SetLabelOver(&linesPlusBtnTxtOver);
01221 linesPlusBtn.SetImage(&linesPlusBtnImg);
01222 linesPlusBtn.SetImageOver(&linesPlusBtnImgOver);
01223 linesPlusBtn.SetSoundOver(&btnSoundOver);
01224 linesPlusBtn.SetTrigger(&trigA);
01225 linesPlusBtn.SetEffectGrow();
01226
01227
01228 GuiButton attackTxtBtn((12 + 1) * 11, 22);
01229 GuiText attackTxtBtnTxt("attack rate:", 22, blackColor);
01230 GuiText attackTxtBtnTxtOver("attack rate:", 22, helpTxtColor);
01231
01232 attackTxtBtn.SetAlignment(ALIGN_LEFT, ALIGN_TOP);
01233 attackTxtBtn.SetPosition(10, 60 + PADDING_TOP + 1 * 40);
01234 attackTxtBtn.SetLabel(&attackTxtBtnTxt);
01235 attackTxtBtn.SetLabelOver(&attackTxtBtnTxtOver);
01236 attackTxtBtn.SetSoundOver(&btnSoundOver);
01237 attackTxtBtn.SetTrigger(&trigA);
01238
01239
01240 GuiText attackTxt(attackRate ? attackRateBuf : "off", 22, blackColor);
01241 attackTxt.SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
01242 attackTxt.SetPosition(-20, 60 + PADDING_TOP + 1 * 40);
01243
01244
01245
01246 GuiButton attackDefaultBtn(btnData40x40Square->GetWidth(), btnData40x40Square->GetHeight());
01247 GuiText attackDefaultBtnTxt(defAttackRateBuf, 22, blackColor);
01248 GuiText attackDefaultBtnTxtOver(defAttackRateBuf, 22, helpTxtColor);
01249 GuiImage attackDefaultBtnImg(btnData40x40Square);
01250 GuiImage attackDefaultBtnImgOver(btnData40x40SquareOver);
01251
01252 attackDefaultBtn.SetAlignment(ALIGN_RIGHT, ALIGN_TOP);
01253 attackDefaultBtn.SetPosition(-10 - 2 * btnData40x40Square->GetWidth(), 60 + 1 * 40);
01254 attackDefaultBtn.SetLabel(&attackDefaultBtnTxt);
01255 attackDefaultBtn.SetLabelOver(&attackDefaultBtnTxtOver);
01256 attackDefaultBtn.SetImage(&attackDefaultBtnImg);
01257 attackDefaultBtn.SetImageOver(&attackDefaultBtnImgOver);
01258 attackDefaultBtn.SetSoundOver(&btnSoundOver);
01259 attackDefaultBtn.SetTrigger(&trigA);
01260 attackDefaultBtn.SetEffectGrow();
01261
01262
01263 GuiButton attackMinusBtn(btnData40x40Square->GetWidth(), btnData40x40Square->GetHeight());
01264 GuiText attackMinusBtnTxt("-", 22, blackColor);
01265 GuiText attackMinusBtnTxtOver("-", 22, helpTxtColor);
01266 GuiImage attackMinusBtnImg(btnData40x40Square);
01267 GuiImage attackMinusBtnImgOver(btnData40x40SquareOver);
01268
01269 attackMinusBtn.SetAlignment(ALIGN_RIGHT, ALIGN_TOP);
01270 attackMinusBtn.SetPosition(-10 - btnData40x40Square->GetWidth(), 60 + 1 * 40);
01271 attackMinusBtn.SetLabel(&attackMinusBtnTxt);
01272 attackMinusBtn.SetLabelOver(&attackMinusBtnTxtOver);
01273 attackMinusBtn.SetImage(&attackMinusBtnImg);
01274 attackMinusBtn.SetImageOver(&attackMinusBtnImgOver);
01275 attackMinusBtn.SetSoundOver(&btnSoundOver);
01276 attackMinusBtn.SetTrigger(&trigA);
01277 attackMinusBtn.SetEffectGrow();
01278
01279
01280 GuiButton attackPlusBtn(btnData40x40Square->GetWidth(), btnData40x40Square->GetHeight());
01281 GuiText attackPlusBtnTxt("+", 22, blackColor);
01282 GuiText attackPlusBtnTxtOver("+", 22, helpTxtColor);
01283 GuiImage attackPlusBtnImg(btnData40x40Square);
01284 GuiImage attackPlusBtnImgOver(btnData40x40SquareOver);
01285
01286 attackPlusBtn.SetAlignment(ALIGN_RIGHT, ALIGN_TOP);
01287 attackPlusBtn.SetPosition(-10, 60 + 1 * 40);
01288 attackPlusBtn.SetLabel(&attackPlusBtnTxt);
01289 attackPlusBtn.SetLabelOver(&attackPlusBtnTxtOver);
01290 attackPlusBtn.SetImage(&attackPlusBtnImg);
01291 attackPlusBtn.SetImageOver(&attackPlusBtnImgOver);
01292 attackPlusBtn.SetSoundOver(&btnSoundOver);
01293 attackPlusBtn.SetTrigger(&trigA);
01294 attackPlusBtn.SetEffectGrow();
01295
01296
01297
01298 GuiButton powerupRateTxtBtn((14 + 1) * 11, 22);
01299 GuiText powerupRateTxtBtnTxt("powerup rate:", 22, blackColor);
01300 GuiText powerupRateTxtBtnTxtOver("powerup rate:", 22, helpTxtColor);
01301
01302 powerupRateTxtBtn.SetAlignment(ALIGN_LEFT, ALIGN_TOP);
01303 powerupRateTxtBtn.SetPosition(10, 60 + PADDING_TOP + 2 * 40);
01304 powerupRateTxtBtn.SetLabel(&powerupRateTxtBtnTxt);
01305 powerupRateTxtBtn.SetLabelOver(&powerupRateTxtBtnTxtOver);
01306 powerupRateTxtBtn.SetSoundOver(&btnSoundOver);
01307 powerupRateTxtBtn.SetTrigger(&trigA);
01308
01309
01310 GuiText powerupRateTxt(powerupRate ? powerupRateBuf : "off", 22, blackColor);
01311 powerupRateTxt.SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
01312 powerupRateTxt.SetPosition(-20, 60 + PADDING_TOP + 2 * 40);
01313
01314
01315 GuiButton powerupRateDefaultBtn(btnData40x40Square->GetWidth(), btnData40x40Square->GetHeight());
01316 GuiText powerupRateDefaultBtnTxt(defPowerupRateBuf, 22, blackColor);
01317 GuiText powerupRateDefaultBtnTxtOver(defPowerupRateBuf, 22, helpTxtColor);
01318 GuiImage powerupRateDefaultBtnImg(btnData40x40Square);
01319 GuiImage powerupRateDefaultBtnImgOver(btnData40x40SquareOver);
01320
01321 powerupRateDefaultBtn.SetAlignment(ALIGN_RIGHT, ALIGN_TOP);
01322 powerupRateDefaultBtn.SetPosition(-10 - 2 * btnData40x40Square->GetWidth(), 60 + 2 * 40);
01323 powerupRateDefaultBtn.SetLabel(&powerupRateDefaultBtnTxt);
01324 powerupRateDefaultBtn.SetLabelOver(&powerupRateDefaultBtnTxtOver);
01325 powerupRateDefaultBtn.SetImage(&powerupRateDefaultBtnImg);
01326 powerupRateDefaultBtn.SetImageOver(&powerupRateDefaultBtnImgOver);
01327 powerupRateDefaultBtn.SetSoundOver(&btnSoundOver);
01328 powerupRateDefaultBtn.SetTrigger(&trigA);
01329 powerupRateDefaultBtn.SetEffectGrow();
01330
01331
01332 GuiButton powerupRateMinusBtn(btnData40x40Square->GetWidth(), btnData40x40Square->GetHeight());
01333 GuiText powerupRateMinusBtnTxt("-", 22, blackColor);
01334 GuiText powerupRateMinusBtnTxtOver("-", 22, helpTxtColor);
01335 GuiImage powerupRateMinusBtnImg(btnData40x40Square);
01336 GuiImage powerupRateMinusBtnImgOver(btnData40x40SquareOver);
01337
01338 powerupRateMinusBtn.SetAlignment(ALIGN_RIGHT, ALIGN_TOP);
01339 powerupRateMinusBtn.SetPosition(-10 - btnData40x40Square->GetWidth(), 60 + 2 * 40);
01340 powerupRateMinusBtn.SetLabel(&powerupRateMinusBtnTxt);
01341 powerupRateMinusBtn.SetLabelOver(&powerupRateMinusBtnTxtOver);
01342 powerupRateMinusBtn.SetImage(&powerupRateMinusBtnImg);
01343 powerupRateMinusBtn.SetImageOver(&powerupRateMinusBtnImgOver);
01344 powerupRateMinusBtn.SetSoundOver(&btnSoundOver);
01345 powerupRateMinusBtn.SetTrigger(&trigA);
01346 powerupRateMinusBtn.SetEffectGrow();
01347
01348
01349 GuiButton powerupRatePlusBtn(btnData40x40Square->GetWidth(), btnData40x40Square->GetHeight());
01350 GuiText powerupRatePlusBtnTxt("+", 22, blackColor);
01351 GuiText powerupRatePlusBtnTxtOver("+", 22, helpTxtColor);
01352 GuiImage powerupRatePlusBtnImg(btnData40x40Square);
01353 GuiImage powerupRatePlusBtnImgOver(btnData40x40SquareOver);
01354
01355 powerupRatePlusBtn.SetAlignment(ALIGN_RIGHT, ALIGN_TOP);
01356 powerupRatePlusBtn.SetPosition(-10, 60 + 2 * 40);
01357 powerupRatePlusBtn.SetLabel(&powerupRatePlusBtnTxt);
01358 powerupRatePlusBtn.SetLabelOver(&powerupRatePlusBtnTxtOver);
01359 powerupRatePlusBtn.SetImage(&powerupRatePlusBtnImg);
01360 powerupRatePlusBtn.SetImageOver(&powerupRatePlusBtnImgOver);
01361 powerupRatePlusBtn.SetSoundOver(&btnSoundOver);
01362 powerupRatePlusBtn.SetTrigger(&trigA);
01363 powerupRatePlusBtn.SetEffectGrow();
01364
01365
01366
01367 GuiButton confirmBtn(btnData40x40Square->GetWidth(), btnData40x40Square->GetHeight());
01368 GuiText confirmBtnTxt("OK", 22, (GXColor){0, 0, 255, 255});
01369 GuiImage confirmBtnImg(btnData40x40Square);
01370 GuiImage confirmBtnImgOver(btnData40x40SquareOver);
01371
01372 confirmBtn.SetAlignment(ALIGN_RIGHT, ALIGN_BOTTOM);
01373 confirmBtn.SetPosition(-10, -10);
01374 confirmBtn.SetLabel(&confirmBtnTxt);
01375 confirmBtn.SetImage(&confirmBtnImg);
01376 confirmBtn.SetImageOver(&confirmBtnImgOver);
01377 confirmBtn.SetSoundOver(&btnSoundOver);
01378 confirmBtn.SetTrigger(&trigA);
01379 confirmBtn.SetEffectGrow();
01380
01381
01382 GuiButton cancelBtn(btnData40x40Square->GetWidth(), btnData40x40Square->GetHeight());
01383 GuiText cancelBtnTxt("X", 22, (GXColor){255, 0, 0, 255});
01384 GuiImage cancelBtnImg(btnData40x40Square);
01385 GuiImage cancelBtnImgOver(btnData40x40SquareOver);
01386
01387 cancelBtn.SetAlignment(ALIGN_RIGHT, ALIGN_TOP);
01388 cancelBtn.SetPosition(-10, 10);
01389 cancelBtn.SetLabel(&cancelBtnTxt);
01390 cancelBtn.SetImage(&cancelBtnImg);
01391 cancelBtn.SetImageOver(&cancelBtnImgOver);
01392 cancelBtn.SetSoundOver(&btnSoundOver);
01393 cancelBtn.SetTrigger(&trigA);
01394 cancelBtn.SetEffectGrow();
01395
01396
01397 GuiButton helpBtn(btnData40x40Square->GetWidth(), btnData40x40Square->GetHeight());
01398 GuiText helpBtnTxt("?", 22, helpTxtColor);
01399 GuiImage helpBtnImg(btnData40x40Square);
01400 GuiImage helpBtnImgOver(btnData40x40SquareOver);
01401
01402 helpBtn.SetAlignment(ALIGN_LEFT, ALIGN_BOTTOM);
01403 helpBtn.SetPosition(10, -10);
01404 helpBtn.SetLabel(&helpBtnTxt);
01405 helpBtn.SetImage(&helpBtnImg);
01406 helpBtn.SetImageOver(&helpBtnImgOver);
01407 helpBtn.SetSoundOver(&btnSoundOver);
01408 helpBtn.SetTrigger(&trigA);
01409 helpBtn.SetEffectGrow();
01410
01411
01412 GuiButton powerupBtn(btnOutline->GetWidth(), btnOutline->GetHeight());
01413 GuiText powerupTxt("Powerups", 22, (GXColor){0, 0, 0, 255});
01414 GuiImage powerupImg(btnOutline);
01415 GuiImage powerupImgOver(btnOutlineOver);
01416
01417 powerupBtn.SetAlignment(ALIGN_CENTRE, ALIGN_BOTTOM);
01418 powerupBtn.SetPosition(0, -10);
01419 powerupBtn.SetLabel(&powerupTxt);
01420 powerupBtn.SetImage(&powerupImg);
01421 powerupBtn.SetImageOver(&powerupImgOver);
01422 powerupBtn.SetSoundOver(&btnSoundOver);
01423 powerupBtn.SetTrigger(&trigA);
01424 powerupBtn.SetEffectGrow();
01425
01426 promptWindow.Append(&mpOptBgImg);
01427 promptWindow.Append(&titleTxt);
01428 promptWindow.Append(&linesTxtBtn);
01429 promptWindow.Append(&linesTxt);
01430 promptWindow.Append(&linesDefaultBtn);
01431 promptWindow.Append(&linesMinusBtn);
01432 promptWindow.Append(&linesPlusBtn);
01433 promptWindow.Append(&attackTxtBtn);
01434 promptWindow.Append(&attackTxt);
01435 promptWindow.Append(&attackDefaultBtn);
01436 promptWindow.Append(&attackMinusBtn);
01437 promptWindow.Append(&attackPlusBtn);
01438 promptWindow.Append(&powerupRateTxtBtn);
01439 promptWindow.Append(&powerupRateTxt);
01440 promptWindow.Append(&powerupRateDefaultBtn);
01441 promptWindow.Append(&powerupRateMinusBtn);
01442 promptWindow.Append(&powerupRatePlusBtn);
01443 promptWindow.Append(&confirmBtn);
01444 promptWindow.Append(&cancelBtn);
01445 promptWindow.Append(&helpBtn);
01446 promptWindow.Append(&powerupBtn);
01447
01448 promptWindow.SetEffect(EFFECT_SLIDE_TOP | EFFECT_SLIDE_IN, 50);
01449 HaltGui();
01450
01451
01452 mainWindow->SetState(STATE_DISABLED);
01453 mainWindow->Append(&promptWindow);
01454 mainWindow->ChangeFocus(&promptWindow);
01455 ResumeGui();
01456
01457 while (true)
01458 {
01459 usleep(THREAD_SLEEP);
01460
01461 if (confirmBtn.GetState() == STATE_CLICKED)
01462 {
01463 g_options.maxLines = maxLines;
01464 g_options.attackRate = attackRate;
01465 g_options.powerupRate = powerupRate;
01466 memcpy(g_options.isPowerupEnabled, isPowerupEnabled, sizeof(isPowerupEnabled));
01467 g_options.powerupsSize = 0;
01468 for (int i = 0; i < POWERUP_ID_MAX; ++i)
01469 {
01470 if (isPowerupEnabled[i])
01471 g_options.powerups[g_options.powerupsSize++] = (PowerupId)i;
01472 }
01473 memcpy(g_options.powerupStartQueue, powerupStartQueue, sizeof(powerupStartQueue));
01474 break;
01475 }
01476 else if (cancelBtn.GetState() == STATE_CLICKED)
01477 {
01478 break;
01479 }
01480 else if (helpBtn.GetState() == STATE_CLICKED)
01481 {
01482 helpBtn.ResetState();
01483
01484 WindowPrompt(
01485 "HINT",
01486 "The option menu text is clickable. Click on it for more information!",
01487 "OK",
01488 NULL,
01489 &promptWindow);
01490 }
01491
01492 else if (linesTxtBtn.GetState() == STATE_CLICKED)
01493 {
01494 linesTxtBtn.ResetState();
01495
01496 WindowPrompt(
01497 "MAX LINES",
01498 "You win the game after clearing this many lines.",
01499 "OK",
01500 NULL,
01501 &promptWindow);
01502 }
01503 else if (linesDefaultBtn.GetState() == STATE_CLICKED)
01504 {
01505 HaltGui();
01506 linesDefaultBtn.SetState(STATE_SELECTED);
01507 maxLines = DEFAULT_MAX_PLAYLINES;
01508 sprintf(maxLinesBuf, "%d", maxLines);
01509 linesTxt.SetText(maxLinesBuf);
01510 ResumeGui();
01511 }
01512 else if (linesMinusBtn.GetState() == STATE_CLICKED)
01513 {
01514 HaltGui();
01515 linesMinusBtn.SetState(STATE_SELECTED);
01516 maxLines -= 5;
01517 if (maxLines <= 0)
01518 {
01519 maxLines = 0;
01520 linesTxt.SetText("off");
01521 }
01522 else
01523 {
01524 sprintf(maxLinesBuf, "%d", maxLines);
01525 linesTxt.SetText(maxLinesBuf);
01526 }
01527 ResumeGui();
01528 }
01529 else if (linesPlusBtn.GetState() == STATE_CLICKED)
01530 {
01531 HaltGui();
01532 linesPlusBtn.SetState(STATE_SELECTED);
01533 maxLines += 5;
01534 if (maxLines >= 1000)
01535 maxLines = 995;
01536
01537 sprintf(maxLinesBuf, "%d", maxLines);
01538 linesTxt.SetText(maxLinesBuf);
01539 ResumeGui();
01540 }
01541
01542 else if (attackTxtBtn.GetState() == STATE_CLICKED)
01543 {
01544 attackTxtBtn.ResetState();
01545
01546 WindowPrompt(
01547 "ATTACK RATE",
01548 "You attack all your opponents every time you score this many points. "
01549 "This raises the speed of the falling block by one level.",
01550 "OK",
01551 NULL,
01552 &promptWindow);
01553 }
01554 else if (attackDefaultBtn.GetState() == STATE_CLICKED)
01555 {
01556 HaltGui();
01557 attackDefaultBtn.SetState(STATE_SELECTED);
01558 attackRate = DEFAULT_ATTACK_RATE;
01559 sprintf(attackRateBuf, "%d", attackRate);
01560 attackTxt.SetText(attackRateBuf);
01561 ResumeGui();
01562 }
01563 else if (attackMinusBtn.GetState() == STATE_CLICKED)
01564 {
01565 HaltGui();
01566 attackMinusBtn.SetState(STATE_SELECTED);
01567 attackRate--;
01568 if (attackRate <= 0)
01569 {
01570 attackRate = 0;
01571 attackTxt.SetText("off");
01572 }
01573 else
01574 {
01575 sprintf(attackRateBuf, "%d", attackRate);
01576 attackTxt.SetText(attackRateBuf);
01577 }
01578 ResumeGui();
01579 }
01580 else if (attackPlusBtn.GetState() == STATE_CLICKED)
01581 {
01582 HaltGui();
01583 attackPlusBtn.SetState(STATE_SELECTED);
01584 attackRate++;
01585 if (attackRate >= 100)
01586 attackRate = 99;
01587
01588 sprintf(attackRateBuf, "%d", attackRate);
01589 attackTxt.SetText(attackRateBuf);
01590 ResumeGui();
01591 }
01592
01593 else if (powerupRateTxtBtn.GetState() == STATE_CLICKED)
01594 {
01595 powerupRateTxtBtn.ResetState();
01596
01597 WindowPrompt(
01598 "POWERUP RATE",
01599 "Every 'x' pieces will be a powerup piece. "
01600 "Clear a powerup piece to earn that powerup.",
01601 "OK",
01602 NULL,
01603 &promptWindow);
01604 }
01605 else if (powerupRateDefaultBtn.GetState() == STATE_CLICKED)
01606 {
01607 HaltGui();
01608 powerupRateDefaultBtn.SetState(STATE_SELECTED);
01609 powerupRate = DEFAULT_POWERUP_RATE;
01610 sprintf(powerupRateBuf, "%d", powerupRate);
01611 powerupRateTxt.SetText(powerupRateBuf);
01612 ResumeGui();
01613 }
01614 else if (powerupRateMinusBtn.GetState() == STATE_CLICKED)
01615 {
01616 HaltGui();
01617 powerupRateMinusBtn.SetState(STATE_SELECTED);
01618 powerupRate--;
01619 if (powerupRate <= 0)
01620 {
01621 powerupRate = 0;
01622 powerupRateTxt.SetText("off");
01623 }
01624 else
01625 {
01626 sprintf(powerupRateBuf, "%d", powerupRate);
01627 powerupRateTxt.SetText(powerupRateBuf);
01628 }
01629 ResumeGui();
01630 }
01631 else if (powerupRatePlusBtn.GetState() == STATE_CLICKED)
01632 {
01633 HaltGui();
01634 powerupRatePlusBtn.SetState(STATE_SELECTED);
01635 powerupRate++;
01636 if (powerupRate >= 100)
01637 powerupRate = 99;
01638
01639 sprintf(powerupRateBuf, "%d", powerupRate);
01640 powerupRateTxt.SetText(powerupRateBuf);
01641 ResumeGui();
01642 }
01643
01644 else if (powerupBtn.GetState() == STATE_CLICKED)
01645 {
01646 powerupBtn.ResetState();
01647 TCYC_MenuPowerupsPopup(&promptWindow, isPowerupEnabled, powerupStartQueue);
01648 }
01649
01650 HaltGui();
01651
01652 if ( linesDefaultBtn.GetState() == STATE_SELECTED
01653 || linesDefaultBtn.GetState() == STATE_CLICKED
01654 || linesMinusBtn.GetState() == STATE_SELECTED
01655 || linesMinusBtn.GetState() == STATE_CLICKED
01656 || linesPlusBtn.GetState() == STATE_SELECTED
01657 || linesPlusBtn.GetState() == STATE_CLICKED)
01658 {
01659 linesTxt.SetColor(helpTxtColor);
01660 }
01661 else
01662 {
01663 linesTxt.SetColor(blackColor);
01664 }
01665
01666 if ( attackDefaultBtn.GetState() == STATE_SELECTED
01667 || attackDefaultBtn.GetState() == STATE_CLICKED
01668 || attackMinusBtn.GetState() == STATE_SELECTED
01669 || attackMinusBtn.GetState() == STATE_CLICKED
01670 || attackPlusBtn.GetState() == STATE_SELECTED
01671 || attackPlusBtn.GetState() == STATE_CLICKED)
01672 {
01673 attackTxt.SetColor(helpTxtColor);
01674 }
01675 else
01676 {
01677 attackTxt.SetColor(blackColor);
01678 }
01679
01680 if ( powerupRateDefaultBtn.GetState() == STATE_SELECTED
01681 || powerupRateDefaultBtn.GetState() == STATE_CLICKED
01682 || powerupRateMinusBtn.GetState() == STATE_SELECTED
01683 || powerupRateMinusBtn.GetState() == STATE_CLICKED
01684 || powerupRatePlusBtn.GetState() == STATE_SELECTED
01685 || powerupRatePlusBtn.GetState() == STATE_CLICKED)
01686 {
01687 powerupRateTxt.SetColor(helpTxtColor);
01688 }
01689 else
01690 {
01691 powerupRateTxt.SetColor(blackColor);
01692 }
01693 ResumeGui();
01694 }
01695
01696 promptWindow.SetEffect(EFFECT_SLIDE_TOP | EFFECT_SLIDE_OUT, 50);
01697 while(promptWindow.GetEffect() > 0) usleep(THREAD_SLEEP);
01698 HaltGui();
01699 mainWindow->Remove(&promptWindow);
01700 mainWindow->SetState(STATE_DEFAULT);
01701 ResumeGui();
01702 }
01703
01704 void TCYC_MenuPowerupsPopup(GuiWindow *parentWindow,
01705 bool isPowerupEnabled[POWERUP_ID_MAX],
01706 PowerupId powerupStartQueue[MAX_ACQUIRED_POWERUPS])
01707 {
01708 GXColor helpTxtColor = (GXColor){0, 170, 0, 255};
01709 GXColor blackColor = (GXColor){0, 0, 0, 255};
01710
01711 GuiSound btnSoundOver(button_over_pcm, button_over_pcm_size, SOUND_PCM);
01712 GuiTrigger trigA;
01713 trigA.SetSimpleTrigger(-1, WPAD_BUTTON_A | WPAD_CLASSIC_BUTTON_A, PAD_BUTTON_A);
01714
01715 bool tmpIsPowerupEnabled[POWERUP_ID_MAX];
01716 memcpy(tmpIsPowerupEnabled, isPowerupEnabled, sizeof(tmpIsPowerupEnabled));
01717
01718 PowerupId tmpPowerupStartQueue[MAX_ACQUIRED_POWERUPS];
01719 memcpy(tmpPowerupStartQueue, powerupStartQueue, sizeof(tmpPowerupStartQueue));
01720
01721 GuiWindow window(screenwidth - 100, screenheight - 100);
01722 window.SetAlignment(ALIGN_CENTRE, ALIGN_MIDDLE);
01723 window.SetPosition(0, 0);
01724 window.SetEffect(EFFECT_SLIDE_TOP | EFFECT_SLIDE_IN, 50);
01725
01726 GuiImage bgImg(screenwidth - 100, screenheight - 100, (GXColor){150, 150, 150, 255});
01727
01728 GuiText titleTxt("Powerups", 30, blackColor);
01729 titleTxt.SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
01730 titleTxt.SetPosition(0, 15);
01731
01732
01733 GuiButton confirmBtn(btnData40x40Square->GetWidth(), btnData40x40Square->GetHeight());
01734 GuiText confirmBtnTxt("OK", 22, (GXColor){0, 0, 255, 255});
01735 GuiImage confirmBtnImg(btnData40x40Square);
01736 GuiImage confirmBtnImgOver(btnData40x40SquareOver);
01737
01738 confirmBtn.SetAlignment(ALIGN_RIGHT, ALIGN_BOTTOM);
01739 confirmBtn.SetPosition(-10, -10);
01740 confirmBtn.SetLabel(&confirmBtnTxt);
01741 confirmBtn.SetImage(&confirmBtnImg);
01742 confirmBtn.SetImageOver(&confirmBtnImgOver);
01743 confirmBtn.SetSoundOver(&btnSoundOver);
01744 confirmBtn.SetTrigger(&trigA);
01745 confirmBtn.SetEffectGrow();
01746
01747
01748 GuiButton cancelBtn(btnData40x40Square->GetWidth(), btnData40x40Square->GetHeight());
01749 GuiText cancelBtnTxt("X", 22, (GXColor){255, 0, 0, 255});
01750 GuiImage cancelBtnImg(btnData40x40Square);
01751 GuiImage cancelBtnImgOver(btnData40x40SquareOver);
01752
01753 cancelBtn.SetAlignment(ALIGN_RIGHT, ALIGN_TOP);
01754 cancelBtn.SetPosition(-10, 10);
01755 cancelBtn.SetLabel(&cancelBtnTxt);
01756 cancelBtn.SetImage(&cancelBtnImg);
01757 cancelBtn.SetImageOver(&cancelBtnImgOver);
01758 cancelBtn.SetSoundOver(&btnSoundOver);
01759 cancelBtn.SetTrigger(&trigA);
01760 cancelBtn.SetEffectGrow();
01761
01762
01763 GuiButton helpBtn(btnData40x40Square->GetWidth(), btnData40x40Square->GetHeight());
01764 GuiText helpBtnTxt("?", 22, helpTxtColor);
01765 GuiImage helpBtnImg(btnData40x40Square);
01766 GuiImage helpBtnImgOver(btnData40x40SquareOver);
01767
01768 helpBtn.SetAlignment(ALIGN_LEFT, ALIGN_BOTTOM);
01769 helpBtn.SetPosition(10, -10);
01770 helpBtn.SetLabel(&helpBtnTxt);
01771 helpBtn.SetImage(&helpBtnImg);
01772 helpBtn.SetImageOver(&helpBtnImgOver);
01773 helpBtn.SetSoundOver(&btnSoundOver);
01774 helpBtn.SetTrigger(&trigA);
01775 helpBtn.SetEffectGrow();
01776
01777
01778 GuiButton allOnBtn(btnData40x40Square->GetWidth(), btnData40x40Square->GetHeight());
01779 GuiText allOnTxt("on", 22, blackColor);
01780 GuiImage allOnImg(btnData40x40Square);
01781 GuiImage allOnImgOver(btnData40x40SquareOver);
01782
01783 allOnBtn.SetAlignment(ALIGN_CENTRE, ALIGN_BOTTOM);
01784 allOnBtn.SetPosition(-btnData40x40Square->GetWidth() / 2, -10);
01785 allOnBtn.SetLabel(&allOnTxt);
01786 allOnBtn.SetImage(&allOnImg);
01787 allOnBtn.SetImageOver(&allOnImgOver);
01788 allOnBtn.SetSoundOver(&btnSoundOver);
01789 allOnBtn.SetTrigger(&trigA);
01790 allOnBtn.SetEffectGrow();
01791
01792
01793 GuiButton allOffBtn(btnData40x40Square->GetWidth(), btnData40x40Square->GetHeight());
01794 GuiText allOffTxt("off", 22, blackColor);
01795 GuiImage allOffImg(btnData40x40Square);
01796 GuiImage allOffImgOver(btnData40x40SquareOver);
01797
01798 allOffBtn.SetAlignment(ALIGN_CENTRE, ALIGN_BOTTOM);
01799 allOffBtn.SetPosition(btnData40x40Square->GetWidth() / 2, -10);
01800 allOffBtn.SetLabel(&allOffTxt);
01801 allOffBtn.SetImage(&allOffImg);
01802 allOffBtn.SetImageOver(&allOffImgOver);
01803 allOffBtn.SetSoundOver(&btnSoundOver);
01804 allOffBtn.SetTrigger(&trigA);
01805 allOffBtn.SetEffectGrow();
01806
01807
01808 GuiButton scrollUpBtn(btnDataPlus->GetWidth(), btnDataPlus->GetHeight());
01809 GuiImage scrollUpImg(btnDataPlus);
01810 GuiImage scrollUpImgOver(btnDataPlusOver);
01811
01812 scrollUpBtn.SetAlignment(ALIGN_RIGHT, ALIGN_MIDDLE);
01813 scrollUpBtn.SetPosition(-10, -btnDataPlus->GetHeight() / 2);
01814 scrollUpBtn.SetImage(&scrollUpImg);
01815 scrollUpBtn.SetImageOver(&scrollUpImgOver);
01816 scrollUpBtn.SetSoundOver(&btnSoundOver);
01817 scrollUpBtn.SetTrigger(&trigA);
01818 scrollUpBtn.SetEffectGrow();
01819
01820
01821 GuiButton scrollDownBtn(btnDataMinus->GetWidth(), btnDataMinus->GetHeight());
01822 GuiImage scrollDownImg(btnDataMinus);
01823 GuiImage scrollDownImgOver(btnDataMinusOver);
01824
01825 scrollDownBtn.SetAlignment(ALIGN_RIGHT, ALIGN_MIDDLE);
01826 scrollDownBtn.SetPosition(-10, btnDataMinus->GetHeight() / 2);
01827 scrollDownBtn.SetImage(&scrollDownImg);
01828 scrollDownBtn.SetImageOver(&scrollDownImgOver);
01829 scrollDownBtn.SetSoundOver(&btnSoundOver);
01830 scrollDownBtn.SetTrigger(&trigA);
01831 scrollDownBtn.SetEffectGrow();
01832
01833
01834 window.Append(&bgImg);
01835 window.Append(&titleTxt);
01836 window.Append(&confirmBtn);
01837 window.Append(&cancelBtn);
01838 window.Append(&helpBtn);
01839 window.Append(&allOnBtn);
01840 window.Append(&allOffBtn);
01841 window.Append(&scrollUpBtn);
01842 window.Append(&scrollDownBtn);
01843
01844
01845 int top = 60;
01846
01847 GuiButton powerupIconBtns[POWERUP_ID_MAX];
01848 GuiImage powerupIconImgs[POWERUP_ID_MAX];
01849
01850 GuiButton powerupOnBtns[POWERUP_ID_MAX];
01851 GuiText powerupOnTxts[POWERUP_ID_MAX];
01852 GuiImage powerupOnImgs[POWERUP_ID_MAX];
01853 GuiImage powerupOnImgsOver[POWERUP_ID_MAX];
01854
01855 GuiButton powerupHelpBtns[POWERUP_ID_MAX];
01856 GuiText powerupHelpTxts[POWERUP_ID_MAX];
01857 GuiImage powerupHelpImgs[POWERUP_ID_MAX];
01858 GuiImage powerupHelpImgsOver[POWERUP_ID_MAX];
01859
01860 for (int i = 0; i < POWERUP_ID_MAX; ++i)
01861 {
01862
01863 powerupIconImgs[i].SetImage(PowerupUtils::GetImageData((PowerupId)i));
01864 powerupIconImgs[i].SetDisplaySize(btnData40x40Square->GetWidth(), btnData40x40Square->GetHeight());
01865
01866 powerupIconBtns[i].SetSize(btnData40x40Square->GetWidth(), btnData40x40Square->GetHeight());
01867 powerupIconBtns[i].SetAlignment(ALIGN_LEFT, ALIGN_TOP);
01868 powerupIconBtns[i].SetPosition(20, top + i * btnData40x40Square->GetHeight());
01869 powerupIconBtns[i].SetImage(powerupIconImgs + i);
01870 powerupIconBtns[i].SetSoundOver(&btnSoundOver);
01871 powerupIconBtns[i].SetTrigger(&trigA);
01872 powerupIconBtns[i].SetEffectGrow();
01873
01874
01875 powerupOnTxts[i].SetText(tmpIsPowerupEnabled[i] ? "on" : "off");
01876 powerupOnTxts[i].SetFontSize(22);
01877 powerupOnTxts[i].SetColor(blackColor);
01878 powerupOnImgs[i].SetImage(btnData40x40Square);
01879 powerupOnImgsOver[i].SetImage(btnData40x40SquareOver);
01880
01881 powerupOnBtns[i].SetSize(btnData40x40Square->GetWidth(), btnData40x40Square->GetHeight());
01882 powerupOnBtns[i].SetAlignment(ALIGN_LEFT, ALIGN_TOP);
01883 powerupOnBtns[i].SetPosition(20 + btnData40x40Square->GetWidth(), top + i * btnData40x40Square->GetHeight());
01884 powerupOnBtns[i].SetLabel(powerupOnTxts + i);
01885 powerupOnBtns[i].SetImage(powerupOnImgs + i);
01886 powerupOnBtns[i].SetImageOver(powerupOnImgsOver + i);
01887 powerupOnBtns[i].SetSoundOver(&btnSoundOver);
01888 powerupOnBtns[i].SetTrigger(&trigA);
01889 powerupOnBtns[i].SetEffectGrow();
01890
01891
01892 powerupHelpTxts[i].SetText("?");
01893 powerupHelpTxts[i].SetFontSize(22);
01894 powerupHelpTxts[i].SetColor(helpTxtColor);
01895 powerupHelpImgs[i].SetImage(btnData40x40Square);
01896 powerupHelpImgsOver[i].SetImage(btnData40x40SquareOver);
01897
01898 powerupHelpBtns[i].SetSize(btnData40x40Square->GetWidth(), btnData40x40Square->GetHeight());
01899 powerupHelpBtns[i].SetAlignment(ALIGN_LEFT, ALIGN_TOP);
01900 powerupHelpBtns[i].SetPosition(20 + 2 * btnData40x40Square->GetWidth(), top + i * btnData40x40Square->GetHeight());
01901 powerupHelpBtns[i].SetLabel(powerupHelpTxts + i);
01902 powerupHelpBtns[i].SetImage(powerupHelpImgs + i);
01903 powerupHelpBtns[i].SetImageOver(powerupHelpImgsOver + i);
01904 powerupHelpBtns[i].SetSoundOver(&btnSoundOver);
01905 powerupHelpBtns[i].SetTrigger(&trigA);
01906 powerupHelpBtns[i].SetEffectGrow();
01907
01908 window.Append(powerupIconBtns + i);
01909 window.Append(powerupOnBtns + i);
01910 window.Append(powerupHelpBtns + i);
01911 }
01912
01913
01914 GuiButton powerupQueueBtns[MAX_ACQUIRED_POWERUPS];
01915 GuiImage powerupQueueImgs[MAX_ACQUIRED_POWERUPS];
01916
01917 int y = 0;
01918 for (int i = 0; i < MAX_ACQUIRED_POWERUPS; ++i, y += POWERUP_WIDTH)
01919 {
01920 powerupQueueImgs[i].SetImage(tmpPowerupStartQueue[i] == POWERUP_ID_NONE ?
01921 btnData40x40Square : PowerupUtils::GetImageData(tmpPowerupStartQueue[i]));
01922 powerupQueueImgs[i].SetDisplaySize(POWERUP_WIDTH, POWERUP_WIDTH);
01923
01924 powerupQueueBtns[i].SetSize(POWERUP_WIDTH, POWERUP_WIDTH);
01925 powerupQueueBtns[i].SetAlignment(ALIGN_RIGHT, ALIGN_TOP);
01926 powerupQueueBtns[i].SetPosition(-60, 60 + y);
01927 powerupQueueBtns[i].SetImage(powerupQueueImgs + i);
01928 powerupQueueBtns[i].SetSoundOver(&btnSoundOver);
01929 powerupQueueBtns[i].SetTrigger(&trigA);
01930 powerupQueueBtns[i].SetEffectGrow();
01931
01932 window.Append(powerupQueueBtns + i);
01933 }
01934
01935 HaltGui();
01936
01937
01938 parentWindow->DisableChildren();
01939 parentWindow->Append(&window);
01940 ResumeGui();
01941
01942 while (true)
01943 {
01944
01945 usleep(THREAD_SLEEP);
01946
01947
01948 if (confirmBtn.GetState() == STATE_CLICKED)
01949 {
01950 memcpy(isPowerupEnabled, tmpIsPowerupEnabled, sizeof(tmpIsPowerupEnabled));
01951 memcpy(powerupStartQueue, tmpPowerupStartQueue, sizeof(tmpPowerupStartQueue));
01952 break;
01953 }
01954 else if (cancelBtn.GetState() == STATE_CLICKED)
01955 {
01956 break;
01957 }
01958 else if (helpBtn.GetState() == STATE_CLICKED)
01959 {
01960 helpBtn.ResetState();
01961
01962 WindowPrompt(
01963 "HINT",
01964 "Click powerup icon to add it to initial powerup queue. Click "
01965 "icon in queue to remove it. Powerups only appear in "
01966 "game if turned on.",
01967 "OK",
01968 NULL,
01969 &window);
01970 }
01971 else if (allOnBtn.GetState() == STATE_CLICKED
01972 || allOffBtn.GetState() == STATE_CLICKED)
01973 {
01974 bool enabled = (allOnBtn.GetState() == STATE_CLICKED);
01975 allOnBtn.ResetState();
01976 allOffBtn.ResetState();
01977 for (int i = 0; i < POWERUP_ID_MAX; ++i)
01978 {
01979 tmpIsPowerupEnabled[i] = enabled;
01980 powerupOnTxts[i].SetText(enabled ? "on" : "off");
01981 }
01982 }
01983 else if (scrollUpBtn.GetState() == STATE_CLICKED
01984 || scrollDownBtn.GetState() == STATE_CLICKED)
01985 {
01986 bool scrollUp = (scrollUpBtn.GetState() == STATE_CLICKED);
01987 scrollUpBtn.ResetState();
01988 scrollDownBtn.ResetState();
01989 if (scrollUp)
01990 {
01991 top += 2 * 40;
01992 if (top > 60)
01993 top = 60;
01994 }
01995 else
01996 {
01997 top -= 2 * 40;
01998 int min = 60 - (POWERUP_ID_MAX - 2) * 40;
01999 if (top < min)
02000 top = min;
02001 }
02002 for (int i = 0; i < POWERUP_ID_MAX; ++i)
02003 {
02004 int ypos = top + i * btnData40x40Square->GetHeight();
02005 powerupIconBtns[i].SetPosition(20, ypos);
02006 powerupOnBtns[i].SetPosition(20 + btnData40x40Square->GetWidth(), ypos);
02007 powerupHelpBtns[i].SetPosition(20 + 2 * btnData40x40Square->GetWidth(), ypos);
02008
02009 int state = STATE_DEFAULT;
02010 bool visible = true;
02011
02012
02013 if (ypos < 60 || ypos > 60 + 5 * 40)
02014 {
02015 state = STATE_DISABLED;
02016 visible = false;
02017 }
02018
02019 powerupIconBtns[i].SetState(state);
02020 powerupIconBtns[i].SetVisible(visible);
02021 powerupOnBtns[i].SetState(state);
02022 powerupOnBtns[i].SetVisible(visible);
02023 powerupHelpBtns[i].SetState(state);
02024 powerupHelpBtns[i].SetVisible(visible);
02025 }
02026 }
02027
02028 for (int i = 0; i < POWERUP_ID_MAX; ++i)
02029 {
02030 if (powerupIconBtns[i].GetState() == STATE_CLICKED)
02031 {
02032 powerupIconBtns[i].ResetState();
02033
02034 for (int j = 0; j < MAX_ACQUIRED_POWERUPS; ++j)
02035 {
02036 if (tmpPowerupStartQueue[j] == POWERUP_ID_NONE)
02037 {
02038 PowerupUtils::GetSound((PowerupId)i)->Play();
02039 tmpPowerupStartQueue[j] = (PowerupId)i;
02040 powerupQueueImgs[j].SetImage(PowerupUtils::GetImageData((PowerupId)i));
02041 break;
02042 }
02043 }
02044 break;
02045 }
02046 else if (powerupOnBtns[i].GetState() == STATE_CLICKED)
02047 {
02048 powerupOnBtns[i].ResetState();
02049 tmpIsPowerupEnabled[i] = !tmpIsPowerupEnabled[i];
02050 powerupOnTxts[i].SetText(tmpIsPowerupEnabled[i] ? "on" : "off");
02051 break;
02052 }
02053 else if (powerupHelpBtns[i].GetState() == STATE_CLICKED)
02054 {
02055 powerupHelpBtns[i].ResetState();
02056 std::string *helpText = PowerupUtils::GetHelpText((PowerupId)i);
02057 WindowPrompt(
02058 helpText[0].c_str(),
02059 helpText[1].c_str(),
02060 "OK",
02061 NULL,
02062 &window);
02063 break;
02064 }
02065 }
02066
02067 for (int i = 0; i < MAX_ACQUIRED_POWERUPS; ++i)
02068 {
02069 if (powerupQueueBtns[i].GetState() == STATE_CLICKED)
02070 {
02071 powerupQueueBtns[i].ResetState();
02072
02073 PowerupUtils::GetInvalidTargetSound()->Play();
02074 tmpPowerupStartQueue[i] = POWERUP_ID_NONE;
02075 powerupQueueImgs[i].SetImage(btnData40x40Square);
02076 break;
02077 }
02078 }
02079 }
02080
02081 window.SetEffect(EFFECT_SLIDE_TOP | EFFECT_SLIDE_OUT, 50);
02082 while (window.GetEffect() > 0) usleep(THREAD_SLEEP);
02083 HaltGui();
02084 parentWindow->Remove(&window);
02085 parentWindow->SetState(STATE_DEFAULT);
02086 ResumeGui();
02087 }
02088
02089 void TCYC_MenuMpHandicapsPopup()
02090 {
02091 static const int PADDING_TOP = 8;
02092 GXColor helpTxtColor = (GXColor){0, 170, 0, 255};
02093 GXColor blackColor = (GXColor){0, 0, 0, 255};
02094
02095 int player = 0;
02096 char playerBuf[7+1+1] = "PLAYER ";
02097 sprintf(playerBuf + 7, "%d", player + 1);
02098
02099 bool isHandicapEnabled[MAX_PLAYERS];
02100 int maxLines[MAX_PLAYERS];
02101 int attackRate[MAX_PLAYERS];
02102 int powerupRate[MAX_PLAYERS];
02103 bool isPowerupEnabled[MAX_PLAYERS][POWERUP_ID_MAX];
02104 PowerupId powerupStartQueue[MAX_PLAYERS][MAX_ACQUIRED_POWERUPS];
02105
02106 for (int i = 0; i < MAX_PLAYERS; ++i)
02107 {
02108 isHandicapEnabled[i] = g_players[i].isHandicapEnabled;
02109 maxLines[i] = g_players[i].maxLines;
02110 attackRate[i] = g_players[i].attackRate;
02111 powerupRate[i] = g_players[i].powerupRate;
02112 memcpy(isPowerupEnabled[i], g_players[i].isPowerupEnabled, sizeof(isPowerupEnabled[i]));
02113 memcpy(powerupStartQueue[i], g_players[i].powerupStartQueue, sizeof(powerupStartQueue[i]));
02114 }
02115
02116 char maxLinesBuf[3+1];
02117 sprintf(maxLinesBuf, "%d", maxLines[player]);
02118 char defMaxLinesBuf[3+1];
02119 sprintf(defMaxLinesBuf, "%d", DEFAULT_MAX_PLAYLINES);
02120
02121 char attackRateBuf[2+1];
02122 sprintf(attackRateBuf, "%d", attackRate[player]);
02123 char defAttackRateBuf[2+1];
02124 sprintf(defAttackRateBuf, "%d", DEFAULT_ATTACK_RATE);
02125
02126 char powerupRateBuf[2+1];
02127 sprintf(powerupRateBuf, "%d", powerupRate[player]);
02128 char defPowerupRateBuf[2+1];
02129 sprintf(defPowerupRateBuf, "%d", DEFAULT_POWERUP_RATE);
02130
02131
02132 GuiWindow promptWindow(screenwidth - 100, screenheight - 100);
02133 promptWindow.SetAlignment(ALIGN_CENTRE, ALIGN_MIDDLE);
02134 promptWindow.SetPosition(0, 0);
02135
02136 GuiSound btnSoundOver(button_over_pcm, button_over_pcm_size, SOUND_PCM);
02137 GuiTrigger trigA;
02138 trigA.SetSimpleTrigger(-1, WPAD_BUTTON_A | WPAD_CLASSIC_BUTTON_A, PAD_BUTTON_A);
02139 GuiImage mpOptBgImg(screenwidth - 100, screenheight - 100, (GXColor){170, 170, 170, 255});
02140
02141 GuiText titleTxt("Handicap Options", 30, blackColor);
02142 titleTxt.SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
02143 titleTxt.SetPosition(0, 15);
02144
02145
02146 GuiButton playerLeftArrowBtn(btnData40x40Square->GetWidth(), btnData40x40Square->GetHeight());
02147 GuiText playerLeftArrowBtnTxt("<", 22, blackColor);
02148 GuiText playerLeftArrowBtnTxtOver("<", 22, helpTxtColor);
02149 GuiImage playerLeftArrowBtnImg(btnData40x40Square);
02150 GuiImage playerLeftArrowBtnImgOver(btnData40x40SquareOver);
02151
02152 playerLeftArrowBtn.SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
02153 playerLeftArrowBtn.SetPosition(-80, 60);
02154 playerLeftArrowBtn.SetLabel(&playerLeftArrowBtnTxt);
02155 playerLeftArrowBtn.SetLabelOver(&playerLeftArrowBtnTxtOver);
02156 playerLeftArrowBtn.SetImage(&playerLeftArrowBtnImg);
02157 playerLeftArrowBtn.SetImageOver(&playerLeftArrowBtnImgOver);
02158 playerLeftArrowBtn.SetSoundOver(&btnSoundOver);
02159 playerLeftArrowBtn.SetTrigger(&trigA);
02160 playerLeftArrowBtn.SetEffectGrow();
02161
02162
02163 GuiButton playerRightArrowBtn(btnData40x40Square->GetWidth(), btnData40x40Square->GetHeight());
02164 GuiText playerRightArrowBtnTxt(">", 22, blackColor);
02165 GuiText playerRightArrowBtnTxtOver(">", 22, helpTxtColor);
02166 GuiImage playerRightArrowBtnImg(btnData40x40Square);
02167 GuiImage playerRightArrowBtnImgOver(btnData40x40SquareOver);
02168
02169 playerRightArrowBtn.SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
02170 playerRightArrowBtn.SetPosition(80, 60);
02171 playerRightArrowBtn.SetLabel(&playerRightArrowBtnTxt);
02172 playerRightArrowBtn.SetLabelOver(&playerRightArrowBtnTxtOver);
02173 playerRightArrowBtn.SetImage(&playerRightArrowBtnImg);
02174 playerRightArrowBtn.SetImageOver(&playerRightArrowBtnImgOver);
02175 playerRightArrowBtn.SetSoundOver(&btnSoundOver);
02176 playerRightArrowBtn.SetTrigger(&trigA);
02177 playerRightArrowBtn.SetEffectGrow();
02178
02179
02180 GuiText playerTxt(playerBuf, 22, blackColor);
02181 playerTxt.SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
02182 playerTxt.SetPosition(0, 60 + PADDING_TOP);
02183
02184
02185 GuiButton handicapLeftArrowBtn(btnData40x40Square->GetWidth(), btnData40x40Square->GetHeight());
02186 GuiText handicapLeftArrowBtnTxt("<", 22, blackColor);
02187 GuiText handicapLeftArrowBtnTxtOver("<", 22, helpTxtColor);
02188 GuiImage handicapLeftArrowBtnImg(btnData40x40Square);
02189 GuiImage handicapLeftArrowBtnImgOver(btnData40x40SquareOver);
02190
02191 handicapLeftArrowBtn.SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
02192 handicapLeftArrowBtn.SetPosition(-80, 60 + btnData40x40Square->GetHeight());
02193 handicapLeftArrowBtn.SetLabel(&handicapLeftArrowBtnTxt);
02194 handicapLeftArrowBtn.SetLabelOver(&handicapLeftArrowBtnTxtOver);
02195 handicapLeftArrowBtn.SetImage(&handicapLeftArrowBtnImg);
02196 handicapLeftArrowBtn.SetImageOver(&handicapLeftArrowBtnImgOver);
02197 handicapLeftArrowBtn.SetSoundOver(&btnSoundOver);
02198 handicapLeftArrowBtn.SetTrigger(&trigA);
02199 handicapLeftArrowBtn.SetEffectGrow();
02200
02201
02202 GuiButton handicapRightArrowBtn(btnData40x40Square->GetWidth(), btnData40x40Square->GetHeight());
02203 GuiText handicapRightArrowBtnTxt(">", 22, blackColor);
02204 GuiText handicapRightArrowBtnTxtOver(">", 22, helpTxtColor);
02205 GuiImage handicapRightArrowBtnImg(btnData40x40Square);
02206 GuiImage handicapRightArrowBtnImgOver(btnData40x40SquareOver);
02207
02208 handicapRightArrowBtn.SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
02209 handicapRightArrowBtn.SetPosition(80, 60 + btnData40x40Square->GetHeight());
02210 handicapRightArrowBtn.SetLabel(&handicapRightArrowBtnTxt);
02211 handicapRightArrowBtn.SetLabelOver(&handicapRightArrowBtnTxtOver);
02212 handicapRightArrowBtn.SetImage(&handicapRightArrowBtnImg);
02213 handicapRightArrowBtn.SetImageOver(&handicapRightArrowBtnImgOver);
02214 handicapRightArrowBtn.SetSoundOver(&btnSoundOver);
02215 handicapRightArrowBtn.SetTrigger(&trigA);
02216 handicapRightArrowBtn.SetEffectGrow();
02217
02218
02219 GuiText handicapTxt(isHandicapEnabled[player] ? "enabled" : "disabled", 22, blackColor);
02220 handicapTxt.SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
02221 handicapTxt.SetPosition(0, 60 + PADDING_TOP + btnData40x40Square->GetHeight());
02222
02223
02224 GuiButton linesTxtBtn((10 + 1) * 11, 22);
02225 GuiText linesTxtBtnTxt("max lines:", 22, blackColor);
02226 GuiText linesTxtBtnTxtOver("max lines:", 22, helpTxtColor);
02227
02228 linesTxtBtn.SetAlignment(ALIGN_LEFT, ALIGN_TOP);
02229 linesTxtBtn.SetPosition(10, 60 + PADDING_TOP + 2 * btnData40x40Square->GetHeight());
02230 linesTxtBtn.SetLabel(&linesTxtBtnTxt);
02231 linesTxtBtn.SetLabelOver(&linesTxtBtnTxtOver);
02232 linesTxtBtn.SetSoundOver(&btnSoundOver);
02233 linesTxtBtn.SetTrigger(&trigA);
02234
02235
02236 GuiText linesTxt(isHandicapEnabled[player] ? (maxLines[player] ? maxLinesBuf : "off") : "disabled", 22, blackColor);
02237 linesTxt.SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
02238 linesTxt.SetPosition(-20, 60 + PADDING_TOP + 2 * btnData40x40Square->GetHeight());
02239
02240
02241
02242 GuiButton linesDefaultBtn(btnData40x40Square->GetWidth(), btnData40x40Square->GetHeight());
02243 GuiText linesDefaultBtnTxt(defMaxLinesBuf, 22, blackColor);
02244 GuiText linesDefaultBtnTxtOver(defMaxLinesBuf, 22, helpTxtColor);
02245 GuiImage linesDefaultBtnImg(btnData40x40Square);
02246 GuiImage linesDefaultBtnImgOver(btnData40x40SquareOver);
02247
02248 linesDefaultBtn.SetAlignment(ALIGN_RIGHT, ALIGN_TOP);
02249 linesDefaultBtn.SetPosition(-10 - 2 * btnData40x40Square->GetWidth(), 60 + 2 * btnData40x40Square->GetHeight());
02250 linesDefaultBtn.SetLabel(&linesDefaultBtnTxt);
02251 linesDefaultBtn.SetLabelOver(&linesDefaultBtnTxtOver);
02252 linesDefaultBtn.SetImage(&linesDefaultBtnImg);
02253 linesDefaultBtn.SetImageOver(&linesDefaultBtnImgOver);
02254 linesDefaultBtn.SetSoundOver(&btnSoundOver);
02255 linesDefaultBtn.SetTrigger(&trigA);
02256 linesDefaultBtn.SetEffectGrow();
02257
02258
02259 GuiButton linesMinusBtn(btnData40x40Square->GetWidth(), btnData40x40Square->GetHeight());
02260 GuiText linesMinusBtnTxt("-", 22, blackColor);
02261 GuiText linesMinusBtnTxtOver("-", 22, helpTxtColor);
02262 GuiImage linesMinusBtnImg(btnData40x40Square);
02263 GuiImage linesMinusBtnImgOver(btnData40x40SquareOver);
02264
02265 linesMinusBtn.SetAlignment(ALIGN_RIGHT, ALIGN_TOP);
02266 linesMinusBtn.SetPosition(-10 - btnData40x40Square->GetWidth(), 60 + 2 * btnData40x40Square->GetHeight());
02267 linesMinusBtn.SetLabel(&linesMinusBtnTxt);
02268 linesMinusBtn.SetLabelOver(&linesMinusBtnTxtOver);
02269 linesMinusBtn.SetImage(&linesMinusBtnImg);
02270 linesMinusBtn.SetImageOver(&linesMinusBtnImgOver);
02271 linesMinusBtn.SetSoundOver(&btnSoundOver);
02272 linesMinusBtn.SetTrigger(&trigA);
02273 linesMinusBtn.SetEffectGrow();
02274
02275
02276 GuiButton linesPlusBtn(btnData40x40Square->GetWidth(), btnData40x40Square->GetHeight());
02277 GuiText linesPlusBtnTxt("+", 22, blackColor);
02278 GuiText linesPlusBtnTxtOver("+", 22, helpTxtColor);
02279 GuiImage linesPlusBtnImg(btnData40x40Square);
02280 GuiImage linesPlusBtnImgOver(btnData40x40SquareOver);
02281
02282 linesPlusBtn.SetAlignment(ALIGN_RIGHT, ALIGN_TOP);
02283 linesPlusBtn.SetPosition(-10, 60 + 2 * btnData40x40Square->GetHeight());
02284 linesPlusBtn.SetLabel(&linesPlusBtnTxt);
02285 linesPlusBtn.SetLabelOver(&linesPlusBtnTxtOver);
02286 linesPlusBtn.SetImage(&linesPlusBtnImg);
02287 linesPlusBtn.SetImageOver(&linesPlusBtnImgOver);
02288 linesPlusBtn.SetSoundOver(&btnSoundOver);
02289 linesPlusBtn.SetTrigger(&trigA);
02290 linesPlusBtn.SetEffectGrow();
02291
02292
02293 GuiButton attackTxtBtn((12 + 1) * 11, 22);
02294 GuiText attackTxtBtnTxt("attack rate:", 22, blackColor);
02295 GuiText attackTxtBtnTxtOver("attack rate:", 22, helpTxtColor);
02296
02297 attackTxtBtn.SetAlignment(ALIGN_LEFT, ALIGN_TOP);
02298 attackTxtBtn.SetPosition(10, 60 + PADDING_TOP + 3 * btnData40x40Square->GetHeight());
02299 attackTxtBtn.SetLabel(&attackTxtBtnTxt);
02300 attackTxtBtn.SetLabelOver(&attackTxtBtnTxtOver);
02301 attackTxtBtn.SetSoundOver(&btnSoundOver);
02302 attackTxtBtn.SetTrigger(&trigA);
02303
02304
02305 GuiText attackTxt(isHandicapEnabled[player] ? (attackRate[player] ? attackRateBuf : "off") : "disabled", 22, blackColor);
02306 attackTxt.SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
02307 attackTxt.SetPosition(-20, 60 + PADDING_TOP + 3 * btnData40x40Square->GetHeight());
02308
02309
02310
02311 GuiButton attackDefaultBtn(btnData40x40Square->GetWidth(), btnData40x40Square->GetHeight());
02312 GuiText attackDefaultBtnTxt(defAttackRateBuf, 22, blackColor);
02313 GuiText attackDefaultBtnTxtOver(defAttackRateBuf, 22, helpTxtColor);
02314 GuiImage attackDefaultBtnImg(btnData40x40Square);
02315 GuiImage attackDefaultBtnImgOver(btnData40x40SquareOver);
02316
02317 attackDefaultBtn.SetAlignment(ALIGN_RIGHT, ALIGN_TOP);
02318 attackDefaultBtn.SetPosition(-10 - 2 * btnData40x40Square->GetWidth(), 60 + 3 * btnData40x40Square->GetHeight());
02319 attackDefaultBtn.SetLabel(&attackDefaultBtnTxt);
02320 attackDefaultBtn.SetLabelOver(&attackDefaultBtnTxtOver);
02321 attackDefaultBtn.SetImage(&attackDefaultBtnImg);
02322 attackDefaultBtn.SetImageOver(&attackDefaultBtnImgOver);
02323 attackDefaultBtn.SetSoundOver(&btnSoundOver);
02324 attackDefaultBtn.SetTrigger(&trigA);
02325 attackDefaultBtn.SetEffectGrow();
02326
02327
02328 GuiButton attackMinusBtn(btnData40x40Square->GetWidth(), btnData40x40Square->GetHeight());
02329 GuiText attackMinusBtnTxt("-", 22, blackColor);
02330 GuiText attackMinusBtnTxtOver("-", 22, helpTxtColor);
02331 GuiImage attackMinusBtnImg(btnData40x40Square);
02332 GuiImage attackMinusBtnImgOver(btnData40x40SquareOver);
02333
02334 attackMinusBtn.SetAlignment(ALIGN_RIGHT, ALIGN_TOP);
02335 attackMinusBtn.SetPosition(-10 - btnData40x40Square->GetWidth(), 60 + 3 * btnData40x40Square->GetHeight());
02336 attackMinusBtn.SetLabel(&attackMinusBtnTxt);
02337 attackMinusBtn.SetLabelOver(&attackMinusBtnTxtOver);
02338 attackMinusBtn.SetImage(&attackMinusBtnImg);
02339 attackMinusBtn.SetImageOver(&attackMinusBtnImgOver);
02340 attackMinusBtn.SetSoundOver(&btnSoundOver);
02341 attackMinusBtn.SetTrigger(&trigA);
02342 attackMinusBtn.SetEffectGrow();
02343
02344
02345 GuiButton attackPlusBtn(btnData40x40Square->GetWidth(), btnData40x40Square->GetHeight());
02346 GuiText attackPlusBtnTxt("+", 22, blackColor);
02347 GuiText attackPlusBtnTxtOver("+", 22, helpTxtColor);
02348 GuiImage attackPlusBtnImg(btnData40x40Square);
02349 GuiImage attackPlusBtnImgOver(btnData40x40SquareOver);
02350
02351 attackPlusBtn.SetAlignment(ALIGN_RIGHT, ALIGN_TOP);
02352 attackPlusBtn.SetPosition(-10, 60 + 3 * btnData40x40Square->GetHeight());
02353 attackPlusBtn.SetLabel(&attackPlusBtnTxt);
02354 attackPlusBtn.SetLabelOver(&attackPlusBtnTxtOver);
02355 attackPlusBtn.SetImage(&attackPlusBtnImg);
02356 attackPlusBtn.SetImageOver(&attackPlusBtnImgOver);
02357 attackPlusBtn.SetSoundOver(&btnSoundOver);
02358 attackPlusBtn.SetTrigger(&trigA);
02359 attackPlusBtn.SetEffectGrow();
02360
02361
02362
02363 GuiButton powerupRateTxtBtn((14 + 1) * 11, 22);
02364 GuiText powerupRateTxtBtnTxt("powerup rate:", 22, blackColor);
02365 GuiText powerupRateTxtBtnTxtOver("powerup rate:", 22, helpTxtColor);
02366
02367 powerupRateTxtBtn.SetAlignment(ALIGN_LEFT, ALIGN_TOP);
02368 powerupRateTxtBtn.SetPosition(10, 60 + PADDING_TOP + 4 * 40);
02369 powerupRateTxtBtn.SetLabel(&powerupRateTxtBtnTxt);
02370 powerupRateTxtBtn.SetLabelOver(&powerupRateTxtBtnTxtOver);
02371 powerupRateTxtBtn.SetSoundOver(&btnSoundOver);
02372 powerupRateTxtBtn.SetTrigger(&trigA);
02373
02374
02375 GuiText powerupRateTxt(isHandicapEnabled[player] ? (powerupRate[player] ? powerupRateBuf : "off") : "disabled", 22, blackColor);
02376 powerupRateTxt.SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
02377 powerupRateTxt.SetPosition(-20, 60 + PADDING_TOP + 4 * 40);
02378
02379
02380 GuiButton powerupRateDefaultBtn(btnData40x40Square->GetWidth(), btnData40x40Square->GetHeight());
02381 GuiText powerupRateDefaultBtnTxt(defPowerupRateBuf, 22, blackColor);
02382 GuiText powerupRateDefaultBtnTxtOver(defPowerupRateBuf, 22, helpTxtColor);
02383 GuiImage powerupRateDefaultBtnImg(btnData40x40Square);
02384 GuiImage powerupRateDefaultBtnImgOver(btnData40x40SquareOver);
02385
02386 powerupRateDefaultBtn.SetAlignment(ALIGN_RIGHT, ALIGN_TOP);
02387 powerupRateDefaultBtn.SetPosition(-10 - 2 * btnData40x40Square->GetWidth(), 60 + 4 * 40);
02388 powerupRateDefaultBtn.SetLabel(&powerupRateDefaultBtnTxt);
02389 powerupRateDefaultBtn.SetLabelOver(&powerupRateDefaultBtnTxtOver);
02390 powerupRateDefaultBtn.SetImage(&powerupRateDefaultBtnImg);
02391 powerupRateDefaultBtn.SetImageOver(&powerupRateDefaultBtnImgOver);
02392 powerupRateDefaultBtn.SetSoundOver(&btnSoundOver);
02393 powerupRateDefaultBtn.SetTrigger(&trigA);
02394 powerupRateDefaultBtn.SetEffectGrow();
02395
02396
02397 GuiButton powerupRateMinusBtn(btnData40x40Square->GetWidth(), btnData40x40Square->GetHeight());
02398 GuiText powerupRateMinusBtnTxt("-", 22, blackColor);
02399 GuiText powerupRateMinusBtnTxtOver("-", 22, helpTxtColor);
02400 GuiImage powerupRateMinusBtnImg(btnData40x40Square);
02401 GuiImage powerupRateMinusBtnImgOver(btnData40x40SquareOver);
02402
02403 powerupRateMinusBtn.SetAlignment(ALIGN_RIGHT, ALIGN_TOP);
02404 powerupRateMinusBtn.SetPosition(-10 - btnData40x40Square->GetWidth(), 60 + 4 * 40);
02405 powerupRateMinusBtn.SetLabel(&powerupRateMinusBtnTxt);
02406 powerupRateMinusBtn.SetLabelOver(&powerupRateMinusBtnTxtOver);
02407 powerupRateMinusBtn.SetImage(&powerupRateMinusBtnImg);
02408 powerupRateMinusBtn.SetImageOver(&powerupRateMinusBtnImgOver);
02409 powerupRateMinusBtn.SetSoundOver(&btnSoundOver);
02410 powerupRateMinusBtn.SetTrigger(&trigA);
02411 powerupRateMinusBtn.SetEffectGrow();
02412
02413
02414 GuiButton powerupRatePlusBtn(btnData40x40Square->GetWidth(), btnData40x40Square->GetHeight());
02415 GuiText powerupRatePlusBtnTxt("+", 22, blackColor);
02416 GuiText powerupRatePlusBtnTxtOver("+", 22, helpTxtColor);
02417 GuiImage powerupRatePlusBtnImg(btnData40x40Square);
02418 GuiImage powerupRatePlusBtnImgOver(btnData40x40SquareOver);
02419
02420 powerupRatePlusBtn.SetAlignment(ALIGN_RIGHT, ALIGN_TOP);
02421 powerupRatePlusBtn.SetPosition(-10, 60 + 4 * 40);
02422 powerupRatePlusBtn.SetLabel(&powerupRatePlusBtnTxt);
02423 powerupRatePlusBtn.SetLabelOver(&powerupRatePlusBtnTxtOver);
02424 powerupRatePlusBtn.SetImage(&powerupRatePlusBtnImg);
02425 powerupRatePlusBtn.SetImageOver(&powerupRatePlusBtnImgOver);
02426 powerupRatePlusBtn.SetSoundOver(&btnSoundOver);
02427 powerupRatePlusBtn.SetTrigger(&trigA);
02428 powerupRatePlusBtn.SetEffectGrow();
02429
02430
02431 GuiButton confirmBtn(btnData40x40Square->GetWidth(), btnData40x40Square->GetHeight());
02432 GuiText confirmBtnTxt("OK", 22, (GXColor){0, 0, 255, 255});
02433 GuiImage confirmBtnImg(btnData40x40Square);
02434 GuiImage confirmBtnImgOver(btnData40x40SquareOver);
02435
02436 confirmBtn.SetAlignment(ALIGN_RIGHT, ALIGN_BOTTOM);
02437 confirmBtn.SetPosition(-10, -10);
02438 confirmBtn.SetLabel(&confirmBtnTxt);
02439 confirmBtn.SetImage(&confirmBtnImg);
02440 confirmBtn.SetImageOver(&confirmBtnImgOver);
02441 confirmBtn.SetSoundOver(&btnSoundOver);
02442 confirmBtn.SetTrigger(&trigA);
02443 confirmBtn.SetEffectGrow();
02444
02445
02446 GuiButton cancelBtn(btnData40x40Square->GetWidth(), btnData40x40Square->GetHeight());
02447 GuiText cancelBtnTxt("X", 22, (GXColor){255, 0, 0, 255});
02448 GuiImage cancelBtnImg(btnData40x40Square);
02449 GuiImage cancelBtnImgOver(btnData40x40SquareOver);
02450
02451 cancelBtn.SetAlignment(ALIGN_RIGHT, ALIGN_TOP);
02452 cancelBtn.SetPosition(-10, 10);
02453 cancelBtn.SetLabel(&cancelBtnTxt);
02454 cancelBtn.SetImage(&cancelBtnImg);
02455 cancelBtn.SetImageOver(&cancelBtnImgOver);
02456 cancelBtn.SetSoundOver(&btnSoundOver);
02457 cancelBtn.SetTrigger(&trigA);
02458 cancelBtn.SetEffectGrow();
02459
02460
02461 GuiButton helpBtn(btnData40x40Square->GetWidth(), btnData40x40Square->GetHeight());
02462 GuiText helpBtnTxt("?", 22, helpTxtColor);
02463 GuiImage helpBtnImg(btnData40x40Square);
02464 GuiImage helpBtnImgOver(btnData40x40SquareOver);
02465
02466 helpBtn.SetAlignment(ALIGN_LEFT, ALIGN_BOTTOM);
02467 helpBtn.SetPosition(10, -10);
02468 helpBtn.SetLabel(&helpBtnTxt);
02469 helpBtn.SetImage(&helpBtnImg);
02470 helpBtn.SetImageOver(&helpBtnImgOver);
02471 helpBtn.SetSoundOver(&btnSoundOver);
02472 helpBtn.SetTrigger(&trigA);
02473 helpBtn.SetEffectGrow();
02474
02475
02476 GuiButton powerupBtn(btnOutline->GetWidth(), btnOutline->GetHeight());
02477 GuiText powerupTxt("Powerups", 22, (GXColor){0, 0, 0, 255});
02478 GuiImage powerupImg(btnOutline);
02479 GuiImage powerupImgOver(btnOutlineOver);
02480
02481 powerupBtn.SetAlignment(ALIGN_CENTRE, ALIGN_BOTTOM);
02482 powerupBtn.SetPosition(0, -10);
02483 powerupBtn.SetLabel(&powerupTxt);
02484 powerupBtn.SetImage(&powerupImg);
02485 powerupBtn.SetImageOver(&powerupImgOver);
02486 powerupBtn.SetSoundOver(&btnSoundOver);
02487 powerupBtn.SetTrigger(&trigA);
02488 powerupBtn.SetEffectGrow();
02489 powerupBtn.SetState(!isHandicapEnabled[player] ? STATE_DISABLED : STATE_DEFAULT);
02490
02491
02492 promptWindow.Append(&mpOptBgImg);
02493 promptWindow.Append(&titleTxt);
02494 promptWindow.Append(&playerLeftArrowBtn);
02495 promptWindow.Append(&playerRightArrowBtn);
02496 promptWindow.Append(&playerTxt);
02497 promptWindow.Append(&handicapLeftArrowBtn);
02498 promptWindow.Append(&handicapRightArrowBtn);
02499 promptWindow.Append(&handicapTxt);
02500 promptWindow.Append(&linesTxtBtn);
02501 promptWindow.Append(&linesTxt);
02502 promptWindow.Append(&linesDefaultBtn);
02503 promptWindow.Append(&linesMinusBtn);
02504 promptWindow.Append(&linesPlusBtn);
02505 promptWindow.Append(&attackTxtBtn);
02506 promptWindow.Append(&attackTxt);
02507 promptWindow.Append(&attackDefaultBtn);
02508 promptWindow.Append(&attackMinusBtn);
02509 promptWindow.Append(&attackPlusBtn);
02510 promptWindow.Append(&powerupRateTxtBtn);
02511 promptWindow.Append(&powerupRateTxt);
02512 promptWindow.Append(&powerupRateDefaultBtn);
02513 promptWindow.Append(&powerupRateMinusBtn);
02514 promptWindow.Append(&powerupRatePlusBtn);
02515 promptWindow.Append(&confirmBtn);
02516 promptWindow.Append(&cancelBtn);
02517 promptWindow.Append(&helpBtn);
02518 promptWindow.Append(&powerupBtn);
02519
02520 promptWindow.SetEffect(EFFECT_SLIDE_TOP | EFFECT_SLIDE_IN, 50);
02521 HaltGui();
02522
02523
02524 mainWindow->SetState(STATE_DISABLED);
02525 mainWindow->Append(&promptWindow);
02526 mainWindow->ChangeFocus(&promptWindow);
02527 ResumeGui();
02528
02529 while (true)
02530 {
02531 usleep(THREAD_SLEEP);
02532
02533 if (confirmBtn.GetState() == STATE_CLICKED)
02534 {
02535 for (int i = 0; i < MAX_PLAYERS; ++i)
02536 {
02537 g_players[i].isHandicapEnabled = isHandicapEnabled[i];
02538 g_players[i].maxLines = maxLines[i];
02539 g_players[i].attackRate = attackRate[i];
02540 g_players[i].powerupRate = powerupRate[i];
02541 memcpy(g_players[i].isPowerupEnabled, isPowerupEnabled[i], sizeof(isPowerupEnabled[i]));
02542 g_players[i].powerupsSize = 0;
02543 for (int j = 0; j < POWERUP_ID_MAX; ++j)
02544 {
02545 if (isPowerupEnabled[i][j])
02546 g_players[i].powerups[g_players[i].powerupsSize++] = (PowerupId)j;
02547 }
02548 memcpy(g_players[i].powerupStartQueue, powerupStartQueue[i], sizeof(powerupStartQueue[i]));
02549 }
02550
02551 break;
02552 }
02553 else if (cancelBtn.GetState() == STATE_CLICKED)
02554 {
02555 break;
02556 }
02557 else if (helpBtn.GetState() == STATE_CLICKED)
02558 {
02559 helpBtn.ResetState();
02560
02561 WindowPrompt(
02562 "HINT",
02563 "Handicap options override multiplayer options!",
02564 "OK",
02565 NULL,
02566 &promptWindow);
02567 }
02568
02569 else if (playerLeftArrowBtn.GetState() == STATE_CLICKED
02570 || playerRightArrowBtn.GetState() == STATE_CLICKED)
02571 {
02572 HaltGui();
02573
02574 if (playerLeftArrowBtn.GetState() == STATE_CLICKED)
02575 {
02576 playerLeftArrowBtn.SetState(STATE_SELECTED);
02577 player--;
02578 if (player < 0)
02579 player = MAX_PLAYERS - 1;
02580 }
02581 else if (playerRightArrowBtn.GetState() == STATE_CLICKED)
02582 {
02583 playerRightArrowBtn.SetState(STATE_SELECTED);
02584 player++;
02585 if (player >= MAX_PLAYERS)
02586 player = 0;
02587 }
02588
02589 sprintf(playerBuf + 7, "%d", player + 1);
02590 playerTxt.SetText(playerBuf);
02591 handicapTxt.SetText(isHandicapEnabled[player] ? "enabled" : "disabled");
02592
02593 sprintf(maxLinesBuf, "%d", maxLines[player]);
02594 if (isHandicapEnabled[player])
02595 linesTxt.SetText(maxLines[player] ? maxLinesBuf : "off");
02596 else
02597 linesTxt.SetText("disabled");
02598
02599 sprintf(attackRateBuf, "%d", attackRate[player]);
02600 if (isHandicapEnabled[player])
02601 attackTxt.SetText(attackRate[player] ? attackRateBuf : "off");
02602 else
02603 attackTxt.SetText("disabled");
02604
02605 sprintf(powerupRateBuf, "%d", powerupRate[player]);
02606 if (isHandicapEnabled[player])
02607 powerupRateTxt.SetText(powerupRate[player] ? powerupRateBuf : "off");
02608 else
02609 powerupRateTxt.SetText("disabled");
02610
02611
02612 powerupBtn.SetState(!isHandicapEnabled[player] ? STATE_DISABLED : STATE_DEFAULT);
02613
02614 ResumeGui();
02615 }
02616
02617 else if (handicapLeftArrowBtn.GetState() == STATE_CLICKED
02618 || handicapRightArrowBtn.GetState() == STATE_CLICKED)
02619 {
02620 HaltGui();
02621
02622 if (handicapLeftArrowBtn.GetState() == STATE_CLICKED)
02623 handicapLeftArrowBtn.SetState(STATE_SELECTED);
02624 else if (handicapRightArrowBtn.GetState() == STATE_CLICKED)
02625 handicapRightArrowBtn.SetState(STATE_SELECTED);
02626
02627 isHandicapEnabled[player] = !isHandicapEnabled[player];
02628 handicapTxt.SetText(isHandicapEnabled[player] ? "enabled" : "disabled");
02629
02630 sprintf(maxLinesBuf, "%d", maxLines[player]);
02631 if (isHandicapEnabled[player])
02632 linesTxt.SetText(maxLines[player] ? maxLinesBuf : "off");
02633 else
02634 linesTxt.SetText("disabled");
02635
02636 sprintf(attackRateBuf, "%d", attackRate[player]);
02637 if (isHandicapEnabled[player])
02638 attackTxt.SetText(attackRate[player] ? attackRateBuf : "off");
02639 else
02640 attackTxt.SetText("disabled");
02641
02642 sprintf(powerupRateBuf, "%d", powerupRate[player]);
02643 if (isHandicapEnabled[player])
02644 powerupRateTxt.SetText(powerupRate[player] ? powerupRateBuf : "off");
02645 else
02646 powerupRateTxt.SetText("disabled");
02647
02648
02649 powerupBtn.SetState(!isHandicapEnabled[player] ? STATE_DISABLED : STATE_DEFAULT);
02650
02651 ResumeGui();
02652 }
02653
02654 else if (linesTxtBtn.GetState() == STATE_CLICKED)
02655 {
02656 linesTxtBtn.ResetState();
02657
02658 WindowPrompt(
02659 "MAX LINES",
02660 "You win the game after clearing this many lines.",
02661 "OK",
02662 NULL,
02663 &promptWindow);
02664 }
02665
02666 else if (attackTxtBtn.GetState() == STATE_CLICKED)
02667 {
02668 attackTxtBtn.ResetState();
02669
02670 WindowPrompt(
02671 "ATTACK RATE",
02672 "You attack all your opponents every time you score this many points. "
02673 "This raises the speed of the falling block by one level.",
02674 "OK",
02675 NULL,
02676 &promptWindow);
02677 }
02678
02679 else if (powerupRateTxtBtn.GetState() == STATE_CLICKED)
02680 {
02681 powerupRateTxtBtn.ResetState();
02682
02683 WindowPrompt(
02684 "POWERUP RATE",
02685 "Every 'x' pieces will be a powerup piece. "
02686 "Clear a powerup piece to earn that powerup.",
02687 "OK",
02688 NULL,
02689 &promptWindow);
02690 }
02691
02692 if (!isHandicapEnabled[player])
02693 continue;
02694
02695
02696 if (linesDefaultBtn.GetState() == STATE_CLICKED)
02697 {
02698 HaltGui();
02699 linesDefaultBtn.SetState(STATE_SELECTED);
02700 maxLines[player] = DEFAULT_MAX_PLAYLINES;
02701 sprintf(maxLinesBuf, "%d", maxLines[player]);
02702 linesTxt.SetText(maxLinesBuf);
02703 ResumeGui();
02704 }
02705 else if (linesMinusBtn.GetState() == STATE_CLICKED)
02706 {
02707 HaltGui();
02708 linesMinusBtn.SetState(STATE_SELECTED);
02709 maxLines[player] -= 5;
02710 if (maxLines[player] <= 0)
02711 {
02712 maxLines[player] = 0;
02713 linesTxt.SetText("off");
02714 }
02715 else
02716 {
02717 sprintf(maxLinesBuf, "%d", maxLines[player]);
02718 linesTxt.SetText(maxLinesBuf);
02719 }
02720 ResumeGui();
02721 }
02722 else if (linesPlusBtn.GetState() == STATE_CLICKED)
02723 {
02724 HaltGui();
02725 linesPlusBtn.SetState(STATE_SELECTED);
02726 maxLines[player] += 5;
02727 if (maxLines[player] >= 1000)
02728 maxLines[player] = 995;
02729
02730 sprintf(maxLinesBuf, "%d", maxLines[player]);
02731 linesTxt.SetText(maxLinesBuf);
02732 ResumeGui();
02733 }
02734
02735 else if (attackDefaultBtn.GetState() == STATE_CLICKED)
02736 {
02737 HaltGui();
02738 attackDefaultBtn.SetState(STATE_SELECTED);
02739 attackRate[player] = DEFAULT_ATTACK_RATE;
02740 sprintf(attackRateBuf, "%d", attackRate[player]);
02741 attackTxt.SetText(attackRateBuf);
02742 ResumeGui();
02743 }
02744 else if (attackMinusBtn.GetState() == STATE_CLICKED)
02745 {
02746 HaltGui();
02747 attackMinusBtn.SetState(STATE_SELECTED);
02748 attackRate[player]--;
02749 if (attackRate[player] <= 0)
02750 {
02751 attackRate[player] = 0;
02752 attackTxt.SetText("off");
02753 }
02754 else
02755 {
02756 sprintf(attackRateBuf, "%d", attackRate[player]);
02757 attackTxt.SetText(attackRateBuf);
02758 }
02759 ResumeGui();
02760 }
02761 else if (attackPlusBtn.GetState() == STATE_CLICKED)
02762 {
02763 HaltGui();
02764 attackPlusBtn.SetState(STATE_SELECTED);
02765 attackRate[player]++;
02766 if (attackRate[player] >= 100)
02767 attackRate[player] = 99;
02768
02769 sprintf(attackRateBuf, "%d", attackRate[player]);
02770 attackTxt.SetText(attackRateBuf);
02771 ResumeGui();
02772 }
02773
02774 else if (powerupRateDefaultBtn.GetState() == STATE_CLICKED)
02775 {
02776 HaltGui();
02777 powerupRateDefaultBtn.SetState(STATE_SELECTED);
02778 powerupRate[player] = DEFAULT_POWERUP_RATE;
02779 sprintf(powerupRateBuf, "%d", powerupRate[player]);
02780 powerupRateTxt.SetText(powerupRateBuf);
02781 ResumeGui();
02782 }
02783 else if (powerupRateMinusBtn.GetState() == STATE_CLICKED)
02784 {
02785 HaltGui();
02786 powerupRateMinusBtn.SetState(STATE_SELECTED);
02787 powerupRate[player]--;
02788 if (powerupRate[player] <= 0)
02789 {
02790 powerupRate[player] = 0;
02791 powerupRateTxt.SetText("off");
02792 }
02793 else
02794 {
02795 sprintf(powerupRateBuf, "%d", powerupRate[player]);
02796 powerupRateTxt.SetText(powerupRateBuf);
02797 }
02798 ResumeGui();
02799 }
02800 else if (powerupRatePlusBtn.GetState() == STATE_CLICKED)
02801 {
02802 HaltGui();
02803 powerupRatePlusBtn.SetState(STATE_SELECTED);
02804 powerupRate[player]++;
02805 if (powerupRate[player] >= 100)
02806 powerupRate[player] = 99;
02807
02808 sprintf(powerupRateBuf, "%d", powerupRate[player]);
02809 powerupRateTxt.SetText(powerupRateBuf);
02810 ResumeGui();
02811 }
02812
02813 else if (powerupBtn.GetState() == STATE_CLICKED)
02814 {
02815 powerupBtn.ResetState();
02816 TCYC_MenuPowerupsPopup(&promptWindow, isPowerupEnabled[player], powerupStartQueue[player]);
02817 }
02818
02819 HaltGui();
02820
02821 if ( linesDefaultBtn.GetState() == STATE_SELECTED
02822 || linesDefaultBtn.GetState() == STATE_CLICKED
02823 || linesMinusBtn.GetState() == STATE_SELECTED
02824 || linesMinusBtn.GetState() == STATE_CLICKED
02825 || linesPlusBtn.GetState() == STATE_SELECTED
02826 || linesPlusBtn.GetState() == STATE_CLICKED)
02827 {
02828 linesTxt.SetColor(helpTxtColor);
02829 }
02830 else
02831 {
02832 linesTxt.SetColor(blackColor);
02833 }
02834
02835 if ( attackDefaultBtn.GetState() == STATE_SELECTED
02836 || attackDefaultBtn.GetState() == STATE_CLICKED
02837 || attackMinusBtn.GetState() == STATE_SELECTED
02838 || attackMinusBtn.GetState() == STATE_CLICKED
02839 || attackPlusBtn.GetState() == STATE_SELECTED
02840 || attackPlusBtn.GetState() == STATE_CLICKED)
02841 {
02842 attackTxt.SetColor(helpTxtColor);
02843 }
02844 else
02845 {
02846 attackTxt.SetColor(blackColor);
02847 }
02848
02849 if ( powerupRateDefaultBtn.GetState() == STATE_SELECTED
02850 || powerupRateDefaultBtn.GetState() == STATE_CLICKED
02851 || powerupRateMinusBtn.GetState() == STATE_SELECTED
02852 || powerupRateMinusBtn.GetState() == STATE_CLICKED
02853 || powerupRatePlusBtn.GetState() == STATE_SELECTED
02854 || powerupRatePlusBtn.GetState() == STATE_CLICKED)
02855 {
02856 powerupRateTxt.SetColor(helpTxtColor);
02857 }
02858 else
02859 {
02860 powerupRateTxt.SetColor(blackColor);
02861 }
02862 ResumeGui();
02863 }
02864
02865 promptWindow.SetEffect(EFFECT_SLIDE_TOP | EFFECT_SLIDE_OUT, 50);
02866 while(promptWindow.GetEffect() > 0) usleep(THREAD_SLEEP);
02867 HaltGui();
02868 mainWindow->Remove(&promptWindow);
02869 mainWindow->SetState(STATE_DEFAULT);
02870 ResumeGui();
02871 }