The attached patch does the following things:

1) it's really difficult to fly a helicopter with the yoke,
but one can make good use of the throttle as the collective.
If one wants to fly and use the mouse as the cyclic control,
it's impossible unless the yoke doesn't send the axis0/1 position
as aileron/elevator control bindings. Thus, the patched file
checks at startup if the "/rotors" property exists (thanks to Melchior
for the tip on what to check!) and then ruthlessly removes
the bindings at runtime.

2) the view pitch change is reversed so that the hat movement
now corresponds to one's head (view) movement (tilting it forward means
tilting your head forward)

3) remap of some buttons:
#0: instead of firing the starter, this one cycles the views in the
reverse direction
#1: this one uses the nasal view cycle wrapper instead of the old
view-cycle command, thus we get the tip popup with the new view name
#8/#9: these get to work as x/X on the keyboard, and pressing them
together gives the same as Ctrl-X on the keyboard. For this,
I removed the /controls/engines/engine[?]/boost control bound to them
(I have no idea what these are for anyway)

Vassilii
Index: ../data/Input/Joysticks/CH/pro-yoke-usb.xml
===================================================================
RCS file: /var/cvs/FlightGear-0.9/data/Input/Joysticks/CH/pro-yoke-usb.xml,v
retrieving revision 1.19
diff -u -p -r1.19 pro-yoke-usb.xml
--- ../data/Input/Joysticks/CH/pro-yoke-usb.xml 22 Jun 2005 13:08:02 -0000      
1.19
+++ ../data/Input/Joysticks/CH/pro-yoke-usb.xml 3 Dec 2005 01:41:34 -0000
@@ -4,6 +4,24 @@
 
  <name>CH PRODUCTS CH FLIGHT SIM YOKE USB </name>
  <name>CH FLIGHT SIM YOKE USB </name>
+ <nasal>
+  <script><![CDATA[
+       view_mod = 0;
+       reset_view = func {
+         setprop("/sim/current-view/field-of-view", 
+               getprop("/sim/view/config/default-field-of-view-deg"));
+         view_mod = 0;
+       }
+       if (props.globals.getNode("/rotors") != nil) {
+        grove = props.globals.getNode(this);
+        
+        grove.getNode("axis[0]").removeChildren("binding");
+        grove.getNode("axis[1]").removeChildren("binding");
+       }
+  ]]>
+  </script>
+ </nasal>
+
 
  <axis n="0">
   <desc>Aileron</desc>
@@ -110,7 +128,7 @@
    <binding>
     <command>property-adjust</command>
     <property>/sim/current-view/goal-pitch-offset-deg</property>
-    <step type="double">2.0</step>
+    <step type="double">-2.0</step>
    </binding>
   </low>
   <high>
@@ -118,29 +136,25 @@
    <binding>
     <command>property-adjust</command>
     <property>/sim/current-view/goal-pitch-offset-deg</property>
-    <step type="double">-2.0</step>
+    <step type="double">2.0</step>
    </binding>
   </high>
  </axis>
 
  <button n="0">
-<desc>Fire Starter on Selected Engine(s)</desc>
+  <repeatable>false</repeatable>
+  <desc>Scroll in reverse through views.</desc>
   <binding>
    <command>nasal</command>
-   <script>controls.startEngine()</script>
+   <script>view.stepView(-1)</script>
   </binding>
-  <mod-up>
-   <binding>
-    <command>nasal</command>
-    <script>props.setAll("/controls/engines/engine", "starter", 0)</script>
-   </binding>
-  </mod-up> 
  </button>
 
 <button n="1">
   <repeatable>false</repeatable>
   <binding>
-   <command>view-cycle</command>
+   <command>nasal</command>
+   <script>view.stepView(1)</script>
   </binding>
  </button>
 
@@ -221,31 +235,46 @@
  </button>
 
  <button n="8">
-  <repeatable>true</repeatable>
-   <binding>
-    <command>property-adjust</command>
-    <property>/controls/engines/engine[0]/boost</property>
-    <step type="double">+0.01</step>
-   </binding>
+  <desc>Decrease field of view.</desc>
+  <repeatable type="bool">false</repeatable>
+  <binding>
+   <command>nasal</command>
+   <script><![CDATA[
+     view.decrease(); 
+     if(view_mod>0) { reset_view(); } else { view_mod = -1; }
+   ]]>
+   </script>
+  </binding>
+  <mod-up>
    <binding>
-    <command>property-adjust</command>
-    <property>/controls/engines/engine[1]/boost</property>
-    <step type="double">+0.01</step>
+    <command>nasal</command>
+    <script><![CDATA[
+      if (view_mod<0) { view_mod += 1;} 
+    ]]></script>
    </binding>
+  </mod-up>
  </button>
 
  <button n="9">
-  <repeatable>true</repeatable>
-   <binding>
-    <command>property-adjust</command>
-    <property>/controls/engines/engine[0]/boost</property>
-    <step type="double">-0.01</step>
-   </binding>
+  <desc>Increase field of view.</desc>
+  <repeatable type="bool">false</repeatable>
+  <binding>
+   <command>nasal</command>
+   <script><![CDATA[ 
+        view.increase(); 
+       if(view_mod<0) { reset_view(); } else { view_mod = 1; }
+   ]]>
+   </script>
+  </binding>
+  <mod-up>
    <binding>
-    <command>property-adjust</command>
-    <property>/controls/engines/engine[1]/boost</property>
-    <step type="double">-0.01</step>
+    <command>nasal</command>
+    <script><![CDATA[ 
+       if (view_mod>0) { view_mod -= 1;} 
+    ]]>
+    </script>
    </binding>
+  </mod-up>
  </button>
 
   <button n="10">
_______________________________________________
Flightgear-devel mailing list
Flightgear-devel@flightgear.org
http://mail.flightgear.org/mailman/listinfo/flightgear-devel
2f585eeea02e2c79d7b1d8c4963bae2d

Reply via email to