1
0
Fork 0

Merge branch 'master' of gitorious.org:fg/fgdata

This commit is contained in:
Durk Talsma 2011-09-11 21:53:39 +02:00
commit fc66e0bd90
3 changed files with 176 additions and 55 deletions

View file

@ -39,6 +39,14 @@
setlistener(_, func(n) mod = n.getValue()); setlistener(_, func(n) mod = n.getValue());
var trimstep = 0.75; var trimstep = 0.75;
var viewstep = 0.5;
var reset_zoom = func setprop("/sim/current-view/field-of-view", 55);
var viewdir = props.globals.getNode("/sim").getChildren("view");
forindex (var i; viewdir) {
var t = viewdir[i].getNode("type");
viewdir[i] = t != nil and t.getValue() == "lookat" ? 1 : -1;
}
load_overlay("generic.xml"); load_overlay("generic.xml");
if (is_helicopter) if (is_helicopter)
@ -77,9 +85,9 @@
<command>nasal</command> <command>nasal</command>
<script> <script>
if (mod) if (mod)
controls.aileronTrim(-trimstep);
else
setprop("/controls/flight/aileron-trim", 0); setprop("/controls/flight/aileron-trim", 0);
else
controls.aileronTrim(-trimstep);
</script> </script>
</binding> </binding>
</low> </low>
@ -89,9 +97,9 @@
<command>nasal</command> <command>nasal</command>
<script> <script>
if (mod) if (mod)
controls.aileronTrim(trimstep);
else
setprop("/controls/flight/aileron-trim", 0); setprop("/controls/flight/aileron-trim", 0);
else
controls.aileronTrim(trimstep);
</script> </script>
</binding> </binding>
</high> </high>
@ -106,9 +114,9 @@
<command>nasal</command> <command>nasal</command>
<script> <script>
if (mod) if (mod)
controls.elevatorTrim(trimstep);
else
setprop("/controls/flight/elevator-trim", 0); setprop("/controls/flight/elevator-trim", 0);
else
controls.elevatorTrim(trimstep);
</script> </script>
</binding> </binding>
</low> </low>
@ -118,9 +126,9 @@
<command>nasal</command> <command>nasal</command>
<script> <script>
if (mod) if (mod)
controls.elevatorTrim(-trimstep);
else
setprop("/controls/flight/elevator-trim", 0); setprop("/controls/flight/elevator-trim", 0);
else
controls.elevatorTrim(-trimstep);
</script> </script>
</binding> </binding>
</high> </high>
@ -187,53 +195,166 @@
<button n="6"> <button n="6">
<name>Target Management Switch (TMS) up</name> <name>Target Management Switch (TMS) up</name>
<desc>zoom in, +mod: reset zoom</desc>
<repeatable>true</repeatable>
<binding>
<command>nasal</command>
<script>
if (mod)
reset_zoom();
else
view.decrease(1);
</script>
</binding>
</button> </button>
<button n="7"> <button n="7">
<name>Target Management Switch (TMS) right</name> <name>Target Management Switch (TMS) right</name>
<desc>next active view, +mod: next view</desc>
<binding>
<command>nasal</command>
<script>view.stepView(1, mod)</script>
</binding>
</button> </button>
<button n="8"> <button n="8">
<name>Target Management Switch (TMS) down</name> <name>Target Management Switch (TMS) down</name>
<desc>zoom out, +mod: reset zoom</desc>
<repeatable>true</repeatable>
<binding>
<command>nasal</command>
<script>
if (mod)
reset_zoom();
else
view.increase(1);
</script>
</binding>
</button> </button>
<button n="9"> <button n="9">
<name>Target Management Switch (TMS) left</name> <name>Target Management Switch (TMS) left</name>
<desc>previous active view, +mod: previous view</desc>
<binding>
<command>nasal</command>
<script>view.stepView(-1, mod)</script>
</binding>
</button> </button>
<button n="10"> <button n="10">
<name>Data Management Switch (DMS) up</name> <name>Data Management Switch (DMS) up</name>
<desc>brakes</desc>
<binding>
<command>nasal</command>
<script>controls.applyBrakes(1)</script>
</binding>
<mod-up>
<binding>
<command>nasal</command>
<script>controls.applyBrakes(0)</script>
</binding>
</mod-up>
</button> </button>
<button n="11"> <button n="11">
<name>Data Management Switch (DMS) right</name> <name>Data Management Switch (DMS) right</name>
<desc>brakes right</desc>
<binding>
<command>nasal</command>
<script>controls.applyBrakes(1, 1)</script>
</binding>
<mod-up>
<binding>
<command>nasal</command>
<script>controls.applyBrakes(0, 1)</script>
</binding>
</mod-up>
</button> </button>
<button n="12"> <button n="12">
<name>Data Management Switch (DMS) down</name> <name>Data Management Switch (DMS) down</name>
<desc>toggle parking brake</desc>
<binding>
<command>nasal</command>
<script>controls.applyBrakes(1)</script>
</binding>
<mod-up>
<binding>
<command>nasal</command>
<script>
var i = controls.applyParkingBrake(1);
popup("Parking Brake %s", i ? "ON" : "OFF");
controls.applyBrakes(0);
</script>
</binding>
</mod-up>
</button> </button>
<button n="13"> <button n="13">
<name>Data Management Switch (DMS) left</name> <name>Data Management Switch (DMS) left</name>
<desc>brakes left</desc>
<binding>
<command>nasal</command>
<script>controls.applyBrakes(1, -1)</script>
</binding>
<mod-up>
<binding>
<command>nasal</command>
<script>controls.applyBrakes(0, -1)</script>
</binding>
</mod-up>
</button> </button>
<button n="14"> <button n="14">
<name>Countermeasures Management Switch (CMS) up</name> <name>Countermeasures Management Switch (CMS) up</name>
<desc>view up</desc>
<repeatable>true</repeatable>
<binding>
<command>nasal</command>
<script>view.panViewPitch(viewstep)</script>
</binding>
</button> </button>
<button n="15"> <button n="15">
<name>Countermeasures Management Switch (CMS) right</name> <name>Countermeasures Management Switch (CMS) right</name>
<desc>view right</desc>
<repeatable>true</repeatable>
<binding>
<command>nasal</command>
<script>view.panViewDir(viewdir[view.index] * viewstep)</script>
</binding>
</button> </button>
<button n="16"> <button n="16">
<name>Countermeasures Management Switch (CMS) down</name> <name>Countermeasures Management Switch (CMS) down</name>
<desc>view down</desc>
<repeatable>true</repeatable>
<binding>
<command>nasal</command>
<script>view.panViewPitch(-viewstep)</script>
</binding>
</button> </button>
<button n="17"> <button n="17">
<name>Countermeasures Management Switch (CMS) left</name> <name>Countermeasures Management Switch (CMS) left</name>
<desc>view left</desc>
<repeatable>true</repeatable>
<binding>
<command>nasal</command>
<script>view.panViewDir(-viewdir[view.index] * viewstep)</script>
</binding>
</button> </button>
<button n="18"> <button n="18">
<name>Countermeasures Management Switch (CMS) push</name> <name>Countermeasures Management Switch (CMS) push</name>
<desc>center view, +mod: centered cockpit view</desc>
<binding>
<command>nasal</command>
<script>
if (mod)
setprop("/sim/current-view/view-number", 0);
view.resetView();
</script>
</binding>
</button> </button>
</PropertyList> </PropertyList>

