1
0
Fork 0

Merge branch 'work' of D:\Git_New\fgdata

This commit is contained in:
Vivian Meazza 2011-09-26 09:43:29 +01:00
commit 87ec5ebb7a
2 changed files with 107 additions and 71 deletions

View file

@ -18,7 +18,7 @@
var this = cmdarg().getParent(); var this = cmdarg().getParent();
var init = !contains(caller(0)[0], "init"); var init = !contains(caller(0)[0], "init");
var popup = func gui.popupTip(call(sprintf, arg)); var popup = func gui.popupTip(call(sprintf, arg));
var is_helicopter = (var _ = props.globals.getNode("rotors", 0)) != nil and _.getAttribute("children"); var is_helicopter = (func {(var n = props.globals.getNode("rotors", 0)) != nil and n.getAttribute("children")})();
var aircraft_type = getprop("/sim/type"); var aircraft_type = getprop("/sim/type");
var overlay = getprop("/input/joysticks/overlay"); var overlay = getprop("/input/joysticks/overlay");
@ -44,12 +44,13 @@
var mod = 0; var mod = 0;
if (init) { if (init) {
var _ = props.globals.initNode("/devices/status/joysticks/warthog/modifier", mod, "INT"); var n = props.globals.initNode("/devices/status/joysticks/warthog/modifier", mod, "INT");
setlistener(_, func(n) mod = n.getValue()); setlistener(n, func(n) mod = n.getValue());
} }
var trimstep = 0.75; var trimstep = 0.75;
var viewstep = 0.5; var viewstep = 0.5;
var button = { 18: { id: 0 }};
var reset_zoom = func setprop("/sim/current-view/field-of-view", 55); var reset_zoom = func setprop("/sim/current-view/field-of-view", 55);
var viewdir = props.globals.getNode("/sim").getChildren("view"); var viewdir = props.globals.getNode("/sim").getChildren("view");
@ -199,55 +200,7 @@
<button n="6"> <button n="6">
<name>left black curosr (TMS) up</name> <name>left black curosr (TMS) up</name>
<desc>zoom in, +mod: reset zoom</desc> <desc>brakes, +mod: toggle parking brake</desc>
<repeatable>true</repeatable>
<binding>
<command>nasal</command>
<script>
if (mod)
reset_zoom();
else
view.decrease(1);
</script>
</binding>
</button>
<button n="7">
<name>left black cursor (TMS) right</name>
<desc>next active view, +mod: next view</desc>
<binding>
<command>nasal</command>
<script>view.stepView(1, mod)</script>
</binding>
</button>
<button n="8">
<name>left black cursor (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 n="9">
<name>left black cursor (TMS) left</name>
<desc>previous active view, +mod: previous view</desc>
<binding>
<command>nasal</command>
<script>view.stepView(-1, mod)</script>
</binding>
</button>
<button n="10">
<name>right black cursor (DMS) up</name>
<desc>brakes</desc>
<binding> <binding>
<command>nasal</command> <command>nasal</command>
<script>controls.applyBrakes(1)</script> <script>controls.applyBrakes(1)</script>
@ -255,13 +208,20 @@
<mod-up> <mod-up>
<binding> <binding>
<command>nasal</command> <command>nasal</command>
<script>controls.applyBrakes(0)</script> <script>
if (mod) {
var i = controls.applyParkingBrake(1);
popup("Parking Brake %s", i ? "ON" : "OFF");
controls.applyBrakes(0);
}
controls.applyBrakes(0)
</script>
</binding> </binding>
</mod-up> </mod-up>
</button> </button>
<button n="11"> <button n="7">
<name>right black cursor (DMS) right</name> <name>left black cursor (TMS) right</name>
<desc>brakes right</desc> <desc>brakes right</desc>
<binding> <binding>
<command>nasal</command> <command>nasal</command>
@ -275,9 +235,9 @@
</mod-up> </mod-up>
</button> </button>
<button n="12"> <button n="8">
<name>right black cursor (DMS) down</name> <name>left black cursor (TMS) down</name>
<desc>toggle parking brake</desc> <desc>brakes, +mod: toggle parking brake</desc>
<binding> <binding>
<command>nasal</command> <command>nasal</command>
<script>controls.applyBrakes(1)</script> <script>controls.applyBrakes(1)</script>
@ -286,16 +246,19 @@
<binding> <binding>
<command>nasal</command> <command>nasal</command>
<script> <script>
if (mod) {
var i = controls.applyParkingBrake(1); var i = controls.applyParkingBrake(1);
popup("Parking Brake %s", i ? "ON" : "OFF"); popup("Parking Brake %s", i ? "ON" : "OFF");
controls.applyBrakes(0); controls.applyBrakes(0);
}
controls.applyBrakes(0)
</script> </script>
</binding> </binding>
</mod-up> </mod-up>
</button> </button>
<button n="13"> <button n="9">
<name>right black cursor (DMS) left</name> <name>left black cursor (TMS) left</name>
<desc>brakes left</desc> <desc>brakes left</desc>
<binding> <binding>
<command>nasal</command> <command>nasal</command>
@ -309,6 +272,54 @@
</mod-up> </mod-up>
</button> </button>
<button n="10">
<name>right black cursor (DMS) 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 n="11">
<name>right black cursor (DMS) right</name>
<desc>next active view, +mod: next view</desc>
<binding>
<command>nasal</command>
<script>view.stepView(1, mod)</script>
</binding>
</button>
<button n="12">
<name>right black cursor (DMS) 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 n="13">
<name>right black cursor (DMS) left</name>
<desc>previous active view, +mod: previous view</desc>
<binding>
<command>nasal</command>
<script>view.stepView(-1, mod)</script>
</binding>
</button>
<button n="14"> <button n="14">
<name>grey cursor (CMS) up</name> <name>grey cursor (CMS) up</name>
<desc>view up</desc> <desc>view up</desc>
@ -351,14 +362,28 @@
<button n="18"> <button n="18">
<name>grey cursor (CMS) push</name> <name>grey cursor (CMS) push</name>
<desc>center view, +mod: centered cockpit view</desc> <desc>short: center view, long (&gt;0.5 sec): centered cockpit view</desc>
<binding> <binding>
<command>nasal</command> <command>nasal</command>
<script> <script>
if (mod) (func(id) {
settimer(func {
if (id == button[18].id) {
setprop("/sim/current-view/view-number", 0); setprop("/sim/current-view/view-number", 0);
view.resetView(); view.resetView();
}
}, 0.5, 1);
})(button[18].id += 1);
</script> </script>
</binding> </binding>
<mod-up>
<binding>
<command>nasal</command>
<script>
view.resetView();
button[18].id += 1;
</script>
</binding>
</mod-up>
</button> </button>
</PropertyList> </PropertyList>

View file

@ -14,7 +14,7 @@
var this = cmdarg().getParent(); var this = cmdarg().getParent();
var init = !contains(caller(0)[0], "init"); var init = !contains(caller(0)[0], "init");
var popup = func gui.popupTip(call(sprintf, arg)); var popup = func gui.popupTip(call(sprintf, arg));
var is_helicopter = (var _ = props.globals.getNode("rotors", 0)) != nil and _.getAttribute("children"); var is_helicopter = (func {(var n = props.globals.getNode("rotors", 0)) != nil and n.getAttribute("children")})();
var aircraft_type = getprop("/sim/type"); var aircraft_type = getprop("/sim/type");
var overlay = getprop("/input/joysticks/overlay"); var overlay = getprop("/input/joysticks/overlay");
@ -40,8 +40,8 @@
var mod = 0; var mod = 0;
if (init) { if (init) {
var _ = props.globals.initNode("/devices/status/joysticks/warthog/modifier", mod, "INT"); var n = props.globals.initNode("/devices/status/joysticks/warthog/modifier", mod, "INT");
setlistener(_, func(n) mod = n.getValue()); setlistener(n, func(n) mod = n.getValue());
} }
var left_engines = [0, 2, 4, 6, 8, 10]; var left_engines = [0, 2, 4, 6, 8, 10];
@ -328,7 +328,18 @@
</button> </button>
<button n="20"> <button n="20">
<name>Landing Gear Horn Silence Button</name> <name>Landing Gear Horn Silence</name>
<desc>gear up, +mod: gear down</desc>
<binding>
<command>nasal</command>
<script>controls.gearDown(mod ? 1 : -1)</script>
</binding>
<mod-up>
<binding>
<command>nasal</command>
<script>controls.gearDown(0)</script>
</binding>
</mod-up>
</button> </button>
<button n="21"> <button n="21">