]> git.mxchange.org Git - flightgear.git/blobdiff - src/FDM/YASim/ControlMap.hpp
Thrust reversers. Very simple implementation.
[flightgear.git] / src / FDM / YASim / ControlMap.hpp
index 722f030ef08913c179de95f1b75532369665efba..07d15f3014d915a0dfbe230d11c4907b4d833f41 100644 (file)
@@ -9,9 +9,13 @@ class ControlMap {
 public:
     ~ControlMap();
 
-    enum OutputType { THROTTLE, MIXTURE, ADVANCE, REHEAT, PROP,
+    enum OutputType { THROTTLE, MIXTURE, STARTER, MAGNETOS,
+                     ADVANCE, REHEAT, PROP,
                      BRAKE, STEER, EXTEND,
-                     INCIDENCE, FLAP0, FLAP1, SLAT, SPOILER };
+                     INCIDENCE, FLAP0, FLAP1, SLAT, SPOILER, VECTOR,
+                      BOOST, CASTERING, PROPPITCH, 
+                      COLLECTIVE, CYCLICAIL, CYCLICELE, ROTORENGINEON,
+                      REVERSE_THRUST };
 
     enum { OPT_SPLIT  = 0x01,
            OPT_INVERT = 0x02,
@@ -26,6 +30,12 @@ public:
     // of object!
     void addMapping(int input, int output, void* object, int options=0);
 
+    // An additional form to specify a mapping range.  Input values
+    // outside of [src0:src1] are clamped, and are then mapped to
+    // [dst0:dst1] before being set on the object.
+    void addMapping(int input, int output, void* object, int options,
+                   float src0, float src1, float dst0, float dst1);
+
     // Resets our accumulated input values.  Call before any
     // setInput() invokations.
     void reset();
@@ -35,12 +45,33 @@ public:
     void setInput(int input, float value);
 
     // Calculates and applies the settings received since the last reset().
-    void applyControls();
+    void applyControls(float dt);
+
+    // Returns the input/output range appropriate for the given
+    // control.  Ailerons go from -1 to 1, while throttles are never
+    // lower than zero, etc...
+    static float rangeMin(int type);
+    static float rangeMax(int type);
+
+    // Each output record is identified by both an object/type tuple
+    // and a numeric handle.
+    int getOutputHandle(void* obj, int type);
+
+    // Sets the transition time for the control output to swing
+    // through its full range.
+    void setTransitionTime(int handle, float time);
+
+    // Retrieves the current value of the control output.  Controls
+    // with OPT_SPLIT settable on inputs will have a separately
+    // computed "right side" value.
+    float getOutput(int handle);
+    float getOutputR(int handle);
 
 private:
-    struct OutRec { int type; void* object; int n;
-                   float* values; Vector options; };
-    struct MapRec  { OutRec* out; int idx; };
+    struct OutRec { int type; void* object; Vector maps;
+                    float oldL, oldR, time; };
+    struct MapRec  { OutRec* out; int idx; int opt; float val;
+                     float src0; float src1; float dst0; float dst1; };
 
     // A list of (sub)Vectors containing a bunch of MapRec objects for
     // each input handle.