1 #ifndef _CONTROL_MAP_HPP
2 #define _CONTROL_MAP_HPP
12 enum OutputType { THROTTLE, MIXTURE, CONDLEVER, STARTER, MAGNETOS,
13 ADVANCE, REHEAT, PROP,
14 BRAKE, STEER, EXTEND, HEXTEND, LEXTEND, LACCEL,
15 INCIDENCE, FLAP0, FLAP1, SLAT, SPOILER, VECTOR,
16 FLAP0EFFECTIVENESS, FLAP1EFFECTIVENESS,
17 BOOST, CASTERING, PROPPITCH, PROPFEATHER,
18 COLLECTIVE, CYCLICAIL, CYCLICELE, ROTORENGINEON,
19 TILTYAW, TILTPITCH, TILTROLL,
20 ROTORBRAKE, ROTORENGINEMAXRELTORQUE, ROTORRELTARGET,
21 ROTORBALANCE, REVERSE_THRUST, WASTEGATE,
22 WINCHRELSPEED, HITCHOPEN, PLACEWINCH, FINDAITOW
25 enum { OPT_SPLIT = 0x01,
29 // Returns a new, not-yet-used "input handle" for addMapping and
30 // setInput. This typically corresponds to one user axis.
33 // Adds a mapping to between input handle and a particular setting
34 // on an output object. The value of output MUST match the type
36 void addMapping(int input, int output, void* object, int options=0);
38 // An additional form to specify a mapping range. Input values
39 // outside of [src0:src1] are clamped, and are then mapped to
40 // [dst0:dst1] before being set on the object.
41 void addMapping(int input, int output, void* object, int options,
42 float src0, float src1, float dst0, float dst1);
44 // Resets our accumulated input values. Call before any
45 // setInput() invokations.
48 // Sets the specified input (as returned by newInput) to the
50 void setInput(int input, float value);
52 // Calculates and applies the settings received since the last reset().
53 void applyControls(float dt);
55 // Returns the input/output range appropriate for the given
56 // control. Ailerons go from -1 to 1, while throttles are never
57 // lower than zero, etc...
58 static float rangeMin(int type);
59 static float rangeMax(int type);
61 // Each output record is identified by both an object/type tuple
62 // and a numeric handle.
63 int getOutputHandle(void* obj, int type);
65 // Sets the transition time for the control output to swing
66 // through its full range.
67 void setTransitionTime(int handle, float time);
69 // Retrieves the current value of the control output. Controls
70 // with OPT_SPLIT settable on inputs will have a separately
71 // computed "right side" value.
72 float getOutput(int handle);
73 float getOutputR(int handle);
76 struct OutRec { int type; void* object; Vector maps;
77 float oldL, oldR, time; };
78 struct MapRec { OutRec* out; int idx; int opt; float val;
79 float src0; float src1; float dst0; float dst1; };
81 // A list of (sub)Vectors containing a bunch of MapRec objects for
85 // An unordered list of output settings.
90 #endif // _CONTROL_MAP_HPP