MCPcopy Create free account
hub / github.com/DescentDevelopers/Descent3 / OptionsMenu

Function OptionsMenu

Descent3/config.cpp:1355–1438  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1353#include "init.h"
1354
1355void OptionsMenu() {
1356 newuiMenu menu;
1357 video_menu video;
1358 details_menu details;
1359 sound_menu sound;
1360 toggles_menu toggles;
1361 hud_menu hud;
1362
1363 int res = -1, state = 0; // state = 0, options menu, 1 = controller config, 2 = quitting.
1364
1365 while (state != 2) {
1366 if (state == 1) {
1367 // enter controller config menu
1368 mprintf(0, "CONTROLLER CONFIG MENU HERE!\n");
1369 CtlConfig(CTLCONFIG_KEYBOARD);
1370 state = 0; // goto options menu.
1371 } else {
1372 // open menu
1373
1374 DoWaitMessage(true);
1375
1376 menu.Create();
1377 menu.Open();
1378
1379 video.setup(&menu); // setup video menu IDV_VCONFIG
1380 details.setup(&menu); // setup details menu. IDV_DCONFIG
1381 sound.setup(&menu); // setup sound menu. IDV_SCONFIG
1382 toggles.setup(&menu); // setup general menu. IDV_GCONFIG
1383 hud.setup(&menu); // setup hud menu. IDV_HCONFIG
1384
1385 menu.AddSimpleOption(IDV_CCONFIG, TXT_OPTCONFIG);
1386 menu.AddSimpleOption(UID_CANCEL, TXT_DONE);
1387
1388 menu.SetCurrentOption(IDV_VCONFIG);
1389
1390 DoWaitMessage(false);
1391
1392 // run menu
1393 do {
1394 res = menu.DoUI();
1395
1396 // immediate checking of any option ids.
1397 if (res == UID_CANCEL || res == NEWUIRES_FORCEQUIT) {
1398 state = 2;
1399 break; // next pass will quit
1400 } else if (res == IDV_CCONFIG) {
1401 state = 1;
1402 break; // next pass will enter controller menu
1403 }
1404
1405 // handle any processing needed by current option.
1406 switch (menu.GetCurrentOption()) {
1407 case IDV_DCONFIG:
1408 details.process(res);
1409 break;
1410 case IDV_SCONFIG:
1411 sound.process(res);
1412 break;

Callers 2

RunGameMenuFunction · 0.85
MainMenuFunction · 0.85

Calls 15

CtlConfigFunction · 0.85
DoWaitMessageFunction · 0.85
PltWriteFileFunction · 0.85
SaveGameSettingsFunction · 0.85
AddSimpleOptionMethod · 0.80
SetCurrentOptionMethod · 0.80
GetCurrentOptionMethod · 0.80
CreateMethod · 0.45
OpenMethod · 0.45
setupMethod · 0.45
DoUIMethod · 0.45
processMethod · 0.45

Tested by

no test coverage detected