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

Function CtlConfig

Descent3/ctlconfig.cpp:1340–1406  ·  view source on GitHub ↗

the main controller config menu loop

Source from the content-addressed store, hash-verified

1338}
1339// the main controller config menu loop
1340void CtlConfig(int mode) {
1341 newuiLargeMenu menu;
1342 joy_cfg_screen joycfg;
1343 key_cfg_screen keycfg;
1344 wpnsel_cfg_screen wpncfg;
1345 t_ctlcfgswitchcb_data cfg_cb_data;
1346 int res;
1347 void (*old_callback)() = GetUICallback();
1348 int old_mode = GetScreenMode();
1349 // must switch to standard resolution for large window
1350 SetScreenMode(SM_MENU);
1351 LoadControlConfig();
1352 // open menu
1353 menu.Create();
1354 menu.Open();
1355 joycfg.setup(&menu);
1356 keycfg.setup(&menu);
1357 wpncfg.setup(&menu);
1358 cfg_cb_data.joycfg = &joycfg;
1359 cfg_cb_data.keycfg = &keycfg;
1360 cfg_cb_data.wpncfg = &wpncfg;
1361 cfg_cb_data.curcfg = NULL;
1362 menu.AddSimpleOption(UID_CANCEL, TXT_GEN_EXIT);
1363 menu.SetCurrentOption((mode == CTLCONFIG_WPNSEL) ? IDV_WPNSEL
1364 : (mode == CTLCONFIG_CONTROLLER) ? IDV_CCONFIG
1365 : IDV_KCONFIG);
1366 menu.SetOnOptionSwitchCB(CtlConfigSwitchCB, (void *)&cfg_cb_data);
1367
1368 // if(mode==CTLCONFIG_CONTROLLER) {
1369 // inSprocket_Configure();
1370 // }
1371 // make sure game is running!
1372 SetUICallback(CtlConfigUICB);
1373 // run menu
1374 do {
1375 res = menu.DoUI();
1376 // immediate checking of any option ids.
1377 if (res == UID_CANCEL || res == NEWUIRES_FORCEQUIT) {
1378 break; // next pass will quit
1379 }
1380 // if(res == IDV_CCONFIG) {
1381 // inSprocket_Configure();
1382 // }
1383 switch (menu.GetCurrentOption()) {
1384 case IDV_KCONFIG:
1385 keycfg.process(res);
1386 break;
1387 case IDV_CCONFIG:
1388 joycfg.process(res);
1389 break;
1390 case IDV_WPNSEL:
1391 wpncfg.process(res);
1392 break;
1393 };
1394 } while (1);
1395 // write them out and close.
1396 wpncfg.finish();
1397 keycfg.finish();

Callers 2

PilotSelectFunction · 0.85
OptionsMenuFunction · 0.85

Calls 15

GetScreenModeFunction · 0.85
SetScreenModeFunction · 0.85
LoadControlConfigFunction · 0.85
SetUICallbackFunction · 0.85
SaveControlConfigFunction · 0.85
PltWriteFileFunction · 0.85
AddSimpleOptionMethod · 0.80
SetCurrentOptionMethod · 0.80
SetOnOptionSwitchCBMethod · 0.80
GetCurrentOptionMethod · 0.80
CreateMethod · 0.45
OpenMethod · 0.45

Tested by

no test coverage detected