View file

@ -40,12 +40,6 @@
var left_engines = [0, 2, 4, 6, 8, 10]; var left_engines = [0, 2, 4, 6, 8, 10];
var right_engines = [1, 3, 5, 7, 9, 11]; var right_engines = [1, 3, 5, 7, 9, 11];
var viewstep = 0.5;
var viewdir = props.globals.getNode("/sim").getChildren("view");
forindex (var i; viewdir) {
var t = viewdir[i].getNode("type");
viewdir[i] = t != nil and t.getValue() == "lookat" ? 1 : -1;
}
load_overlay("generic.xml"); load_overlay("generic.xml");
if (is_helicopter) if (is_helicopter)
@ -56,40 +50,10 @@
<axis n="0"> <axis n="0">
<name>Mouse Horizontal</name> <name>Mouse Horizontal</name>
<desc>mouse horizontal</desc>
<low>
<repeatable type="bool">true</repeatable>
<binding>
<command>nasal</command>
<script>view.panViewDir(-viewdir[view.index] * viewstep)</script>
</binding>
</low>
<high>
<repeatable type="bool">true</repeatable>
<binding>
<command>nasal</command>
<script>view.panViewDir(viewdir[view.index] * viewstep)</script>
</binding>
</high>
</axis> </axis>
<axis n="1"> <axis n="1">
<name>Mouse Vertical</name> <name>Mouse Vertical</name>
<desc>mouse vertical</desc>
<low>
<repeatable type="bool">true</repeatable>
<binding>
<command>nasal</command>
<script>view.panViewPitch(viewstep)</script>
</binding>
</low>
<high>
<repeatable type="bool">true</repeatable>
<binding>
<command>nasal</command>
<script>view.panViewPitch(-viewstep)</script>
</binding>
</high>
</axis> </axis>
<axis n="2"> <axis n="2">
@ -129,58 +93,60 @@
<command>property-scale</command> <command>property-scale</command>
<property>/controls/flight/rudder-trim</property> <property>/controls/flight/rudder-trim</property>
<factor type="double">-1</factor> <factor type="double">-1</factor>
<power type="int">2</power>
</binding> </binding>
</axis> </axis>
<axis n="5"> <axis n="5">
<name>Coolie Switch Horizontal</name> <name>Coolie Switch Horizontal</name>
<desc>adjust mixture: left = leaner, right = fatter</desc>
<number> <number>
<unix>5</unix> <unix>5</unix>
<mac>5</mac> <mac>5</mac>
<windows>3</windows> <windows>3</windows>
</number> </number>
<low> <low>
<repeatable>true</repeatable>
<binding> <binding>
<command>nasal</command> <command>nasal</command>
<script>popup("coolie switch left")</script> <script>controls.adjMixture(-1)</script>
</binding> </binding>
</low> </low>
<high> <high>
<repeatable>true</repeatable>
<binding> <binding>
<command>nasal</command> <command>nasal</command>
<script>popup("coolie switch right")</script> <script>controls.adjMixture(1)</script>
</binding> </binding>
</high> </high>
</axis> </axis>
<axis n="6"> <axis n="6">
<name>Coolie Switch Vertical</name> <name>Coolie Switch Vertical</name>
<desc>adjust propeller pitch: forward = increase, backward = decrease</desc>
<number> <number>
<unix>6</unix> <unix>6</unix>
<mac>6</mac> <mac>6</mac>
<windows>4</windows> <windows>4</windows>
</number> </number>
<low> <low>
<repeatable>true</repeatable>
<binding> <binding>
<command>nasal</command> <command>nasal</command>
<script>popup("coolie switch up")</script> <script>controls.adjPropeller(1)</script>
</binding> </binding>
</low> </low>
<high> <high>
<repeatable>true</repeatable>
<binding> <binding>
<command>nasal</command> <command>nasal</command>
<script>popup("coolie switch down")</script> <script>controls.adjPropeller(-1)</script>
</binding> </binding>
</high> </high>
</axis> </axis>
<button n="0"> <button n="0">
<name>Mouse Button</name> <name>Mouse Button</name>
<desc>reset view</desc>
<binding>
<command>nasal</command>
<script>view.resetView()</script>
</binding>
</button> </button>
<button n="1"> <button n="1">
@ -427,10 +393,44 @@
<button n="28"> <button n="28">
<name>Right Throttle Idle Switch</name> <name>Right Throttle Idle Switch</name>
<desc>right engines cutoff</desc>
<binding>
<command>nasal</command>
<script>
foreach (var i; right_engines)
setprop("/controls/engines/engine[" ~ i ~ "]/cutoff", 1);
</script>
</binding>
<mod-up>
<binding>
<command>nasal</command>
<script>
foreach (var i; right_engines)
setprop("/controls/engines/engine[" ~ i ~ "]/cutoff", 0);
</script>
</binding>
</mod-up>
</button> </button>
<button n="29"> <button n="29">
<name>Left Throttle Idle Switch</name> <name>Left Throttle Idle Switch</name>
<desc>left engines cutoff</desc>
<binding>
<command>nasal</command>
<script>
foreach (var i; left_engines)
setprop("/controls/engines/engine[" ~ i ~ "]/cutoff", 1);
</script>
</binding>
<mod-up>
<binding>
<command>nasal</command>
<script>
foreach (var i; left_engines)
setprop("/controls/engines/engine[" ~ i ~ "]/cutoff", 0);
</script>
</binding>
</mod-up>
</button> </button>
<button n="30"> <button n="30">

View file

@ -6,8 +6,8 @@
<nasal> <nasal>
<script> <script>
var thrust_display = func { var thrust_display = func {
var thv = getprop("/controls/engines/engine[0]/mixture"); var thv = getprop("/controls/engines/engine/mixture");
popup("Thrust vector " ~ int(thv * 120 - 20 + 0.5)); popup("Thrust vector %d", thv * 120 - 20 + 0.5);
} }
</script> </script>
</nasal> </nasal>