Debian Codegraph @

src/menu/setupmenu.cpp

raw symbols SCIP
1
2 /**
3 *
4 * @file setupmenu.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 menusetup.cpp from parts of menu.cpp
12 * - 26th July 2009: Renamed menusetup.cpp to setupmenu.cpp
13 * - 21st July 2013: Created setup.cpp from parts of main.cpp and setupmenu.cpp
14 *
15 * @par Licence:
16 * Copyright (c) 2005-2017 AJ Thomson
17 * Copyright (c) 2015-2026 Carsten Teibes
18 *
19 * OpenJazz is distributed under the terms of
20 * the GNU General Public License, version 2.0
21 *
22 * @par Description:
23 * Deals with the running of setup menus.
24 *
25 */
26
27
28 #include "menu.h"
29
30 #include "io/controls.h"
31 #include "io/gfx/font.h"
32 #include "io/gfx/video.h"
33 #include "io/sound.h"
34 #include "player/player.h"
35 #include "loop.h"
36 #include "setup.h"
37 #include "util.h"
38 #include "platforms/platforms.h"
39
40 #ifndef NO_KEYBOARD_CFG
41 /**
42 * Run the keyboard setup menu.
43 *
44 * @return Error code
45 */
46 int SetupMenu::setupKeyboard () {
47
48 const char *options[PCONTROLS] = {"up", "down", "left", "right", "jump", "swim up", "fire", "weapon"};
49 int progress, x, y;
50
51 progress = 0;
52
53 while (true) {
54
55 int character = loop(SET_KEY_LOOP);
56
57 if (character == E_QUIT) return E_QUIT;
58
59 if (character == controls.getKey(C_ESCAPE)) return E_NONE;
60
61 if (controls.getCursor(x, y) &&
62 (x < 100) && (y >= canvasH - 12) &&
63 controls.wasCursorReleased()) return E_NONE;
64
65 if (character > 0) {
66
67 // If this is a navigation controls (up, down, or enter),
68 // make sure it's not the same as other navigation controls
69
70 if (((progress != C_UP) &&
71 (progress != C_DOWN) &&
72 (progress != C_ENTER)) ||
73 (controls.getKey(progress) == character) ||
74 ((controls.getKey(C_UP) != character) &&
75 (controls.getKey(C_DOWN) != character) &&
76 (controls.getKey(C_ENTER) != character))) {
77
78 controls.setKey(progress, character);
79 progress++;
80
81 if (progress == PCONTROLS) {
82
83 // If all controls have been assigned, return
84 playConfirmSound();
85 return E_NONE;
86
87 }
88
89 }
90
91 }
92
93
94 SDL_Delay(T_MENU_FRAME);
95
96 video.clearScreen(0);
97
98 fontmn2->showString("KEYBOARD CONFIGURATION", canvasW >> 1,
99 (canvasH >> 1) - 80, alignX::Center);
100
101 for (int count = 0; count < PCONTROLS; count++) {
102
103 if (count < progress)
104 fontmn2->showString("okay", (canvasW >> 1) + 16,
105 (canvasH >> 1) + (count << 4) - 56);
106
107 else if (count == progress) fontmn2->mapPalette(240, 8, 114, 16);
108
109 fontmn2->showString(options[count], (canvasW >> 1) - 96,
110 (canvasH >> 1) + (count << 4) - 56);
111
112 if (count == progress) {
113
114 fontmn2->showString("press key", canvasW >> 1,
115 (canvasH >> 1) + (count << 4) - 56);
116
117 fontmn2->restorePalette();
118
119 }
120
121 }
122
123 showEscString();
124
125 }
126
127 return E_NONE;
128
129 }
130 #endif
131
132 #ifndef NO_CONTROLLER_CFG
133 /**
134 * Run the joystick setup menu.
135 *
136 * @return Error code
137 */
138 int SetupMenu::setupJoystick () {
139
140 const char *options[PCONTROLS] = {"up", "down", "left", "right", "jump", "swim up", "fire", "weapon"};
141 int x, y;
142
143 int progress = 0;
144
145 while (true) {
146
147 int control = loop(SET_JOYSTICK_LOOP);
148
149 if (control == E_QUIT) return E_QUIT;
150
151 switch (control & 0xF00) {
152
153 case JOYSTICKB:
154
155 // If this is a navigation controls (up, down, or enter),
156 // make sure it's not the same as other navigation controls
157
158 if (((progress != C_UP) &&
159 (progress != C_DOWN) &&
160 (progress != C_ENTER)) ||
161 (controls.getButton(progress) == (control & 0xFF)) ||
162 ((controls.getButton(C_UP) != (control & 0xFF)) &&
163 (controls.getButton(C_DOWN) != (control & 0xFF)) &&
164 (controls.getButton(C_ENTER) != (control & 0xFF)))) {
165
166 controls.setButton(progress, control & 0xFF);
167 progress++;
168
169 if (progress == PCONTROLS) {
170
171 // If all controls have been assigned, return
172 playConfirmSound();
173 return E_NONE;
174
175 }
176
177 }
178
179 break;
180
181 case JOYSTICKANEG:
182
183 // If this is a navigation controls (up, down, or enter),
184 // make sure it's not the same as other navigation controls
185
186 if (((progress != C_UP) &&
187 (progress != C_DOWN) &&
188 (progress != C_ENTER)) ||
189 ((controls.getAxis(progress) == (control & 0xFF)) && !controls.getAxisDirection(progress)) ||
190 (((controls.getAxis(C_UP) != (control & 0xFF)) || controls.getAxisDirection(C_UP)) &&
191 ((controls.getAxis(C_DOWN) != (control & 0xFF)) || controls.getAxisDirection(C_DOWN)) &&
192 ((controls.getAxis(C_ENTER) != (control & 0xFF)) || controls.getAxisDirection(C_ENTER)))) {
193
194 controls.setAxis(progress, control & 0xFF, false);
195 progress++;
196
197 if (progress == PCONTROLS) {
198
199 // If all controls have been assigned, return
200 playConfirmSound();
201 return E_NONE;
202
203 }
204
205 }
206
207 break;
208
209 case JOYSTICKAPOS:
210
211 // If this is a navigation controls (up, down, or enter),
212 // make sure it's not the same as other navigation controls
213
214 if (((progress != C_UP) &&
215 (progress != C_DOWN) &&
216 (progress != C_ENTER)) ||
217 ((controls.getAxis(progress) == (control & 0xFF)) && controls.getAxisDirection(progress)) ||
218 (((controls.getAxis(C_UP) != (control & 0xFF)) || !controls.getAxisDirection(C_UP)) &&
219 ((controls.getAxis(C_DOWN) != (control & 0xFF)) || !controls.getAxisDirection(C_DOWN)) &&
220 ((controls.getAxis(C_ENTER) != (control & 0xFF)) || !controls.getAxisDirection(C_ENTER)))) {
221
222 controls.setAxis(progress, control & 0xFF, true);
223 progress++;
224
225 if (progress == PCONTROLS) {
226
227 // If all controls have been assigned, return
228 playConfirmSound();
229 return E_NONE;
230
231 }
232
233 }
234
235 break;
236
237 case JOYSTICKHUP:
238 case JOYSTICKHLFT:
239 case JOYSTICKHRHT:
240 case JOYSTICKHDWN:
241
242 int direction = 0;
243 switch(control & 0xF00) {
244 case JOYSTICKHUP: direction = SDL_HAT_UP; break;
245 case JOYSTICKHLFT: direction = SDL_HAT_LEFT; break;
246 case JOYSTICKHRHT: direction = SDL_HAT_RIGHT; break;
247 case JOYSTICKHDWN: direction = SDL_HAT_DOWN; break;
248 }
249
250 // If this is a navigation controls (up, down, or enter),
251 // make sure it's not the same as other navigation controls
252
253 if (((progress != C_UP) &&
254 (progress != C_DOWN) &&
255 (progress != C_ENTER)) ||
256 ((controls.getHat(progress) == (control & 0xFF)) && (controls.getHatDirection(progress) == direction)) ||
257 (((controls.getHat(C_UP) != (control & 0xFF)) || (controls.getHatDirection(C_UP) != direction)) &&
258 ((controls.getHat(C_DOWN) != (control & 0xFF)) || (controls.getHatDirection(C_DOWN) != direction)) &&
259 ((controls.getHat(C_ENTER) != (control & 0xFF)) || (controls.getHatDirection(C_ENTER) != direction)))) {
260
261 controls.setHat(progress, control & 0xFF, direction);
262 progress++;
263
264 if (progress == PCONTROLS) {
265
266 // If all controls have been assigned, return
267 playConfirmSound();
268 return E_NONE;
269
270 }
271
272 }
273
274 break;
275
276 }
277
278 if (controls.release(C_ESCAPE)) return E_NONE;
279
280 if ((controls.getCursor(x, y) &&
281 (x < 100) && (y >= canvasH - 12) &&
282 controls.wasCursorReleased())) return E_NONE;
283
284
285 SDL_Delay(T_MENU_FRAME);
286
287 video.clearScreen(0);
288
289 fontmn2->showString("JOYSTICK CONFIGURATION", canvasW >> 1,
290 (canvasH >> 1) - 80, alignX::Center);
291
292 for (int count = 0; count < PCONTROLS; count++) {
293
294 if (count < progress)
295 fontmn2->showString("okay", (canvasW >> 1) + 16,
296 (canvasH >> 1) + (count << 4) - 56);
297
298 else if (count == progress) fontmn2->mapPalette(240, 8, 114, 16);
299
300 fontmn2->showString(options[count], (canvasW >> 1) - 96,
301 (canvasH >> 1) + (count << 4) - 56);
302
303 if (count == progress) {
304
305 fontmn2->showString("press control", canvasW >> 1,
306 (canvasH >> 1) + (count << 4) - 56);
307
308 fontmn2->restorePalette();
309
310 }
311
312 }
313
314 showEscString();
315
316 }
317
318 return E_NONE;
319
320 }
321 #endif
322
323 #if !defined(NO_RESIZE) || defined(SCALE)
324 /**
325 * Run the resolution/scaling setup menu.
326 *
327 * @return Error code
328 */
329 int SetupMenu::setupVideo () {
330 int widthOptions[] = {SW, 352, 384, 400, 480, 512, 640, 720, 768, 800, 960,
331 1024, 1152, 1280, 1366, 1400, 1440, 1600, 1680, 1920, 2048, 2560, 3200,
332 3440, 3840, 4096, MAX_SCREEN_WIDTH};
333 int heightOptions[] = {SH, 240, 288, 300, 320, 384, 400, 480, 576, 600, 720,
334 768, 800, 864, 900, 960, 1024, 1050, 1080, 1152, 1200, 1440, 1536, 1600,
335 2048, 2160, MAX_SCREEN_HEIGHT};
336 const char *methodString[4] = { "nearest", "bilinear", "scalex", "hqx"};
337 int scaleFactor = video.getScaleFactor();
338 scalerType scaleMethod = video.getScaleMethod();
339 int screenW, screenH, oldscreenW, oldscreenH, x, y;
340 screenW = oldscreenW = video.getWidth();
341 screenH = oldscreenH = video.getHeight();
342 int selection = 0;
343 bool resOK = true;
344
345 char scaleString[3] = "Yx";
346 bool fillScaleString = true;
347 char resString[22] = "game res: XXXX x YYYY";
348 bool fillResString = true;
349 int resStringWidth = 0;
350
351 // helpers
352 auto changeWidth = [&] (bool isPositive) {
353 int count = 0;
354 if(isPositive && (screenW < video.getMaxWidth())) {
355 while (screenW >= widthOptions[count])
356 count++;
357
358 screenW = widthOptions[count];
359 } else if (!isPositive && (screenW > video.getMinWidth())) {
360 count = sizeof(widthOptions)/sizeof(widthOptions[0]) - 1;
361 while (screenW <= widthOptions[count])
362 count--;
363
364 screenW = widthOptions[count];
365 }
366 };
367 auto changeHeight = [&] (bool isPositive) {
368 int count = 0;
369 if(isPositive && (screenH < video.getMaxHeight())) {
370 while (screenH >= heightOptions[count])
371 count++;
372
373 screenH = heightOptions[count];
374 } else if (!isPositive && (screenH > video.getMinHeight())) {
375 count = sizeof(heightOptions)/sizeof(heightOptions[0]) - 1;
376 while (screenH <= heightOptions[count])
377 count--;
378
379 screenH = heightOptions[count];
380 }
381 };
382 auto changeScaleFactor = [&] (bool isPositive) {
383 if(isPositive && scaleFactor < MAX_SCALE)
384 scaleFactor++;
385 else if (!isPositive && scaleFactor > MIN_SCALE)
386 scaleFactor--;
387 };
388 auto changeScaleMethod = [&] (bool isPositive) {
389 // TODO
390 #if 0
391 if (isPositive && scaleMethod != scalerType::hqx)
392 scaleMethod = static_cast<scalerType>(+scaleMethod + 1);
393 else if(!isPositive && scaleMethod != scalerType::None)
394 scaleMethod = static_cast<scalerType>(+scaleMethod - 1);
395 #else
396 OJ_UNUSED(isPositive);
397
398 #if OJ_SDL3 || OJ_SDL2
399 if(scaleMethod != scalerType::None)
400 scaleMethod = scalerType::None;
401 else
402 scaleMethod = scalerType::Bilinear;
403 #else
404 if(scaleMethod != scalerType::None)
405 scaleMethod = scalerType::None;
406 else
407 scaleMethod = scalerType::Scale2x;
408 #endif
409 #endif
410 };
411
412 auto switchPalette = [] (bool activate) {
413 if(activate)
414 fontmn2->mapPalette(240, 8, 114, 16);
415 else
416 fontmn2->restorePalette();
417 };
418
419 // sanitize
420 scaleFactor = CLAMP(scaleFactor, MIN_SCALE, MAX_SCALE);
421
422 while (true) {
423
424 if (loop(NORMAL_LOOP) == E_QUIT) return E_QUIT;
425
426 if (controls.release(C_ESCAPE)) return E_NONE;
427
428 if (controls.getCursor(x, y)) {
429
430 // ESC
431 if ((x >= 32) && (x < 132) && (y >= canvasH - 12)
432 && controls.wasCursorReleased())
433 return E_NONE;
434
435 // TODO: selection? not feasible with one button
436 }
437
438 SDL_Delay(T_MENU_FRAME);
439
440 video.clearScreen(0);
441
442
443 // Show screen corners
444 video.drawRect(0, 0, 32, 32, 79);
445 video.drawRect(canvasW - 32, 0, 32, 32, 79);
446 video.drawRect(canvasW - 32, canvasH - 32, 32, 32, 79);
447 video.drawRect(0, canvasH - 32, 32, 32, 79);
448
449 fontmn2->showString("VIDEO OPTIONS", canvasW >> 1, (canvasH >> 1) - 80, alignX::Center);
450
451 // Game Resolution
452 if(fillResString) {
453 snprintf(resString, sizeof(resString), "game res: %d x %d", canvasW, canvasH);
454 resStringWidth = fontmn2->getStringWidth(resString);
455 fillResString = false;
456 }
457 video.drawRect(((canvasW - resStringWidth) >> 1) - 4, (canvasH >> 1) - 50, resStringWidth + 4, 14, 46);
458 fontmn2->showString(resString, (canvasW - resStringWidth) >> 1, (canvasH >> 1) - 48);
459
460 switchPalette(selection == 0);
461
462 // Width
463 fontmn2->showString("width:", (canvasW >> 1) - 80, (canvasH >> 1) - 16);
464 fontmn2->showNumber(screenW, (canvasW >> 1) + 48, (canvasH >> 1) - 16);
465
466 switchPalette(selection == 1);
467
468 // Height
469 fontmn2->showString("height:", (canvasW >> 1) - 80, canvasH >> 1);
470 fontmn2->showNumber(screenH, (canvasW >> 1) + 48, canvasH >> 1);
471
472 switchPalette(selection == 2);
473
474 // Factor
475 if(fillScaleString) {
476 snprintf(scaleString, sizeof(scaleString), "%dx", scaleFactor);
477 fillScaleString = false;
478 }
479 fontmn2->showString("scale:", (canvasW >> 1) - 80, (canvasH >> 1) + 16);
480 fontmn2->showString(scaleString, (canvasW >> 1) + 8, (canvasH >> 1) + 16);
481
482 switchPalette(selection == 3);
483
484 // Method
485 fontmn2->showString("method:", (canvasW >> 1) - 80, (canvasH >> 1) + 32);
486 fontmn2->showString(methodString[+scaleMethod], (canvasW >> 1) + 8, (canvasH >> 1) + 32);
487
488 switchPalette(false);
489
490 if (controls.release(C_UP)) {
491 if(selection > 0)
492 selection--;
493 else
494 selection = 3;
495 }
496
497 if (controls.release(C_DOWN)) {
498 if(selection < 3)
499 selection++;
500 else
501 selection = 0;
502 }
503
504 bool hasPressedRight = controls.release(C_RIGHT);
505 if (controls.release(C_LEFT) || hasPressedRight) {
506 switch(selection) {
507 case 0:
508 changeWidth(hasPressedRight);
509 break;
510 case 1:
511 changeHeight(hasPressedRight);
512 break;
513 case 2:
514 changeScaleFactor(hasPressedRight);
515 fillScaleString = true;
516 break;
517 case 3:
518 changeScaleMethod(hasPressedRight);
519 break;
520 }
521 resOK = true;
522 }
523
524 // Check for a resolution or scaling change
525 if (screenH != oldscreenH || screenW != oldscreenW ||
526 scaleFactor != video.getScaleFactor() || scaleMethod != video.getScaleMethod()) {
527
528 fontmn2->showString(resOK ? "press enter to apply" : "invalid resolution!",
529 (canvasW >> 1), (canvasH >> 1) + 56, alignX::Center);
530
531 // Apply resolution change
532 if (controls.release(C_ENTER)) {
533 playConfirmSound();
534
535 if (video.reset(screenW, screenH)) {
536 // New resolution is ok
537 oldscreenW = screenW;
538 oldscreenH = screenH;
539
540 video.setScaling(scaleFactor, scaleMethod);
541 scaleFactor = video.getScaleFactor();
542 scaleMethod = video.getScaleMethod();
543
544 fillResString = true;
545 fillScaleString = true;
546 } else {
547 // It failed, reset to sanity
548 video.reset(oldscreenW, oldscreenH);
549 resOK = false;
550 }
551 }
552 }
553
554 // cannot use showEscString() here, needs shifting to the right
555 fontbig->showString(ESCAPE_STRING, 35, canvasH, alignX::Left, alignY::Bottom);
556 }
557
558 return E_NONE;
559 }
560 #endif
561
562
563 /**
564 * Run the audio setup menu.
565 *
566 * @return Error code
567 */
568 int SetupMenu::setupAudio () {
569
570 int x, y;
571 bool soundActive;
572
573 soundActive = false;
574
575 while (true) {
576
577 if (loop(NORMAL_LOOP) == E_QUIT) return E_QUIT;
578
579 if (controls.release(C_ESCAPE)) return E_NONE;
580
581 if (controls.release(C_ENTER)) return E_NONE;
582
583 if (controls.getCursor(x, y)) {
584
585 // ESC
586 if ((x < 100) && (y >= canvasH - 12) && controls.wasCursorReleased()) return E_NONE;
587
588 // start from drawing position
589 x -= (canvasW >> 1) + 48;
590 y -= canvasH >> 1;
591
592 if ((x >= 0) && (x < (MAX_VOLUME >> 1)) && (y >= 0) && (y < 11)) setMusicVolume(x << 1);
593 if ((x >= 0) && (x < (MAX_VOLUME >> 1)) && (y >= 16) && (y < 27)) setSoundVolume(x << 1);
594
595 if (controls.wasCursorReleased()) playConfirmSound();
596
597 }
598
599 SDL_Delay(T_MENU_FRAME);
600
601 video.clearScreen(0);
602
603 fontmn2->showString("AUDIO OPTIONS", canvasW >> 1, (canvasH >> 1) - 80, alignX::Center);
604
605 // Music Volume
606 if (!soundActive) fontmn2->mapPalette(240, 8, 114, 16);
607 fontmn2->showString("music volume", (canvasW >> 1) - 88, canvasH >> 1);
608 fontmn2->restorePalette();
609
610 video.drawRect((canvasW >> 1) + 48, canvasH >> 1, getMusicVolume() >> 1, 11, 175);
611
612 // Sound Volume
613 if (soundActive) fontmn2->mapPalette(240, 8, 114, 16);
614 fontmn2->showString("effect volume", (canvasW >> 1) - 88, (canvasH >> 1) + 16);
615 fontmn2->restorePalette();
616
617 video.drawRect((canvasW >> 1) + 48, (canvasH >> 1) + 16, getSoundVolume() >> 1, 11, 175);
618
619 if (controls.release(C_UP)) soundActive = !soundActive;
620
621 if (controls.release(C_DOWN)) soundActive = !soundActive;
622
623 if (controls.release(C_LEFT)) {
624
625 if (soundActive) setSoundVolume(getSoundVolume() - 4);
626 else setMusicVolume(getMusicVolume() - 4);
627
628 playConfirmSound();
629
630 }
631
632 if (controls.release(C_RIGHT)) {
633
634 if (soundActive) setSoundVolume(getSoundVolume() + 4);
635 else setMusicVolume(getMusicVolume() + 4);
636
637 playConfirmSound();
638
639 }
640
641 showEscString();
642
643 }
644
645 return E_NONE;
646
647 }
648
649
650 /**
651 * Run the setup menu.
652 *
653 * @return Error code
654 */
655 int SetupMenu::setupMain () {
656
657 const char* setupOptions[6] = {"character", "keyboard", "joystick", "video", "audio", "gameplay"};
658 const char* setupCharacterOptions[5] = {"name", "fur", "bandana", "gun", "wristband"};
659 const char* setupCharacterColOptions[8] = {"white", "red", "orange", "yellow", "green", "blue", "animation 1", "animation 2"};
660 const unsigned char setupCharacterCols[8] = {PC_GREY, PC_RED, PC_ORANGE, PC_YELLOW, PC_LGREEN, PC_BLUE, PC_SANIM, PC_LANIM};
661 const char* setupModsOff[4] = {"slow motion: off", "extra items: take", "bird limit: one", "hud style: classic"};
662 const char* setupModsOn[4] = {"slow motion: on", "extra items: leave", "bird limit: no", "hud style: old fps" };
663 const char* setupMods[4];
664 int ret;
665 int option, suboption, subsuboption;
666
667 option = 0;
668
669 setupMods[0] = (setup.slowMotion? setupModsOn[0]: setupModsOff[0]);
670 setupMods[1] = (setup.leaveUnneeded? setupModsOn[1]: setupModsOff[1]);
671 setupMods[2] = (setup.manyBirds? setupModsOn[2]: setupModsOff[2]);
672 setupMods[3] = (setup.hudStyle == hudType::FPS? setupModsOn[3]: setupModsOff[3]);
673
674 video.setPalette(menuPalette);
675
676 while (true) {
677
678 ret = generic("SETUP OPTIONS", setupOptions, 6, option);
679
680 if (ret == E_RETURN) return E_NONE;
681 if (ret < 0) return ret;
682
683 switch (option) {
684
685 case 0:
686
687 suboption = 0;
688
689 while (true) {
690
691 ret = generic("CHARACTER OPTIONS", setupCharacterOptions, 5, suboption);
692
693 if (ret == E_QUIT) return E_QUIT;
694 if (ret < 0) break;
695
696 switch (suboption) {
697
698 case 0: // Character name
699
700 if (textInput("character name:", setup.characterName) == E_QUIT) return E_QUIT;
701
702 break;
703
704 default: // Character colour
705
706 subsuboption = 0;
707 ret = generic(nullptr, setupCharacterColOptions, 8, subsuboption);
708
709 if (ret == E_QUIT) return E_QUIT;
710
711 if (ret == E_NONE)
712 setup.characterCols[suboption - 1] = setupCharacterCols[subsuboption];
713
714 break;
715
716 }
717
718 }
719
720 break;
721
722 case 1:
723
724 #ifdef NO_KEYBOARD_CFG
725 if (message("FEATURE NOT AVAILABLE") == E_QUIT) return E_QUIT;
726 #else
727 if (setupKeyboard() == E_QUIT) return E_QUIT;
728 #endif
729
730 break;
731
732 case 2:
733
734 #ifdef NO_CONTROLLER_CFG
735 if (message("FEATURE NOT AVAILABLE") == E_QUIT) return E_QUIT;
736 #else
737 if (setupJoystick() == E_QUIT) return E_QUIT;
738 #endif
739
740 break;
741
742 case 3:
743
744 #if defined(NO_RESIZE) && !defined(SCALE)
745 if (message("FEATURE NOT AVAILABLE") == E_QUIT) return E_QUIT;
746 #else
747 if (setupVideo() == E_QUIT) return E_QUIT;
748 #endif
749
750 break;
751
752 case 4:
753
754 if (setupAudio() == E_QUIT) return E_QUIT;
755
756 break;
757
758 case 5:
759
760 suboption = 0;
761
762 while (true) {
763
764 ret = generic("GAME OPTIONS", setupMods, 4, suboption);
765
766 if (ret == E_QUIT) return E_QUIT;
767 if (ret < 0) break;
768
769 if (setupMods[suboption] == setupModsOff[suboption])
770 setupMods[suboption] = setupModsOn[suboption];
771 else
772 setupMods[suboption] = setupModsOff[suboption];
773
774 setup.slowMotion = (setupMods[0] == setupModsOn[0]);
775 setup.leaveUnneeded = (setupMods[1] == setupModsOn[1]);
776 setup.manyBirds = (setupMods[2] == setupModsOn[2]);
777 if(setupMods[3] == setupModsOn[3]) {
778 setup.hudStyle = hudType::FPS;
779 } else {
780 setup.hudStyle = hudType::Classic;
781 }
782
783 }
784
785 break;
786
787 }
788
789 }
790
791 return E_NONE;
792
793 }