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

Function SaveControlConfig

Descent3/Controls.cpp:1381–1410  ·  view source on GitHub ↗

saves the internal controller config of current pilot. if the controller changes, then calling LoadControlConfig will restore ONLY VALID configurations.

Source from the content-addressed store, hash-verified

1379// saves the internal controller config of current pilot. if the controller changes, then calling
1380// LoadControlConfig will restore ONLY VALID configurations.
1381void SaveControlConfig(pilot *plt) {
1382 int j;
1383 if (!plt)
1384 plt = &Current_pilot;
1385
1386 for (int i = 0; i < NUM_CONTROLLER_FUNCTIONS; i++) {
1387 ct_type ctype[2];
1388 ct_config_data ccfgdata;
1389 uint8_t flags[2];
1390 Controller->get_controller_function(Controller_needs[i].id, ctype, &ccfgdata, flags);
1391
1392 plt->controls[i].id = Controller_needs[i].id;
1393 plt->controls[i].type[0] = ctype[0];
1394 plt->controls[i].type[1] = ctype[1];
1395 plt->controls[i].value = ccfgdata;
1396 plt->controls[i].flags[0] = flags[0];
1397 plt->controls[i].flags[1] = flags[1];
1398 }
1399
1400 for (j = 0; j < N_MOUSE_AXIS; j++) {
1401 float sens = Controller->get_axis_sensitivity(ctMouseAxis, j + 1);
1402 plt->mouse_sensitivity[j] = sens;
1403 }
1404 for (j = 0; j < N_JOY_AXIS; j++) {
1405 float sens = Controller->get_axis_sensitivity(ctAxis, j + 1);
1406 plt->joy_sensitivity[j] = sens;
1407 }
1408
1409 plt->key_ramping = Key_ramp_speed;
1410}
1411
1412void ToggleHeadlightControlState() {
1413 if (Players[Player_num].flags & PLAYER_FLAGS_HEADLIGHT_STOLEN) {

Callers 3

CtlConfigFunction · 0.85
ShutdownD3Function · 0.85
processMethod · 0.85

Calls 2

get_axis_sensitivityMethod · 0.45

Tested by

no test coverage detected