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,
15 INCIDENCE, FLAP0, FLAP1, SLAT, SPOILER, VECTOR,
16 BOOST, CASTERING, PROPPITCH, PROPFEATHER,
17 COLLECTIVE, CYCLICAIL, CYCLICELE, ROTORENGINEON,
18 TILTYAW, TILTPITCH, TILTROLL,
19 ROTORBRAKE, ROTORENGINEMAXRELTORQUE, ROTORELTARGET,
20 REVERSE_THRUST, WASTEGATE,
21 WINCHRELSPEED, HITCHOPEN, PLACEWINCH, FINDAITOW};
23 enum { OPT_SPLIT = 0x01,
27 // Returns a new, not-yet-used "input handle" for addMapping and
28 // setInput. This typically corresponds to one user axis.
31 // Adds a mapping to between input handle and a particular setting
32 // on an output object. The value of output MUST match the type
34 void addMapping(int input, int output, void* object, int options=0);
36 // An additional form to specify a mapping range. Input values
37 // outside of [src0:src1] are clamped, and are then mapped to
38 // [dst0:dst1] before being set on the object.
39 void addMapping(int input, int output, void* object, int options,
40 float src0, float src1, float dst0, float dst1);
42 // Resets our accumulated input values. Call before any
43 // setInput() invokations.
46 // Sets the specified input (as returned by newInput) to the
48 void setInput(int input, float value);
50 // Calculates and applies the settings received since the last reset().
51 void applyControls(float dt);
53 // Returns the input/output range appropriate for the given
54 // control. Ailerons go from -1 to 1, while throttles are never
55 // lower than zero, etc...
56 static float rangeMin(int type);
57 static float rangeMax(int type);
59 // Each output record is identified by both an object/type tuple
60 // and a numeric handle.
61 int getOutputHandle(void* obj, int type);
63 // Sets the transition time for the control output to swing
64 // through its full range.
65 void setTransitionTime(int handle, float time);
67 // Retrieves the current value of the control output. Controls
68 // with OPT_SPLIT settable on inputs will have a separately
69 // computed "right side" value.
70 float getOutput(int handle);
71 float getOutputR(int handle);
74 struct OutRec { int type; void* object; Vector maps;
75 float oldL, oldR, time; };
76 struct MapRec { OutRec* out; int idx; int opt; float val;
77 float src0; float src1; float dst0; float dst1; };
79 // A list of (sub)Vectors containing a bunch of MapRec objects for
83 // An unordered list of output settings.
88 #endif // _CONTROL_MAP_HPP