| 1 | |
| 2 | /** |
| 3 | * |
| 4 | * @file gamemenu.cpp |
| 5 | * |
| 6 | * Part of the OpenJazz project |
| 7 | * |
| 8 | * @par History: |
| 9 | * - 23rd of August 2005: Created menu.c |
| 10 | * - 3rd of February 2009: Renamed menu.c to menu.cpp |
| 11 | * - 18th July 2009: Created menugame.cpp from parts of menu.cpp |
| 12 | * - 26th July 2009: Renamed menugame.cpp to gamemenu.cpp |
| 13 | * |
| 14 | * @par Licence: |
| 15 | * Copyright (c) 2005-2017 AJ Thomson |
| 16 | * Copyright (c) 2015-2026 Carsten Teibes |
| 17 | * |
| 18 | * OpenJazz is distributed under the terms of |
| 19 | * the GNU General Public License, version 2.0 |
| 20 | * |
| 21 | * @par Description: |
| 22 | * Deals with the running of the menus used to create a new game. |
| 23 | * |
| 24 | */ |
| 25 | |
| 26 | |
| 27 | #include "menu.h"cxx . . $ `<file>/src/menu/menu.h`/ |
| 28 | |
| 29 | #include "game/game.h"cxx . . $ `<file>/src/game/game.h`/ |
| 30 | #include "game/gamemode.h"cxx . . $ `<file>/src/game/gamemode.h`/ |
| 31 | #include "io/controls.h"cxx . . $ `<file>/src/io/controls.h`/ |
| 32 | #include "io/gfx/font.h"cxx . . $ `<file>/src/io/gfx/font.h`/ |
| 33 | #include "io/gfx/video.h"cxx . . $ `<file>/src/io/gfx/video.h`/ |
| 34 | #include "io/sound.h"cxx . . $ `<file>/src/io/sound.h`/ |
| 35 | #include "jj1/save/jj1save.h"cxx . . $ `<file>/src/jj1/save/jj1save.h`/ |
| 36 | #include "jj1/jj1episodeutils.h"cxx . . $ `<file>/src/jj1/jj1episodeutils.h`/ |
| 37 | #include "loop.h"cxx . . $ `<file>/src/loop.h`/ |
| 38 | #include "util.h"cxx . . $ `<file>/src/util.h`/ |
| 39 | #include "io/log.h"cxx . . $ `<file>/src/io/log.h`/ |
| 40 | #include <memory> |
| 41 | |
| 42 | static bool getSaveDatacxx . . $ getSaveData(dfd6f429dd9e090e).(int slot, int &lvl, int &plnt, difficultyTypecxx . . $ difficultyType# &dffclty) { |
| 43 | // load save game |
| 44 | char* fileName = createStringcxx . . $ createString(a8b8e32347182212).("SAVE.0"); |
| 45 | fileName[5] += slot; |
| 46 | auto save = stdcxx . . $ std/unique_ptr#unique_ptr(d6762fce684538e4).::make_uniquecxx . . $ std/make_unique(5cd499e8540a10bb).<JJ1Savecxx . . $ JJ1Save#>(fileName); |
| 47 | delete[] fileName; |
| 48 | |
| 49 | if(save->cxx . . $ std/unique_ptr#`operator->`(ca399b2b6292c808).validcxx . . $ JJ1Save#valid.) { |
| 50 | lvl = save->cxx . . $ std/unique_ptr#`operator->`(ca399b2b6292c808).levelcxx . . $ JJ1Save#level.; |
| 51 | plnt = save->cxx . . $ std/unique_ptr#`operator->`(ca399b2b6292c808).planetcxx . . $ JJ1Save#planet.; |
| 52 | dffclty = save->cxx . . $ std/unique_ptr#`operator->`(ca399b2b6292c808).difficultycxx . . $ JJ1Save#difficulty.; |
| 53 | |
| 54 | return true; |
| 55 | } |
| 56 | |
| 57 | return false; |
| 58 | } |
| 59 | |
| 60 | |
| 61 | /** |
| 62 | * Create the game menu. |
| 63 | * |
| 64 | * @param file File containing menu graphics |
| 65 | */ |
| 66 | GameMenucxx . . $ GameMenu#::GameMenucxx . . $ GameMenu#GameMenu(cbcd11eaff6dd399). (Filecxx . . $ File# *file) { |
| 67 | |
| 68 | difficultycxx . . $ GameMenu#difficulty. = difficultyTypecxx . . $ difficultyType#::Normalcxx . . $ difficultyType#Normal.; |
| 69 | |
| 70 | // Load the difficulty graphics |
| 71 | file->loadPalettecxx . . $ File#loadPalette(a8e7e0a5cf0a5bef).(menuPalettecxx . . $ menuPalette.); |
| 72 | difficultyScreencxx . . $ GameMenu#difficultyScreen. = file->loadSurfacecxx . . $ File#loadSurface(efa8a2aaf13882cf).(SWcxx . . $ `src/io/gfx/video.h:38:9`!, SHcxx . . $ `src/io/gfx/video.h:39:9`!); |
| 73 | videocxx . . $ video..enableColorKeycxx . . $ Video#enableColorKey(905504f46e4e09c1).(difficultyScreencxx . . $ GameMenu#difficultyScreen., 0); |
| 74 | |
| 75 | // Load the episode pictures (max. 10 episodes + bonus level) |
| 76 | |
| 77 | // Load their palette |
| 78 | file->loadPalettecxx . . $ File#loadPalette(a8e7e0a5cf0a5bef).(palettecxx . . $ GameMenu#palette.); |
| 79 | |
| 80 | // Generate a greyscale mapping |
| 81 | for (int i = 0; i < MAX_PALETTE_COLORScxx . . $ `src/OpenJazz.h:71:9`!; i++) { |
| 82 | |
| 83 | int col = ((palettecxx . . $ GameMenu#palette.[i].rcxx . . $ SDL_Color#r. >> 1) + (palettecxx . . $ GameMenu#palette.[i].gcxx . . $ SDL_Color#g. << 1) + (palettecxx . . $ GameMenu#palette.[i].bcxx . . $ SDL_Color#b. >> 1)) >> 3; |
| 84 | |
| 85 | if (col > 79) col = 79; |
| 86 | |
| 87 | greyPalettecxx . . $ GameMenu#greyPalette.[i].rcxx . . $ SDL_Color#r. = greyPalettecxx . . $ GameMenu#greyPalette.[i].gcxx . . $ SDL_Color#g. = greyPalettecxx . . $ GameMenu#greyPalette.[i].bcxx . . $ SDL_Color#b. = col; |
| 88 | |
| 89 | } |
| 90 | |
| 91 | episodescxx . . $ GameMenu#episodes. = MAX_EPISODEScxx . . $ `src/menu/menu.h:41:9`!; |
| 92 | |
| 93 | for (int i = 0; i < MAX_EPISODEScxx . . $ `src/menu/menu.h:41:9`!; i++) { |
| 94 | |
| 95 | episodeScreenscxx . . $ GameMenu#episodeScreens.[i] = file->loadSurfacecxx . . $ File#loadSurface(efa8a2aaf13882cf).(134, 110); |
| 96 | |
| 97 | if (file->tellcxx . . $ File#tell(b126dc7c1de90089).() >= file->getSizecxx . . $ File#getSize(b126dc7c1de90089).()) { |
| 98 | |
| 99 | episodescxx . . $ GameMenu#episodes. = ++i; |
| 100 | |
| 101 | for (; i < MAX_EPISODEScxx . . $ `src/menu/menu.h:41:9`!; i++) { |
| 102 | |
| 103 | unsigned char pixel = 0; |
| 104 | episodeScreenscxx . . $ GameMenu#episodeScreens.[i] = videocxx . . $ video..createSurfacecxx . . $ Video#createSurface(5ec4649223a2dfef).(&pixel, 1, 1); |
| 105 | |
| 106 | } |
| 107 | |
| 108 | } |
| 109 | |
| 110 | } |
| 111 | |
| 112 | fileMenucxx . . $ GameMenu#fileMenu. = new FileMenucxx . . $ FileMenu#(); |
| 113 | |
| 114 | } |
| 115 | |
| 116 | |
| 117 | /** |
| 118 | * Delete the game menu. |
| 119 | */ |
| 120 | GameMenucxx . . $ GameMenu#::~cxx . . $ GameMenu#`~GameMenu`(49f6e7a06ebc5aa8).GameMenucxx . . $ GameMenu# () { |
| 121 | |
| 122 | for (int i = 0; i < MAX_EPISODEScxx . . $ `src/menu/menu.h:41:9`!; i++) |
| 123 | videocxx . . $ video..destroySurfacecxx . . $ Video#destroySurface(60a0b30a00b4fc6d).(episodeScreenscxx . . $ GameMenu#episodeScreens.[i]); |
| 124 | |
| 125 | videocxx . . $ video..destroySurfacecxx . . $ Video#destroySurface(60a0b30a00b4fc6d).(difficultyScreencxx . . $ GameMenu#difficultyScreen.); |
| 126 | |
| 127 | delete fileMenucxx . . $ GameMenu#fileMenu.; |
| 128 | |
| 129 | } |
| 130 | |
| 131 | |
| 132 | /** |
| 133 | * Create and play a new game. |
| 134 | * |
| 135 | * @param mode Game mode |
| 136 | * @param firstLevel First level's file name |
| 137 | * |
| 138 | * @return Error code |
| 139 | */ |
| 140 | int GameMenucxx . . $ GameMenu#::playNewGamecxx . . $ GameMenu#playNewGame(8cd152da69128d1a). (GameModeTypecxx . . $ GameModeType# mode, char* firstLevel) { |
| 141 | |
| 142 | Gamecxx . . $ Game#* game; |
| 143 | int ret; |
| 144 | |
| 145 | playConfirmSoundcxx . . $ playConfirmSound(49f6e7a06ebc5aa8).(); |
| 146 | |
| 147 | if (mode == M_SINGLEcxx . . $ M_SINGLE.) { |
| 148 | |
| 149 | try { |
| 150 | |
| 151 | game = new LocalGamecxx . . $ LocalGame#(firstLevel, difficultycxx . . $ GameMenu#difficulty.); |
| 152 | |
| 153 | } catch (int e) { |
| 154 | |
| 155 | if (messagecxx . . $ Menu#message(5c4306d8553b3696).("COULD NOT START GAME") == E_QUITcxx . . $ `src/OpenJazz.h:67:9`!) return E_QUITcxx . . $ `src/OpenJazz.h:67:9`!; |
| 156 | |
| 157 | return e; |
| 158 | |
| 159 | } |
| 160 | |
| 161 | } else { |
| 162 | |
| 163 | try { |
| 164 | |
| 165 | game = new ServerGamecxx . . $ ServerGame#(mode, firstLevel, difficultycxx . . $ GameMenu#difficulty.); |
| 166 | |
| 167 | } catch (int e) { |
| 168 | |
| 169 | if (messagecxx . . $ Menu#message(5c4306d8553b3696).("COULD NOT CREATE SERVER") == E_QUITcxx . . $ `src/OpenJazz.h:67:9`!) return E_QUITcxx . . $ `src/OpenJazz.h:67:9`!; |
| 170 | |
| 171 | return e; |
| 172 | |
| 173 | } |
| 174 | |
| 175 | } |
| 176 | |
| 177 | |
| 178 | // Play the level(s) |
| 179 | |
| 180 | ret = game->playcxx . . $ Game#play(b126dc7c1de90089).(); |
| 181 | |
| 182 | delete game; |
| 183 | |
| 184 | if (ret != E_QUITcxx . . $ `src/OpenJazz.h:67:9`!) playMusiccxx . . $ playMusic(90ef5b561fbcb8de).("MENUSNG.PSM"); |
| 185 | |
| 186 | switch (ret) { |
| 187 | |
| 188 | case E_LOAD0cxx . . $ `src/OpenJazz.h:62:9`!: |
| 189 | case E_LOAD1cxx . . $ `src/OpenJazz.h:63:9`!: |
| 190 | case E_LOAD2cxx . . $ `src/OpenJazz.h:64:9`!: |
| 191 | case E_LOAD3cxx . . $ `src/OpenJazz.h:65:9`!: |
| 192 | { |
| 193 | // FIXME: Rewrite load logic, save state in memory |
| 194 | |
| 195 | int lvl, plnt; |
| 196 | difficultyTypecxx . . $ difficultyType# dffclty; |
| 197 | if (getSaveDatacxx . . $ getSaveData(dfd6f429dd9e090e).(ret - E_LOAD0cxx . . $ `src/OpenJazz.h:62:9`!, lvl, plnt, dffclty)) { |
| 198 | char* firstLevel = createFileNamecxx . . $ createFileName(dc9afb5388f048cb).("LEVEL", lvl, plnt); |
| 199 | difficultycxx . . $ GameMenu#difficulty. = dffclty; |
| 200 | ret = playNewGamecxx . . $ GameMenu#playNewGame(8cd152da69128d1a).(M_SINGLEcxx . . $ M_SINGLE., firstLevel); // recursive call |
| 201 | delete[] firstLevel; |
| 202 | } else |
| 203 | ret = E_NONEcxx . . $ `src/OpenJazz.h:69:9`!; |
| 204 | |
| 205 | return ret; |
| 206 | } |
| 207 | |
| 208 | case E_QUITcxx . . $ `src/OpenJazz.h:67:9`!: |
| 209 | |
| 210 | return E_QUITcxx . . $ `src/OpenJazz.h:67:9`!; |
| 211 | |
| 212 | case E_FILEcxx . . $ `src/OpenJazz.h:60:9`!: |
| 213 | |
| 214 | return messagecxx . . $ Menu#message(5c4306d8553b3696).("FILE NOT FOUND OR CORRUPTED"); |
| 215 | |
| 216 | } |
| 217 | |
| 218 | return E_NONEcxx . . $ `src/OpenJazz.h:69:9`!; |
| 219 | |
| 220 | } |
| 221 | |
| 222 | |
| 223 | /** |
| 224 | * Run the new game difficulty menu. |
| 225 | * |
| 226 | * @param mode Game mode |
| 227 | * @param firstLevel First level's file name |
| 228 | * |
| 229 | * @return Error code |
| 230 | */ |
| 231 | int GameMenucxx . . $ GameMenu#::newGameDifficultycxx . . $ GameMenu#newGameDifficulty(8cd152da69128d1a). (GameModeTypecxx . . $ GameModeType# mode, char* firstLevel) { |
| 232 | |
| 233 | const char *options[4] = {"easy", "medium", "hard", "turbo"}; |
| 234 | SDL_Rect src, dst; |
| 235 | int x, y; |
| 236 | |
| 237 | videocxx . . $ video..setPalettecxx . . $ Video#setPalette(d5421d17e1a4b2b2).(menuPalettecxx . . $ menuPalette.); |
| 238 | |
| 239 | while (true) { |
| 240 | |
| 241 | if (loopcxx . . $ loop(fd873fd06cfe1135).(NORMAL_LOOPcxx . . $ NORMAL_LOOP.) == E_QUITcxx . . $ `src/OpenJazz.h:67:9`!) return E_QUITcxx . . $ `src/OpenJazz.h:67:9`!; |
| 242 | |
| 243 | if (controlscxx . . $ controls..releasecxx . . $ Controls#release(83c267b20bac841a).(C_ESCAPEcxx . . $ `src/io/controls.h:39:9`!)) return E_NONEcxx . . $ `src/OpenJazz.h:69:9`!; |
| 244 | |
| 245 | if (controlscxx . . $ controls..releasecxx . . $ Controls#release(83c267b20bac841a).(C_UPcxx . . $ `src/io/controls.h:30:9`!)) { |
| 246 | if(difficultycxx . . $ GameMenu#difficulty. == difficultyTypecxx . . $ difficultyType#::Easycxx . . $ difficultyType#Easy.) |
| 247 | difficultycxx . . $ GameMenu#difficulty. = difficultyTypecxx . . $ difficultyType#::Turbocxx . . $ difficultyType#Turbo.; |
| 248 | else |
| 249 | difficultycxx . . $ GameMenu#difficulty. = static_cast<difficultyTypecxx . . $ difficultyType#>(+cxx . . $ operator+(19ccb40277a922df).difficultycxx . . $ GameMenu#difficulty. - 1); |
| 250 | } |
| 251 | |
| 252 | if (controlscxx . . $ controls..releasecxx . . $ Controls#release(83c267b20bac841a).(C_DOWNcxx . . $ `src/io/controls.h:31:9`!)) { |
| 253 | if(difficultycxx . . $ GameMenu#difficulty. == difficultyTypecxx . . $ difficultyType#::Turbocxx . . $ difficultyType#Turbo.) |
| 254 | difficultycxx . . $ GameMenu#difficulty. = difficultyTypecxx . . $ difficultyType#::Easycxx . . $ difficultyType#Easy.; |
| 255 | else |
| 256 | difficultycxx . . $ GameMenu#difficulty. = static_cast<difficultyTypecxx . . $ difficultyType#>(+cxx . . $ operator+(19ccb40277a922df).difficultycxx . . $ GameMenu#difficulty. + 1); |
| 257 | } |
| 258 | |
| 259 | if (controlscxx . . $ controls..releasecxx . . $ Controls#release(83c267b20bac841a).(C_ENTERcxx . . $ `src/io/controls.h:38:9`!)) return playNewGamecxx . . $ GameMenu#playNewGame(8cd152da69128d1a).(mode, firstLevel); |
| 260 | |
| 261 | if (controlscxx . . $ controls..getCursorcxx . . $ Controls#getCursor(8a990ad1ed500b42).(x, y)) { |
| 262 | |
| 263 | // ESC |
| 264 | if ((x < 100) && (y >= canvasHcxx . . $ canvasH. - 12) && controlscxx . . $ controls..wasCursorReleasedcxx . . $ Controls#wasCursorReleased(c9857a73d68e59ba).()) return E_NONEcxx . . $ `src/OpenJazz.h:69:9`!; |
| 265 | |
| 266 | // start from drawing position |
| 267 | x -= (canvasWcxx . . $ canvasW. >> 1) - 60; |
| 268 | y -= (canvasHcxx . . $ canvasH. >> 1) - 32; |
| 269 | |
| 270 | if ((x >= 0) && (x < 60) && (y >= 0) && (y < 64)) { |
| 271 | |
| 272 | difficultycxx . . $ GameMenu#difficulty. = static_cast<difficultyTypecxx . . $ difficultyType#>(y >> 4); |
| 273 | |
| 274 | if (controlscxx . . $ controls..wasCursorReleasedcxx . . $ Controls#wasCursorReleased(c9857a73d68e59ba).()) return playNewGamecxx . . $ GameMenu#playNewGame(8cd152da69128d1a).(mode, firstLevel); |
| 275 | |
| 276 | } |
| 277 | |
| 278 | } |
| 279 | |
| 280 | SDL_Delay(T_MENU_FRAMEcxx . . $ `src/io/gfx/video.h:78:9`!); |
| 281 | |
| 282 | videocxx . . $ video..clearScreencxx . . $ Video#clearScreen(d4f767463ce0a6b3).(0); |
| 283 | |
| 284 | fontmn2cxx . . $ fontmn2.->showStringcxx . . $ Font#showString(7e50a619d5a117f1).("SELECT DIFFICULTY", (canvasWcxx . . $ canvasW. >> 1), (canvasHcxx . . $ canvasH. >> 1) - 92, alignXcxx . . $ alignX#::Centercxx . . $ alignX#Center.); |
| 285 | |
| 286 | for (unsigned int i = 0; i < 4; i++) { |
| 287 | |
| 288 | if (i == +cxx . . $ operator+(19ccb40277a922df).difficultycxx . . $ GameMenu#difficulty.) fontmn2cxx . . $ fontmn2.->mapPalettecxx . . $ Font#mapPalette(748afa4755bc9595).(240, 8, 114, 16); |
| 289 | |
| 290 | fontmn2cxx . . $ fontmn2.->showStringcxx . . $ Font#showString(7e50a619d5a117f1).(options[i], (canvasWcxx . . $ canvasW. >> 1) - 60, |
| 291 | (canvasHcxx . . $ canvasH. >> 1) + (i << 4) - 32); |
| 292 | |
| 293 | if (i == +cxx . . $ operator+(19ccb40277a922df).difficultycxx . . $ GameMenu#difficulty.) fontmn2cxx . . $ fontmn2.->restorePalettecxx . . $ Font#restorePalette(49f6e7a06ebc5aa8).(); |
| 294 | |
| 295 | } |
| 296 | |
| 297 | src.x = (+cxx . . $ operator+(19ccb40277a922df).difficultycxx . . $ GameMenu#difficulty. & 1) * 160; |
| 298 | src.y = (+cxx . . $ operator+(19ccb40277a922df).difficultycxx . . $ GameMenu#difficulty. & 2) * 50; |
| 299 | src.w = 160; |
| 300 | src.h = 100; |
| 301 | dst.x = canvasWcxx . . $ canvasW. >> 1; |
| 302 | dst.y = (canvasHcxx . . $ canvasH. >> 1) - 50; |
| 303 | SDL_BlitSurfacecxx . . $ `<external>/18043084669712134795/SDL_surface.h:873:9`!(difficultyScreencxx . . $ GameMenu#difficultyScreen., &src, canvascxx . . $ canvas., &dst); |
| 304 | |
| 305 | showEscStringcxx . . $ Menu#showEscString(b45ddcbc8423892c).(); |
| 306 | |
| 307 | } |
| 308 | |
| 309 | return E_NONEcxx . . $ `src/OpenJazz.h:69:9`!; |
| 310 | |
| 311 | } |
| 312 | |
| 313 | |
| 314 | /** |
| 315 | * Run the new game difficulty menu. |
| 316 | * |
| 317 | * @param mode Game mode |
| 318 | * @param levelNum First level's number |
| 319 | * @param levelNum First level's world number |
| 320 | * |
| 321 | * @return Error code |
| 322 | */ |
| 323 | int GameMenucxx . . $ GameMenu#::newGameDifficultycxx . . $ GameMenu#newGameDifficulty(274cbed7efcd7c9d). (GameModeTypecxx . . $ GameModeType# mode, int levelNum, int worldNum) { |
| 324 | |
| 325 | char* firstLevel; |
| 326 | int ret; |
| 327 | |
| 328 | if (levelNum == -1) firstLevel = createFileNamecxx . . $ createFileName(2050848944e00d54).("BONUSMAP", worldNum); |
| 329 | else firstLevel = createFileNamecxx . . $ createFileName(dc9afb5388f048cb).("LEVEL", levelNum, worldNum); |
| 330 | |
| 331 | ret = newGameDifficultycxx . . $ GameMenu#newGameDifficulty(8cd152da69128d1a).(mode, firstLevel); |
| 332 | |
| 333 | delete[] firstLevel; |
| 334 | |
| 335 | return ret; |
| 336 | |
| 337 | } |
| 338 | |
| 339 | |
| 340 | /** |
| 341 | * Run the game loading menu. |
| 342 | * |
| 343 | * @return Error code |
| 344 | */ |
| 345 | int GameMenucxx . . $ GameMenu#::loadGamecxx . . $ GameMenu#loadGame(b126dc7c1de90089). () { |
| 346 | int ret; |
| 347 | |
| 348 | while (true) { |
| 349 | ret = fileMenucxx . . $ GameMenu#fileMenu.->maincxx . . $ FileMenu#main(9f1afb2e1f195c72).(false, true); |
| 350 | if (ret < 0) return ret; |
| 351 | |
| 352 | if (ret == 4) { |
| 353 | while (true) { |
| 354 | ret = loadGameCustomcxx . . $ GameMenu#loadGameCustom(b126dc7c1de90089).(); |
| 355 | if (ret == E_QUITcxx . . $ `src/OpenJazz.h:67:9`!) return E_QUITcxx . . $ `src/OpenJazz.h:67:9`!; // return to main menu |
| 356 | if (ret <= 0) break; // return to load menu |
| 357 | } |
| 358 | } else { |
| 359 | // load save game |
| 360 | int lvl, plnt; |
| 361 | difficultyTypecxx . . $ difficultyType# dffclty; |
| 362 | if (getSaveDatacxx . . $ getSaveData(dfd6f429dd9e090e).(ret, lvl, plnt, dffclty)) { |
| 363 | char* firstLevel = createFileNamecxx . . $ createFileName(dc9afb5388f048cb).("LEVEL", lvl, plnt); |
| 364 | difficultycxx . . $ GameMenu#difficulty. = dffclty; |
| 365 | ret = playNewGamecxx . . $ GameMenu#playNewGame(8cd152da69128d1a).(M_SINGLEcxx . . $ M_SINGLE., firstLevel); |
| 366 | delete[] firstLevel; |
| 367 | } else |
| 368 | ret = E_NONEcxx . . $ `src/OpenJazz.h:69:9`!; |
| 369 | |
| 370 | break; |
| 371 | } |
| 372 | } |
| 373 | |
| 374 | return ret; |
| 375 | } |
| 376 | |
| 377 | |
| 378 | /** |
| 379 | * Run the custom game loading menu. |
| 380 | * |
| 381 | * @return Error code |
| 382 | */ |
| 383 | int GameMenucxx . . $ GameMenu#::loadGameCustomcxx . . $ GameMenu#loadGameCustom(b126dc7c1de90089). () { |
| 384 | |
| 385 | int option, worldNum, levelNum, x, y; |
| 386 | |
| 387 | worldNum = levelNum = option = 0; |
| 388 | |
| 389 | videocxx . . $ video..setPalettecxx . . $ Video#setPalette(d5421d17e1a4b2b2).(menuPalettecxx . . $ menuPalette.); |
| 390 | |
| 391 | while (true) { |
| 392 | |
| 393 | if (loopcxx . . $ loop(fd873fd06cfe1135).(NORMAL_LOOPcxx . . $ NORMAL_LOOP.) == E_QUITcxx . . $ `src/OpenJazz.h:67:9`!) return E_QUITcxx . . $ `src/OpenJazz.h:67:9`!; |
| 394 | |
| 395 | if (controlscxx . . $ controls..releasecxx . . $ Controls#release(83c267b20bac841a).(C_ESCAPEcxx . . $ `src/io/controls.h:39:9`!)) return E_NONEcxx . . $ `src/OpenJazz.h:69:9`!; |
| 396 | |
| 397 | if (controlscxx . . $ controls..releasecxx . . $ Controls#release(83c267b20bac841a).(C_UPcxx . . $ `src/io/controls.h:30:9`!)) option ^= 1; |
| 398 | |
| 399 | if (controlscxx . . $ controls..releasecxx . . $ Controls#release(83c267b20bac841a).(C_DOWNcxx . . $ `src/io/controls.h:31:9`!)) option ^= 1; |
| 400 | |
| 401 | if (controlscxx . . $ controls..releasecxx . . $ Controls#release(83c267b20bac841a).(C_LEFTcxx . . $ `src/io/controls.h:32:9`!)) { |
| 402 | |
| 403 | if (option) levelNum = ((levelNum + MAX_EPISODEScxx . . $ `src/menu/menu.h:41:9`!) % MAX_EPISODEScxx . . $ `src/menu/menu.h:41:9`!) - 1; |
| 404 | else worldNum = (worldNum + 999) % 1000; |
| 405 | |
| 406 | } |
| 407 | |
| 408 | if (controlscxx . . $ controls..releasecxx . . $ Controls#release(83c267b20bac841a).(C_RIGHTcxx . . $ `src/io/controls.h:33:9`!)) { |
| 409 | |
| 410 | if (option) levelNum = ((levelNum + 2) % MAX_EPISODEScxx . . $ `src/menu/menu.h:41:9`!) - 1; |
| 411 | else worldNum = (worldNum + 1) % 1000; |
| 412 | |
| 413 | } |
| 414 | |
| 415 | if (controlscxx . . $ controls..releasecxx . . $ Controls#release(83c267b20bac841a).(C_ENTERcxx . . $ `src/io/controls.h:38:9`!)) { |
| 416 | |
| 417 | playConfirmSoundcxx . . $ playConfirmSound(49f6e7a06ebc5aa8).(); |
| 418 | |
| 419 | if (newGameDifficultycxx . . $ GameMenu#newGameDifficulty(274cbed7efcd7c9d).(M_SINGLEcxx . . $ M_SINGLE., levelNum, worldNum) == E_QUITcxx . . $ `src/OpenJazz.h:67:9`!) return E_QUITcxx . . $ `src/OpenJazz.h:67:9`!; |
| 420 | |
| 421 | videocxx . . $ video..setPalettecxx . . $ Video#setPalette(d5421d17e1a4b2b2).(menuPalettecxx . . $ menuPalette.); |
| 422 | |
| 423 | } |
| 424 | |
| 425 | if (controlscxx . . $ controls..getCursorcxx . . $ Controls#getCursor(8a990ad1ed500b42).(x, y)) { |
| 426 | |
| 427 | // ESC |
| 428 | if ((x < 100) && (y >= canvasHcxx . . $ canvasH. - 12) && controlscxx . . $ controls..wasCursorReleasedcxx . . $ Controls#wasCursorReleased(c9857a73d68e59ba).()) return E_NONEcxx . . $ `src/OpenJazz.h:69:9`!; |
| 429 | |
| 430 | if (y < (canvasHcxx . . $ canvasH. >> 1)) option = 0; |
| 431 | else option = 1; |
| 432 | |
| 433 | } |
| 434 | |
| 435 | |
| 436 | SDL_Delay(T_MENU_FRAMEcxx . . $ `src/io/gfx/video.h:78:9`!); |
| 437 | |
| 438 | videocxx . . $ video..clearScreencxx . . $ Video#clearScreen(d4f767463ce0a6b3).(15); |
| 439 | |
| 440 | if (option == 0) fontmn2cxx . . $ fontmn2.->mapPalettecxx . . $ Font#mapPalette(748afa4755bc9595).(240, 8, 114, 16); |
| 441 | Pointcxx . . $ Point# pos = fontmn2cxx . . $ fontmn2.->showStringcxx . . $ Font#showString(7e50a619d5a117f1).("choose world:", canvasWcxx . . $ canvasW. >> 1, canvasHcxx . . $ canvasH. / 3, alignXcxx . . $ alignX#::Rightcxx . . $ alignX#Right.); |
| 442 | fontmn2cxx . . $ fontmn2.->showNumbercxx . . $ Font#showNumber(b1146eedae1e1d0b).(worldNum, pos.xcxx . . $ Point#x. + 36, canvasHcxx . . $ canvasH. / 3); |
| 443 | |
| 444 | if (option == 0) fontmn2cxx . . $ fontmn2.->restorePalettecxx . . $ Font#restorePalette(49f6e7a06ebc5aa8).(); |
| 445 | else fontmn2cxx . . $ fontmn2.->mapPalettecxx . . $ Font#mapPalette(748afa4755bc9595).(240, 8, 114, 16); |
| 446 | |
| 447 | pos =cxx . . $ Point#`operator=`(fce63e263050c648). fontmn2cxx . . $ fontmn2.->showStringcxx . . $ Font#showString(7e50a619d5a117f1).("choose level:", canvasWcxx . . $ canvasW. >> 1, (canvasHcxx . . $ canvasH. << 1) / 3, alignXcxx . . $ alignX#::Rightcxx . . $ alignX#Right.); |
| 448 | if (levelNum >= 0) fontmn2cxx . . $ fontmn2.->showNumbercxx . . $ Font#showNumber(b1146eedae1e1d0b).(levelNum, pos.xcxx . . $ Point#x. + 36, (canvasHcxx . . $ canvasH. << 1) / 3); |
| 449 | else fontmn2cxx . . $ fontmn2.->showStringcxx . . $ Font#showString(7e50a619d5a117f1).("bonus", pos.xcxx . . $ Point#x. + 8, (canvasHcxx . . $ canvasH. << 1) / 3); |
| 450 | |
| 451 | if (option != 0) fontmn2cxx . . $ fontmn2.->restorePalettecxx . . $ Font#restorePalette(49f6e7a06ebc5aa8).(); |
| 452 | |
| 453 | showEscStringcxx . . $ Menu#showEscString(b45ddcbc8423892c).(); |
| 454 | |
| 455 | } |
| 456 | |
| 457 | return E_NONEcxx . . $ `src/OpenJazz.h:69:9`!; |
| 458 | |
| 459 | } |
| 460 | |
| 461 | |
| 462 | /** |
| 463 | * Directly load level. |
| 464 | * |
| 465 | * @return Error code |
| 466 | */ |
| 467 | int GameMenucxx . . $ GameMenu#::loadGamecxx . . $ GameMenu#loadGame(9b79fb6aee4c0440). (int levelNum, int worldNum) { |
| 468 | |
| 469 | if (newGameDifficultycxx . . $ GameMenu#newGameDifficulty(274cbed7efcd7c9d).(M_SINGLEcxx . . $ M_SINGLE., levelNum, worldNum) == E_QUITcxx . . $ `src/OpenJazz.h:67:9`!) return E_QUITcxx . . $ `src/OpenJazz.h:67:9`!; |
| 470 | |
| 471 | return E_NONEcxx . . $ `src/OpenJazz.h:69:9`!; |
| 472 | |
| 473 | } |
| 474 | |
| 475 | |
| 476 | /** |
| 477 | * Run the new game level selection menu. |
| 478 | * |
| 479 | * @param mode Game mode |
| 480 | * |
| 481 | * @return Error code |
| 482 | */ |
| 483 | int GameMenucxx . . $ GameMenu#::newGameLevelcxx . . $ GameMenu#newGameLevel(eac196c7edaa1201). (GameModeTypecxx . . $ GameModeType# mode) { |
| 484 | |
| 485 | char* fileName; |
| 486 | int ret; |
| 487 | |
| 488 | fileName = createStringcxx . . $ createString(a8b8e32347182212).("level0.000"); |
| 489 | |
| 490 | ret = E_NONEcxx . . $ `src/OpenJazz.h:69:9`!; |
| 491 | |
| 492 | while (true) { |
| 493 | |
| 494 | ret = textInputcxx . . $ Menu#textInput(bc30cf002e76fcd0).("level file name:", fileName); |
| 495 | |
| 496 | if (ret < 0) break; |
| 497 | |
| 498 | ret = newGameDifficultycxx . . $ GameMenu#newGameDifficulty(8cd152da69128d1a).(mode, fileName); |
| 499 | |
| 500 | if (ret < 0) break; |
| 501 | |
| 502 | } |
| 503 | |
| 504 | delete[] fileName; |
| 505 | |
| 506 | return ret; |
| 507 | |
| 508 | } |
| 509 | |
| 510 | |
| 511 | /** |
| 512 | * Run the appropriate menu for the given episode selection. |
| 513 | * |
| 514 | * @param mode Game mode |
| 515 | * @param episode Episode number |
| 516 | * |
| 517 | * @return Error code |
| 518 | */ |
| 519 | int GameMenucxx . . $ GameMenu#::selectEpisodecxx . . $ GameMenu#selectEpisode(47ff60b9b94a3aa1). (GameModeTypecxx . . $ GameModeType# mode, int episode) { |
| 520 | |
| 521 | playConfirmSoundcxx . . $ playConfirmSound(49f6e7a06ebc5aa8).(); |
| 522 | |
| 523 | if (episode < 10) { |
| 524 | |
| 525 | int worldNum = episodeToWorldcxx . . $ episodeToWorld(7864480464b09eea).(episode); |
| 526 | |
| 527 | if (newGameDifficultycxx . . $ GameMenu#newGameDifficulty(274cbed7efcd7c9d).(mode, 0, worldNum) == E_QUITcxx . . $ `src/OpenJazz.h:67:9`!) return E_QUITcxx . . $ `src/OpenJazz.h:67:9`!; |
| 528 | |
| 529 | } else if (episode == 10) { |
| 530 | |
| 531 | if (newGameDifficultycxx . . $ GameMenu#newGameDifficulty(274cbed7efcd7c9d).(mode, -1, 0) == E_QUITcxx . . $ `src/OpenJazz.h:67:9`!) return E_QUITcxx . . $ `src/OpenJazz.h:67:9`!; |
| 532 | |
| 533 | } else { |
| 534 | |
| 535 | if (newGameLevelcxx . . $ GameMenu#newGameLevel(eac196c7edaa1201).(mode) == E_QUITcxx . . $ `src/OpenJazz.h:67:9`!) return E_QUITcxx . . $ `src/OpenJazz.h:67:9`!; |
| 536 | |
| 537 | } |
| 538 | |
| 539 | videocxx . . $ video..setPalettecxx . . $ Video#setPalette(d5421d17e1a4b2b2).(palettecxx . . $ GameMenu#palette.); |
| 540 | |
| 541 | return E_NONEcxx . . $ `src/OpenJazz.h:69:9`!; |
| 542 | |
| 543 | } |
| 544 | |
| 545 | |
| 546 | /** |
| 547 | * Run the new game episode menu. |
| 548 | * |
| 549 | * @param mode Game mode |
| 550 | * |
| 551 | * @return Error code |
| 552 | */ |
| 553 | int GameMenucxx . . $ GameMenu#::newGameEpisodecxx . . $ GameMenu#newGameEpisode(eac196c7edaa1201). (GameModeTypecxx . . $ GameModeType# mode) { |
| 554 | bool exists[12]; |
| 555 | char *check; |
| 556 | SDL_Rect dst; |
| 557 | int episode, count, x, y; |
| 558 | |
| 559 | videocxx . . $ video..setPalettecxx . . $ Video#setPalette(d5421d17e1a4b2b2).(palettecxx . . $ GameMenu#palette.); |
| 560 | |
| 561 | for (count = 0; count < 10; count++) { |
| 562 | |
| 563 | check = createFileNamecxx . . $ createFileName(dc9afb5388f048cb).("LEVEL", 0, episodeToWorldcxx . . $ episodeToWorld(7864480464b09eea).(count)); |
| 564 | exists[count] = fileExistscxx . . $ fileExists(2551bed5d6fc04f6).(check, PATH_TYPE_GAMEcxx . . $ PATH_TYPE_GAME.); |
| 565 | delete[] check; |
| 566 | |
| 567 | if (exists[count]) videocxx . . $ video..restoreSurfacePalettecxx . . $ Video#restoreSurfacePalette(60a0b30a00b4fc6d).(episodeScreenscxx . . $ GameMenu#episodeScreens.[count]); |
| 568 | else videocxx . . $ video..setSurfacePalettecxx . . $ Video#setSurfacePalette(b59f7f041c83eb39).(episodeScreenscxx . . $ GameMenu#episodeScreens.[count], greyPalettecxx . . $ GameMenu#greyPalette., 0, MAX_PALETTE_COLORScxx . . $ `src/OpenJazz.h:71:9`!); |
| 569 | |
| 570 | } |
| 571 | |
| 572 | if (mode == M_SINGLEcxx . . $ M_SINGLE.) { |
| 573 | |
| 574 | check = createFileNamecxx . . $ createFileName(2050848944e00d54).("BONUSMAP", 0); |
| 575 | exists[10] = fileExistscxx . . $ fileExists(2551bed5d6fc04f6).(check, PATH_TYPE_GAMEcxx . . $ PATH_TYPE_GAME.); |
| 576 | delete[] check; |
| 577 | |
| 578 | } else exists[10] = false; |
| 579 | |
| 580 | exists[MAX_EPISODEScxx . . $ `src/menu/menu.h:41:9`!] = true; // always possible to load custom level |
| 581 | |
| 582 | episode = 0; |
| 583 | |
| 584 | while (true) { |
| 585 | |
| 586 | if (loopcxx . . $ loop(fd873fd06cfe1135).(NORMAL_LOOPcxx . . $ NORMAL_LOOP.) == E_QUITcxx . . $ `src/OpenJazz.h:67:9`!) return E_QUITcxx . . $ `src/OpenJazz.h:67:9`!; |
| 587 | |
| 588 | if (controlscxx . . $ controls..releasecxx . . $ Controls#release(83c267b20bac841a).(C_ESCAPEcxx . . $ `src/io/controls.h:39:9`!)) return E_NONEcxx . . $ `src/OpenJazz.h:69:9`!; |
| 589 | |
| 590 | if (controlscxx . . $ controls..releasecxx . . $ Controls#release(83c267b20bac841a).(C_UPcxx . . $ `src/io/controls.h:30:9`!)) episode = (episode + MAX_EPISODEScxx . . $ `src/menu/menu.h:41:9`!) % 12; |
| 591 | |
| 592 | if (controlscxx . . $ controls..releasecxx . . $ Controls#release(83c267b20bac841a).(C_DOWNcxx . . $ `src/io/controls.h:31:9`!)) episode = (episode + 1) % 12; |
| 593 | |
| 594 | if (controlscxx . . $ controls..releasecxx . . $ Controls#release(83c267b20bac841a).(C_ENTERcxx . . $ `src/io/controls.h:38:9`!) && exists[episode]) { |
| 595 | |
| 596 | count = selectEpisodecxx . . $ GameMenu#selectEpisode(47ff60b9b94a3aa1).(mode, episode); |
| 597 | |
| 598 | if (count < 0) return count; |
| 599 | |
| 600 | } |
| 601 | |
| 602 | if (controlscxx . . $ controls..getCursorcxx . . $ Controls#getCursor(8a990ad1ed500b42).(x, y)) { |
| 603 | |
| 604 | if ((x >= canvasWcxx . . $ canvasW. - 100) && (y >= canvasHcxx . . $ canvasH. - 12) && controlscxx . . $ controls..wasCursorReleasedcxx . . $ Controls#wasCursorReleased(c9857a73d68e59ba).()) return E_NONEcxx . . $ `src/OpenJazz.h:69:9`!; |
| 605 | |
| 606 | // start from drawing position |
| 607 | x -= canvasWcxx . . $ canvasW. >> 3; |
| 608 | y -= (canvasHcxx . . $ canvasH. >> 1) - 92; |
| 609 | |
| 610 | if ((x >= 0) && (x < 256) && (y >= 0) && (y < 192)) { |
| 611 | |
| 612 | episode = y >> 4; |
| 613 | |
| 614 | if (controlscxx . . $ controls..wasCursorReleasedcxx . . $ Controls#wasCursorReleased(c9857a73d68e59ba).() && exists[episode]) { |
| 615 | |
| 616 | count = selectEpisodecxx . . $ GameMenu#selectEpisode(47ff60b9b94a3aa1).(mode, episode); |
| 617 | |
| 618 | if (count < 0) return count; |
| 619 | |
| 620 | } |
| 621 | |
| 622 | } |
| 623 | |
| 624 | } |
| 625 | |
| 626 | |
| 627 | SDL_Delay(T_MENU_FRAMEcxx . . $ `src/io/gfx/video.h:78:9`!); |
| 628 | |
| 629 | videocxx . . $ video..clearScreencxx . . $ Video#clearScreen(d4f767463ce0a6b3).(0); |
| 630 | |
| 631 | const char *title = "EPISODES"; |
| 632 | if(canvasWcxx . . $ canvasW. == SWcxx . . $ `src/io/gfx/video.h:38:9`!) |
| 633 | fontmn2cxx . . $ fontmn2.->showStringcxx . . $ Font#showString(7e50a619d5a117f1).(title, (canvasWcxx . . $ canvasW. >> 1) + 48, 8); |
| 634 | else |
| 635 | fontmn2cxx . . $ fontmn2.->showStringcxx . . $ Font#showString(7e50a619d5a117f1).(title, (canvasWcxx . . $ canvasW. >> 1), (canvasHcxx . . $ canvasH. >> 1) - 124, alignXcxx . . $ alignX#::Centercxx . . $ alignX#Center.); |
| 636 | |
| 637 | // center on right side |
| 638 | dst.x = (canvasWcxx . . $ canvasW. >> 1) + 16; // image is 144 pixels wide |
| 639 | dst.y = (canvasHcxx . . $ canvasH. - 110) >> 1; |
| 640 | |
| 641 | if ((episode < episodescxx . . $ GameMenu#episodes. - 1) || (episode < 6)) { |
| 642 | |
| 643 | SDL_BlitSurfacecxx . . $ `<external>/18043084669712134795/SDL_surface.h:873:9`!(episodeScreenscxx . . $ GameMenu#episodeScreens.[episode], NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!, canvascxx . . $ canvas., &dst); |
| 644 | |
| 645 | } else if ((episode == 10) && (episodescxx . . $ GameMenu#episodes. > 6)) { |
| 646 | |
| 647 | SDL_BlitSurfacecxx . . $ `<external>/18043084669712134795/SDL_surface.h:873:9`!(episodeScreenscxx . . $ GameMenu#episodeScreens.[episodescxx . . $ GameMenu#episodes. - 1], NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!, canvascxx . . $ canvas., &dst); |
| 648 | |
| 649 | } |
| 650 | |
| 651 | // center on left side |
| 652 | int episodeX = (canvasWcxx . . $ canvasW. >> 1) - 152; // 8 pixels left |
| 653 | |
| 654 | for (count = 0; count < 12; count++) { |
| 655 | |
| 656 | if (count == episode) { |
| 657 | |
| 658 | // black on white |
| 659 | fontmn2cxx . . $ fontmn2.->mapPalettecxx . . $ Font#mapPalette(748afa4755bc9595).(240, 8, 79, -80); |
| 660 | videocxx . . $ video..drawRectcxx . . $ Video#drawRect(a4376a5627a47301).(episodeX - 2, (canvasHcxx . . $ canvasH. >> 1) + (count << 4) - 94, |
| 661 | 160, 15, 79); |
| 662 | |
| 663 | } else if (!exists[count]) |
| 664 | fontmn2cxx . . $ fontmn2.->mapPalettecxx . . $ Font#mapPalette(748afa4755bc9595).(240, 8, 94, -16); |
| 665 | |
| 666 | const char *tag; |
| 667 | const char *title; |
| 668 | switch(count) { |
| 669 | case 10: |
| 670 | tag = "z"; |
| 671 | title = "bonus levels"; |
| 672 | break; |
| 673 | |
| 674 | case 11: |
| 675 | tag = " "; |
| 676 | title = "specific level"; |
| 677 | break; |
| 678 | |
| 679 | default: |
| 680 | tag = episodeTagcxx . . $ episodeTag(f7ae7e56280f18ae).(count); |
| 681 | title = episodeTitlecxx . . $ episodeTitle(f7ae7e56280f18ae).(count); |
| 682 | break; |
| 683 | } |
| 684 | |
| 685 | // align both separately |
| 686 | fontmn2cxx . . $ fontmn2.->showStringcxx . . $ Font#showString(7e50a619d5a117f1).(tag, episodeX - (count < 6 ? 2 : 0), |
| 687 | (canvasHcxx . . $ canvasH. >> 1) + (count << 4) - 92); |
| 688 | fontmn2cxx . . $ fontmn2.->showStringcxx . . $ Font#showString(7e50a619d5a117f1).(title, episodeX + 16, |
| 689 | (canvasHcxx . . $ canvasH. >> 1) + (count << 4) - 92); |
| 690 | |
| 691 | if ((count == episode) || (!exists[count])) |
| 692 | fontmn2cxx . . $ fontmn2.->mapPalettecxx . . $ Font#mapPalette(748afa4755bc9595).(240, 8, 9, 80); |
| 693 | |
| 694 | } |
| 695 | |
| 696 | showEscStringcxx . . $ Menu#showEscString(b45ddcbc8423892c).(false); |
| 697 | |
| 698 | } |
| 699 | |
| 700 | return E_NONEcxx . . $ `src/OpenJazz.h:69:9`!; |
| 701 | |
| 702 | } |
| 703 | |
| 704 | |
| 705 | /** |
| 706 | * Run the game joining menu. |
| 707 | * |
| 708 | * @return Error code |
| 709 | */ |
| 710 | int GameMenucxx . . $ GameMenu#::joinGamecxx . . $ GameMenu#joinGame(b126dc7c1de90089). () { |
| 711 | |
| 712 | Gamecxx . . $ Game#* game; |
| 713 | int ret; |
| 714 | |
| 715 | ret = textInputcxx . . $ Menu#textInput(bc30cf002e76fcd0).("ip address:", netAddresscxx . . $ netAddress., true); |
| 716 | |
| 717 | if (ret < 0) return ret; |
| 718 | |
| 719 | try { |
| 720 | |
| 721 | game = new ClientGamecxx . . $ ClientGame#(netAddresscxx . . $ netAddress.); |
| 722 | |
| 723 | } catch (int e) { |
| 724 | |
| 725 | switch (e) { |
| 726 | |
| 727 | case E_N_SOCKETcxx . . $ `src/OpenJazz.h:55:9`!: |
| 728 | |
| 729 | if (messagecxx . . $ Menu#message(5c4306d8553b3696).("SOCKET ERROR") == E_QUITcxx . . $ `src/OpenJazz.h:67:9`!) return E_QUITcxx . . $ `src/OpenJazz.h:67:9`!; |
| 730 | |
| 731 | break; |
| 732 | |
| 733 | case E_N_ADDRESScxx . . $ `src/OpenJazz.h:52:9`!: |
| 734 | |
| 735 | if (messagecxx . . $ Menu#message(5c4306d8553b3696).("INVALID ADDRESS") == E_QUITcxx . . $ `src/OpenJazz.h:67:9`!) return E_QUITcxx . . $ `src/OpenJazz.h:67:9`!; |
| 736 | |
| 737 | break; |
| 738 | |
| 739 | case E_N_CONNECTcxx . . $ `src/OpenJazz.h:51:9`!: |
| 740 | |
| 741 | if (messagecxx . . $ Menu#message(5c4306d8553b3696).("COULD NOT CONNECT") == E_QUITcxx . . $ `src/OpenJazz.h:67:9`!) return E_QUITcxx . . $ `src/OpenJazz.h:67:9`!; |
| 742 | |
| 743 | break; |
| 744 | |
| 745 | case E_TIMEOUTcxx . . $ `src/OpenJazz.h:58:9`!: |
| 746 | |
| 747 | if (messagecxx . . $ Menu#message(5c4306d8553b3696).("OPERATION TIMED OUT") == E_QUITcxx . . $ `src/OpenJazz.h:67:9`!) return E_QUITcxx . . $ `src/OpenJazz.h:67:9`!; |
| 748 | |
| 749 | break; |
| 750 | |
| 751 | case E_DATAcxx . . $ `src/OpenJazz.h:56:9`!: |
| 752 | |
| 753 | if (messagecxx . . $ Menu#message(5c4306d8553b3696).("INCORRECT DATA\nRECEIVED") == E_QUITcxx . . $ `src/OpenJazz.h:67:9`!) return E_QUITcxx . . $ `src/OpenJazz.h:67:9`!; |
| 754 | |
| 755 | break; |
| 756 | |
| 757 | case E_VERSIONcxx . . $ `src/OpenJazz.h:57:9`!: |
| 758 | |
| 759 | if (messagecxx . . $ Menu#message(5c4306d8553b3696).("WRONG SERVER VERSION") == E_QUITcxx . . $ `src/OpenJazz.h:67:9`!) return E_QUITcxx . . $ `src/OpenJazz.h:67:9`!; |
| 760 | |
| 761 | break; |
| 762 | |
| 763 | case E_RETURNcxx . . $ `src/OpenJazz.h:66:9`!: |
| 764 | case E_QUITcxx . . $ `src/OpenJazz.h:67:9`!: |
| 765 | |
| 766 | break; |
| 767 | |
| 768 | default: |
| 769 | |
| 770 | if (messagecxx . . $ Menu#message(5c4306d8553b3696).("COULD NOT COMPLETE CONNECTION") == E_QUITcxx . . $ `src/OpenJazz.h:67:9`!) return E_QUITcxx . . $ `src/OpenJazz.h:67:9`!; |
| 771 | |
| 772 | break; |
| 773 | |
| 774 | } |
| 775 | |
| 776 | return e; |
| 777 | |
| 778 | } |
| 779 | |
| 780 | |
| 781 | // Play the level(s) |
| 782 | |
| 783 | ret = game->playcxx . . $ Game#play(b126dc7c1de90089).(); |
| 784 | |
| 785 | delete game; |
| 786 | |
| 787 | if (ret != E_QUITcxx . . $ `src/OpenJazz.h:67:9`!) playMusiccxx . . $ playMusic(90ef5b561fbcb8de).("MENUSNG.PSM"); |
| 788 | |
| 789 | switch (ret) { |
| 790 | |
| 791 | case E_QUITcxx . . $ `src/OpenJazz.h:67:9`!: |
| 792 | |
| 793 | return E_QUITcxx . . $ `src/OpenJazz.h:67:9`!; |
| 794 | |
| 795 | case E_FILEcxx . . $ `src/OpenJazz.h:60:9`!: |
| 796 | |
| 797 | return messagecxx . . $ Menu#message(5c4306d8553b3696).("FILE NOT FOUND"); |
| 798 | |
| 799 | case E_N_DISCONNECTcxx . . $ `src/OpenJazz.h:50:9`!: |
| 800 | |
| 801 | return messagecxx . . $ Menu#message(5c4306d8553b3696).("DISCONNECTED"); |
| 802 | |
| 803 | } |
| 804 | |
| 805 | return E_NONEcxx . . $ `src/OpenJazz.h:69:9`!; |
| 806 | |
| 807 | } |
| 808 | |
| 809 | |
| 810 | /** |
| 811 | * Run the new game menu. |
| 812 | * |
| 813 | * @return Error code |
| 814 | */ |
| 815 | int GameMenucxx . . $ GameMenu#::newGamecxx . . $ GameMenu#newGame(b126dc7c1de90089). () { |
| 816 | |
| 817 | #if (defined USE_SOCKETScxx . . $ `<built-in>:467:9`!) || (defined USE_SDL_NET) |
| 818 | const char *newGameOptions[6] = {"new single player game", "new co-op game", |
| 819 | "new battle", "new team battle", "new race", "join game"}; |
| 820 | int option = 0; |
| 821 | |
| 822 | while (true) { |
| 823 | |
| 824 | videocxx . . $ video..setPalettecxx . . $ Video#setPalette(d5421d17e1a4b2b2).(menuPalettecxx . . $ menuPalette.); |
| 825 | |
| 826 | int ret = genericcxx . . $ Menu#generic(9f6ec59569c98226).("NEW GAME", newGameOptions, 6, option); |
| 827 | |
| 828 | if (ret == E_QUITcxx . . $ `src/OpenJazz.h:67:9`!) return E_QUITcxx . . $ `src/OpenJazz.h:67:9`!; |
| 829 | if (ret < 0) return E_NONEcxx . . $ `src/OpenJazz.h:69:9`!; |
| 830 | |
| 831 | if (option == 5) { |
| 832 | |
| 833 | if (joinGamecxx . . $ GameMenu#joinGame(b126dc7c1de90089).() == E_QUITcxx . . $ `src/OpenJazz.h:67:9`!) return E_QUITcxx . . $ `src/OpenJazz.h:67:9`!; |
| 834 | |
| 835 | } else { |
| 836 | |
| 837 | if (newGameEpisodecxx . . $ GameMenu#newGameEpisode(eac196c7edaa1201).(GameModeTypecxx . . $ GameModeType#(option)) == E_QUITcxx . . $ `src/OpenJazz.h:67:9`!) return E_QUITcxx . . $ `src/OpenJazz.h:67:9`!; |
| 838 | |
| 839 | } |
| 840 | |
| 841 | } |
| 842 | |
| 843 | return E_NONEcxx . . $ `src/OpenJazz.h:69:9`!; |
| 844 | #else |
| 845 | return newGameEpisode(M_SINGLE); |
| 846 | #endif |
| 847 | |
| 848 | } |