| 571 | // INITIALIZATION FUNCTIONS |
| 572 | |
| 573 | void InitControls() { |
| 574 | // Create controller object |
| 575 | if (Control_system_init) |
| 576 | return; |
| 577 | |
| 578 | Control_system_init = true; |
| 579 | |
| 580 | Controller = CreateController(NUM_CONTROLLER_FUNCTIONS, Controller_needs, Controller_ip); |
| 581 | if (Controller == NULL) |
| 582 | Error(TXT_ERRUNINITCNT); |
| 583 | Controller->mask_controllers(false, false); |
| 584 | Controller->mask_controllers(true, true); |
| 585 | |
| 586 | Controller->mask_controllers((Current_pilot.read_controller & READF_JOY) ? true : false, |
| 587 | (Current_pilot.read_controller & READF_MOUSE) ? true : false); |
| 588 | |
| 589 | Controller->set_axis_sensitivity(ctMouseAxis, CT_X_AXIS, Current_pilot.mouse_sensitivity[0]); |
| 590 | Controller->set_axis_sensitivity(ctMouseAxis, CT_Y_AXIS, Current_pilot.mouse_sensitivity[1]); |
| 591 | Controller->set_axis_sensitivity(ctMouseAxis, CT_Z_AXIS, Current_pilot.mouse_sensitivity[0]); |
| 592 | Controller->set_axis_sensitivity(ctAxis, CT_X_AXIS, Current_pilot.joy_sensitivity[0]); |
| 593 | Controller->set_axis_sensitivity(ctAxis, CT_Y_AXIS, Current_pilot.joy_sensitivity[1]); |
| 594 | Controller->set_axis_sensitivity(ctAxis, CT_Z_AXIS, Current_pilot.joy_sensitivity[2]); |
| 595 | Controller->set_axis_sensitivity(ctAxis, CT_R_AXIS, Current_pilot.joy_sensitivity[3]); |
| 596 | Controller->set_axis_sensitivity(ctAxis, CT_U_AXIS, Current_pilot.joy_sensitivity[4]); |
| 597 | Controller->set_axis_sensitivity(ctAxis, CT_V_AXIS, Current_pilot.joy_sensitivity[5]); |
| 598 | |
| 599 | int i; |
| 600 | i = FindArg("-deadzone0"); |
| 601 | if (i > 0) { |
| 602 | Controller->set_controller_deadzone(0, atof(GameArgs[i + 1])); |
| 603 | } |
| 604 | i = FindArg("-deadzone1"); |
| 605 | if (i > 0) { |
| 606 | Controller->set_controller_deadzone(1, atof(GameArgs[i + 1])); |
| 607 | } |
| 608 | |
| 609 | Key_ramp_speed = Current_pilot.key_ramping; // DAJ added to restore ramping |
| 610 | |
| 611 | SuspendControls(); |
| 612 | |
| 613 | // start controller time. |
| 614 | Control_current_time = Control_interval_time = timer_GetTime(); |
| 615 | Key_ramp.op = Key_ramp.p = 0.0f; |
| 616 | Key_ramp.ob = Key_ramp.b = 0.0f; |
| 617 | Key_ramp.oh = Key_ramp.h = 0.0f; |
| 618 | Key_ramp.ox = Key_ramp.x = 0.0f; |
| 619 | Key_ramp.oy = Key_ramp.y = 0.0f; |
| 620 | Key_ramp.oz = Key_ramp.z = 0.0f; |
| 621 | |
| 622 | // Initialize preemptive controller system for non-positonal data. |
| 623 | mprintf(0, "Initialized control system.\n"); |
| 624 | } |
| 625 | |
| 626 | void CloseControls() { |
| 627 | if (!Control_system_init) |
no test coverage detected