sets the internal controller config to the current pilot's configuration.
| 1348 | |
| 1349 | // sets the internal controller config to the current pilot's configuration. |
| 1350 | void LoadControlConfig(pilot *plt) { |
| 1351 | int j; |
| 1352 | if (!plt) |
| 1353 | plt = &Current_pilot; |
| 1354 | |
| 1355 | for (int i = 0; i < NUM_CONTROLLER_FUNCTIONS; i++) { |
| 1356 | int id = Current_pilot.controls[i].id; |
| 1357 | ct_type type[2]; |
| 1358 | ct_config_data ccfgdata; |
| 1359 | uint8_t flags[2]; |
| 1360 | |
| 1361 | type[0] = plt->controls[i].type[0]; |
| 1362 | type[1] = plt->controls[i].type[1]; |
| 1363 | ccfgdata = plt->controls[i].value; |
| 1364 | flags[0] = plt->controls[i].flags[0]; |
| 1365 | flags[1] = plt->controls[i].flags[1]; |
| 1366 | |
| 1367 | Controller->set_controller_function(id, type, ccfgdata, flags); |
| 1368 | } |
| 1369 | for (j = 0; j < N_MOUSE_AXIS; j++) { |
| 1370 | Controller->set_axis_sensitivity(ctMouseAxis, j + 1, plt->mouse_sensitivity[j]); |
| 1371 | } |
| 1372 | for (j = 0; j < N_JOY_AXIS; j++) { |
| 1373 | Controller->set_axis_sensitivity(ctAxis, j + 1, plt->joy_sensitivity[j]); |
| 1374 | } |
| 1375 | |
| 1376 | Key_ramp_speed = plt->key_ramping; |
| 1377 | } |
| 1378 | |
| 1379 | // saves the internal controller config of current pilot. if the controller changes, then calling |
| 1380 | // LoadControlConfig will restore ONLY VALID configurations. |
no test coverage detected