| 1 | /* ************************************************************************* * |
| 2 | SDL-Ball - DX-Ball/Breakout remake with openGL and SDL for Linux |
| 3 | Copyright (C) 2008 Jimmy Christensen ( dusted at dusted dot dk ) |
| 4 | |
| 5 | This program is free software: you can redistribute it and/or modify |
| 6 | it under the terms of the GNU General Public License as published by |
| 7 | the Free Software Foundation, either version 3 of the License, or |
| 8 | (at your option) any later version. |
| 9 | |
| 10 | This program is distributed in the hope that it will be useful, |
| 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 | GNU General Public License for more details. |
| 14 | |
| 15 | You should have received a copy of the GNU General Public License |
| 16 | along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 17 | * ************************************************************************* */ |
| 18 | |
| 19 | struct score { |
| 20 | int score; |
| 21 | string level; |
| 22 | string name; |
| 23 | }; |
| 24 | |
| 25 | struct score *sortScores(int *rl) |
| 26 | { |
| 27 | ifstream hsList; |
| 28 | string line; |
| 29 | int i=0,t; |
| 30 | int delim[2]; |
| 31 | |
| 32 | struct score *final=NULL, *temp=NULL; |
| 33 | final = new struct score[1]; |
| 34 | |
| 35 | hsList.open(privFile.highScoreFile.data()); |
| 36 | |
| 37 | if(hsList.is_open()) |
| 38 | { |
| 39 | while(!hsList.eof()) |
| 40 | { |
| 41 | getline(hsList,line); |
| 42 | |
| 43 | if(line != "") |
| 44 | { |
| 45 | if(line[0]=='[') |
| 46 | { |
| 47 | delim[0] = line.find(']'); |
| 48 | delim[1] = line.find('|', delim[0]+1); |
| 49 | |
| 50 | final[i].level=line.substr(0, delim[0]+1); |
| 51 | final[i].level+=" "; |
| 52 | final[i].score = atoi(line.substr(delim[0]+1, delim[1]).data()); |
| 53 | final[i].name = line.substr(delim[1]+1); |
| 54 | } else { |
| 55 | final[i].level.clear(); |
| 56 | final[i].score = atoi(line.substr(0, line.find('|')).data()); |
| 57 | final[i].name = line.substr(line.find('|')+1); |
| 58 | } |
| 59 | |
| 60 | temp = new struct score[i+1]; |
| 61 | |
| 62 | for(t = 0; t < i+1; t++) |
| 63 | { |
| 64 | temp[t] = final[t]; |
| 65 | } |
| 66 | |
| 67 | delete[] final; |
| 68 | final = new struct score[i+2]; |
| 69 | |
| 70 | for(t = 0; t < i+1; t++) |
| 71 | { |
| 72 | final[t] = temp[t]; |
| 73 | } |
| 74 | delete[] temp; |
| 75 | |
| 76 | i++; |
| 77 | } |
| 78 | } |
| 79 | hsList.close(); |
| 80 | } |
| 81 | |
| 82 | if(i > 20) |
| 83 | *rl=20; |
| 84 | else |
| 85 | *rl=i; |
| 86 | |
| 87 | int k; |
| 88 | bool done=0; |
| 89 | bool swaps=0; |
| 90 | |
| 91 | temp = new struct score[1]; |
| 92 | while(!done) |
| 93 | { |
| 94 | for(k=0; k < i; k++) |
| 95 | { |
| 96 | for(t=0; t < i; t++) |
| 97 | { |
| 98 | if(final[k].score > final[t].score) |
| 99 | { |
| 100 | swaps=1; |
| 101 | temp[0] = final[t]; |
| 102 | final[t] = final[k]; |
| 103 | final[k] = temp[0]; |
| 104 | } else { |
| 105 | swaps=0; |
| 106 | } |
| 107 | } |
| 108 | } |
| 109 | if(swaps == 0) |
| 110 | { |
| 111 | done=1; |
| 112 | } |
| 113 | } |
| 114 | delete[] temp; |
| 115 | return(final); |
| 116 | } |
| 117 | |
| 118 | class menuClass { |
| 119 | private: |
| 120 | string saveGameName[6]; //The name of saveGames |
| 121 | int saveGameSlot; //Where player choose to save/load to/from |
| 122 | textureClass tex[5]; |
| 123 | GLuint dl; |
| 124 | |
| 125 | bool themeChanged; //If the theme has changed change the banner. |
| 126 | vector<struct themeInfo> tI; //Vector of theme info |
| 127 | |
| 128 | public: |
| 129 | char highScores[20][255]; |
| 130 | |
| 131 | menuClass() |
| 132 | { |
| 133 | |
| 134 | refreshHighScoreList(); //load the highscore file (if exists) |
| 135 | textureManager texMgr; |
| 136 | |
| 137 | dl = glGenLists(4); //Generate displaylists (+0 = background, +1,2 = but |
| 138 | |
| 139 | texMgr.load(useTheme("/gfx/menu/menu0.png",setting.gfxTheme), tex[0]); |
| 140 | texMgr.load(useTheme("/gfx/menu/but0.png",setting.gfxTheme), tex[1]); |
| 141 | texMgr.load(useTheme("/gfx/menu/but1.png",setting.gfxTheme), tex[2]); |
| 142 | texMgr.load(useTheme("/gfx/menu/but2.png",setting.gfxTheme), tex[3]); |
| 143 | texMgr.load(useTheme("/gfx/menu/highscorebg.png",setting.gfxTheme), tex[4]); |
| 144 | |
| 145 | tI = getThemes(); //Read themes and put them in the vector tI |
| 146 | listSaveGames(saveGameName); |
| 147 | |
| 148 | //Baggrund |
| 149 | glNewList(dl, GL_COMPILE); |
| 150 | glBindTexture(GL_TEXTURE_2D, tex[0].prop.texture); |
| 151 | glBegin( GL_QUADS ); |
| 152 | glTexCoord2f(0.0f,0.0f);glVertex3f( -1.0, 1.0, 0.0 ); |
| 153 | glTexCoord2f(1.0f,0.0f);glVertex3f( 1.0, 1.0, 0.0 ); |
| 154 | glTexCoord2f(1.0f,1.0f);glVertex3f( 1.0,-1.0, 0.0 ); |
| 155 | glTexCoord2f(0.0f,1.0f);glVertex3f( -1.0,-1.0, 0.0 ); |
| 156 | glEnd( ); |
| 157 | glEndList( ); |
| 158 | |
| 159 | |
| 160 | //Hvide |
| 161 | glNewList(dl+1, GL_COMPILE); |
| 162 | glBindTexture(GL_TEXTURE_2D, tex[1].prop.texture); |
| 163 | glBegin( GL_QUADS ); |
| 164 | glTexCoord2f(0.132f,0.3f); glVertex3f( -0.5, 0.07, 0.0 ); |
| 165 | glTexCoord2f(0.87f, 0.3f); glVertex3f( 0.5, 0.07, 0.0 ); |
| 166 | glTexCoord2f(0.87f, 0.7f); glVertex3f( 0.5,-0.07, 0.0 ); |
| 167 | glTexCoord2f(0.132f,0.7f); glVertex3f( -0.5,-0.07, 0.0 ); |
| 168 | glEnd( ); |
| 169 | glEndList( ); |
| 170 | |
| 171 | //Røde |
| 172 | glNewList(dl+2, GL_COMPILE); |
| 173 | glBindTexture(GL_TEXTURE_2D, tex[2].prop.texture); |
| 174 | glBegin( GL_QUADS ); |
| 175 | glTexCoord2f(0.132f,0.3f); glVertex3f( -0.5, 0.07, 0.0 ); |
| 176 | glTexCoord2f(0.87f, 0.3f); glVertex3f( 0.5, 0.07, 0.0 ); |
| 177 | glTexCoord2f(0.87f, 0.7f); glVertex3f( 0.5,-0.07, 0.0 ); |
| 178 | glTexCoord2f(0.132f,0.7f); glVertex3f( -0.5,-0.07, 0.0 ); |
| 179 | glEnd( ); |
| 180 | glEndList( ); |
| 181 | |
| 182 | //Grøn |
| 183 | glNewList(dl+3, GL_COMPILE); |
| 184 | glBindTexture(GL_TEXTURE_2D, tex[3].prop.texture); |
| 185 | glBegin( GL_QUADS ); |
| 186 | glTexCoord2f(0.132f,0.3f); glVertex3f( -0.5, 0.07, 0.0 ); |
| 187 | glTexCoord2f(0.87f, 0.3f); glVertex3f( 0.5, 0.07, 0.0 ); |
| 188 | glTexCoord2f(0.87f, 0.7f); glVertex3f( 0.5,-0.07, 0.0 ); |
| 189 | glTexCoord2f(0.132f,0.7f); glVertex3f( -0.5,-0.07, 0.0 ); |
| 190 | glEnd( ); |
| 191 | glEndList( ); |
| 192 | } |
| 193 | |
| 194 | void refreshHighScoreList() |
| 195 | { |
| 196 | struct score *final; |
| 197 | int lines; |
| 198 | |
| 199 | final = sortScores(&lines); |
| 200 | |
| 201 | //Fill out remaining highscore slots (if any) |
| 202 | for(int t=lines; t < 20; t++) |
| 203 | { |
| 204 | switch(t) |
| 205 | { |
| 206 | case 0: |
| 207 | sprintf(highScores[t], "SDL-BALL v " VERSION ); |
| 208 | break; |
| 209 | case 1: |
| 210 | sprintf(highScores[t], "-----------------------"); |
| 211 | break; |
| 212 | case 2: |
| 213 | sprintf(highScores[t], "Copyleft GPLv3 2008-2014 Jimmy Christensen"); |
| 214 | break; |
| 215 | case 3: |
| 216 | sprintf(highScores[t], "Based on Dx-Ball by Michael P. Welch"); |
| 217 | break; |
| 218 | case 4: |
| 219 | sprintf(highScores[t], "Based on Megaball by Ed and Al Mackey"); |
| 220 | break; |
| 221 | case 5: |
| 222 | sprintf(highScores[t], "-----------------------"); |
| 223 | break; |
| 224 | case 6: |
| 225 | sprintf(highScores[t], "Thanks to players, packagers and patchers!"); |
| 226 | break; |
| 227 | case 7: |
| 228 | sprintf(highScores[t], "Greetings to everyone!"); |
| 229 | break; |
| 230 | default: |
| 231 | sprintf(highScores[t], "SDL-Ball - %i", (t*-1)+20 ); |
| 232 | break; |
| 233 | |
| 234 | } |
| 235 | } |
| 236 | |
| 237 | //Highscores list |
| 238 | for(int t=0; t < lines; t++) |
| 239 | { |
| 240 | sprintf(highScores[t], "%s%i - %s", final[t].level.data(), final[t].score, final[t].name.data()); |
| 241 | } |
| 242 | |
| 243 | if(lines>0) |
| 244 | delete[] final; |
| 245 | } |
| 246 | |
| 247 | void enterSaveGameName(SDL_Event e) |
| 248 | { |
| 249 | if(e.key.keysym.sym != SDLK_RETURN && e.key.keysym.sym != SDLK_ESCAPE) |
| 250 | { |
| 251 | if ( (e.key.keysym.unicode & 0xFF80) == 0 && e.key.keysym.unicode != 0) { |
| 252 | if(e.key.keysym.sym == SDLK_BACKSPACE) |
| 253 | { |
| 254 | if(saveGameName[saveGameSlot].length() > 0) |
| 255 | saveGameName[saveGameSlot].erase(saveGameName[saveGameSlot].length()-1); |
| 256 | } else { |
| 257 | saveGameName[saveGameSlot] += e.key.keysym.unicode; |
| 258 | } |
| 259 | } |
| 260 | } else { |
| 261 | if(e.key.keysym.sym == SDLK_RETURN) |
| 262 | { |
| 263 | //player saved |
| 264 | saveGame(saveGameSlot, saveGameName[saveGameSlot]); |
| 265 | } |
| 266 | var.enterSaveGameName=0; |
| 267 | } |
| 268 | } |
| 269 | |
| 270 | |
| 271 | void doMenu() |
| 272 | { |
| 273 | int i=0; |
| 274 | glColor4f(1.0, 1.0, 1.0, 1.0); |
| 275 | glLoadIdentity(); |
| 276 | glTranslatef(0.0,0.0,-3.0f); |
| 277 | glCallList(dl); //baggrunden |
| 278 | |
| 279 | glTranslatef(0.0,-1.0,0.0f); |
| 280 | |
| 281 | if(var.menu==1) |
| 282 | { |
| 283 | |
| 284 | //Exit |
| 285 | glTranslatef(0.0,0.22,0.0f); |
| 286 | if(var.menuItem==1) |
| 287 | glCallList(dl+2); |
| 288 | else |
| 289 | glCallList(dl+1); |
| 290 | |
| 291 | glColor4f(0,0,0,1); |
| 292 | glText->write("Quit SDL-Ball", FONT_MENU, 1, 1.0, 0.0, -0.005); |
| 293 | glColor4f(1,1,1,1); |
| 294 | |
| 295 | //Settings |
| 296 | glTranslatef(0.0,0.22,0.0f); |
| 297 | if(var.menuItem==2) |
| 298 | glCallList(dl+2); |
| 299 | else |
| 300 | glCallList(dl+1); |
| 301 | |
| 302 | glColor4f(0,0,0,1); |
| 303 | glText->write("Settings", FONT_MENU, 1, 1.0, 0.0, -0.005); |
| 304 | glColor4f(1,1,1,1); |
| 305 | |
| 306 | //highscores |
| 307 | glTranslatef(0.0,0.22,0.0f); |
| 308 | if(var.menuItem==3) |
| 309 | glCallList(dl+2); |
| 310 | else |
| 311 | glCallList(dl+1); |
| 312 | |
| 313 | glColor4f(0,0,0,1); |
| 314 | glText->write("Highscores", FONT_MENU, 1, 1.0, 0.0, -0.005); |
| 315 | glColor4f(1,1,1,1); |
| 316 | |
| 317 | //Save |
| 318 | glTranslatef(0.0,0.22,0.0f); |
| 319 | if(player.level > 0)// && !var.startedPlaying) |
| 320 | { |
| 321 | if(var.menuItem==4) |
| 322 | glCallList(dl+2); |
| 323 | else |
| 324 | glCallList(dl+1); |
| 325 | |
| 326 | glColor4f(0,0,0,1); |
| 327 | glText->write("Save Game", FONT_MENU, 1, 1.0, 0.0, -0.005); |
| 328 | glColor4f(1,1,1,1); |
| 329 | } else { |
| 330 | glColor4f(1,1,1,1); |
| 331 | if(var.menuItem==4) |
| 332 | { |
| 333 | glCallList(dl+2); |
| 334 | glColor4f(0.5,0.5,0.5,1); |
| 335 | glText->write("Not in Level 1", FONT_MENU, 1, 1.0, 0.0, -0.005); |
| 336 | } else { |
| 337 | glCallList(dl+1); |
| 338 | glColor4f(0.5,0.5,0.5,1); |
| 339 | glText->write("Save Game", FONT_MENU, 1, 1.0, 0.0, -0.005); |
| 340 | } |
| 341 | glColor4f(1,1,1,1); |
| 342 | |
| 343 | } |
| 344 | |
| 345 | |
| 346 | //Load |
| 347 | glTranslatef(0.0,0.22,0.0f); |
| 348 | if(var.menuItem==5) |
| 349 | glCallList(dl+2); |
| 350 | else |
| 351 | glCallList(dl+1); |
| 352 | |
| 353 | glColor4f(0,0,0,1); |
| 354 | glText->write("Load Game", FONT_MENU, 1, 1.0, 0.0, -0.005); |
| 355 | glColor4f(1,1,1,1); |
| 356 | |
| 357 | //Continue |
| 358 | glTranslatef(0.0,0.22,0.0f); |
| 359 | if(var.menuItem==6) |
| 360 | glCallList(dl+2); |
| 361 | else |
| 362 | glCallList(dl+1); |
| 363 | |
| 364 | glColor4f(0,0,0,1); |
| 365 | glText->write("Continue", FONT_MENU, 1, 1.0, 0.0, -0.005); |
| 366 | glColor4f(1,1,1,1); |
| 367 | |
| 368 | //new game |
| 369 | glTranslatef(0.0,0.22,0.0f); |
| 370 | if(var.menuItem==7) |
| 371 | glCallList(dl+2); |
| 372 | else |
| 373 | glCallList(dl+3); |
| 374 | |
| 375 | glColor4f(0,0,0,1); |
| 376 | glText->write("New Game", FONT_MENU, 1, 1.0, 0.0, -0.005); |
| 377 | glColor4f(1,1,1,1); |
| 378 | |
| 379 | |
| 380 | if(var.menuPressed) |
| 381 | { |
| 382 | switch(var.menuItem) |
| 383 | { |
| 384 | case 1: //quit |
| 385 | var.menu=6; |
| 386 | break; |
| 387 | case 2: //settings |
| 388 | var.menu=2; |
| 389 | break; |
| 390 | case 3: //highscores |
| 391 | var.menu=7; |
| 392 | break; |
| 393 | case 4: //Save Game |
| 394 | if(player.level > 0)// && !var.startedPlaying) |
| 395 | var.menu=9; |
| 396 | break; |
| 397 | case 5: //Load game |
| 398 | var.menu=8; |
| 399 | break; |
| 400 | case 6: //resume |
| 401 | resumeGame(); |
| 402 | break; |
| 403 | case 7: //new game |
| 404 | var.menu=5; |
| 405 | } |
| 406 | var.menuPressed=0; |
| 407 | } |
| 408 | var.menuNumItems=7; |
| 409 | } else if(var.menu==2) |
| 410 | { |
| 411 | //Settings |
| 412 | |
| 413 | //Back |
| 414 | glTranslatef(0.0,0.22,0.0f); |
| 415 | if(var.menuItem==1) |
| 416 | glCallList(dl+2); |
| 417 | else |
| 418 | glCallList(dl+1); |
| 419 | |
| 420 | glColor4f(0,0,0,1); |
| 421 | glText->write("Back", FONT_MENU, 1, 1.0, 0.0, -0.005); |
| 422 | glColor4f(1,1,1,1); |
| 423 | |
| 424 | //settings |
| 425 | glLoadIdentity(); |
| 426 | glTranslatef(0.0, 0.54,-3.0f); |
| 427 | |
| 428 | glCallList(dl+3); |
| 429 | |
| 430 | glColor4f(1,1,1,1); |
| 431 | glText->write("Settings", FONT_MENU, 1, 1.0, 0.0, -0.005); |
| 432 | |
| 433 | |
| 434 | //Video |
| 435 | glTranslatef(0.0,-0.22,0.0f); |
| 436 | if(var.menuItem==6) |
| 437 | glCallList(dl+2); |
| 438 | else |
| 439 | glCallList(dl+1); |
| 440 | glColor4f(0,0,0,1); |
| 441 | glText->write("Video", FONT_MENU, 1, 1.0, 0.0, -0.005); |
| 442 | glColor4f(1,1,1,1); |
| 443 | |
| 444 | |
| 445 | //sound |
| 446 | glTranslatef(0.0,-0.22,0.0f); |
| 447 | #ifndef NOSOUND |
| 448 | if(var.menuItem==5) |
| 449 | glCallList(dl+2); |
| 450 | else |
| 451 | glCallList(dl+1); |
| 452 | glColor4f(0,0,0,1); |
| 453 | glText->write("Sound", FONT_MENU, 1, 1.0, 0.0, -0.005); |
| 454 | glColor4f(1,1,1,1); |
| 455 | #endif |
| 456 | |
| 457 | //Calibrate |
| 458 | glTranslatef(0.0,-0.22,0.0f); |
| 459 | if(SDL_JoystickOpened(0)) |
| 460 | { |
| 461 | if(var.menuItem==4) |
| 462 | glCallList(dl+2); |
| 463 | else |
| 464 | glCallList(dl+1); |
| 465 | glColor4f(0,0,0,1); |
| 466 | glText->write("Calibrate Joystick", FONT_MENU, 1, 1.0, 0.0, -0.005); |
| 467 | glColor4f(1,1,1,1); |
| 468 | } |
| 469 | |
| 470 | glTranslatef(0.0,-0.22,0.0f); |
| 471 | #ifdef WITH_WIIUSE |
| 472 | if(!var.wiiConnect) |
| 473 | { |
| 474 | if(var.menuItem==3) |
| 475 | glCallList(dl+2); |
| 476 | else |
| 477 | glCallList(dl+1); |
| 478 | glColor4f(0,0,0,1); |
| 479 | glText->write("Connect WiiMote", FONT_MENU, 1, 1.0, 0.0, -0.005); |
| 480 | glColor4f(1,1,1,1); |
| 481 | } |
| 482 | #endif |
| 483 | |
| 484 | glTranslatef(0.0,-0.22,0.0f); |
| 485 | if(var.menuItem==2) |
| 486 | glCallList(dl+2); |
| 487 | else |
| 488 | glCallList(dl+1); |
| 489 | glColor4f(0,0,0,1); |
| 490 | glText->write("Themes", FONT_MENU, 1, 1.0, 0.0, -0.005); |
| 491 | glColor4f(1,1,1,1); |
| 492 | |
| 493 | |
| 494 | if(var.menuPressed) |
| 495 | { |
| 496 | switch(var.menuItem) |
| 497 | { |
| 498 | case 1: |
| 499 | var.menu=1; |
| 500 | break; |
| 501 | case 6: |
| 502 | var.menu=3; |
| 503 | break; |
| 504 | case 5: |
| 505 | var.menu=4; |
| 506 | break; |
| 507 | case 4: |
| 508 | if(SDL_JoystickOpened(0)) |
| 509 | { |
| 510 | var.menuJoyCalStage=0; |
| 511 | var.menu=10; |
| 512 | } |
| 513 | break; |
| 514 | |
| 515 | #ifdef WITH_WIIUSE |
| 516 | case 3: |
| 517 | if(!var.wiiConnect) |
| 518 | { |
| 519 | var.menuJoyCalStage=-1; |
| 520 | var.menu=11; |
| 521 | } |
| 522 | break; |
| 523 | #endif |
| 524 | case 2: |
| 525 | var.menu=12; |
| 526 | break; |
| 527 | } |
| 528 | var.menuPressed=0; |
| 529 | } |
| 530 | var.menuNumItems=6; |
| 531 | } else if(var.menu==3) |
| 532 | { |
| 533 | //Video options |
| 534 | glLoadIdentity(); |
| 535 | glTranslatef(0.0, 0.54,-3.0f); |
| 536 | glCallList(dl+3); |
| 537 | |
| 538 | glColor4f(1,1,1,1); |
| 539 | glText->write("Video Options", FONT_MENU, 1, 1.0, 0.0, -0.005); |
| 540 | |
| 541 | //Toggle full |
| 542 | glTranslatef(0.0,-0.22,0.0f); |
| 543 | if(var.menuItem==6) |
| 544 | glCallList(dl+2); |
| 545 | else |
| 546 | glCallList(dl+1); |
| 547 | glColor4f(0,0,0,1); |
| 548 | if(setting.fullscreen) |
| 549 | glText->write("Fullscreen:On", FONT_MENU, 1, 1.0, 0.0, -0.005); |
| 550 | else |
| 551 | glText->write("Fullscreen:Off", FONT_MENU, 1, 1.0, 0.0, -0.005); |
| 552 | glColor4f(1,1,1,1); |
| 553 | |
| 554 | //Eyecandy |
| 555 | glTranslatef(0.0,-0.22,0.0f); |
| 556 | if(var.menuItem==5) |
| 557 | glCallList(dl+2); |
| 558 | else |
| 559 | glCallList(dl+1); |
| 560 | glColor4f(0,0,0,1); |
| 561 | if(setting.eyeCandy) |
| 562 | glText->write("Eyecandy:On", FONT_MENU, 1, 1.0, 0.0, -0.005); |
| 563 | else |
| 564 | glText->write("Eyecandy:Off", FONT_MENU, 1, 1.0, 0.0, -0.005); |
| 565 | glColor4f(1,1,1,1); |
| 566 | |
| 567 | //1600 |
| 568 | glTranslatef(0.0,-0.22,0.0f); |
| 569 | if(var.menuItem==4) |
| 570 | glCallList(dl+2); |
| 571 | else |
| 572 | glCallList(dl+1); |
| 573 | glColor4f(0,0,0,1); |
| 574 | glText->write("1600x1200", FONT_MENU, 1, 1.0, 0.0, -0.005); |
| 575 | glColor4f(1,1,1,1); |
| 576 | |
| 577 | //1024 |
| 578 | glTranslatef(0.0,-0.22,0.0f); |
| 579 | if(var.menuItem==3) |
| 580 | glCallList(dl+2); |
| 581 | else |
| 582 | glCallList(dl+1); |
| 583 | glColor4f(0,0,0,1); |
| 584 | glText->write("1024x768", FONT_MENU, 1, 1.0, 0.0, -0.005); |
| 585 | glColor4f(1,1,1,1); |
| 586 | |
| 587 | //background |
| 588 | glTranslatef(0.0,-0.22,0.0f); |
| 589 | if(var.menuItem==2) |
| 590 | glCallList(dl+2); |
| 591 | else |
| 592 | glCallList(dl+1); |
| 593 | glColor4f(0,0,0,1); |
| 594 | if(setting.showBg) |
| 595 | glText->write("Background:On", FONT_MENU, 1, 1.0, 0.0, -0.005); |
| 596 | else |
| 597 | glText->write("Background:Off", FONT_MENU, 1, 1.0, 0.0, -0.005); |
| 598 | glColor4f(1,1,1,1); |
| 599 | |
| 600 | //Back |
| 601 | glTranslatef(0.0,-0.22,0.0f); |
| 602 | if(var.menuItem==1) |
| 603 | glCallList(dl+2); |
| 604 | else |
| 605 | glCallList(dl+1); |
| 606 | glColor4f(0,0,0,1); |
| 607 | glText->write("Back", FONT_MENU, 1, 1.0, 0.0, -0.005); |
| 608 | glColor4f(1,1,1,1); |
| 609 | |
| 610 | if(var.menuPressed) |
| 611 | { |
| 612 | switch(var.menuItem) |
| 613 | { |
| 614 | case 1: |
| 615 | var.menu=2; |
| 616 | break; |
| 617 | case 2: |
| 618 | if(!setting.showBg) |
| 619 | setting.showBg=1; |
| 620 | else |
| 621 | setting.showBg=0; |
| 622 | writeSettings(); |
| 623 | break; |
| 624 | case 3: |
| 625 | setting.resx = 1024; |
| 626 | setting.resy = 768; |
| 627 | #ifndef WIN32 |
| 628 | if(initScreen()) |
| 629 | #endif |
| 630 | writeSettings(); |
| 631 | break; |
| 632 | case 4: |
| 633 | setting.resx = 1600; |
| 634 | setting.resy = 1200; |
| 635 | #ifndef WIN32 |
| 636 | if(initScreen()) |
| 637 | #endif |
| 638 | writeSettings(); |
| 639 | break; |
| 640 | case 5: |
| 641 | if(setting.eyeCandy) |
| 642 | setting.eyeCandy=0; |
| 643 | else |
| 644 | setting.eyeCandy=1; |
| 645 | writeSettings(); |
| 646 | break; |
| 647 | case 6: |
| 648 | if(setting.fullscreen) |
| 649 | setting.fullscreen=0; |
| 650 | else |
| 651 | setting.fullscreen=1; |
| 652 | #ifndef WIN32 |
| 653 | if(initScreen()) |
| 654 | #endif |
| 655 | writeSettings(); |
| 656 | break; |
| 657 | } |
| 658 | var.menuPressed=0; |
| 659 | } |
| 660 | var.menuNumItems=6; |
| 661 | } else if(var.menu==4) |
| 662 | { |
| 663 | //Audio |
| 664 | glLoadIdentity(); |
| 665 | glTranslatef(0.0, 0.54,-3.0f); |
| 666 | glCallList(dl+3); |
| 667 | glColor4f(1,1,1,1); |
| 668 | glText->write("Audio", FONT_MENU, 1, 1.0, 0.0, -0.005); |
| 669 | |
| 670 | |
| 671 | //Sound on/off |
| 672 | glTranslatef(0.0,-0.22,0.0f); |
| 673 | if(var.menuItem==6) |
| 674 | glCallList(dl+2); |
| 675 | else |
| 676 | glCallList(dl+1); |
| 677 | glColor4f(0,0,0,1); |
| 678 | if(setting.sound) |
| 679 | glText->write("Sound:On", FONT_MENU, 1, 1.0, 0.0, -0.005); |
| 680 | else |
| 681 | glText->write("Sound:Off", FONT_MENU, 1, 1.0, 0.0, -0.005); |
| 682 | glColor4f(1,1,1,1); |
| 683 | |
| 684 | //Stereo |
| 685 | glTranslatef(0.0,-0.22,0.0f); |
| 686 | if(var.menuItem==5) { |
| 687 | glCallList(dl+2); |
| 688 | } else { |
| 689 | glCallList(dl+1); |
| 690 | glColor4f(0,0,0,1); |
| 691 | } |
| 692 | if(setting.stereo) { |
| 693 | glText->write("Stereo:On", FONT_MENU, 1, 1.0, 0.0, -0.005); |
| 694 | } else { |
| 695 | glText->write("Stereo:Off", FONT_MENU, 1, 1.0, 0.0, -0.005); |
| 696 | } |
| 697 | glColor4f(1,1,1,1); |
| 698 | |
| 699 | //Back |
| 700 | glTranslatef(0.0,-0.88,0.0f); |
| 701 | if(var.menuItem==1) { |
| 702 | glCallList(dl+2); |
| 703 | } else { |
| 704 | glCallList(dl+1); |
| 705 | } |
| 706 | glColor4f(0,0,0,1); |
| 707 | glText->write("Back", FONT_MENU, 1, 1.0, 0.0, -0.005); |
| 708 | glColor4f(1,1,1,1); |
| 709 | |
| 710 | if(var.menuPressed) |
| 711 | { |
| 712 | switch(var.menuItem) |
| 713 | { |
| 714 | case 1: |
| 715 | var.menu=2; |
| 716 | break; |
| 717 | case 5: |
| 718 | if(setting.stereo) |
| 719 | setting.stereo=0; |
| 720 | else |
| 721 | setting.stereo=1; |
| 722 | writeSettings(); |
| 723 | break; |
| 724 | case 6: |
| 725 | if(setting.sound) { |
| 726 | setting.sound=0; |
| 727 | } else { |
| 728 | setting.sound=1; |
| 729 | soundMan.loadsounds(); |
| 730 | } |
| 731 | writeSettings(); |
| 732 | |
| 733 | break; |
| 734 | |
| 735 | } |
| 736 | var.menuPressed=0; |
| 737 | } |
| 738 | |
| 739 | var.menuNumItems=7; |
| 740 | |
| 741 | } else if(var.menu==5) |
| 742 | { |
| 743 | //New game? |
| 744 | glLoadIdentity(); |
| 745 | glTranslatef(0.0, 0.54,-3.0f); |
| 746 | glCallList(dl+3); |
| 747 | |
| 748 | glColor4f(0,0,0,1); |
| 749 | glText->write("New Game", FONT_MENU, 1, 1.0, 0.0, -0.005); |
| 750 | glColor4f(1,1,1,1); |
| 751 | // glBindTexture(GL_TEXTURE_2D, tex[28].prop.texture); |
| 752 | // glCallList(dl+3); |
| 753 | |
| 754 | //Easy |
| 755 | glTranslatef(0.0,-0.22,0.0f); |
| 756 | if(var.menuItem==6) |
| 757 | glCallList(dl+2); |
| 758 | else |
| 759 | glCallList(dl+1); |
| 760 | |
| 761 | glColor4f(0,1,0,1); |
| 762 | glText->write("Easy", FONT_MENU, 1, 1.0, 0.0, -0.005); |
| 763 | glColor4f(1,1,1,1); |
| 764 | // glBindTexture(GL_TEXTURE_2D, tex[29].prop.texture); |
| 765 | // glCallList(dl+3); |
| 766 | |
| 767 | //Normal |
| 768 | glTranslatef(0.0,-0.22,0.0f); |
| 769 | if(var.menuItem==5) |
| 770 | glCallList(dl+2); |
| 771 | else |
| 772 | glCallList(dl+1); |
| 773 | |
| 774 | glColor4f(0,0,1,1); |
| 775 | glText->write("Normal", FONT_MENU, 1, 1.0, 0.0, -0.005); |
| 776 | glColor4f(1,1,1,1); |
| 777 | |
| 778 | // glBindTexture(GL_TEXTURE_2D, tex[30].prop.texture); |
| 779 | // glCallList(dl+3); |
| 780 | |
| 781 | //Hard |
| 782 | glTranslatef(0.0,-0.22,0.0f); |
| 783 | if(var.menuItem==4) |
| 784 | glCallList(dl+2); |
| 785 | else |
| 786 | glCallList(dl+1); |
| 787 | |
| 788 | glColor4f(1,0,0,1); |
| 789 | glText->write("Hard", FONT_MENU, 1, 1.0, 0.0, -0.005); |
| 790 | glColor4f(1,1,1,1); |
| 791 | // glBindTexture(GL_TEXTURE_2D, tex[31].prop.texture); |
| 792 | // glCallList(dl+3); |
| 793 | |
| 794 | //Back |
| 795 | glTranslatef(0.0,-0.66,0.0f); |
| 796 | if(var.menuItem==1) |
| 797 | glCallList(dl+2); |
| 798 | else |
| 799 | glCallList(dl+1); |
| 800 | |
| 801 | glColor4f(0,0,0,1); |
| 802 | glText->write("Back", FONT_MENU, 1, 1.0, 0.0, -0.005); |
| 803 | glColor4f(1,1,1,1); |
| 804 | |
| 805 | // glBindTexture(GL_TEXTURE_2D, tex[32].prop.texture); |
| 806 | // glCallList(dl+3); |
| 807 | |
| 808 | if(var.menuPressed) |
| 809 | { |
| 810 | switch(var.menuItem) |
| 811 | { |
| 812 | case 1: |
| 813 | var.menu=1; |
| 814 | break; |
| 815 | case 4: //New game, hard |
| 816 | player.difficulty=HARD; |
| 817 | writeSettings(); |
| 818 | resumeGame(); |
| 819 | initNewGame(); |
| 820 | break; |
| 821 | case 5: //New Game, Normal |
| 822 | player.difficulty=NORMAL; |
| 823 | writeSettings(); |
| 824 | resumeGame(); |
| 825 | initNewGame(); |
| 826 | break; |
| 827 | case 6: //New game, easy |
| 828 | player.difficulty=EASY; |
| 829 | writeSettings(); |
| 830 | resumeGame(); |
| 831 | initNewGame(); |
| 832 | break; |
| 833 | |
| 834 | } |
| 835 | var.menuPressed=0; |
| 836 | } |
| 837 | |
| 838 | var.menuNumItems=7; |
| 839 | } else if(var.menu==6) |
| 840 | { |
| 841 | //Exit |
| 842 | glLoadIdentity(); |
| 843 | glTranslatef(0.0, 0.54,-3.0f); |
| 844 | glCallList(dl+2); |
| 845 | glColor4f(0,0,0,1); |
| 846 | glText->write("Exit Game?", FONT_MENU, 1, 1.0, 0.0, -0.005); |
| 847 | glColor4f(1,1,1,1); |
| 848 | |
| 849 | //Yes |
| 850 | glTranslatef(0.0,-0.44,0.0f); |
| 851 | if(var.menuItem==5) |
| 852 | glCallList(dl+2); |
| 853 | else |
| 854 | glCallList(dl+1); |
| 855 | glColor4f(1,0,0,1); |
| 856 | glText->write("Yes.", FONT_MENU, 1, 1.0, 0.0, -0.005); |
| 857 | glColor4f(1,1,1,1); |
| 858 | |
| 859 | //Noes! |
| 860 | glTranslatef(0.0,-0.22,0.0f); |
| 861 | if(var.menuItem==4) |
| 862 | glCallList(dl+2); |
| 863 | else |
| 864 | glCallList(dl+1); |
| 865 | glColor4f(0,1,0,1); |
| 866 | glText->write("No way!", FONT_MENU, 1, 1.0, 0.0, -0.005); |
| 867 | glColor4f(1,1,1,1); |
| 868 | |
| 869 | if(var.menuPressed) |
| 870 | { |
| 871 | switch(var.menuItem) |
| 872 | { |
| 873 | case 4: //no |
| 874 | var.menu=1; |
| 875 | break; |
| 876 | case 5: //Yes |
| 877 | var.quit=1; |
| 878 | break; |
| 879 | |
| 880 | } |
| 881 | var.menuPressed=0; |
| 882 | } |
| 883 | var.menuNumItems=5; |
| 884 | |
| 885 | } else if(var.menu==7) // highscores |
| 886 | { |
| 887 | //Highscores |
| 888 | glLoadIdentity(); |
| 889 | glTranslatef(0.0, 0.54,-3.0f); |
| 890 | if(var.menuItem==7) |
| 891 | glCallList(dl+2); |
| 892 | else |
| 893 | glCallList(dl+3); |
| 894 | |
| 895 | glColor4f(1,1,1,1); |
| 896 | glText->write("Highscores", FONT_MENU, 1, 1.0, 0.0, -0.005); |
| 897 | |
| 898 | glTranslatef(0.0, -0.75, 0.0f); |
| 899 | glBindTexture(GL_TEXTURE_2D, tex[4].prop.texture); |
| 900 | glEnable(GL_TEXTURE_2D); |
| 901 | glColor4f(1.0,1.0,1.0,1.0); |
| 902 | glBegin( GL_QUADS ); |
| 903 | glTexCoord2f( 0.0, 0.0 ); glVertex3f( -0.8, 0.63, 0.0 ); |
| 904 | glTexCoord2f( 1.0, 0.0 ); glVertex3f( 0.8, 0.63, 0.0 ); |
| 905 | glTexCoord2f( 1.0, 1.0 ); glVertex3f( 0.8,-0.63, 0.0 ); |
| 906 | glTexCoord2f( 0.0, 1.0 ); glVertex3f( -0.8,-0.63, 0.0 ); |
| 907 | glEnd( ); |
| 908 | |
| 909 | glLoadIdentity(); |
| 910 | glTranslatef(0.0, 0.435,-3.0f); |
| 911 | |
| 912 | //Find out how many lines we have room for in the box. |
| 913 | int nl= (1.26/glText->getHeight(FONT_MENUHIGHSCORE)); |
| 914 | //If theres room for more than 20, only show 20.. |
| 915 | if (nl > 20) { |
| 916 | nl = 20; |
| 917 | } |
| 918 | |
| 919 | for(int i=0; i < nl; i++) |
| 920 | { |
| 921 | glTranslatef(0.0, -glText->getHeight(FONT_MENUHIGHSCORE),0.0f); |
| 922 | glText->write(highScores[i], FONT_MENUHIGHSCORE, 0, 1.0, -0.75, 0.0); |
| 923 | } |
| 924 | |
| 925 | |
| 926 | if(var.menuPressed) |
| 927 | { |
| 928 | switch(var.menuItem) |
| 929 | { |
| 930 | case 7: |
| 931 | var.menu=1; |
| 932 | break; |
| 933 | } |
| 934 | var.menuPressed=0; |
| 935 | } |
| 936 | } else if(var.menu==8) |
| 937 | { |
| 938 | //Load game |
| 939 | glLoadIdentity(); |
| 940 | glTranslatef(0.0, 0.54,-3.0f); |
| 941 | if(var.menuItem==8) |
| 942 | glCallList(dl+2); |
| 943 | else |
| 944 | glCallList(dl+3); |
| 945 | glColor4f(1,1,1,1); |
| 946 | glText->write("Load Game", FONT_MENU, 1, 1.0, 0.0, -0.005); |
| 947 | |
| 948 | for(int i=0; i < 6; i++) |
| 949 | { |
| 950 | glTranslatef(0.0,-0.22,0.0f); |
| 951 | if(var.menuItem==6-i) |
| 952 | glCallList(dl+2); |
| 953 | else |
| 954 | glCallList(dl+1); |
| 955 | glColor4f(0,0,0,1); |
| 956 | glText->write(saveGameName[i], FONT_MENU, 1, 1.0, 0.0, -0.005); |
| 957 | glColor4f(1,1,1,1); |
| 958 | |
| 959 | } |
| 960 | |
| 961 | if(var.menuPressed) |
| 962 | { |
| 963 | if(var.menuItem==7) |
| 964 | { |
| 965 | var.menu=1; |
| 966 | } else if(var.menuItem !=0) |
| 967 | { |
| 968 | loadGame(var.menuItem*-1 +6); |
| 969 | var.menu=0; |
| 970 | resumeGame(); |
| 971 | |
| 972 | } |
| 973 | var.menuPressed=0; |
| 974 | } |
| 975 | |
| 976 | } else if(var.menu == 9) |
| 977 | { |
| 978 | //Save game |
| 979 | //Back |
| 980 | |
| 981 | if(var.enterSaveGameName) |
| 982 | { |
| 983 | glLoadIdentity(); |
| 984 | glTranslatef(0.0, 0.54,-3.0f); |
| 985 | glTranslatef(0.0, 0.12,0.0f); |
| 986 | |
| 987 | glColor4f(0,0,0,1); |
| 988 | glText->write("Enter name and press Enter to save. ESC to cancel", FONT_MENU, 1, 1.0, 0.0, -0.005); |
| 989 | glColor4f(1,0,0,1); |
| 990 | } |
| 991 | |
| 992 | glLoadIdentity(); |
| 993 | glTranslatef(0.0, 0.54,-3.0f); |
| 994 | |
| 995 | if(var.menuItem==8) |
| 996 | glCallList(dl+2); |
| 997 | else |
| 998 | glCallList(dl+3); |
| 999 | glColor4f(1,1,1,1); |
| 1000 | glText->write("Save Game", FONT_MENU, 1, 1.0, 0.0, -0.005); |
| 1001 | |
| 1002 | |
| 1003 | for(int i=0; i < 6; i++) |
| 1004 | { |
| 1005 | glTranslatef(0.0,-0.22,0.0f); |
| 1006 | if(var.menuItem==6-i) |
| 1007 | glCallList(dl+2); |
| 1008 | else |
| 1009 | glCallList(dl+1); |
| 1010 | glColor4f(0,0,0,1); |
| 1011 | glText->write(saveGameName[i], FONT_MENU, 1, 1.0, 0.0, -0.005); |
| 1012 | glColor4f(1,1,1,1); |
| 1013 | |
| 1014 | } |
| 1015 | |
| 1016 | if(var.menuPressed) |
| 1017 | { |
| 1018 | if(var.menuItem==7) |
| 1019 | { |
| 1020 | var.menu=1; |
| 1021 | } else if(var.menuItem !=0) |
| 1022 | { |
| 1023 | var.enterSaveGameName = 1; |
| 1024 | saveGameSlot = (var.menuItem*-1 +6); |
| 1025 | saveGameName[saveGameSlot]=""; |
| 1026 | } |
| 1027 | var.menuPressed=0; |
| 1028 | } |
| 1029 | |
| 1030 | } else if(var.menu == 10) |
| 1031 | { |
| 1032 | //Joystick options |
| 1033 | glLoadIdentity(); |
| 1034 | glTranslatef(0.0, 0.54,-3.0f); |
| 1035 | glCallList(dl+3); |
| 1036 | glColor4f(1,1,1,1); |
| 1037 | glText->write("Calibrate Joystick", FONT_MENU, 1, 1.0, 0.0, -0.005); |
| 1038 | |
| 1039 | |
| 1040 | glTranslatef(0.0,-0.22,0.0f); |
| 1041 | if(var.menuItem==6) |
| 1042 | glCallList(dl+2); |
| 1043 | else |
| 1044 | glCallList(dl+1); |
| 1045 | glColor4f(0,0,0,1); |
| 1046 | if(setting.joyIsDigital) |
| 1047 | glText->write("Digital Joystick", FONT_MENU, 1, 1.0, 0.0, -0.005); |
| 1048 | else |
| 1049 | glText->write("Analog Joystick", FONT_MENU, 1, 1.0, 0.0, -0.005); |
| 1050 | glColor4f(1,1,1,1); |
| 1051 | |
| 1052 | |
| 1053 | glTranslatef(0.0,-0.22,0.0f); |
| 1054 | if(!setting.joyIsDigital) |
| 1055 | { |
| 1056 | if(var.menuItem==5) |
| 1057 | glCallList(dl+2); |
| 1058 | else |
| 1059 | glCallList(dl+1); |
| 1060 | |
| 1061 | glColor4f(0,0,0,1); |
| 1062 | if(var.menuJoyCalStage==0) |
| 1063 | glText->write("Start Calibration", FONT_MENU, 1, 1.0, 0.0, -0.005); |
| 1064 | else if(var.menuJoyCalStage==1) |
| 1065 | glText->write("Center, Push", FONT_MENU, 1, 1.0, 0.0, -0.005); |
| 1066 | else if(var.menuJoyCalStage==2) |
| 1067 | glText->write("Move Left, Push", FONT_MENU, 1, 1.0, 0.0, -0.005); |
| 1068 | else if(var.menuJoyCalStage==3) |
| 1069 | glText->write("Move Right, Push", FONT_MENU, 1, 1.0, 0.0, -0.005); |
| 1070 | else if(var.menuJoyCalStage==4) |
| 1071 | glText->write("Saving...", FONT_MENU, 1, 1.0, 0.0, -0.005); |
| 1072 | else if(var.menuJoyCalStage==5) |
| 1073 | glText->write("Finished.", FONT_MENU, 1, 1.0, 0.0, -0.005); |
| 1074 | glColor4f(1,1,1,1); |
| 1075 | } |
| 1076 | |
| 1077 | glTranslatef(0.0,-0.22,0.0f); |
| 1078 | glTranslatef(0.0,-0.22,0.0f); |
| 1079 | glTranslatef(0.0,-0.22,0.0f); |
| 1080 | glTranslatef(0.0,-0.22,0.0f); |
| 1081 | |
| 1082 | if(var.menuItem==1) |
| 1083 | glCallList(dl+2); |
| 1084 | else |
| 1085 | glCallList(dl+1); |
| 1086 | glColor4f(0,0,0,1); |
| 1087 | glText->write("Back", FONT_MENU, 1, 1.0, 0.0, -0.005); |
| 1088 | glColor4f(1,1,1,1); |
| 1089 | |
| 1090 | if(var.menuPressed) |
| 1091 | { |
| 1092 | switch(var.menuItem) |
| 1093 | { |
| 1094 | case 1: |
| 1095 | var.menu=2; |
| 1096 | break; |
| 1097 | case 2: |
| 1098 | break; |
| 1099 | case 3: |
| 1100 | break; |
| 1101 | case 4: |
| 1102 | break; |
| 1103 | case 5: |
| 1104 | if(!var.menuJoyCalStage) |
| 1105 | var.menuJoyCalStage=1; |
| 1106 | break; |
| 1107 | case 6: |
| 1108 | if(setting.joyIsDigital) |
| 1109 | setting.joyIsDigital=0; |
| 1110 | else |
| 1111 | setting.joyIsDigital=1; |
| 1112 | |
| 1113 | writeSettings(); |
| 1114 | break; |
| 1115 | } |
| 1116 | var.menuPressed=0; |
| 1117 | } |
| 1118 | var.menuNumItems=6; |
| 1119 | } |
| 1120 | #ifdef WITH_WIIUSE |
| 1121 | else if(var.menu == 11) //Wiimote |
| 1122 | { |
| 1123 | |
| 1124 | glLoadIdentity(); |
| 1125 | glTranslatef(0.0, 0.54,-3.0f); |
| 1126 | glCallList(dl+3); |
| 1127 | glColor4f(1,1,1,1); |
| 1128 | glText->write("Connect WiiMote", FONT_MENU, 1, 1.0, 0.0, -0.005); |
| 1129 | |
| 1130 | glTranslatef(0.0,-0.22,0.0f); |
| 1131 | if(var.menuItem==6 && !var.wiiConnect) |
| 1132 | glCallList(dl+2); |
| 1133 | else |
| 1134 | glCallList(dl+1); |
| 1135 | |
| 1136 | glColor4f(0,0,0,1); |
| 1137 | if(var.menuJoyCalStage==-2) |
| 1138 | glText->write("1+2 on WiiMote", FONT_MENU, 1, 1.0, 0.0, -0.005); |
| 1139 | else if(var.menuJoyCalStage==-3) |
| 1140 | glText->write("WiiMote Connected!", FONT_MENU, 1, 1.0, 0.0, -0.005); |
| 1141 | else if(var.menuJoyCalStage==-4) |
| 1142 | glText->write("Failed! Try again.", FONT_MENU, 1, 1.0, 0.0, -0.005); |
| 1143 | glColor4f(1,1,1,1); |
| 1144 | |
| 1145 | |
| 1146 | glCallList(dl+3); |
| 1147 | |
| 1148 | |
| 1149 | glTranslatef(0.0,-1.0,0.0); |
| 1150 | |
| 1151 | if(var.menuItem==1) |
| 1152 | glCallList(dl+2); |
| 1153 | else |
| 1154 | glCallList(dl+1); |
| 1155 | |
| 1156 | glColor4f(0,0,0,1); |
| 1157 | glText->write("Back", FONT_MENU, 1, 1.0, 0.0, -0.005); |
| 1158 | glColor4f(1,1,1,1); |
| 1159 | |
| 1160 | if(var.menuPressed) |
| 1161 | { |
| 1162 | switch(var.menuItem) |
| 1163 | { |
| 1164 | |
| 1165 | case 6: |
| 1166 | if(!var.wiiConnect) |
| 1167 | { |
| 1168 | var.menu=11; |
| 1169 | var.menuJoyCalStage=-1; |
| 1170 | } |
| 1171 | break; |
| 1172 | |
| 1173 | case 1: |
| 1174 | var.menu=2; |
| 1175 | break; |
| 1176 | } |
| 1177 | var.menuPressed=0; |
| 1178 | } |
| 1179 | var.menuNumItems=6; |
| 1180 | } |
| 1181 | #endif |
| 1182 | else if(var.menu == 12) //Theme selector (Main screen) |
| 1183 | { |
| 1184 | glLoadIdentity(); |
| 1185 | glTranslatef(0.0, 0.54,-3.0f); |
| 1186 | glCallList(dl+3); |
| 1187 | |
| 1188 | if(!themeChanged) |
| 1189 | { |
| 1190 | glColor4f(0,0,0,1); |
| 1191 | glText->write("Themes", FONT_MENU, 1, 1.0, 0.0, -0.005); |
| 1192 | } else { |
| 1193 | glColor4f(1,0,0,1); |
| 1194 | glText->write("Restart to apply", FONT_MENU, 1, 1.0, 0.0, -0.005); |
| 1195 | } |
| 1196 | glColor4f(1,1,1,1); |
| 1197 | |
| 1198 | int i=0; |
| 1199 | for(vector<struct themeInfo>::iterator it=tI.begin(); it < tI.end(); ++it) |
| 1200 | { |
| 1201 | if(i ==5) |
| 1202 | break; |
| 1203 | glTranslatef(0.0,-0.22,0.0f); |
| 1204 | if(var.menuItem==6-i) |
| 1205 | glCallList(dl+2); |
| 1206 | else if(it->name.compare(setting.gfxTheme)==0) |
| 1207 | glCallList(dl+3); |
| 1208 | else |
| 1209 | glCallList(dl+1); |
| 1210 | glColor4f(0,0,0,1); |
| 1211 | glText->write(it->name, FONT_MENU, 1, 1.0, 0.0, -0.005); |
| 1212 | glColor4f(1,1,1,1); |
| 1213 | i++; |
| 1214 | } |
| 1215 | |
| 1216 | for(int a=i; a < 6; a++) |
| 1217 | { |
| 1218 | glTranslatef(0.0,-0.22,0.0f); |
| 1219 | } |
| 1220 | |
| 1221 | if(var.menuItem==1) |
| 1222 | glCallList(dl+2); |
| 1223 | else |
| 1224 | glCallList(dl+1); |
| 1225 | glColor4f(0,0,0,1); |
| 1226 | glText->write("Back", FONT_MENU, 1, 1.0, 0.0, -0.005); |
| 1227 | glColor4f(1,1,1,1); |
| 1228 | |
| 1229 | } |
| 1230 | |
| 1231 | if(var.menuPressed) |
| 1232 | { |
| 1233 | switch(var.menuItem) |
| 1234 | { |
| 1235 | case 1: |
| 1236 | var.menu=2; |
| 1237 | break; |
| 1238 | } |
| 1239 | |
| 1240 | for(i=0; i < (int)tI.size() && i<5; i++) |
| 1241 | { |
| 1242 | if(6-i == var.menuItem) |
| 1243 | { |
| 1244 | setting.gfxTheme = tI.at(i).name; |
| 1245 | setting.sndTheme = tI.at(i).name; |
| 1246 | setting.lvlTheme = tI.at(i).name; |
| 1247 | themeChanged=1; |
| 1248 | writeSettings(); |
| 1249 | } |
| 1250 | } |
| 1251 | var.menuPressed=0; |
| 1252 | } |
| 1253 | } |
| 1254 | }; |
| 1255 |